Skip to content

Commit cdcee84

Browse files
hack: Reorder the launch sequence
1 parent e8cf8f2 commit cdcee84

5 files changed

Lines changed: 225 additions & 97 deletions

File tree

main.star

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,36 @@ def run(plan, args={}):
171171
observability_helper=observability_helper,
172172
)
173173

174+
for index, chain in enumerate(optimism_args.chains):
175+
# We filter out the supervisors applicable to this network
176+
l2_supervisors_params = [
177+
supervisor_params
178+
for supervisor_params in optimism_args.supervisors
179+
if chain.network_params.network_id
180+
in supervisor_params.superchain.participants
181+
]
182+
183+
original_l2_output__hack = l2s[index]
184+
185+
l2_launcher__hack.launch_l2__hack(
186+
original_l2_output__hack=original_l2_output__hack,
187+
plan=plan,
188+
l2_services_suffix=chain.network_params.name,
189+
l2_args=chain,
190+
jwt_file=jwt_file,
191+
deployment_output=deployment_output,
192+
l1_config=l1_config_env_vars,
193+
l1_priv_key=l1_priv_key,
194+
l1_rpc_url=l1_rpc_url,
195+
global_log_level=global_log_level,
196+
global_node_selectors=global_node_selectors,
197+
global_tolerations=global_tolerations,
198+
persistent=persistent,
199+
observability_helper=observability_helper,
200+
supervisors_params=l2_supervisors_params,
201+
registry=registry,
202+
)
203+
174204
if optimism_args.faucet.enabled:
175205
_install_faucet(
176206
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: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
el_cl_client_launcher = import_module("./el_cl_launcher.star")
2+
participant_module = import_module("./participant.star")
3+
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")
7+
_proxyd_launcher = import_module("./proxyd/launcher.star")
8+
util = import_module("./util.star")
9+
_net = import_module("/src/util/net.star")
10+
_registry = import_module("./package_io/registry.star")
11+
12+
13+
def launch_participant_network__hack(
14+
original_participant_network_output__hack,
15+
plan,
16+
participants,
17+
jwt_file,
18+
network_params,
19+
proxyd_params,
20+
batcher_params,
21+
proposer_params,
22+
mev_params,
23+
conductor_params,
24+
deployment_output,
25+
l1_config_env_vars,
26+
l2_services_suffix,
27+
global_log_level,
28+
global_node_selectors,
29+
global_tolerations,
30+
persistent,
31+
additional_services,
32+
observability_helper,
33+
supervisors_params,
34+
da_server_context,
35+
registry=_registry.Registry(),
36+
):
37+
# In the legacy setup the first node is always the sequencer
38+
sequencer_participant = original_participant_network_output__hack.participants[0]
39+
conductor_context = (
40+
_op_conductor_launcher.launch(
41+
plan=plan,
42+
params=conductor_params,
43+
network_params=network_params,
44+
deployment_output=deployment_output,
45+
# FIXME We need to plumb the legacy args into the new format so that we make our lives easier when we're switching
46+
el_params=struct(
47+
service_name=sequencer_participant.el_context.ip_addr,
48+
ports={
49+
_net.RPC_PORT_NAME: _net.port(
50+
number=sequencer_participant.el_context.rpc_port_num
51+
)
52+
},
53+
),
54+
cl_params=struct(
55+
service_name=sequencer_participant.cl_context.ip_addr,
56+
ports={
57+
_net.RPC_PORT_NAME: _net.port(
58+
number=sequencer_participant.cl_context.http_port
59+
)
60+
},
61+
),
62+
observability_helper=observability_helper,
63+
).context
64+
if conductor_params
65+
else None
66+
)
67+
68+
batcher_key = util.read_network_config_value(
69+
plan,
70+
deployment_output,
71+
"batcher-{0}".format(network_params.network_id),
72+
".privateKey",
73+
)
74+
_op_batcher_launcher.launch(
75+
plan=plan,
76+
params=batcher_params,
77+
# FIXME We need to plumb the legacy args into the new format so that we make our lives easier when we're switching
78+
sequencers_params=[
79+
struct(
80+
el=struct(
81+
service_name=all_el_contexts[0].ip_addr,
82+
ports={
83+
_net.RPC_PORT_NAME: _net.port(
84+
number=all_el_contexts[0].rpc_port_num
85+
)
86+
},
87+
),
88+
cl=struct(
89+
service_name=all_cl_contexts[0].ip_addr,
90+
ports={
91+
_net.RPC_PORT_NAME: _net.port(
92+
number=all_cl_contexts[0].http_port
93+
)
94+
},
95+
),
96+
# Conductor params are not being parsed yet
97+
conductor_params=None,
98+
)
99+
],
100+
l1_config_env_vars=l1_config_env_vars,
101+
gs_batcher_private_key=batcher_key,
102+
network_params=network_params,
103+
observability_helper=observability_helper,
104+
da_server_context=da_server_context,
105+
)
106+
107+
# We'll grab the game factory address from the deployments
108+
game_factory_address = util.read_network_config_value(
109+
plan,
110+
deployment_output,
111+
"state",
112+
'.opChainDeployments[] | select(.id=="{0}") | .DisputeGameFactoryProxy'.format(
113+
util.to_hex_chain_id(network_params.network_id)
114+
),
115+
)
116+
117+
proposer_key = util.read_network_config_value(
118+
plan,
119+
deployment_output,
120+
"proposer-{0}".format(network_params.network_id),
121+
".privateKey",
122+
)
123+
_op_proposer_launcher.launch(
124+
plan=plan,
125+
params=proposer_params,
126+
cl_context=all_cl_contexts[0],
127+
l1_config_env_vars=l1_config_env_vars,
128+
gs_proposer_private_key=proposer_key,
129+
game_factory_address=game_factory_address,
130+
network_params=network_params,
131+
observability_helper=observability_helper,
132+
)

0 commit comments

Comments
 (0)