Skip to content

Commit

Permalink
feat!(bolt-boost): support in main.star; refactor of mev_sidecar_laun…
Browse files Browse the repository at this point in the history
…cher
  • Loading branch information
thedevbirb committed Oct 2, 2024
1 parent fea7f34 commit f1b0479
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 61 deletions.
117 changes: 73 additions & 44 deletions main.star
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ blockscout = import_module("./src/blockscout/blockscout_launcher.star")
prometheus = import_module("./src/prometheus/prometheus_launcher.star")
grafana = import_module("./src/grafana/grafana_launcher.star")
mev_boost = import_module("./src/mev/mev_boost/mev_boost_launcher.star")
bolt_boost = import_module("./src/mev/bolt-boost/bolt-boost-launcher.star")
mock_mev = import_module("./src/mev/mock_mev/mock_mev_launcher.star")
mev_relay = import_module("./src/mev/mev_relay/mev_relay_launcher.star")
helix_relay = import_module("./src/mev/mev_relay/helix_launcher.star")
Expand Down Expand Up @@ -127,10 +128,11 @@ def run(plan, args={}):
)
)

mev_sidecar_context=struct(
ip_addr="",
metrics_port_num=0,
)
#mev_sidecar_context=struct(
# ip_addr="",
# metrics_port_num=0,
#)
mev_sidecar_context = None
all_el_contexts = []
all_cl_contexts = []
all_vc_contexts = []
Expand Down Expand Up @@ -269,47 +271,74 @@ def run(plan, args={}):
index + 1, len(str(len(all_participants)))
)
if args_with_right_defaults.participants[index].validator_count != 0:
mev_boost_launcher = mev_boost.new_mev_boost_launcher(
MEV_BOOST_SHOULD_CHECK_RELAY,
mev_endpoints,
)
mev_boost_service_name = "{0}-{1}-{2}-{3}".format(
input_parser.MEV_BOOST_SERVICE_NAME_PREFIX,
index_str,
participant.cl_type,
participant.el_type,
)
mev_boost_context = mev_boost.launch(
plan,
mev_boost_launcher,
mev_boost_service_name,
network_params.network_id,
mev_params.mev_boost_image,
mev_params.mev_boost_args,
global_node_selectors,
network_params,
)
all_mevboost_contexts.append(mev_boost_context)
if mev_params.bolt_boost_image == None:
mev_boost_launcher = mev_boost.new_mev_boost_launcher(
MEV_BOOST_SHOULD_CHECK_RELAY,
mev_endpoints,
)
mev_boost_service_name = "{0}-{1}-{2}-{3}".format(
input_parser.MEV_BOOST_SERVICE_NAME_PREFIX,
index_str,
participant.cl_type,
participant.el_type,
)
mev_boost_context = mev_boost.launch(
plan,
mev_boost_launcher,
mev_boost_service_name,
network_params.network_id,
mev_params.mev_boost_image,
mev_params.mev_boost_args,
global_node_selectors,
network_params,
)
all_mevboost_contexts.append(mev_boost_context)

# add mev-sidecar
mev_sidecar_ctx = mev_sidecar.launch_mev_sidecar(
plan,
mev_params,
global_node_selectors,
mev_boost_context,
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
)
mev_sidecar_context = mev_sidecar_ctx
else:
bolt_boost_service_name = "{0}-{1}-{2}-{3}".format(
input_parser.BOLT_BOOST_SERVICE_NAME_PREFIX,
index_str,
participant.cl_type,
participant.el_type,
)
relays_config = [{
"id": "helix_relay",
"url": helix_endpoint,
}]
bolt_sidecar_config = {
"constraints_api_url": "{0}:{1}".format(
mev_sidecar.MEV_SIDECAR_ENDPOINT, mev_sidecar.MEV_SIDECAR_ENDPOINT_PORT
),
"beacon_api_url": all_cl_contexts[0].beacon_http_url,
"execution_api_url": "http://{0}:{1}".format(
all_el_contexts[0].ip_addr,
all_el_contexts[0].rpc_port_num,
),
"engine_api_url": "http://{0}:{1}".format(
all_el_contexts[0].ip_addr,
all_el_contexts[0].engine_rpc_port_num
),
"jwt_hex": raw_jwt_secret,
"metrics_port": mev_sidecar.MEV_SIDECAR_METRICS_PORT,
}
bolt_boost_context = bolt_boost.launch(
plan,
mev_params.bolt_boost_image,
bolt_boost_service_name,
relays_config,
bolt_sidecar_config,
network_params,
global_node_selectors,
)
all_mevboost_contexts.append(bolt_boost_context)
# add mev-sidecar
mev_sidecar_context = mev_sidecar.launch_mev_sidecar(
plan,
mev_params.mev_sidecar_image,
bolt_sidecar_config,
network_params,
global_node_selectors,
)

if len(args_with_right_defaults.additional_services) == 0:
output = struct(
Expand Down
28 changes: 11 additions & 17 deletions src/mev/mev_sidecar/mev_sidecar_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ postgres_module = import_module("github.com/kurtosis-tech/postgres-package/main.
constants = import_module("../../package_io/constants.star")
mev_boost_context_util = import_module("../mev_boost/mev_boost_context.star")

MEV_SIDECAR_ENDPOINT = "mev-sidecar-api"
MEV_SIDECAR_ENDPOINT = "http://mev-sidecar-api"

MEV_SIDECAR_ENDPOINT_PORT = 9061
MEV_SIDECAR_BOOST_PROXY_PORT = 9062
Expand All @@ -17,23 +17,17 @@ MEV_SIDECAR_MAX_MEMORY = 1024

def launch_mev_sidecar(
plan,
mev_params,
image,
sidecar_config,
network_params,
node_selectors,
mev_boost_context,
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": "bolt_sidecar=trace",
}

api = plan.add_service(
name=MEV_SIDECAR_ENDPOINT,
name="mev-sidecar-api",
config=ServiceConfig(
image=image,
cmd=[
Expand All @@ -43,27 +37,27 @@ def launch_mev_sidecar(
# Random private key for testing, generated with `openssl rand -hex 32`
"18d1c5302e734fd6fbfaa51828d42c4c6d3cbe020c42bab7dd15a2799cf00b82",
"--constraints-url",
mev_boost_context_util.mev_boost_endpoint(mev_boost_context),
sidecar_config["constraints_api_url"],
"--constraints-proxy-port",
str(MEV_SIDECAR_BOOST_PROXY_PORT),
"--beacon-api-url",
beacon_api_url,
sidecar_config["beacon_api_url"],
"--execution-api-url",
execution_api_url,
sidecar_config["execution_api_url"],
"--engine-api-url",
engine_api_url,
sidecar_config["engine_api_url"],
"--fee-recipient",
"0x0000000000000000000000000000000000000000",
"--jwt-hex",
raw_jwt_secret,
sidecar_config["jwt_hex"],
"--commitment-deadline",
str(100),
"--chain",
"kurtosis",
"--validator-indexes",
"0..64",
"--slot-time",
str(seconds_per_slot),
str(network_params.seconds_per_slot),
"--metrics-port",
str(MEV_SIDECAR_METRICS_PORT),
],
Expand Down

0 comments on commit f1b0479

Please sign in to comment.