Skip to content

Commit

Permalink
fix: dont spin up extra el/cl client for mock-mev (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
h4ck3rk3y authored Aug 30, 2023
1 parent 0165ef1 commit 46d67fc
Showing 1 changed file with 37 additions and 21 deletions.
58 changes: 37 additions & 21 deletions src/package_io/parse_input.star
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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)

Expand All @@ -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

0 comments on commit 46d67fc

Please sign in to comment.