Skip to content

Commit bc45808

Browse files
feat: op-signer: Connect to sequencers [9/N] (#389)
**Description** Addresses an additional request to be able to use `op-signer` with `kona-node`. This meant that the signer needs to be launched not in `launcher__hack` but in `launcher` so it was moved there and passed to `launcher__hack` in the return value (`original_launcher_output__hack.signer`).
1 parent 677d2c1 commit bc45808

File tree

8 files changed

+319
-46
lines changed

8 files changed

+319
-46
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
optimism_package:
2+
chains:
3+
opkurtosis:
4+
participants:
5+
node0:
6+
sequencer: true
7+
el:
8+
type: op-geth
9+
cl:
10+
type: op-node
11+
log_level: debug
12+
node1:
13+
sequencer: false
14+
el:
15+
type: op-geth
16+
cl:
17+
type: kona-node
18+
log_level: debug
19+
signer_params:
20+
enabled: true
21+
network_params:
22+
network: "konatosis"
23+
network_id: "2151909"
24+
seconds_per_slot: 2
25+
fjord_time_offset: 0
26+
granite_time_offset: 0
27+
fund_dev_accounts: true
28+
op_contract_deployer_params:
29+
image: us-docker.pkg.dev/oplabs-tools-artifacts/images/op-deployer:v0.4.0-rc.2
30+
l1_artifacts_locator: https://storage.googleapis.com/oplabs-contract-artifacts/artifacts-v1-02024c5a26c16fc1a5c716fff1c46b5bf7f23890d431bb554ddbad60971211d4.tar.gz
31+
l2_artifacts_locator: https://storage.googleapis.com/oplabs-contract-artifacts/artifacts-v1-02024c5a26c16fc1a5c716fff1c46b5bf7f23890d431bb554ddbad60971211d4.tar.gz
32+
global_log_level: "info"
33+
global_node_selectors: {}
34+
global_tolerations: []
35+
persistent: false
36+
ethereum_package:
37+
participants:
38+
- el_type: geth
39+
cl_type: lighthouse
40+
cl_image: "ethpandaops/lighthouse:stable-e21198c"
41+
network_params:
42+
preset: minimal
43+
genesis_delay: 5
44+
additional_preloaded_contracts: '
45+
{
46+
"0x4e59b44847b379578588920cA78FbF26c0B4956C": {
47+
"balance": "0ETH",
48+
"code": "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf3",
49+
"storage": {},
50+
"nonce": "1"
51+
}
52+
}
53+
'

.github/workflows/per-pr.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
file_name:
1616
[
1717
"./network_params.yaml",
18+
"./.github/tests/kona-node-signer.yaml"
1819
]
1920
runs-on: ubuntu-latest
2021
steps:

main.star

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ def run(plan, args={}):
150150
log_level=global_log_level,
151151
tolerations=global_tolerations,
152152
persistent=persistent,
153+
registry=registry,
153154
)
154155
)
155156

