Skip to content

Commit ddea15f

Browse files
committed
feat: add alt-da support
1 parent c32a626 commit ddea15f

File tree

13 files changed

+297
-3
lines changed

13 files changed

+297
-3
lines changed

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,29 @@ optimism_package:
121121

122122
# A list of optional extra params that will be passed to the supervisor container for modifying its behaviour
123123
extra_params: []
124+
125+
# AltDA Deploy Configuration, which is passed to op-deployer.
126+
#
127+
# For simplicity we currently enforce chains to all be altda or all rollups.
128+
# Adding a single altda chain to a cluster essentially makes all chains have altda levels of security.
129+
#
130+
# To setup an altda cluster, make sure to
131+
# 1. Set altda_deploy_config.use_altda to true (and da_commitment_type to KeccakCommitment, see TODO below)
132+
# 2. For each chain,
133+
# - Add "da_server" to the additional_services list if it should use alt-da
134+
# - For altda chains, set da_server_params to use an image and cmd of your choice (one could use da-server, another eigenda-proxy, another celestia proxy, etc). If unset, op's default da-server image will be used.
135+
altda_deploy_config:
136+
use_altda: false
137+
# TODO: Is this field redundant? Afaiu setting it to GenericCommitment will not deploy the
138+
# DAChallengeContract, and hence is equivalent to setting use_altda to false.
139+
# Furthermore, altda rollups using generic commitments might anyways need to support failing over
140+
# to keccak commitments if the altda layer is down.
141+
da_commitment_type: KeccakCommitment
142+
da_challenge_window: 100
143+
da_resolve_window: 100
144+
da_bond_size: 0
145+
da_resolver_refund_percentage: 0
146+
124147
# An array of L2 networks to run
125148
chains:
126149
# Specification of the optimism-participants in the network
@@ -391,8 +414,25 @@ optimism_package:
391414
# Available services:
392415
# - blockscout
393416
# - rollup-boost
417+
# - da_server
394418
additional_services: []
395419

420+
# Configuration for da-server - https://specs.optimism.io/experimental/alt-da.html#da-server
421+
# TODO: each op-node and op-batcher should potentially have their own da-server, instead of sharing one like we currently do. For eg batcher needs to write via its da-server, whereas op-nodes don't.
422+
da_server_params:
423+
image: us-docker.pkg.dev/oplabs-tools-artifacts/images/da-server:latest
424+
# Command to pass to the container.
425+
# This is kept maximally generic to allow for any possible configuration, given that different
426+
# da layer da-servers might have completely different flags.
427+
# The below arguments are also the default, so can be omitted, and will work as long as the image
428+
# is the da-server above (which is also the default, so can also be omitted).
429+
cmd:
430+
- "da-server"
431+
- "--file.path=/home"
432+
- "--addr=0.0.0.0"
433+
- "--port=3100"
434+
- "--log.level=debug"
435+
396436
# L2 contract deployer configuration - used for all L2 networks
397437
# The docker image that should be used for the L2 contract deployer
398438
op_contract_deployer_params:

main.star

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def run(plan, args):
4444
global_node_selectors = optimism_args_with_right_defaults.global_node_selectors
4545
global_log_level = optimism_args_with_right_defaults.global_log_level
4646
persistent = optimism_args_with_right_defaults.persistent
47+
altda_deploy_config = optimism_args_with_right_defaults.altda_deploy_config
4748

4849
observability_params = optimism_args_with_right_defaults.observability
4950
interop_params = optimism_args_with_right_defaults.interop
@@ -94,6 +95,7 @@ def run(plan, args):
9495
l1_config_env_vars,
9596
optimism_args_with_right_defaults,
9697
l1_network,
98+
altda_deploy_config,
9799
)
98100

