Skip to content

Commit

Permalink
feat: adds op-proposer support
Browse files Browse the repository at this point in the history
required for challenger since we need something making proposals
  • Loading branch information
zhwrd committed Dec 18, 2024
1 parent 9c98e66 commit 6e9fd47
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 22 deletions.
2 changes: 2 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
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,6 +38,7 @@ def launch_l2(
jwt_file,
network_params,
batcher_params,
proposer_params,
mev_params,
deployment_output,
l1_config,
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
50 changes: 32 additions & 18 deletions src/participant_network.star
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def launch_participant_network(
jwt_file,
network_params,
batcher_params,
proposer_params,
mev_params,
deployment_output,
l1_config_env_vars,
Expand Down Expand Up @@ -58,25 +59,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 +81,36 @@ 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",
# ".opChainDeployments[{0}].disputeGameFactoryProxyAddress".format(
# 1
# ),
)

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 6e9fd47

Please sign in to comment.