Skip to content

Commit d0db99c

Browse files
fix: Support multiple sequencers: Reorder the launch sequence [28/N] (#321)
**Description** The launch sequence needs to be reorganized so that the conductors can receive supervisor URLs (the supervisors need to be running by the time we launch the conductors so we cannot simply pass the precomputed URLs). All of this is heavily marked as `hack` since it's a dirty fix. It will need to be replaced A$AP with a better solution - be it #318 or another. Fixes ethereum-optimism/optimism#16366
1 parent 927deb7 commit d0db99c

File tree

5 files changed

+222
-97
lines changed

5 files changed

+222
-97
lines changed

main.star

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
ethereum_package = import_module("github.com/ethpandaops/ethereum-package/main.star")
22
contract_deployer = import_module("./src/contracts/contract_deployer.star")
33
l2_launcher = import_module("./src/l2.star")
4+
l2_launcher__hack = import_module("./src/l2__hack.star")
45
superchain_launcher = import_module("./src/superchain/launcher.star")
56
supervisor_launcher = import_module("./src/supervisor/launcher.star")
67
op_challenger_launcher = import_module("./src/challenger/op-challenger/launcher.star")
@@ -171,6 +172,36 @@ def run(plan, args={}):
171172
observability_helper=observability_helper,
172173
)
173174

