Skip to content

Commit

Permalink
feat: make mev more configurable (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
h4ck3rk3y committed Aug 29, 2023
1 parent 4eba65d commit 0165ef1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions main.star
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ 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)
mev_flood_module.spam_in_background(plan, el_uri, mev_params.mev_flood_extra_args)
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_endpoints.append(endpoint)


Expand Down
6 changes: 3 additions & 3 deletions src/mev_flood/mev_flood_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ def launch_mev_flood(plan, image, el_uri):
)
)

def spam_in_background(plan, el_uri, mev_flood_extra_args):
command = ["/bin/sh", "-c", "nohup ./run spam -r {0} -k {1} -u {2} -l deployment.json --secondsPerBundle 15 >main.log 2>&1 &".format(el_uri, ADMIN_KEY, USER_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)]
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 15 {3} >main.log 2>&1 &".format(el_uri, ADMIN_KEY, USER_KEY, 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
5 changes: 3 additions & 2 deletions src/mev_relay/mev_relay_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ NETWORK_ID_TO_NAME = {
"3": "ropsten",
}

def launch_mev_relay(plan, mev_params, network_id, beacon_uris, validator_root, builder_uri):
def launch_mev_relay(plan, mev_params, network_id, beacon_uris, validator_root, builder_uri, seconds_per_slot):
redis = redis_module.run(plan, {})
# making the password postgres as the relay expects it to be postgres
postgres = postgres_module.run(plan, {"password": "postgres", "user": "postgres", "database": "postgres", "name": "postgres"})
Expand All @@ -32,7 +32,8 @@ def launch_mev_relay(plan, mev_params, network_id, beacon_uris, validator_root,
"BELLATRIX_FORK_VERSION": "0x30000038",
"CAPELLA_FORK_VERSION": "0x40000038",
"DENEB_FORK_VERSION": "0x50000038",
"GENESIS_VALIDATORS_ROOT": validator_root
"GENESIS_VALIDATORS_ROOT": validator_root,
"SEC_PER_SLOT": str(seconds_per_slot)
}

plan.add_service(
Expand Down
6 changes: 4 additions & 2 deletions src/package_io/parse_input.star
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ def parse_input(input_args):
mev_relay_website_extra_args = result["mev_params"]["mev_relay_website_extra_args"],
mev_builder_extra_args = result["mev_params"]["mev_builder_extra_args"],
mev_flood_image = result["mev_params"]["mev_flood_image"],
mev_flood_extra_args = result["mev_params"]["mev_flood_extra_args"]
mev_flood_extra_args = result["mev_params"]["mev_flood_extra_args"],
mev_flood_seconds_per_bundle = result["mev_params"]["mev_flood_seconds_per_bundle"]
),
launch_additional_services=result["launch_additional_services"],
wait_for_finalization=result["wait_for_finalization"],
Expand Down Expand Up @@ -223,7 +224,8 @@ def get_default_mev_params():
"mev_relay_website_extra_args": [],
"mev_builder_extra_args": [],
"mev_flood_image": "flashbots/mev-flood",
"mev_flood_extra_args": []
"mev_flood_extra_args": [],
"mev_flood_seconds_per_bundle": 15,
}


Expand Down

0 comments on commit 0165ef1

Please sign in to comment.