Skip to content

Commit

Permalink
fix: additional fixes for rollup-boost drift (#163)
Browse files Browse the repository at this point in the history
### Issue
Rollup-boost encountered issues due to configuration drift. 
### Description
While the primary drift problem was resolved in [PR
#147](#147),
follow-up testing uncovered additional inconsistencies that require
further adjustments.
This issue proposes targeted fixes based on local test results and
addresses the rest of inconsistencies.
Also couple of uncovered bugs were addressed (mainly with external
builder)
Removed
[this](https://github.com/ethpandaops/optimism-package/blob/0d490fd395ee579ea905bb4633e453e27e075bb8/src/el_cl_launcher.star#L354)
as it was causing a bug + was confusing
Changed behavior of builder consensus node. Now if external builder is
used it should setup consensus node outside of enclave too.
  • Loading branch information
SozinM authored Feb 20, 2025
1 parent b62804e commit 8d6ded4
Show file tree
Hide file tree
Showing 4 changed files with 241 additions and 133 deletions.
122 changes: 87 additions & 35 deletions src/cl/op-node/op_node_builder_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ ethereum_package_input_parser = import_module(
constants = import_module("../../package_io/constants.star")

util = import_module("../../util.star")
observability = import_module("../../observability/observability.star")
interop_constants = import_module("../../interop/constants.star")

# ---------------------------------- Beacon client -------------------------------------

Expand Down Expand Up @@ -73,6 +75,9 @@ def launch(
existing_cl_clients,
l1_config_env_vars,
sequencer_enabled,
observability_helper,
interop_params,
da_server_context,
):
beacon_node_identity_recipe = PostHttpRequestRecipe(
endpoint="/",
Expand Down Expand Up @@ -104,6 +109,9 @@ def launch(
l1_config_env_vars,
beacon_node_identity_recipe,
sequencer_enabled,
observability_helper,
interop_params,
da_server_context,
)

beacon_service = plan.add_service(service_name, config)
Expand All @@ -113,6 +121,8 @@ def launch(
beacon_service.ip_address, beacon_http_port.number
)

metrics_info = observability.new_metrics_info(observability_helper, beacon_service)

response = plan.request(
recipe=beacon_node_identity_recipe, service_name=service_name
)
Expand All @@ -127,7 +137,7 @@ def launch(
ip_addr=beacon_service.ip_address,
http_port=beacon_http_port.number,
beacon_http_url=beacon_http_url,
cl_nodes_metrics_info=None,
cl_nodes_metrics_info=[metrics_info],
beacon_service_name=service_name,
multiaddr=beacon_multiaddr,
peer_id=beacon_peer_id,
Expand All @@ -148,49 +158,107 @@ def get_beacon_config(
l1_config_env_vars,
beacon_node_identity_recipe,
sequencer_enabled,
observability_helper,
interop_params,
da_server_context,
):
ports = dict(get_used_ports(BEACON_DISCOVERY_PORT_NUM))

EXECUTION_ENGINE_ENDPOINT = "http://{0}:{1}".format(
el_context.ip_addr,
el_context.engine_rpc_port_num,
)

used_ports = get_used_ports(BEACON_DISCOVERY_PORT_NUM)

cmd = [
"op-node",
"--l2={0}".format(EXECUTION_ENGINE_ENDPOINT),
"--l2.jwt-secret=" + ethereum_package_constants.JWT_MOUNT_PATH_ON_CONTAINER,
"--verifier.l1-confs=4",
"--verifier.l1-confs=1",
"--rollup.config="
+ ethereum_package_constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS
+ "/rollup-{0}.json".format(launcher.network_params.network_id),
+ "{0}/rollup-{1}.json".format(
ethereum_package_constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS,
launcher.network_params.network_id,
),
"--rpc.addr=0.0.0.0",
"--rpc.port={0}".format(BEACON_HTTP_PORT_NUM),
"--rpc.enable-admin",
"--l1={0}".format(l1_config_env_vars["L1_RPC_URL"]),
"--l1.rpckind={0}".format(l1_config_env_vars["L1_RPC_KIND"]),
"--l1.beacon={0}".format(l1_config_env_vars["CL_RPC_URL"]),
"--l1.trustrpc",
"--p2p.advertise.ip="
+ ethereum_package_constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
"--p2p.advertise.tcp={0}".format(BEACON_DISCOVERY_PORT_NUM),
"--p2p.advertise.udp={0}".format(BEACON_DISCOVERY_PORT_NUM),
"--p2p.listen.ip=0.0.0.0",
"--p2p.listen.tcp={0}".format(BEACON_DISCOVERY_PORT_NUM),
"--p2p.listen.udp={0}".format(BEACON_DISCOVERY_PORT_NUM),
"--safedb.path={0}".format(BEACON_DATA_DIRPATH_ON_SERVICE_CONTAINER),
"--altda.enabled=" + str(da_server_context.enabled),
"--altda.da-server=" + da_server_context.http_url,
]

sequencer_private_key = util.read_network_config_value(
plan,
launcher.deployment_output,
"sequencer-{0}".format(launcher.network_params.network_id),
".privateKey",
)
# configure files

files = {
ethereum_package_constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: launcher.deployment_output,
ethereum_package_constants.JWT_MOUNTPOINT_ON_CLIENTS: launcher.jwt_file,
}

if persistent:
files[BEACON_DATA_DIRPATH_ON_SERVICE_CONTAINER] = Directory(
persistent_key="data-{0}".format(service_name),
size=int(participant.cl_builder_volume_size)
if int(participant.cl_builder_volume_size) > 0
else constants.VOLUME_SIZE[launcher.network][
constants.CL_TYPE.hildr + "_volume_size"
],
)

# configure environment variables

env_vars = dict(participant.cl_builder_extra_env_vars)

# apply customizations

if observability_helper.enabled:
cmd += [
"--metrics.enabled=true",
"--metrics.addr=0.0.0.0",
"--metrics.port={0}".format(observability.METRICS_PORT_NUM),
]

observability.expose_metrics_port(ports)

if interop_params.enabled:
ports[
interop_constants.INTEROP_WS_PORT_ID
] = ethereum_package_shared_utils.new_port_spec(
interop_constants.INTEROP_WS_PORT_NUM,
ethereum_package_shared_utils.TCP_PROTOCOL,
)

env_vars.update(
{
# "OP_NODE_INTEROP_SUPERVISOR": interop_constants.SUPERVISOR_ENDPOINT,
"OP_NODE_INTEROP_RPC_ADDR": "0.0.0.0",
"OP_NODE_INTEROP_RPC_PORT": str(interop_constants.INTEROP_WS_PORT_NUM),
"OP_NODE_INTEROP_JWT_SECRET": ethereum_package_constants.JWT_MOUNT_PATH_ON_CONTAINER,
}
)

if sequencer_enabled:
cmd.append("--p2p.sequencer.key=" + sequencer_private_key)
cmd.append("--sequencer.enabled")
cmd.append("--sequencer.l1-confs=5")
sequencer_private_key = util.read_network_config_value(
plan,
launcher.deployment_output,
"sequencer-{0}".format(launcher.network_params.network_id),
".privateKey",
)

cmd += [
"--p2p.sequencer.key=" + sequencer_private_key,
"--sequencer.enabled",
"--sequencer.l1-confs=2",
]

if len(existing_cl_clients) > 0:
cmd.append(
Expand All @@ -207,25 +275,6 @@ def get_beacon_config(

cmd += participant.cl_builder_extra_params

files = {
ethereum_package_constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: launcher.deployment_output,
ethereum_package_constants.JWT_MOUNTPOINT_ON_CLIENTS: launcher.jwt_file,
}

if persistent:
files[BEACON_DATA_DIRPATH_ON_SERVICE_CONTAINER] = Directory(
persistent_key="data-{0}".format(service_name),
size=int(participant.cl_builder_volume_size)
if int(participant.cl_builder_volume_size) > 0
else constants.VOLUME_SIZE[launcher.network][
constants.CL_TYPE.hildr + "_volume_size"
],
)

ports = {}
ports.update(used_ports)

env_vars = participant.cl_builder_extra_env_vars
config_args = {
"image": participant.cl_builder_image,
"ports": ports,
Expand All @@ -251,6 +300,8 @@ def get_beacon_config(
"node_selectors": node_selectors,
}

# configure resources

if participant.cl_builder_min_cpu > 0:
config_args["min_cpu"] = participant.cl_builder_min_cpu
if participant.cl_builder_max_cpu > 0:
Expand All @@ -259,6 +310,7 @@ def get_beacon_config(
config_args["min_memory"] = participant.cl_builder_min_mem
if participant.cl_builder_max_mem > 0:
config_args["max_memory"] = participant.cl_builder_max_mem

return ServiceConfig(**config_args)


Expand Down
Loading

0 comments on commit 8d6ded4

Please sign in to comment.