Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove hardcoding of addresses in MEV flood #184

Merged
merged 1 commit into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions main.star
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def run(plan, args):
beacon_uris = beacon_uri
first_cl_client = all_cl_client_contexts[0]
first_client_beacon_name = first_cl_client.beacon_service_name
mev_flood_module.launch_mev_flood(plan, mev_params.mev_flood_image, el_uri)
mev_flood_module.launch_mev_flood(plan, mev_params.mev_flood_image, el_uri, genesis_constants.PRE_FUNDED_ACCOUNTS)
epoch_recipe = GetHttpRequestRecipe(
endpoint = "/eth/v2/beacon/blocks/head",
port_id = HTTP_PORT_ID_FOR_FACT,
Expand All @@ -82,7 +82,7 @@ def run(plan, args):
plan.wait(recipe = epoch_recipe, field = "extract.epoch", assertion = ">=", target_value = str(network_params.capella_fork_epoch), timeout = "20m", service_name = first_client_beacon_name)
plan.print("epoch 2 reached, can begin mev stuff")
endpoint = mev_relay_launcher_module.launch_mev_relay(plan, mev_params, network_params.network_id, beacon_uris, genesis_validators_root, builder_uri, network_params.seconds_per_slot)
mev_flood_module.spam_in_background(plan, el_uri, mev_params.mev_flood_extra_args, mev_params.mev_flood_seconds_per_bundle)
mev_flood_module.spam_in_background(plan, el_uri, mev_params.mev_flood_extra_args, mev_params.mev_flood_seconds_per_bundle, genesis_constants.PRE_FUNDED_ACCOUNTS)
mev_endpoints.append(endpoint)


Expand Down
18 changes: 11 additions & 7 deletions src/mev_flood/mev_flood_launcher.star
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
ADMIN_KEY = "0xef5177cd0b6b21c87db5a0bf35d4084a8a57a9d6a064f86d51ac85f2b873a4e2"
USER_KEY = "0x7988b3a148716ff800414935b305436493e1f25237a2a03e5eebc343735e2f31"
ADMIN_KEY_INDEX = 0
USER_KEY_INDEX = 2

def launch_mev_flood(plan, image, el_uri):
def prefixed_address(address):
return "0x" + address

def launch_mev_flood(plan, image, el_uri, genesis_accounts):
plan.add_service(
name = "mev-flood",
config = ServiceConfig(
Expand All @@ -13,15 +16,16 @@ def launch_mev_flood(plan, image, el_uri):
plan.exec(
service_name = "mev-flood",
recipe = ExecRecipe(
command = ["/bin/sh", "-c", "./run init -r {0} -k {1} -u {2} -s deployment.json".format(el_uri, ADMIN_KEY, USER_KEY)]
command = ["/bin/sh", "-c", "./run init -r {0} -k {1} -u {2} -s deployment.json".format(el_uri, prefixed_address(genesis_accounts[0].private_key), prefixed_address(genesis_accounts[2].private_key))]
)
)

def spam_in_background(plan, el_uri, mev_flood_extra_args, seconds_per_bundle):
command = ["/bin/sh", "-c", "nohup ./run spam -r {0} -k {1} -u {2} -l deployment.json --secondsPerBundle {3} >main.log 2>&1 &".format(el_uri, ADMIN_KEY, USER_KEY, seconds_per_bundle)]
def spam_in_background(plan, el_uri, mev_flood_extra_args, seconds_per_bundle, genesis_accounts):
admin_key, user_key = prefixed_address(genesis_accounts[0].private_key), prefixed_address(genesis_accounts[2].private_key)
command = ["/bin/sh", "-c", "nohup ./run spam -r {0} -k {1} -u {2} -l deployment.json --secondsPerBundle {3} >main.log 2>&1 &".format(el_uri, admin_key, user_key, seconds_per_bundle)]
if mev_flood_extra_args:
joined_extra_args = " ".join(mev_flood_extra_args)
command = ["/bin/sh", "-c", "nohup ./run spam -r {0} -k {1} -u {2} -l deployment.json --secondsPerBundle {3} {4} >main.log 2>&1 &".format(el_uri, ADMIN_KEY, USER_KEY, seconds_per_bundle, joined_extra_args)]
command = ["/bin/sh", "-c", "nohup ./run spam -r {0} -k {1} -u {2} -l deployment.json --secondsPerBundle {3} {4} >main.log 2>&1 &".format(el_uri, admin_key, user_key, seconds_per_bundle, joined_extra_args)]
plan.exec(
service_name = "mev-flood",
recipe = ExecRecipe(
Expand Down