175+
for index, chain in enumerate(optimism_args.chains):
176+
# We filter out the supervisors applicable to this network
177+
l2_supervisors_params = [
178+
supervisor_params
179+
for supervisor_params in optimism_args.supervisors
180+
if chain.network_params.network_id
181+
in supervisor_params.superchain.participants
182+
]
183+
184+
original_l2_output__hack = l2s[index]
185+
186+
l2_launcher__hack.launch_l2__hack(
187+
original_l2_output__hack=original_l2_output__hack,
188+
plan=plan,
189+
l2_services_suffix=chain.network_params.name,
190+
l2_args=chain,
191+
jwt_file=jwt_file,
192+
deployment_output=deployment_output,
193+
l1_config=l1_config_env_vars,
194+
l1_priv_key=l1_priv_key,
195+
l1_rpc_url=l1_rpc_url,
196+
global_log_level=global_log_level,
197+
global_node_selectors=global_node_selectors,
198+
global_tolerations=global_tolerations,
199+
persistent=persistent,
200+
observability_helper=observability_helper,
201+
supervisors_params=l2_supervisors_params,
202+
registry=registry,
203+
)
204+
174205
if optimism_args.faucet.enabled:
175206
_install_faucet(
176207
plan=plan,

src/conductor/op-conductor/launcher.star

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def get_service_config(
102102
#
103103
# TODO This might be later added as a multiplier parameter if needed
104104
"OP_CONDUCTOR_HEALTHCHECK_UNSAFE_INTERVAL": str(
105-
network_params.seconds_per_slot * 3
105+
network_params.seconds_per_slot * 2 + 1
106106
),
107107
"OP_CONDUCTOR_LOG_FORMAT": "logfmt",
108108
"OP_CONDUCTOR_LOG_LEVEL": "info",

src/l2__hack.star

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
participant_network__hack = import_module("./participant_network__hack.star")
2+
blockscout = import_module("./blockscout/blockscout_launcher.star")
3+
_da_server_launcher = import_module("./da/da-server/launcher.star")
4+
_tx_fuzzer_launcher = import_module("./tx-fuzzer/launcher.star")
5+
contract_deployer = import_module("./contracts/contract_deployer.star")
6+
input_parser = import_module("./package_io/input_parser.star")
7+
util = import_module("./util.star")
8+
9+
10+
def launch_l2__hack(
11+
original_l2_output__hack,
12+
plan,
13+
l2_services_suffix,
14+
l2_args,
15+
jwt_file,
16+
deployment_output,
17+
l1_config,
18+
l1_priv_key,
19+
l1_rpc_url,
20+
global_log_level,
21+
global_node_selectors,
22+
global_tolerations,
23+
persistent,
24+
observability_helper,
25+
supervisors_params,
26+
registry=None,
27+
):
28+
network_params = l2_args.network_params
29+
proxyd_params = l2_args.proxyd_params
30+
batcher_params = l2_args.batcher_params
31+
proposer_params = l2_args.proposer_params
32+
mev_params = l2_args.mev_params
33+
conductor_params = l2_args.conductor_params
34+
tx_fuzzer_params = l2_args.tx_fuzzer_params
35+
36+
plan.print("Deploying L2 with name {0}, part 2".format(network_params.name))
37+
38+
participant_network__hack.launch_participant_network__hack(
39+
original_participant_network_output__hack=original_l2_output__hack,
40+
plan=plan,
41+
participants=l2_args.participants,
42+
jwt_file=jwt_file,
43+
network_params=network_params,
44+
proxyd_params=proxyd_params,
45+
batcher_params=batcher_params,
46+
proposer_params=proposer_params,
47+
mev_params=mev_params,
48+
conductor_params=conductor_params,
49+
deployment_output=deployment_output,
50+
l1_config_env_vars=l1_config,
51+
l2_services_suffix=l2_services_suffix,
52+
global_log_level=global_log_level,
53+
global_node_selectors=global_node_selectors,
54+
global_tolerations=global_tolerations,
55+
persistent=persistent,
56+
additional_services=l2_args.additional_services,
57+
observability_helper=observability_helper,
58+
supervisors_params=supervisors_params,
59+
da_server_context=original_l2_output__hack.da_server_context__hack,
60+
registry=registry,
61+
)

src/participant_network.star

Lines changed: 1 addition & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
el_cl_client_launcher = import_module("./el_cl_launcher.star")
22
participant_module = import_module("./participant.star")
33
input_parser = import_module("./package_io/input_parser.star")
4-
_op_batcher_launcher = import_module("./batcher/op-batcher/launcher.star")
5-
_op_conductor_launcher = import_module("./conductor/op-conductor/launcher.star")
6-
_op_proposer_launcher = import_module("./proposer/op-proposer/launcher.star")
74
_proxyd_launcher = import_module("./proxyd/launcher.star")
85
util = import_module("./util.star")
96
_net = import_module("/src/util/net.star")
@@ -82,101 +79,9 @@ def launch_participant_network(
8279
observability_helper=observability_helper,
8380
)
8481

85-
conductor_context = (
86-
_op_conductor_launcher.launch(
87-
plan=plan,
88-
params=conductor_params,
89-
network_params=network_params,
90-
deployment_output=deployment_output,
91-
# FIXME We need to plumb the legacy args into the new format so that we make our lives easier when we're switching
92-
el_params=struct(
93-
service_name=all_el_contexts[0].ip_addr,
94-
ports={
95-
_net.RPC_PORT_NAME: _net.port(
96-
number=all_el_contexts[0].rpc_port_num
97-
)
98-
},
99-
),
100-
cl_params=struct(
101-
service_name=all_cl_contexts[0].ip_addr,
102-
ports={
103-
_net.RPC_PORT_NAME: _net.port(number=all_cl_contexts[0].http_port)
104-
},
105-
),
106-
observability_helper=observability_helper,
107-
).context
108-
if conductor_params
109-
else None
110-
)
111-
112-
batcher_key = util.read_network_config_value(
113-
plan,
114-
deployment_output,
115-
"batcher-{0}".format(network_params.network_id),
116-
".privateKey",
117-
)
118-
_op_batcher_launcher.launch(
119-
plan=plan,
120-
params=batcher_params,
121-
# FIXME We need to plumb the legacy args into the new format so that we make our lives easier when we're switching
122-
sequencers_params=[
123-
struct(
124-
el=struct(
125-
service_name=all_el_contexts[0].ip_addr,
126-
ports={
127-
_net.RPC_PORT_NAME: _net.port(
128-
number=all_el_contexts[0].rpc_port_num
129-
)
130-
},
131-
),
132-
cl=struct(
133-
service_name=all_cl_contexts[0].ip_addr,
134-
ports={
135-
_net.RPC_PORT_NAME: _net.port(
136-
number=all_cl_contexts[0].http_port
137-
)
138-
},
139-
),
140-
# Conductor params are not being parsed yet
141-
conductor_params=None,
142-
)
143-
],
144-
l1_config_env_vars=l1_config_env_vars,
145-
gs_batcher_private_key=batcher_key,
146-
network_params=network_params,
147-
observability_helper=observability_helper,
148-
da_server_context=da_server_context,
149-
)
150-
151-
# We'll grab the game factory address from the deployments
152-
game_factory_address = util.read_network_config_value(
153-
plan,
154-
deployment_output,
155-
"state",
156-
'.opChainDeployments[] | select(.id=="{0}") | .DisputeGameFactoryProxy'.format(
157-
util.to_hex_chain_id(network_params.network_id)
158-
),
159-
)
160-
161-
proposer_key = util.read_network_config_value(
162-
plan,
163-
deployment_output,
164-
"proposer-{0}".format(network_params.network_id),
165-
".privateKey",
166-
)
167-
_op_proposer_launcher.launch(
168-
plan=plan,
169-
params=proposer_params,
170-
cl_context=all_cl_contexts[0],
171-
l1_config_env_vars=l1_config_env_vars,
172-
gs_proposer_private_key=proposer_key,
173-
game_factory_address=game_factory_address,
174-
network_params=network_params,
175-
observability_helper=observability_helper,
176-
)
177-
17882
return struct(
17983
name=network_params.name,
18084
network_id=network_params.network_id,
18185
participants=all_participants,
86+
da_server_context__hack=da_server_context,
18287
)

src/participant_network__hack.star

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
_op_batcher_launcher = import_module("./batcher/op-batcher/launcher.star")
2+
_op_conductor_launcher = import_module("./conductor/op-conductor/launcher.star")
3+
_op_proposer_launcher = import_module("./proposer/op-proposer/launcher.star")
4+
util = import_module("./util.star")
5+
_net = import_module("/src/util/net.star")
6+
_registry = import_module("./package_io/registry.star")
7+
8+
9+
def launch_participant_network__hack(
10+
original_participant_network_output__hack,
11+
plan,
12+
participants,
13+
jwt_file,
14+
network_params,
15+
proxyd_params,
16+
batcher_params,
17+
proposer_params,
18+
mev_params,
19+
conductor_params,
20+
deployment_output,
21+
l1_config_env_vars,
22+
l2_services_suffix,
23+
global_log_level,
24+
global_node_selectors,
25+
global_tolerations,
26+
persistent,
27+
additional_services,
28+
observability_helper,
29+
supervisors_params,
30+
da_server_context,
31+
registry=_registry.Registry(),
32+
):
33+
# In the legacy setup the first node is always the sequencer
34+
sequencer_participant = original_participant_network_output__hack.participants[0]
35+
conductor_context = (
36+
_op_conductor_launcher.launch(
37+
plan=plan,
38+
params=conductor_params,
39+
network_params=network_params,
40+
deployment_output=deployment_output,
41+
# FIXME We need to plumb the legacy args into the new format so that we make our lives easier when we're switching
42+
el_params=struct(
43+
service_name=sequencer_participant.el_context.ip_addr,
44+
ports={
45+
_net.RPC_PORT_NAME: _net.port(
46+
number=sequencer_participant.el_context.rpc_port_num
47+
)
48+
},
49+
),
50+
cl_params=struct(
51+
service_name=sequencer_participant.cl_context.ip_addr,
52+
ports={
53+
_net.RPC_PORT_NAME: _net.port(
54+
number=sequencer_participant.cl_context.http_port
55+
)
56+
},
57+
),
58+
observability_helper=observability_helper,
59+
).context
60+
if conductor_params
61+
else None
62+
)
63+
64+
batcher_key = util.read_network_config_value(
65+
plan,
66+
deployment_output,
67+
"batcher-{0}".format(network_params.network_id),
68+
".privateKey",
69+
)
70+
_op_batcher_launcher.launch(
71+
plan=plan,
72+
params=batcher_params,
73+
# FIXME We need to plumb the legacy args into the new format so that we make our lives easier when we're switching
74+
sequencers_params=[
75+
struct(
76+
el=struct(
77+
service_name=sequencer_participant.el_context.ip_addr,
78+
ports={
79+
_net.RPC_PORT_NAME: _net.port(
80+
number=sequencer_participant.el_context.rpc_port_num
81+
)
82+
},
83+
),
84+
cl=struct(
85+
service_name=sequencer_participant.cl_context.ip_addr,
86+
ports={
87+
_net.RPC_PORT_NAME: _net.port(
88+
number=sequencer_participant.cl_context.http_port
89+
)
90+
},
91+
),
92+
# Conductor params are not being parsed yet
93+
conductor_params=None,
94+
)
95+
],
96+
l1_config_env_vars=l1_config_env_vars,
97+
gs_batcher_private_key=batcher_key,
98+
network_params=network_params,
99+
observability_helper=observability_helper,
100+
da_server_context=da_server_context,
101+
)
102+
103+
# We'll grab the game factory address from the deployments
104+
game_factory_address = util.read_network_config_value(
105+
plan,
106+
deployment_output,
107+
"state",
108+
'.opChainDeployments[] | select(.id=="{0}") | .DisputeGameFactoryProxy'.format(
109+
util.to_hex_chain_id(network_params.network_id)
110+
),
111+
)
112+
113+
proposer_key = util.read_network_config_value(
114+
plan,
115+
deployment_output,
116+
"proposer-{0}".format(network_params.network_id),
117+
".privateKey",
118+
)
119+
_op_proposer_launcher.launch(
120+
plan=plan,
121+
params=proposer_params,
122+
cl_context=sequencer_participant.cl_context,
123+
l1_config_env_vars=l1_config_env_vars,
124+
gs_proposer_private_key=proposer_key,
125+
game_factory_address=game_factory_address,
126+
network_params=network_params,
127+
observability_helper=observability_helper,
128+
)

0 commit comments

Comments
 (0)