@@ -17,6 +17,8 @@ ethereum_package_input_parser = import_module(
1717constants = import_module ("../../package_io/constants.star" )
1818
1919util = import_module ("../../util.star" )
20+ observability = import_module ("../../observability/observability.star" )
21+ interop_constants = import_module ("../../interop/constants.star" )
2022
2123# ---------------------------------- Beacon client -------------------------------------
2224
@@ -73,6 +75,9 @@ def launch(
7375 existing_cl_clients ,
7476 l1_config_env_vars ,
7577 sequencer_enabled ,
78+ observability_helper ,
79+ interop_params ,
80+ da_server_context ,
7681):
7782 beacon_node_identity_recipe = PostHttpRequestRecipe (
7883 endpoint = "/" ,
@@ -104,6 +109,9 @@ def launch(
104109 l1_config_env_vars ,
105110 beacon_node_identity_recipe ,
106111 sequencer_enabled ,
112+ observability_helper ,
113+ interop_params ,
114+ da_server_context ,
107115 )
108116
109117 beacon_service = plan .add_service (service_name , config )
@@ -113,6 +121,8 @@ def launch(
113121 beacon_service .ip_address , beacon_http_port .number
114122 )
115123
124+ metrics_info = observability .new_metrics_info (observability_helper , beacon_service )
125+
116126 response = plan .request (
117127 recipe = beacon_node_identity_recipe , service_name = service_name
118128 )
@@ -127,7 +137,7 @@ def launch(
127137 ip_addr = beacon_service .ip_address ,
128138 http_port = beacon_http_port .number ,
129139 beacon_http_url = beacon_http_url ,
130- cl_nodes_metrics_info = None ,
140+ cl_nodes_metrics_info = [ metrics_info ] ,
131141 beacon_service_name = service_name ,
132142 multiaddr = beacon_multiaddr ,
133143 peer_id = beacon_peer_id ,
@@ -148,49 +158,107 @@ def get_beacon_config(
148158 l1_config_env_vars ,
149159 beacon_node_identity_recipe ,
150160 sequencer_enabled ,
161+ observability_helper ,
162+ interop_params ,
163+ da_server_context ,
151164):
165+ ports = dict (get_used_ports (BEACON_DISCOVERY_PORT_NUM ))
166+
152167 EXECUTION_ENGINE_ENDPOINT = "http://{0}:{1}" .format (
153168 el_context .ip_addr ,
154169 el_context .engine_rpc_port_num ,
155170 )
156171
157- used_ports = get_used_ports (BEACON_DISCOVERY_PORT_NUM )
158-
159172 cmd = [
160173 "op-node" ,
161174 "--l2={0}" .format (EXECUTION_ENGINE_ENDPOINT ),
162175 "--l2.jwt-secret=" + ethereum_package_constants .JWT_MOUNT_PATH_ON_CONTAINER ,
163- "--verifier.l1-confs=4 " ,
176+ "--verifier.l1-confs=1 " ,
164177 "--rollup.config="
165- + ethereum_package_constants .GENESIS_DATA_MOUNTPOINT_ON_CLIENTS
166- + "/rollup-{0}.json" .format (launcher .network_params .network_id ),
178+ + "{0}/rollup-{1}.json" .format (
179+ ethereum_package_constants .GENESIS_DATA_MOUNTPOINT_ON_CLIENTS ,
180+ launcher .network_params .network_id ,
181+ ),
167182 "--rpc.addr=0.0.0.0" ,
168183 "--rpc.port={0}" .format (BEACON_HTTP_PORT_NUM ),
169184 "--rpc.enable-admin" ,
170185 "--l1={0}" .format (l1_config_env_vars ["L1_RPC_URL" ]),
171186 "--l1.rpckind={0}" .format (l1_config_env_vars ["L1_RPC_KIND" ]),
172187 "--l1.beacon={0}" .format (l1_config_env_vars ["CL_RPC_URL" ]),
173- "--l1.trustrpc" ,
174188 "--p2p.advertise.ip="
175189 + ethereum_package_constants .PRIVATE_IP_ADDRESS_PLACEHOLDER ,
176190 "--p2p.advertise.tcp={0}" .format (BEACON_DISCOVERY_PORT_NUM ),
177191 "--p2p.advertise.udp={0}" .format (BEACON_DISCOVERY_PORT_NUM ),
178192 "--p2p.listen.ip=0.0.0.0" ,
179193 "--p2p.listen.tcp={0}" .format (BEACON_DISCOVERY_PORT_NUM ),
180194 "--p2p.listen.udp={0}" .format (BEACON_DISCOVERY_PORT_NUM ),
195+ "--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 ,
181198 ]
182199
183- sequencer_private_key = util .read_network_config_value (
184- plan ,
185- launcher .deployment_output ,
186- "sequencer-{0}" .format (launcher .network_params .network_id ),
187- ".privateKey" ,
188- )
200+ # configure files
201+
202+ files = {
203+ ethereum_package_constants .GENESIS_DATA_MOUNTPOINT_ON_CLIENTS : launcher .deployment_output ,
204+ ethereum_package_constants .JWT_MOUNTPOINT_ON_CLIENTS : launcher .jwt_file ,
205+ }
206+
207+ if persistent :
208+ files [BEACON_DATA_DIRPATH_ON_SERVICE_CONTAINER ] = Directory (
209+ persistent_key = "data-{0}" .format (service_name ),
210+ size = int (participant .cl_builder_volume_size )
211+ if int (participant .cl_builder_volume_size ) > 0
212+ else constants .VOLUME_SIZE [launcher .network ][
213+ constants .CL_TYPE .hildr + "_volume_size"
214+ ],
215+ )
216+
217+ # configure environment variables
218+
219+ env_vars = dict (participant .cl_builder_extra_env_vars )
220+
221+ # apply customizations
222+
223+ if observability_helper .enabled :
224+ cmd += [
225+ "--metrics.enabled=true" ,
226+ "--metrics.addr=0.0.0.0" ,
227+ "--metrics.port={0}" .format (observability .METRICS_PORT_NUM ),
228+ ]
229+
230+ observability .expose_metrics_port (ports )
231+
232+ if interop_params .enabled :
233+ ports [
234+ interop_constants .INTEROP_WS_PORT_ID
235+ ] = ethereum_package_shared_utils .new_port_spec (
236+ interop_constants .INTEROP_WS_PORT_NUM ,
237+ ethereum_package_shared_utils .TCP_PROTOCOL ,
238+ )
239+
240+ env_vars .update (
241+ {
242+ # "OP_NODE_INTEROP_SUPERVISOR": interop_constants.SUPERVISOR_ENDPOINT,
243+ "OP_NODE_INTEROP_RPC_ADDR" : "0.0.0.0" ,
244+ "OP_NODE_INTEROP_RPC_PORT" : str (interop_constants .INTEROP_WS_PORT_NUM ),
245+ "OP_NODE_INTEROP_JWT_SECRET" : ethereum_package_constants .JWT_MOUNT_PATH_ON_CONTAINER ,
246+ }
247+ )
189248
190249 if sequencer_enabled :
191- cmd .append ("--p2p.sequencer.key=" + sequencer_private_key )
192- cmd .append ("--sequencer.enabled" )
193- cmd .append ("--sequencer.l1-confs=5" )
250+ sequencer_private_key = util .read_network_config_value (
251+ plan ,
252+ launcher .deployment_output ,
253+ "sequencer-{0}" .format (launcher .network_params .network_id ),
254+ ".privateKey" ,
255+ )
256+
257+ cmd += [
258+ "--p2p.sequencer.key=" + sequencer_private_key ,
259+ "--sequencer.enabled" ,
260+ "--sequencer.l1-confs=2" ,
261+ ]
194262
195263 if len (existing_cl_clients ) > 0 :
196264 cmd .append (
@@ -207,25 +275,6 @@ def get_beacon_config(
207275
208276 cmd += participant .cl_builder_extra_params
209277
210- files = {
211- ethereum_package_constants .GENESIS_DATA_MOUNTPOINT_ON_CLIENTS : launcher .deployment_output ,
212- ethereum_package_constants .JWT_MOUNTPOINT_ON_CLIENTS : launcher .jwt_file ,
213- }
214-
215- if persistent :
216- files [BEACON_DATA_DIRPATH_ON_SERVICE_CONTAINER ] = Directory (
217- persistent_key = "data-{0}" .format (service_name ),
218- size = int (participant .cl_builder_volume_size )
219- if int (participant .cl_builder_volume_size ) > 0
220- else constants .VOLUME_SIZE [launcher .network ][
221- constants .CL_TYPE .hildr + "_volume_size"
222- ],
223- )
224-
225- ports = {}
226- ports .update (used_ports )
227-
228- env_vars = participant .cl_builder_extra_env_vars
229278 config_args = {
230279 "image" : participant .cl_builder_image ,
231280 "ports" : ports ,
@@ -251,6 +300,8 @@ def get_beacon_config(
251300 "node_selectors" : node_selectors ,
252301 }
253302
303+ # configure resources
304+
254305 if participant .cl_builder_min_cpu > 0 :
255306 config_args ["min_cpu" ] = participant .cl_builder_min_cpu
256307 if participant .cl_builder_max_cpu > 0 :
@@ -259,6 +310,7 @@ def get_beacon_config(
259310 config_args ["min_memory" ] = participant .cl_builder_min_mem
260311 if participant .cl_builder_max_mem > 0 :
261312 config_args ["max_memory" ] = participant .cl_builder_max_mem
313+
262314 return ServiceConfig (** config_args )
263315
264316
0 commit comments