Skip to content

Commit

Permalink
feat: adds op-proposer support (#111)
Browse files Browse the repository at this point in the history
**Description**

Adds op-proposer support back in preparation for adding op-challenger
support. We need proposer to make proposals to test challenger
functionality.

The launcher supports a few config params:
```
{
  "image": "",
  "extra_params": [],
  "game_type": 1,
  "proposal_interval": "10m",
}
```

**Changes**
* Adds an l2_num param to l2, network participant launchers so we can
index into the deployment state to get per-chain addresses
* Makes proposer parameters consistent with batcher
* Updates proposer to use dispute game factory

Signed-off-by: Matthew Slipper <me@matthewslipper.com>
Co-authored-by: Matthew Slipper <me@matthewslipper.com>
  • Loading branch information
zhwrd and mslipper authored Dec 20, 2024
1 parent 9e47fd6 commit f062776
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 25 deletions.
5 changes: 2 additions & 3 deletions main.star
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,10 @@ def run(plan, args):
l1_network,
)

for chain in optimism_args_with_right_defaults.chains:
for l2_num, chain in enumerate(optimism_args_with_right_defaults.chains):
l2_launcher.launch_l2(
plan,
l2_num,
chain.network_params.name,
chain,
deployment_output,
Expand All @@ -97,8 +98,6 @@ def run(plan, args):
persistent,
)

return


def get_l1_config(all_l1_participants, l1_network_params, l1_network_id):
env_vars = {}
Expand Down
4 changes: 4 additions & 0 deletions src/l2.star
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ util = import_module("./util.star")

