Skip to content

Commit

Permalink
Merge pull request #6 from chainbound/feat/mev-boost-proxy
Browse files Browse the repository at this point in the history
feat(mev-boost): proxy with sidecar
  • Loading branch information
thedevbirb authored Aug 22, 2024
2 parents a508f25 + 6f379ea commit d3e6dcc
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 15 deletions.
12 changes: 11 additions & 1 deletion main.star
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,17 @@ def run(plan, args={}):
mev_params,
global_node_selectors,
mev_boost_context,
all_cl_contexts[0].beacon_http_url
all_cl_contexts[0].beacon_http_url,
"http://{0}:{1}".format(
all_el_contexts[0].ip_addr,
all_el_contexts[0].rpc_port_num,
),
"http://{0}:{1}".format(
all_el_contexts[0].ip_addr,
all_el_contexts[0].engine_rpc_port_num
),
raw_jwt_secret,
network_params.seconds_per_slot
)

if len(args_with_right_defaults.additional_services) == 0:
Expand Down
37 changes: 31 additions & 6 deletions src/mev/mev_sidecar/mev_sidecar_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ mev_boost_context_util = import_module("../mev_boost/mev_boost_context.star")
MEV_SIDECAR_ENDPOINT = "mev-sidecar-api"

MEV_SIDECAR_ENDPOINT_PORT = 9061
MEV_SIDECAR_BOOST_PROXY_PORT = 9062

# The min/max CPU/memory that mev-sidecar can use
MEV_SIDECAR_MIN_CPU = 100
Expand All @@ -18,35 +19,59 @@ def launch_mev_sidecar(
mev_params,
node_selectors,
mev_boost_context,
beacon_client_url
beacon_api_url,
execution_api_url,
engine_api_url,
raw_jwt_secret,
seconds_per_slot,
):
image = mev_params.mev_sidecar_image

env_vars = {
"RUST_LOG": "info",
"RUST_LOG": "bolt_sidecar=trace",
}

api = plan.add_service(
name=MEV_SIDECAR_ENDPOINT,
config=ServiceConfig(
image=image,
cmd=[
"/bolt-sidecar",
"--port",
str(MEV_SIDECAR_ENDPOINT_PORT),
"--private-key",
# Random private key for testing, generated with `openssl rand -hex 32`
"18d1c5302e734fd6fbfaa51828d42c4c6d3cbe020c42bab7dd15a2799cf00b82",
"--mevboost-url",
mev_boost_context_util.mev_boost_endpoint(mev_boost_context),
"--beacon-client-url",
beacon_client_url
"--mevboost-proxy-port",
str(MEV_SIDECAR_BOOST_PROXY_PORT),
"--beacon-api-url",
beacon_api_url,
"--execution-api-url",
execution_api_url,
"--engine-api-url",
engine_api_url,
"--fee-recipient",
"0x0000000000000000000000000000000000000000",
"--jwt-hex",
raw_jwt_secret,
"--commitment-deadline",
str(100),
"--chain",
"kurtosis",
"--validator-indexes",
"0..64",
"--slot-time",
str(seconds_per_slot),
],
# + mev_params.mev_relay_api_extra_args,
ports={
"api": PortSpec(
number=MEV_SIDECAR_ENDPOINT_PORT, transport_protocol="TCP"
)
),
"mevboost-proxy": PortSpec(
number=MEV_SIDECAR_BOOST_PROXY_PORT, transport_protocol="TCP"
),
},
env_vars=env_vars,
min_cpu=MEV_SIDECAR_MIN_CPU,
Expand Down
21 changes: 13 additions & 8 deletions src/package_io/input_parser.star
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ shared_utils = import_module("../shared_utils/shared_utils.star")
genesis_constants = import_module(
"../prelaunch_data_generator/genesis_constants/genesis_constants.star"
)
mev_sidecar = import_module("../mev/mev_sidecar/mev_sidecar_launcher.star")

DEFAULT_EL_IMAGES = {
"geth": "ethereum/client-go:latest",
Expand Down Expand Up @@ -143,7 +144,7 @@ def input_parser(plan, input_args):
result = enrich_mev_extra_params(
result,
MEV_BOOST_SERVICE_NAME_PREFIX,
FLASHBOTS_MEV_BOOST_PORT,
mev_sidecar.MEV_SIDECAR_BOOST_PROXY_PORT,
result.get("mev_type"),
)

Expand Down Expand Up @@ -794,13 +795,17 @@ def enrich_mev_extra_params(parsed_arguments_dict, mev_prefix, mev_port, mev_typ
index_str = shared_utils.zfill_custom(
index + 1, len(str(len(parsed_arguments_dict["participants"])))
)
mev_url = "http://{0}-{1}-{2}-{3}:{4}".format(
MEV_BOOST_SERVICE_NAME_PREFIX,
index_str,
participant["cl_type"],
participant["el_type"],
mev_port,
)

# mev_url = "http://{0}-{1}-{2}-{3}:{4}".format(
# MEV_BOOST_SERVICE_NAME_PREFIX,
# index_str,
# participant["cl_type"],
# participant["el_type"],
# mev_port,
# )

# connection: beacon node -> mev-boost
mev_url = "http://mev-sidecar-api:{0}".format(mev_port)

if participant["cl_type"] == "lighthouse":
participant["vc_extra_params"].append("--builder-proposals")
Expand Down

0 comments on commit d3e6dcc

Please sign in to comment.