src/cl/kona-node/launcher.star

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def launch(
5454
node_selectors,
5555
el_context,
5656
cl_contexts,
57+
signer_context,
5758
l1_config_env_vars,
5859
observability_helper,
5960
):
@@ -97,6 +98,7 @@ def launch(
9798
node_selectors=cl_node_selectors,
9899
el_context=el_context,
99100
cl_contexts=cl_contexts,
101+
signer_context=signer_context,
100102
l1_config_env_vars=l1_config_env_vars,
101103
observability_helper=observability_helper,
102104
)
@@ -147,6 +149,7 @@ def get_service_config(
147149
node_selectors,
148150
el_context,
149151
cl_contexts,
152+
signer_context,
150153
l1_config_env_vars,
151154
observability_helper,
152155
):
@@ -226,19 +229,51 @@ def get_service_config(
226229
# apply customizations
227230

228231
if is_sequencer:
229-
sequencer_private_key = _util.read_network_config_value(
230-
plan,
231-
deployment_output,
232-
"sequencer-{0}".format(network_params.network_id),
233-
".privateKey",
234-
)
235-
236232
cmd += [
237233
"--mode=sequencer",
238-
"--p2p.sequencer.key=" + sequencer_private_key,
239234
"--sequencer.l1-confs=2",
240235
]
241236

237+
# kona-node sequencer flags for remote and local signer are exclusive
238+
# so we have to treat them accordingly and only supply the ones that apply to our case
239+
if signer_context:
240+
# In case of remote signer, we need to supply the certificates & endpoint
241+
sequencer_address = _util.read_network_config_value(
242+
plan,
243+
deployment_output,
244+
"sequencer-{}".format(network_params.network_id),
245+
".address",
246+
)
247+
248+
cmd += [
249+
"--p2p.signer.tls.ca={}".format(signer_context.credentials.ca.crt),
250+
"--p2p.signer.tls.cert={}".format(
251+
signer_context.credentials.hosts[params.service_name].tls.crt
252+
),
253+
"--p2p.signer.tls.key={}".format(
254+
signer_context.credentials.hosts[params.service_name].tls.key
255+
),
256+
"--p2p.signer.endpoint={}".format(
257+
_net.service_url(
258+
signer_context.service.hostname,
259+
signer_context.service.ports[_net.HTTP_PORT_NAME],
260+
)
261+
),
262+
"--p2p.signer.address={}".format(sequencer_address),
263+
]
264+
else:
265+
# In case of local signer, we need to supply the private key
266+
sequencer_private_key = _util.read_network_config_value(
267+
plan,
268+
deployment_output,
269+
"sequencer-{0}".format(network_params.network_id),
270+
".privateKey",
271+
)
272+
273+
cmd += [
274+
"--p2p.sequencer.key=" + sequencer_private_key,
275+
]
276+
242277
if conductor_params:
243278
cmd += [
244279
"--conductor.rpc={0}".format(

src/cl/launcher.star

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def launch(
1818
deployment_output,
1919
el_context,
2020
cl_contexts,
21+
signer_context,
2122
l1_config_env_vars,
2223
log_level,
2324
persistent,
@@ -62,6 +63,7 @@ def launch(
6263
deployment_output=deployment_output,
6364
el_context=el_context,
6465
cl_contexts=cl_contexts,
66+
signer_context=signer_context,
6567
l1_config_env_vars=l1_config_env_vars,
6668
log_level=log_level,
6769
persistent=persistent,

src/l2/launcher.star

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
_cl_launcher = import_module("/src/cl/launcher.star")
22
_el_launcher = import_module("/src/el/launcher.star")
33
_da_server_launcher = import_module("/src/da/da-server/launcher.star")
4+
_op_signer_launcher = import_module("/src/signer/op-signer/launcher.star")
45
_rollup_boost_launcher = import_module("/src/mev/rollup-boost/launcher.star")
56

67
_selectors = import_module("./selectors.star")
@@ -21,6 +22,7 @@ def launch(
2122
tolerations,
2223
node_selectors,
2324
observability_helper,
25+
registry,
2426
):
2527
network_params = params.network_params
2628
network_name = network_params.name
@@ -36,6 +38,54 @@ def launch(
3638
plan=plan, da_params=params.da_params, log_prefix=network_log_prefix
3739
)
3840

41+
# We'll need batcher private key for the batcher as well as for the signer
42+
batcher_private_key = _util.read_network_config_value(
43+
plan,
44+
deployment_output,
45+
"batcher-{0}".format(network_params.network_id),
46+
".privateKey",
47+
)
48+
49+
# We'll need proposer private key for the proposer as well as for the signer
50+
proposer_private_key = _util.read_network_config_value(
51+
plan,
52+
deployment_output,
53+
"proposer-{0}".format(network_params.network_id),
54+
".privateKey",
55+
)
56+
57+
sequencer_private_key = _util.read_network_config_value(
58+
plan,
59+
deployment_output,
60+
"sequencer-{0}".format(network_params.network_id),
61+
".privateKey",
62+
)
63+
64+
signer = _launch_signer_maybe(
65+
plan=plan,
66+
signer_params=params.signer_params,
67+
network_params=network_params,
68+
clients=[
69+
struct(
70+
hostname=params.batcher_params.service_name,
71+
private_key=batcher_private_key,
72+
),
73+
struct(
74+
hostname=params.proposer_params.service_name,
75+
private_key=proposer_private_key,
76+
),
77+
]
78+
+ [
79+
struct(
80+
hostname=participant_params.cl.service_name,
81+
private_key=sequencer_private_key,
82+
)
83+
for participant_params in params.participants
84+
],
85+
registry=registry,
86+
log_prefix=network_log_prefix,
87+
)
88+
3989
#
4090
# Launch CL & EL clients
4191
#
@@ -112,6 +162,7 @@ def launch(
112162
da_params=params.da_params,
113163
el_context=el.context,
114164
cl_contexts=cl_contexts,
165+
signer_context=signer,
115166
jwt_file=jwt_file,
116167
deployment_output=deployment_output,
117168
l1_config_env_vars=l1_config_env_vars,
@@ -146,6 +197,7 @@ def launch(
146197
if sidecar_and_builders and sidecar_and_builders.el_builder
147198
else el.context,
148199
cl_contexts=cl_contexts,
200+
signer_context=signer,
149201
jwt_file=jwt_file,
150202
deployment_output=deployment_output,
151203
l1_config_env_vars=l1_config_env_vars,
@@ -171,6 +223,7 @@ def launch(
171223
network_id=network_params.network_id,
172224
participants=participants,
173225
da=da,
226+
signer=signer,
174227
)
175228

176229

@@ -197,6 +250,7 @@ def _launch_sidecar_maybe(
197250
is_sequencer,
198251
el_context,
199252
cl_contexts,
253+
signer_context,
200254
jwt_file,
201255
deployment_output,
202256
l1_config_env_vars,
@@ -291,6 +345,7 @@ def _launch_sidecar_maybe(
291345
is_sequencer=True,
292346
el_context=el_builder_context,
293347
cl_contexts=cl_contexts,
348+
signer_context=signer_context,
294349
jwt_file=jwt_file,
295350
deployment_output=deployment_output,
296351
l1_config_env_vars=l1_config_env_vars,
@@ -323,3 +378,20 @@ def _launch_sidecar(
323378
)
324379
else:
325380
fail("Invalid MEV type: {}".format(mev_params.type))
381+
382+
383+
def _launch_signer_maybe(
384+
plan, signer_params, network_params, clients, registry, log_prefix
385+
):
386+
if signer_params:
387+
plan.print("{}: Launching signer".format(log_prefix))
388+
389+
_op_signer_launcher.launch(
390+
plan=plan,
391+
params=signer_params,
392+
network_params=network_params,
393+
clients=clients,
394+
registry=registry,
395+
)
396+
397+
plan.print("{}: Successfully launched signer".format(log_prefix))

src/l2/launcher__hack.star

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ _op_batcher_launcher = import_module("/src/batcher/op-batcher/launcher.star")
33
_op_conductor_launcher = import_module("/src/conductor/op-conductor/launcher.star")
44
_op_proposer_launcher = import_module("/src/proposer/op-proposer/launcher.star")
55
_proxyd_launcher = import_module("/src/proxyd/launcher.star")
6-
_op_signer_launcher = import_module("/src/signer/op-signer/launcher.star")
76
_tx_fuzzer_launcher = import_module("/src/tx-fuzzer/launcher.star")
87
_op_conductor_ops_launcher = import_module(
98
"/src/conductor/op-conductor-ops/launcher.star"
@@ -94,24 +93,6 @@ def launch(
9493
".privateKey",
9594
)
9695

97-
signer_context = _launch_signer_maybe(
98-
plan=plan,
99-
signer_params=params.signer_params,
100-
network_params=network_params,
101-
clients=[
102-
struct(
103-
hostname=params.batcher_params.service_name,
104-
private_key=batcher_private_key,
105-
),
106-
struct(
107-
hostname=params.proposer_params.service_name,
108-
private_key=proposer_private_key,
109-
),
110-
],
111-
registry=registry,
112-
log_prefix=network_log_prefix,
113-
)
114-
11596
_launch_batcher(
11697
plan=plan,
11798
batcher_params=params.batcher_params,
@@ -123,7 +104,7 @@ def launch(
123104
da_server_context=original_launcher_output__hack.da.context
124105
if original_launcher_output__hack.da
125106
else None,
126-
signer_context=signer_context,
107+
signer_context=original_launcher_output__hack.signer,
127108
observability_helper=observability_helper,
128109
log_prefix=network_log_prefix,
129110
)
@@ -137,7 +118,7 @@ def launch(
137118
private_key=proposer_private_key,
138119
l1_config_env_vars=l1_config_env_vars,
139120
observability_helper=observability_helper,
140-
signer_context=signer_context,
121+
signer_context=original_launcher_output__hack.signer,
141122
log_prefix=network_log_prefix,
142123
)
143124

@@ -253,23 +234,6 @@ def _launch_proxyd_maybe(
253234
plan.print("{}: Successfully launched proxyd".format(log_prefix))
254235

255236

256-
def _launch_signer_maybe(
257-
plan, signer_params, network_params, clients, registry, log_prefix
258-
):
259-
if signer_params:
260-
plan.print("{}: Launching signer".format(log_prefix))
261-
262-
_op_signer_launcher.launch(
263-
plan=plan,
264-
params=signer_params,
265-
network_params=network_params,
266-
clients=clients,
267-
registry=registry,
268-
)
269-
270-
plan.print("{}: Successfully launched signer".format(log_prefix))
271-
272-
273237
def _launch_batcher(
274238
plan,
275239
batcher_params,

0 commit comments

Comments
 (0)