def launch_l2(
plan,
l2_num,
l2_services_suffix,
l2_args,
deployment_output,
Expand All @@ -23,6 +24,7 @@ def launch_l2(
):
network_params = l2_args.network_params
batcher_params = l2_args.batcher_params
proposer_params = l2_args.proposer_params
mev_params = l2_args.mev_params

plan.print("Deploying L2 with name {0}".format(network_params.name))
Expand All @@ -37,9 +39,11 @@ def launch_l2(
jwt_file,
network_params,
batcher_params,
proposer_params,
mev_params,
deployment_output,
l1_config,
l2_num,
l2_services_suffix,
global_log_level,
global_node_selectors,
Expand Down
20 changes: 20 additions & 0 deletions src/package_io/input_parser.star
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ def input_parser(plan, input_args):
image=result["batcher_params"]["image"],
extra_params=result["batcher_params"]["extra_params"],
),
proposer_params=struct(
image=result["proposer_params"]["image"],
extra_params=result["proposer_params"]["extra_params"],
game_type=result["proposer_params"]["game_type"],
proposal_interval=result["proposer_params"]["proposal_interval"],
),
mev_params=struct(
rollup_boost_image=result["mev_params"]["rollup_boost_image"],
builder_host=result["mev_params"]["builder_host"],
Expand Down Expand Up @@ -146,6 +152,9 @@ def parse_network_params(plan, input_args):
batcher_params = default_batcher_params()
batcher_params.update(chain.get("batcher_params", {}))

proposer_params = default_proposer_params()
proposer_params.update(chain.get("proposer_params", {}))

mev_params = default_mev_params()
mev_params.update(chain.get("mev_params", {}))

Expand Down Expand Up @@ -221,6 +230,7 @@ def parse_network_params(plan, input_args):
"participants": participants,
"network_params": network_params,
"batcher_params": batcher_params,
"proposer_params": proposer_params,
"mev_params": mev_params,
"additional_services": chain.get(
"additional_services", DEFAULT_ADDITIONAL_SERVICES
Expand Down Expand Up @@ -263,6 +273,7 @@ def default_chains():
"participants": [default_participant()],
"network_params": default_network_params(),
"batcher_params": default_batcher_params(),
"proposer_params": default_proposer_params(),
"mev_params": default_mev_params(),
"additional_services": DEFAULT_ADDITIONAL_SERVICES,
}
Expand Down Expand Up @@ -291,6 +302,15 @@ def default_batcher_params():
}


def default_proposer_params():
return {
"image": "",
"extra_params": [],
"game_type": 1,
"proposal_interval": "10m",
}


def default_participant():
return {
"el_type": "op-geth",
Expand Down
1 change: 1 addition & 0 deletions src/package_io/sanity_check.star
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ SUBCATEGORY_PARAMS = {
"fund_dev_accounts",
],
"batcher_params": ["image", "extra_params"],
"proposer_params": ["image", "extra_params", "game_type", "proposal_interval"],
"mev_params": ["rollup_boost_image", "builder_host", "builder_port"],
}

Expand Down
48 changes: 30 additions & 18 deletions src/participant_network.star
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ def launch_participant_network(
jwt_file,
network_params,
batcher_params,
proposer_params,
mev_params,
deployment_output,
l1_config_env_vars,
l2_num,
l2_services_suffix,
global_log_level,
global_node_selectors,
Expand Down Expand Up @@ -58,25 +60,17 @@ def launch_participant_network(

all_participants.append(participant_entry)

proposer_key = util.read_network_config_value(
plan,
deployment_output,
"proposer-{0}".format(network_params.network_id),
".privateKey",
)
batcher_key = util.read_network_config_value(
plan,
deployment_output,
"batcher-{0}".format(network_params.network_id),
".privateKey",
)

op_batcher_image = (
batcher_params.image
if batcher_params.image != ""
else input_parser.DEFAULT_BATCHER_IMAGES["op-batcher"]
)

op_batcher_launcher.launch(
plan,
"op-batcher-{0}".format(l2_services_suffix),
Expand All @@ -88,15 +82,33 @@ def launch_participant_network(
batcher_params,
)

# The OP Stack don't run the proposer anymore, it has been replaced with the challenger
# op_proposer_launcher.launch(
# plan,
# "op-proposer{0}".format(l2_services_suffix),
# input_parser.DEFAULT_PROPOSER_IMAGES["op-proposer"],
# all_cl_contexts[0],
# l1_config_env_vars,
# gs_private_keys["GS_PROPOSER_PRIVATE_KEY"],
# l2oo_address,
# )
game_factory_address = util.read_network_config_value(
plan,
deployment_output,
"state",
".opChainDeployments[{0}].disputeGameFactoryProxyAddress".format(l2_num),
)

proposer_key = util.read_network_config_value(
plan,
deployment_output,
"proposer-{0}".format(network_params.network_id),
".privateKey",
)
op_proposer_image = (
proposer_params.image
if proposer_params.image != ""
else input_parser.DEFAULT_PROPOSER_IMAGES["op-proposer"]
)
op_proposer_launcher.launch(
plan,
"op-proposer-{0}".format(l2_services_suffix),
op_proposer_image,
all_cl_contexts[0],
l1_config_env_vars,
proposer_key,
game_factory_address,
proposer_params,
)

return all_participants
17 changes: 13 additions & 4 deletions src/proposer/op-proposer/op_proposer_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ def launch(
cl_context,
l1_config_env_vars,
gs_proposer_private_key,
l2oo_address,
game_factory_address,
proposer_params,
):
proposer_service_name = "{0}".format(service_name)

Expand All @@ -50,7 +51,8 @@ def launch(
cl_context,
l1_config_env_vars,
gs_proposer_private_key,
l2oo_address,
game_factory_address,
proposer_params,
)

proposer_service = plan.add_service(service_name, config)
Expand All @@ -70,18 +72,25 @@ def get_proposer_config(
cl_context,
l1_config_env_vars,
gs_proposer_private_key,
l2oo_address,
game_factory_address,
proposer_params,
):
cmd = [
"op-proposer",
"--poll-interval=12s",
"--rpc.port=" + str(PROPOSER_HTTP_PORT_NUM),
"--rollup-rpc=" + cl_context.beacon_http_url,
"--l2oo-address=" + str(l2oo_address),
"--game-factory-address=" + str(game_factory_address),
"--private-key=" + gs_proposer_private_key,
"--l1-eth-rpc=" + l1_config_env_vars["L1_RPC_URL"],
"--allow-non-finalized=true",
"--game-type={0}".format(proposer_params.game_type),
"--proposal-interval=" + proposer_params.proposal_interval,
"--wait-node-sync=true",
]

cmd += proposer_params.extra_params

ports = get_used_ports()
return ServiceConfig(
image=image,
Expand Down

0 comments on commit f062776

Please sign in to comment.