Skip to content

Commit

Permalink
feat: integrate Rollup boost (#105)
Browse files Browse the repository at this point in the history
Option to add `rollup-boost` as an additional service. The rollup-boost
image can be specified in mev_params.

---------

Co-authored-by: Barnabas Busa <barnabas.busa@ethereum.org>
  • Loading branch information
avalonche and barnabasbusa authored Dec 11, 2024
1 parent 9bd409e commit df0aa48
Show file tree
Hide file tree
Showing 9 changed files with 392 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .github/tests/rollup-boost.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
optimism_package:
chains:
- participants:
- el_type: op-geth
network_params:
name: op-rollup-one
additional_services:
- rollup-boost
58 changes: 58 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,31 @@ optimism_package:
cl_min_mem: 0
cl_max_mem: 0

# Builder client specific flags
# The type of builder EL client that should be started
# Valid values are:
# op-geth
# op-reth
el_builder_type: ""

# The Docker image that should be used for the builder EL client; leave blank to use the default for the client type
# Defaults by client:
# - op-geth: us-docker.pkg.dev/oplabs-tools-artifacts/images/op-geth:latest
# - op-reth: parithoshj/op-reth:latest
el_builder_image: ""

# The type of builder CL client that should be started
# Valid values are:
# op-node
# hildr
cl_builder_type: ""

# The Docker image that should be used for the builder CL client; leave blank to use the default for the client type
# Defaults by client:
# - op-node: us-docker.pkg.dev/oplabs-tools-artifacts/images/op-node:develop
# - hildr: ghcr.io/optimism-java/hildr:latest
cl_builder_image: ""

# Participant specific flags
# Node selector
# Only works with Kubernetes
Expand Down Expand Up @@ -272,11 +297,24 @@ optimism_package:

# A list of optional extra params that will be passed to the batcher container for modifying its behaviour
extra_params: []

# Default MEV configuration
mev_params:
# The Docker image that should be used for rollup boost; leave blank to use the default rollup-boost image
# Defaults to "flashbots/rollup-boost:latest"
rollup_boost_image: ""

# The host of an external builder
builder_host: ""

# The port of an external builder
builder_port: ""

# Additional services to run alongside the network
# Defaults to []
# Available services:
# - blockscout
# - rollup-boost
additional_services: []

# L2 contract deployer configuration - used for all L2 networks
Expand Down Expand Up @@ -437,5 +475,25 @@ ethereum_package:
```
Note: if configuring multiple L2s, make sure that the `network_id` and `name` are set to differentiate networks.

#### Rollup Boost for External Block Building

Rollup Boost is a sidecar to the sequencer op-node that allows blocks to be built by an external builder on the L2 network.

To use rollup boost, you can add `rollup-boost` as an additional service and configure the `mev_params` section of your arguments file to specify the rollup boost image. Optionally, you can specify the host and port of an external builder outside of the Kurtosis enclave.

```yaml
optimism_package:
chains:
- participants:
- el_builder_type: op-geth
cl_builder_type: op-node
mev_params:
rollup_boost_image: "flashbots/rollup-boost:latest"
builder_host: "localhost"
builder_port: "8545"
additional_services:
- rollup-boost
```

### Additional configurations
Please find examples of additional configurations in the [test folder](.github/tests/).
4 changes: 4 additions & 0 deletions network_params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ optimism_package:
batcher_params:
image: ""
extra_params: []
mev_params:
rollup_boost_image: ""
builder_host: ""
builder_port: ""
additional_services: []
op_contract_deployer_params:
image: us-docker.pkg.dev/oplabs-tools-artifacts/images/op-deployer:v0.0.7
Expand Down
124 changes: 123 additions & 1 deletion src/el_cl_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ ethereum_package_input_parser = import_module(
"github.com/ethpandaops/ethereum-package/src/package_io/input_parser.star"
)

input_parser = import_module("./package_io/input_parser.star")

# EL
op_geth = import_module("./el/op-geth/op_geth_launcher.star")
op_reth = import_module("./el/op-reth/op_reth_launcher.star")
Expand All @@ -16,11 +18,15 @@ op_besu = import_module("./el/op-besu/op_besu_launcher.star")
op_node = import_module("./cl/op-node/op_node_launcher.star")
hildr = import_module("./cl/hildr/hildr_launcher.star")

# MEV
rollup_boost = import_module("./mev/rollup-boost/rollup_boost_launcher.star")


def launch(
plan,
jwt_file,
network_params,
mev_params,
deployment_output,
participants,
num_participants,
Expand All @@ -30,6 +36,7 @@ def launch(
global_node_selectors,
global_tolerations,
persistent,
additional_services,
):
el_launchers = {
"op-geth": {
Expand Down Expand Up @@ -94,12 +101,28 @@ def launch(
},
}

sidecar_launchers = {
"rollup-boost": {
"launcher": rollup_boost.new_rollup_boost_launcher(
deployment_output,
jwt_file,
network_params.network,
network_params.network_id,
),
"launch_method": rollup_boost.launch,
}
}

all_cl_contexts = []
all_el_contexts = []
sequencer_enabled = True
rollup_boost_enabled = "rollup-boost" in additional_services

for index, participant in enumerate(participants):
cl_type = participant.cl_type
el_type = participant.el_type
cl_builder_type = participant.cl_builder_type
el_builder_type = participant.el_builder_type

node_selectors = ethereum_package_input_parser.get_client_node_selectors(
participant.node_selectors,
Expand Down Expand Up @@ -127,6 +150,20 @@ def launch(
)
)

if el_builder_type not in el_launchers:
fail(
"Unsupported launcher '{0}', need one of '{1}'".format(
el_builder_type, ",".join(el_launchers.keys())
)
)

if cl_builder_type not in cl_launchers:
fail(
"Unsupported launcher '{0}', need one of '{1}'".format(
cl_builder_type, ",".join(cl_launchers.keys())
)
)

el_launcher, el_launch_method = (
el_launchers[el_type]["launcher"],
el_launchers[el_type]["launch_method"],
Expand All @@ -137,6 +174,21 @@ def launch(
cl_launchers[cl_type]["launch_method"],
)

el_builder_launcher, el_builder_launch_method = (
el_launchers[el_builder_type]["launcher"],
el_launchers[el_builder_type]["launch_method"],
)

cl_builder_launcher, cl_builder_launch_method = (
cl_launchers[cl_builder_type]["launcher"],
cl_launchers[cl_builder_type]["launch_method"],
)

sidecar_launcher, sidecar_launch_method = (
sidecar_launchers["rollup-boost"]["launcher"],
sidecar_launchers["rollup-boost"]["launch_method"],
)

# Zero-pad the index using the calculated zfill value
index_str = ethereum_package_shared_utils.zfill_custom(
index + 1, len(str(len(participants)))
Expand All @@ -148,6 +200,15 @@ def launch(
cl_service_name = "op-cl-{0}-{1}-{2}-{3}".format(
index_str, cl_type, el_type, l2_services_suffix
)
el_builder_service_name = "op-el-builder-{0}-{1}-{2}-{3}".format(
index_str, el_builder_type, cl_builder_type, l2_services_suffix
)
cl_builder_service_name = "op-cl-builder-{0}-{1}-{2}-{3}".format(
index_str, cl_builder_type, el_builder_type, l2_services_suffix
)
sidecar_service_name = "op-rollup-boost-{0}-{1}".format(
index_str, l2_services_suffix
)

sequencer_context = all_el_contexts[0] if len(all_el_contexts) > 0 else None
el_context = el_launch_method(
Expand All @@ -164,6 +225,50 @@ def launch(
sequencer_context,
)

if rollup_boost_enabled:
plan.print("Rollup boost enabled")

if mev_params.builder_host == "" or mev_params.builder_port == "":
el_builder_context = el_builder_launch_method(
plan,
el_builder_launcher,
el_builder_service_name,
participant,
global_log_level,
persistent,
el_tolerations,
node_selectors,
all_el_contexts,
sequencer_enabled,
sequencer_context,
)
else:
el_builder_context = struct(
ip_addr=mev_params.builder_host,
engine_rpc_port_num=mev_params.builder_port,
)

rollup_boost_image = (
mev_params.rollup_boost_image
if mev_params.rollup_boost_image != ""
else input_parser.DEFAULT_SIDECAR_IMAGES["rollup-boost"]
)

sidecar_context = sidecar_launch_method(
plan,
sidecar_launcher,
sidecar_service_name,
rollup_boost_image,
all_el_contexts,
el_context,
el_builder_context,
)

all_el_contexts.append(el_builder_context)
all_el_contexts.append(sidecar_context)
else:
sidecar_context = None

cl_context = cl_launch_method(
plan,
cl_launcher,
Expand All @@ -173,7 +278,7 @@ def launch(
persistent,
cl_tolerations,
node_selectors,
el_context,
sidecar_context if rollup_boost_enabled else el_context,
all_cl_contexts,
l1_config_env_vars,
sequencer_enabled,
Expand All @@ -184,5 +289,22 @@ def launch(
all_el_contexts.append(el_context)
all_cl_contexts.append(cl_context)

if rollup_boost_enabled:
cl_builder_context = cl_builder_launch_method(
plan,
cl_builder_launcher,
cl_builder_service_name,
participant,
global_log_level,
persistent,
cl_tolerations,
node_selectors,
el_builder_context,
all_cl_contexts,
l1_config_env_vars,
False,
)
all_cl_contexts.append(cl_builder_context)

plan.print("Successfully added {0} EL/CL participants".format(num_participants))
return all_el_contexts, all_cl_contexts
3 changes: 3 additions & 0 deletions src/l2.star
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def launch_l2(
):
network_params = l2_args.network_params
batcher_params = l2_args.batcher_params
mev_params = l2_args.mev_params

plan.print("Deploying L2 with name {0}".format(network_params.name))
jwt_file = plan.upload_files(
Expand All @@ -36,13 +37,15 @@ def launch_l2(
jwt_file,
network_params,
batcher_params,
mev_params,
deployment_output,
l1_config,
l2_services_suffix,
global_log_level,
global_node_selectors,
global_tolerations,
persistent,
l2_args.additional_services,
)

all_el_contexts = []
Expand Down
Loading

0 comments on commit df0aa48

Please sign in to comment.