99101
jwt_file = plan.upload_files(

network_params.yaml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
optimism_package:
2+
altda_deploy_config:
3+
use_altda: true
4+
da_commitment_type: KeccakCommitment
5+
da_challenge_window: 100
6+
da_resolve_window: 100
7+
da_bond_size: 0
8+
da_resolver_refund_percentage: 0
29
chains:
310
- participants:
411
- el_type: op-geth
@@ -39,7 +46,17 @@ optimism_package:
3946
mev_params:
4047
builder_host: ""
4148
builder_port: ""
42-
additional_services: []
49+
da_server_params:
50+
image: us-docker.pkg.dev/oplabs-tools-artifacts/images/da-server:latest
51+
# A list of optional extra params that will be passed to the da-server container for modifying its behaviour
52+
cmd:
53+
- "da-server"
54+
- "--file.path=/home"
55+
- "--addr=0.0.0.0"
56+
- "--port=3100"
57+
- "--log.level=debug"
58+
additional_services:
59+
- da_server
4360
op_contract_deployer_params:
4461
image: us-docker.pkg.dev/oplabs-tools-artifacts/images/op-deployer:v0.0.11
4562
l1_artifacts_locator: https://storage.googleapis.com/oplabs-contract-artifacts/artifacts-v1-c193a1863182092bc6cb723e523e8313a0f4b6e9c9636513927f1db74c047c15.tar.gz
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
shared_utils = import_module(
2+
"github.com/ethpandaops/ethereum-package/src/shared_utils/shared_utils.star"
3+
)
4+
constants = import_module(
5+
"github.com/ethpandaops/ethereum-package/src/package_io/constants.star"
6+
)
7+
8+
# Port IDs
9+
DA_SERVER_HTTP_PORT_ID = "http"
10+
11+
# Port nums
12+
DA_SERVER_HTTP_PORT_NUM = 3100
13+
14+
15+
def get_used_ports():
16+
used_ports = {
17+
DA_SERVER_HTTP_PORT_ID: shared_utils.new_port_spec(
18+
DA_SERVER_HTTP_PORT_NUM,
19+
shared_utils.TCP_PROTOCOL,
20+
shared_utils.HTTP_APPLICATION_PROTOCOL,
21+
),
22+
}
23+
return used_ports
24+
25+
26+
def launch_da_server(
27+
plan,
28+
service_name,
29+
image,
30+
cmd,
31+
):
32+
config = get_da_server_config(
33+
plan,
34+
service_name,
35+
image,
36+
cmd,
37+
)
38+
39+
da_server_service = plan.add_service(service_name, config)
40+
41+
http_url = "http://{0}:{1}".format(
42+
da_server_service.ip_address, DA_SERVER_HTTP_PORT_NUM
43+
)
44+
# da_server_context is passed as argument to op-batcher and op-node(s)
45+
return new_da_server_context(
46+
http_url=http_url,
47+
)
48+
49+
50+
def get_da_server_config(
51+
plan,
52+
service_name,
53+
image,
54+
cmd,
55+
):
56+
ports = get_used_ports()
57+
58+
return ServiceConfig(
59+
image=image,
60+
ports=ports,
61+
cmd=cmd,
62+
private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
63+
)
64+
65+
66+
def disabled_da_server_context():
67+
return new_da_server_context(
68+
http_url="",
69+
)
70+
71+
72+
def new_da_server_context(http_url):
73+
return struct(
74+
enabled=http_url != "",
75+
http_url=http_url,
76+
)

src/batcher/op-batcher/op_batcher_launcher.star

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def launch(
4545
gs_batcher_private_key,
4646
batcher_params,
4747
observability_helper,
48+
da_server_context,
4849
):
4950
batcher_service_name = "{0}".format(service_name)
5051

@@ -58,6 +59,7 @@ def launch(
5859
gs_batcher_private_key,
5960
batcher_params,
6061
observability_helper,
62+
da_server_context,
6163
)
6264

6365
batcher_service = plan.add_service(service_name, config)
@@ -82,6 +84,7 @@ def get_batcher_config(
8284
gs_batcher_private_key,
8385
batcher_params,
8486
observability_helper,
87+
da_server_context,
8588
):
8689
ports = dict(get_used_ports())
8790

@@ -100,7 +103,15 @@ def get_batcher_config(
100103
"--max-channel-duration=1",
101104
"--l1-eth-rpc=" + l1_config_env_vars["L1_RPC_URL"],
102105
"--private-key=" + gs_batcher_private_key,
103-
"--data-availability-type=blobs",
106+
# da commitments currently have to be sent as calldata to the batcher inbox
107+
"--data-availability-type=" + "calldata"
108+
if da_server_context.enabled
109+
else "blobs",
110+
"--altda.enabled=" + str(da_server_context.enabled),
111+
"--altda.da-server=" + da_server_context.http_url,
112+
# This flag is very badly named, but is needed in order to let the da-server compute the commitment.
113+
# This leads to sending POST requests to /put instead of /put/<keccak256(data)>
114+
"--altda.da-service",
104115
]
105116

106117
# apply customizations

src/cl/hildr/hildr_launcher.star

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ def launch(
7878
sequencer_enabled,
7979
observability_helper,
8080
interop_params,
81+
da_server_context,
8182
):
8283
# beacon_node_identity_recipe = PostHttpRequestRecipe(
8384
# endpoint="/",
@@ -109,6 +110,7 @@ def launch(
109110
l1_config_env_vars,
110111
sequencer_enabled,
111112
observability_helper,
113+
da_server_context,
112114
)
113115

114116
beacon_service = plan.add_service(service_name, config)
@@ -155,6 +157,7 @@ def get_beacon_config(
155157
l1_config_env_vars,
156158
sequencer_enabled,
157159
observability_helper,
160+
da_server_context,
158161
):
159162
EXECUTION_ENGINE_ENDPOINT = "http://{0}:{1}".format(
160163
el_context.ip_addr,
@@ -183,6 +186,9 @@ def get_beacon_config(
183186
ethereum_package_constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS,
184187
launcher.network_params.network_id,
185188
),
189+
# TODO: support altda flags once they are implemented.
190+
# See https://github.com/optimism-java/hildr/issues/134
191+
# eg: "--altda.enabled=" + str(da_server_context.enabled),
186192
]
187193

188194
# configure files

src/cl/op-node/op_node_launcher.star

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def launch(
7777
sequencer_enabled,
7878
observability_helper,
7979
interop_params,
80+
da_server_context,
8081
):
8182
beacon_node_identity_recipe = PostHttpRequestRecipe(
8283
endpoint="/",
@@ -110,6 +111,7 @@ def launch(
110111
sequencer_enabled,
111112
observability_helper,
112113
interop_params,
114+
da_server_context,
113115
)
114116

115117
beacon_service = plan.add_service(service_name, config)
@@ -158,6 +160,7 @@ def get_beacon_config(
158160
sequencer_enabled,
159161
observability_helper,
160162
interop_params,
163+
da_server_context,
161164
):
162165
ports = dict(get_used_ports(BEACON_DISCOVERY_PORT_NUM))
163166

@@ -190,6 +193,8 @@ def get_beacon_config(
190193
"--p2p.listen.tcp={0}".format(BEACON_DISCOVERY_PORT_NUM),
191194
"--p2p.listen.udp={0}".format(BEACON_DISCOVERY_PORT_NUM),
192195
"--safedb.path={0}".format(BEACON_DATA_DIRPATH_ON_SERVICE_CONTAINER),
196+
"--altda.enabled=" + str(da_server_context.enabled),
197+
"--altda.da-server=" + da_server_context.http_url,
193198
]
194199

195200
# configure files

src/contracts/contract_deployer.star

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ CANNED_VALUES = (
2020
)
2121

2222

23-
def deploy_contracts(plan, priv_key, l1_config_env_vars, optimism_args, l1_network):
23+
def deploy_contracts(
24+
plan, priv_key, l1_config_env_vars, optimism_args, l1_network, altda_args
25+
):
2426
l2_chain_ids_list = [
2527
str(chain.network_params.network_id) for chain in optimism_args.chains
2628
]
@@ -201,6 +203,37 @@ def deploy_contracts(plan, priv_key, l1_config_env_vars, optimism_args, l1_netwo
201203
address_update(
202204
chain_key(i, "roles.unsafeBlockSigner"), "sequencer", chain_id
203205
),
206+
# altda deploy config
207+
(
208+
"bool",
209+
chain_key(i, "dangerousAltDAConfig.useAltDA"),
210+
altda_args.use_altda,
211+
),
212+
(
213+
"string",
214+
chain_key(i, "dangerousAltDAConfig.daCommitmentType"),
215+
altda_args.da_commitment_type,
216+
),
217+
(
218+
"int",
219+
chain_key(i, "dangerousAltDAConfig.daChallengeWindow"),
220+
altda_args.da_challenge_window,
221+
),
222+
(
223+
"int",
224+
chain_key(i, "dangerousAltDAConfig.daResolveWindow"),
225+
altda_args.da_resolve_window,
226+
),
227+
(
228+
"int",
229+
chain_key(i, "dangerousAltDAConfig.daBondSize"),
230+
altda_args.da_bond_size,
231+
),
232+
(
233+
"int",
234+
chain_key(i, "dangerousAltDAConfig.daResolverRefundPercentage"),
235+
altda_args.da_resolver_refund_percentage,
236+
),
204237
]
205238
)
206239
intent_updates.extend([(t, chain_key(i, k), v) for t, k, v in CANNED_VALUES])

src/el_cl_launcher.star

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def launch(
4444
additional_services,
4545
observability_helper,
4646
interop_params,
47+
da_server_context,
4748
):
4849
el_launchers = {
4950
"op-geth": {
@@ -336,6 +337,7 @@ def launch(
336337
sequencer_enabled,
337338
observability_helper,
338339
interop_params,
340+
da_server_context,
339341
)
340342

341343
for metrics_info in [x for x in cl_context.cl_nodes_metrics_info if x != None]:

src/l2.star

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
participant_network = import_module("./participant_network.star")
22
blockscout = import_module("./blockscout/blockscout_launcher.star")
3+
da_server_launcher = import_module("./alt-da/da-server/da_server_launcher.star")
34
contract_deployer = import_module("./contracts/contract_deployer.star")
45
input_parser = import_module("./package_io/input_parser.star")
56
util = import_module("./util.star")
@@ -30,6 +31,20 @@ def launch_l2(
3031

3132
plan.print("Deploying L2 with name {0}".format(network_params.name))
3233

34+
# we need to launch da-server before launching the participant network
35+
# because op-batcher and op-node(s) need to know the da-server url, if present
36+
da_server_context = da_server_launcher.disabled_da_server_context()
37+
if "da_server" in l2_args.additional_services:
38+
da_server_image = l2_args.da_server_params.image
39+
plan.print("Launching da-server")
40+
da_server_context = da_server_launcher.launch_da_server(
41+
plan,
42+
"da-server-{0}".format(l2_services_suffix),
43+
da_server_image,
44+
l2_args.da_server_params.cmd,
45+
)
46+
plan.print("Successfully launched da-server")
47+
3348
all_l2_participants = participant_network.launch_participant_network(
3449
plan,
3550
l2_args.participants,
@@ -50,6 +65,7 @@ def launch_l2(
5065
l2_args.additional_services,
5166
observability_helper,
5267
interop_params,
68+
da_server_context,
5369
)
5470

5571
all_el_contexts = []

0 commit comments

Comments
 (0)