From 46d67fc5878a01984623c8f3ac9f667d1fb891f2 Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Wed, 30 Aug 2023 10:17:33 +0100 Subject: [PATCH] fix: dont spin up extra el/cl client for mock-mev (#158) --- src/package_io/parse_input.star | 58 +++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/src/package_io/parse_input.star b/src/package_io/parse_input.star index 36229f1a2..b8b2866ec 100644 --- a/src/package_io/parse_input.star +++ b/src/package_io/parse_input.star @@ -117,7 +117,7 @@ def parse_input(input_args): if result.get("mev_type") in ("mock", "full"): - result = enrich_mev_extra_params(result, MEV_BOOST_SERVICE_NAME_PREFIX, FLASHBOTS_MEV_BOOST_PORT) + result = enrich_mev_extra_params(result, MEV_BOOST_SERVICE_NAME_PREFIX, FLASHBOTS_MEV_BOOST_PORT, result.get("mev_type")) return struct( participants=[struct( @@ -230,7 +230,7 @@ def get_default_mev_params(): # TODO perhaps clean this up into a map -def enrich_mev_extra_params(parsed_arguments_dict, mev_prefix, mev_port): +def enrich_mev_extra_params(parsed_arguments_dict, mev_prefix, mev_port, mev_type): for index, participant in enumerate(parsed_arguments_dict["participants"]): mev_url = "http://{0}{1}:{2}".format(mev_prefix, index, mev_port) @@ -253,24 +253,40 @@ def enrich_mev_extra_params(parsed_arguments_dict, mev_prefix, mev_port): num_participants = len(parsed_arguments_dict["participants"]) - mev_url = "http://{0}{1}:{2}".format(mev_prefix, num_participants, mev_port) - - mev_participant = { - "el_client_type": "geth", - # TODO replace with actual when flashbots/builder is published - "el_client_image": "h4ck3rk3y/builder", - "el_client_log_level": "", - "cl_client_type": "lighthouse", - # THIS overrides the beacon image - "cl_client_image": "sigp/lighthouse", - "cl_client_log_level": "", - "beacon_extra_params": ["--builder={0}".format(mev_url), "--always-prepare-payload", "--prepare-payload-lookahead", "12000"], - # TODO(maybe) make parts of this more passable like the mev-relay-endpoint & forks - "el_extra_params": ["--builder", "--builder.remote_relay_endpoint=http://mev-relay-api:9062", "--builder.beacon_endpoints=http://cl-{0}-lighthouse-geth:4000".format(num_participants+1), "--builder.bellatrix_fork_version=0x30000038", "--builder.genesis_fork_version=0x10000038", "--builder.genesis_validators_root={0}".format(package_io.GENESIS_VALIDATORS_ROOT_PLACEHOLDER), "--miner.extradata=\"Illuminate Dmocratize Dstribute\"", "--miner.algotype=greedy"] + parsed_arguments_dict["mev_params"]["mev_builder_extra_args"], - "validator_extra_params": ["--builder-proposals"], - "builder_network_params": None - } - - parsed_arguments_dict["participants"].append(mev_participant) + if mev_type == "full": + + mev_url = "http://{0}{1}:{2}".format(mev_prefix, num_participants, mev_port) + + mev_participant = { + "el_client_type": "geth", + # TODO replace with actual when flashbots/builder is published + "el_client_image": "h4ck3rk3y/builder", + "el_client_log_level": "", + "cl_client_type": "lighthouse", + # THIS overrides the beacon image + "cl_client_image": "sigp/lighthouse", + "cl_client_log_level": "", + "beacon_extra_params": [ + "--builder={0}".format(mev_url), + "--always-prepare-payload", + "--prepare-payload-lookahead", + "12000" + ], + # TODO(maybe) make parts of this more passable like the mev-relay-endpoint & forks + "el_extra_params": [ + "--builder", + "--builder.remote_relay_endpoint=http://mev-relay-api:9062", + "--builder.beacon_endpoints=http://cl-{0}-lighthouse-geth:4000".format(num_participants+1), + "--builder.bellatrix_fork_version=0x30000038", + "--builder.genesis_fork_version=0x10000038", + "--builder.genesis_validators_root={0}".format(package_io.GENESIS_VALIDATORS_ROOT_PLACEHOLDER), + "--miner.extradata=\"Illuminate Dmocratize Dstribute\"", + "--miner.algotype=greedy" + ] + parsed_arguments_dict["mev_params"]["mev_builder_extra_args"], + "validator_extra_params": ["--builder-proposals"], + "builder_network_params": None + } + + parsed_arguments_dict["participants"].append(mev_participant) return parsed_arguments_dict