Skip to content

Commit 0165ef1

Browse files
authored
feat: make mev more configurable (#164)
1 parent 4eba65d commit 0165ef1

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

main.star

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ def run(plan, args):
8181
)
8282
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)
8383
plan.print("epoch 2 reached, can begin mev stuff")
84-
endpoint = mev_relay_launcher_module.launch_mev_relay(plan, mev_params, network_params.network_id, beacon_uris, genesis_validators_root, builder_uri)
85-
mev_flood_module.spam_in_background(plan, el_uri, mev_params.mev_flood_extra_args)
84+
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)
85+
mev_flood_module.spam_in_background(plan, el_uri, mev_params.mev_flood_extra_args, mev_params.mev_flood_seconds_per_bundle)
8686
mev_endpoints.append(endpoint)
8787

8888

src/mev_flood/mev_flood_launcher.star

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ def launch_mev_flood(plan, image, el_uri):
1717
)
1818
)
1919

20-
def spam_in_background(plan, el_uri, mev_flood_extra_args):
21-
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)]
20+
def spam_in_background(plan, el_uri, mev_flood_extra_args, seconds_per_bundle):
21+
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)]
2222
if mev_flood_extra_args:
2323
joined_extra_args = " ".join(mev_flood_extra_args)
24-
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)]
24+
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)]
2525
plan.exec(
2626
service_name = "mev-flood",
2727
recipe = ExecRecipe(

src/mev_relay/mev_relay_launcher.star

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ NETWORK_ID_TO_NAME = {
1717
"3": "ropsten",
1818
}
1919

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

3839
plan.add_service(

src/package_io/parse_input.star

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ def parse_input(input_args):
150150
mev_relay_website_extra_args = result["mev_params"]["mev_relay_website_extra_args"],
151151
mev_builder_extra_args = result["mev_params"]["mev_builder_extra_args"],
152152
mev_flood_image = result["mev_params"]["mev_flood_image"],
153-
mev_flood_extra_args = result["mev_params"]["mev_flood_extra_args"]
153+
mev_flood_extra_args = result["mev_params"]["mev_flood_extra_args"],
154+
mev_flood_seconds_per_bundle = result["mev_params"]["mev_flood_seconds_per_bundle"]
154155
),
155156
launch_additional_services=result["launch_additional_services"],
156157
wait_for_finalization=result["wait_for_finalization"],
@@ -223,7 +224,8 @@ def get_default_mev_params():
223224
"mev_relay_website_extra_args": [],
224225
"mev_builder_extra_args": [],
225226
"mev_flood_image": "flashbots/mev-flood",
226-
"mev_flood_extra_args": []
227+
"mev_flood_extra_args": [],
228+
"mev_flood_seconds_per_bundle": 15,
227229
}
228230

229231

0 commit comments

Comments
 (0)