From 77ef93c1da7a73c672ddc249e4b46854c883448b Mon Sep 17 00:00:00 2001 From: Barnabas Busa Date: Fri, 27 Sep 2024 12:00:48 +0200 Subject: [PATCH] feat: enable one parameter supernode --- README.md | 6 + network_params.yaml | 1 + src/cl/cl_launcher.star | 28 +---- src/cl/grandine/grandine_launcher.star | 120 +++++++++----------- src/cl/lighthouse/lighthouse_launcher.star | 112 +++++++++---------- src/cl/lodestar/lodestar_launcher.star | 110 +++++++++---------- src/cl/nimbus/nimbus_launcher.star | 98 +++++++---------- src/cl/prysm/prysm_launcher.star | 109 ++++++++---------- src/cl/teku/teku_launcher.star | 122 +++++++++------------ src/package_io/input_parser.star | 2 + src/package_io/sanity_check.star | 1 + 11 files changed, 301 insertions(+), 408 deletions(-) diff --git a/README.md b/README.md index 4bb689459..c73f7307b 100644 --- a/README.md +++ b/README.md @@ -284,6 +284,12 @@ participants: cl_min_mem: 0 cl_max_mem: 0 + # Whether to act as a supernode for the network + # Supernodes will subscribe to all subnet topics + # This flag should only be used with peerdas + # Defaults to false + supernode: false + # Whether to use a separate validator client attached to the CL client. # Defaults to false for clients that can run both in one process (Teku, Nimbus) use_separate_vc: true diff --git a/network_params.yaml b/network_params.yaml index 6f44b3fac..21820b93a 100644 --- a/network_params.yaml +++ b/network_params.yaml @@ -25,6 +25,7 @@ participants: cl_max_cpu: 0 cl_min_mem: 0 cl_max_mem: 0 + supernode: false use_separate_vc: true # Validator vc_type: lighthouse diff --git a/src/cl/cl_launcher.star b/src/cl/cl_launcher.star index 69fd5ee91..9d470dc59 100644 --- a/src/cl/cl_launcher.star +++ b/src/cl/cl_launcher.star @@ -63,8 +63,6 @@ def launch( el_cl_data, jwt_file, network_params, - prysm_password_relative_filepath, - prysm_password_artifact_uuid, ), "launch_method": prysm.launch, }, @@ -171,8 +169,7 @@ def launch( plan, cl_launcher, cl_service_name, - participant.cl_image, - participant.cl_log_level, + participant, global_log_level, cl_context_BOOTNODE, el_context, @@ -182,19 +179,11 @@ def launch( cl_max_cpu, cl_min_mem, cl_max_mem, - participant.snooper_enabled, + cl_volume_size, snooper_engine_context, - participant.blobber_enabled, - participant.blobber_extra_params, - participant.cl_extra_params, - participant.cl_extra_env_vars, - participant.cl_extra_labels, persistent, - cl_volume_size, tolerations, node_selectors, - participant.use_separate_vc, - participant.keymanager_enabled, checkpoint_sync_enabled, checkpoint_sync_url, port_publisher, @@ -206,8 +195,7 @@ def launch( plan, cl_launcher, cl_service_name, - participant.cl_image, - participant.cl_log_level, + participant, global_log_level, boot_cl_client_ctx, el_context, @@ -217,19 +205,11 @@ def launch( cl_max_cpu, cl_min_mem, cl_max_mem, - participant.snooper_enabled, + cl_volume_size, snooper_engine_context, - participant.blobber_enabled, - participant.blobber_extra_params, - participant.cl_extra_params, - participant.cl_extra_env_vars, - participant.cl_extra_labels, persistent, - cl_volume_size, tolerations, node_selectors, - participant.use_separate_vc, - participant.keymanager_enabled, checkpoint_sync_enabled, checkpoint_sync_url, port_publisher, diff --git a/src/cl/grandine/grandine_launcher.star b/src/cl/grandine/grandine_launcher.star index d0305bb51..64062bbff 100644 --- a/src/cl/grandine/grandine_launcher.star +++ b/src/cl/grandine/grandine_launcher.star @@ -33,11 +33,10 @@ VERBOSITY_LEVELS = { def launch( plan, launcher, - service_name, - image, - participant_log_level, + beacon_service_name, + participant, global_log_level, - bootnode_context, + bootnode_contexts, el_context, full_name, node_keystore_files, @@ -45,54 +44,35 @@ def launch( cl_max_cpu, cl_min_mem, cl_max_mem, - snooper_enabled, snooper_engine_context, - blobber_enabled, - blobber_extra_params, - extra_params, - extra_env_vars, - extra_labels, persistent, cl_volume_size, tolerations, node_selectors, - use_separate_vc, - keymanager_enabled, checkpoint_sync_enabled, checkpoint_sync_url, port_publisher, participant_index, ): - beacon_service_name = "{0}".format(service_name) log_level = input_parser.get_client_log_level_or_default( - participant_log_level, global_log_level, VERBOSITY_LEVELS + participant.cl_log_level, global_log_level, VERBOSITY_LEVELS ) - extra_params = [param for param in extra_params] - config = get_beacon_config( plan, - launcher.el_cl_genesis_data, - launcher.jwt_file, - launcher.network, - keymanager_enabled, - image, + launcher, beacon_service_name, - bootnode_context, + participant, + log_level, + bootnode_contexts, el_context, full_name, - log_level, node_keystore_files, cl_min_cpu, cl_max_cpu, cl_min_mem, cl_max_mem, - snooper_enabled, snooper_engine_context, - extra_params, - extra_env_vars, - extra_labels, - use_separate_vc, persistent, cl_volume_size, tolerations, @@ -103,7 +83,7 @@ def launch( participant_index, ) - beacon_service = plan.add_service(service_name, config) + beacon_service = plan.add_service(beacon_service_name, config) beacon_http_port = beacon_service.ports[constants.HTTP_PORT_ID] beacon_http_url = "http://{0}:{1}".format( @@ -125,14 +105,14 @@ def launch( }, ) response = plan.request( - recipe=beacon_node_identity_recipe, service_name=service_name + recipe=beacon_node_identity_recipe, service_name=beacon_service_name ) beacon_node_enr = response["extract.enr"] beacon_multiaddr = response["extract.multiaddr"] beacon_peer_id = response["extract.peer_id"] beacon_node_metrics_info = node_metrics.new_node_metrics_info( - service_name, BEACON_METRICS_PATH, beacon_metrics_url + beacon_service_name, BEACON_METRICS_PATH, beacon_metrics_url ) nodes_metrics_info = [beacon_node_metrics_info] return cl_context.new_cl_context( @@ -145,7 +125,7 @@ def launch( beacon_service_name=beacon_service_name, multiaddr=beacon_multiaddr, peer_id=beacon_peer_id, - snooper_enabled=snooper_enabled, + snooper_enabled=participant.snooper_enabled, snooper_engine_context=snooper_engine_context, validator_keystore_files_artifact_uuid=node_keystore_files.files_artifact_uuid if node_keystore_files @@ -155,27 +135,19 @@ def launch( def get_beacon_config( plan, - el_cl_genesis_data, - jwt_file, - network, - keymanager_enabled, - image, - service_name, + launcher, + beacon_service_name, + participant, + log_level, bootnode_contexts, el_context, full_name, - log_level, node_keystore_files, cl_min_cpu, cl_max_cpu, cl_min_mem, cl_max_mem, - snooper_enabled, snooper_engine_context, - extra_params, - extra_env_vars, - extra_labels, - use_separate_vc, persistent, cl_volume_size, tolerations, @@ -197,7 +169,7 @@ def get_beacon_config( node_keystore_files.teku_secrets_relative_dirpath, ) # If snooper is enabled use the snooper engine context, otherwise use the execution client context - if snooper_enabled: + if participant.snooper_enabled: EXECUTION_ENGINE_ENDPOINT = "http://{0}:{1}".format( snooper_engine_context.ip_addr, snooper_engine_context.engine_rpc_port_num, @@ -232,7 +204,9 @@ def get_beacon_config( cmd = [ "--network={0}".format( - network if network in constants.PUBLIC_NETWORKS else "custom" + launcher.network + if launcher.network in constants.PUBLIC_NETWORKS + else "custom" ), "--data-dir=" + BEACON_DATA_DIRPATH_ON_SERVICE_CONTAINER, "--http-address=0.0.0.0", @@ -270,31 +244,39 @@ def get_beacon_config( # "--validator-api-bearer-file=" + constants.KEYMANAGER_MOUNT_PATH_ON_CONTAINER, Not yet supported ] + supernode_cmd = [ + "--subscribe-all-data-column-subnets", + ] + + if participant.supernode: + cmd.extend(supernode_cmd) + # If checkpoint sync is enabled, add the checkpoint sync url if checkpoint_sync_enabled: if checkpoint_sync_url: cmd.append("--checkpoint-sync-url=" + checkpoint_sync_url) else: if ( - network in constants.PUBLIC_NETWORKS - or network == constants.NETWORK_NAME.ephemery + launcher.network in constants.PUBLIC_NETWORKS + or launcher.network == constants.NETWORK_NAME.ephemery ): cmd.append( - "--checkpoint-sync-url=" + constants.CHECKPOINT_SYNC_URL[network] + "--checkpoint-sync-url=" + + constants.CHECKPOINT_SYNC_URL[launcher.network] ) else: fail( "Checkpoint sync URL is required if you enabled checkpoint_sync for custom networks. Please provide a valid URL." ) - if network not in constants.PUBLIC_NETWORKS: + if launcher.network not in constants.PUBLIC_NETWORKS: cmd.append( "--configuration-directory=" + constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER ) if ( - network == constants.NETWORK_NAME.kurtosis - or constants.NETWORK_NAME.shadowfork in network + launcher.network == constants.NETWORK_NAME.kurtosis + or constants.NETWORK_NAME.shadowfork in launcher.network ): if bootnode_contexts != None: cmd.append( @@ -306,44 +288,44 @@ def get_beacon_config( ] ) ) - elif network == constants.NETWORK_NAME.ephemery: + elif launcher.network == constants.NETWORK_NAME.ephemery: cmd.append( "--boot-nodes=" + shared_utils.get_devnet_enrs_list( - plan, el_cl_genesis_data.files_artifact_uuid + plan, launcher.el_cl_genesis_data.files_artifact_uuid ) ) - elif constants.NETWORK_NAME.shadowfork in network: + elif constants.NETWORK_NAME.shadowfork in launcher.network: cmd.append( "--boot-nodes=" + shared_utils.get_devnet_enrs_list( - plan, el_cl_genesis_data.files_artifact_uuid + plan, launcher.el_cl_genesis_data.files_artifact_uuid ) ) else: # Devnets cmd.append( "--boot-nodes=" + shared_utils.get_devnet_enrs_list( - plan, el_cl_genesis_data.files_artifact_uuid + plan, launcher.el_cl_genesis_data.files_artifact_uuid ) ) - if len(extra_params) > 0: - # we do the list comprehension as the default extra_params is a proto repeated string - cmd.extend([param for param in extra_params]) + if len(participant.cl_extra_params) > 0: + # we do the list comprehension as the default participant.extra_params is a proto repeated string + cmd.extend([param for param in participant.cl_extra_params]) files = { - constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data.files_artifact_uuid, - constants.JWT_MOUNTPOINT_ON_CLIENTS: jwt_file, + constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: launcher.el_cl_genesis_data.files_artifact_uuid, + constants.JWT_MOUNTPOINT_ON_CLIENTS: launcher.jwt_file, } - if node_keystore_files != None and not use_separate_vc: + if node_keystore_files != None and not participant.use_separate_vc: cmd.extend(validator_default_cmd) files[ constants.VALIDATOR_KEYS_DIRPATH_ON_SERVICE_CONTAINER ] = node_keystore_files.files_artifact_uuid - if keymanager_enabled: + if participant.keymanager_enabled: cmd.extend(keymanager_api_cmd) used_ports.update(vc_shared.VALIDATOR_KEYMANAGER_USED_PORTS) public_ports.update( @@ -352,16 +334,16 @@ def get_beacon_config( if persistent: files[BEACON_DATA_DIRPATH_ON_SERVICE_CONTAINER] = Directory( - persistent_key="data-{0}".format(service_name), + persistent_key="data-{0}".format(beacon_service_name), size=cl_volume_size, ) config_args = { - "image": image, + "image": participant.cl_image, "ports": used_ports, "public_ports": public_ports, "cmd": cmd, "files": files, - "env_vars": extra_env_vars, + "env_vars": participant.cl_extra_env_vars, "private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, "ready_conditions": cl_node_ready_conditions.get_ready_conditions( constants.HTTP_PORT_ID @@ -369,9 +351,9 @@ def get_beacon_config( "labels": shared_utils.label_maker( constants.CL_TYPE.grandine, constants.CLIENT_TYPES.cl, - image, + participant.cl_image, el_context.client_name, - extra_labels, + participant.cl_extra_labels, ), "tolerations": tolerations, "node_selectors": node_selectors, diff --git a/src/cl/lighthouse/lighthouse_launcher.star b/src/cl/lighthouse/lighthouse_launcher.star index b27511a02..2af9551c2 100644 --- a/src/cl/lighthouse/lighthouse_launcher.star +++ b/src/cl/lighthouse/lighthouse_launcher.star @@ -39,9 +39,8 @@ VERBOSITY_LEVELS = { def launch( plan, launcher, - service_name, - image, - participant_log_level, + beacon_service_name, + participant, global_log_level, bootnode_contexts, el_context, @@ -51,50 +50,35 @@ def launch( cl_max_cpu, cl_min_mem, cl_max_mem, - snooper_enabled, snooper_engine_context, - blobber_enabled, - blobber_extra_params, - extra_params, - extra_env_vars, - extra_labels, persistent, cl_volume_size, tolerations, node_selectors, - use_separate_vc, - keymanager_enabled, checkpoint_sync_enabled, checkpoint_sync_url, port_publisher, participant_index, ): - beacon_service_name = "{0}".format(service_name) - log_level = input_parser.get_client_log_level_or_default( - participant_log_level, global_log_level, VERBOSITY_LEVELS + participant.cl_log_level, global_log_level, VERBOSITY_LEVELS ) - # Launch Beacon node beacon_config = get_beacon_config( plan, - launcher.el_cl_genesis_data, - launcher.jwt_file, - launcher.network, - image, + launcher, beacon_service_name, + participant, + log_level, bootnode_contexts, el_context, - log_level, + full_name, + node_keystore_files, cl_min_cpu, cl_max_cpu, cl_min_mem, cl_max_mem, - snooper_enabled, snooper_engine_context, - extra_params, - extra_env_vars, - extra_labels, persistent, cl_volume_size, tolerations, @@ -112,13 +96,13 @@ def launch( ) # Blobber config - if blobber_enabled: + if participant.blobber_enabled: blobber_service_name = "{0}-{1}".format("blobber", beacon_service_name) blobber_config = blobber_launcher.get_config( blobber_service_name, node_keystore_files, beacon_http_url, - blobber_extra_params, + participant.blobber_extra_params, node_selectors, ) @@ -166,7 +150,7 @@ def launch( beacon_service_name=beacon_service_name, multiaddr=beacon_multiaddr, peer_id=beacon_peer_id, - snooper_enabled=snooper_enabled, + snooper_enabled=participant.snooper_enabled, snooper_engine_context=snooper_engine_context, validator_keystore_files_artifact_uuid=node_keystore_files.files_artifact_uuid if node_keystore_files @@ -176,23 +160,19 @@ def launch( def get_beacon_config( plan, - el_cl_genesis_data, - jwt_file, - network, - image, - service_name, - boot_cl_client_ctxs, - el_context, + launcher, + beacon_service_name, + participant, log_level, + bootnode_contexts, + el_context, + full_name, + node_keystore_files, cl_min_cpu, cl_max_cpu, cl_min_mem, cl_max_mem, - snooper_enabled, snooper_engine_context, - extra_params, - extra_env_vars, - extra_labels, persistent, cl_volume_size, tolerations, @@ -203,7 +183,7 @@ def get_beacon_config( participant_index, ): # If snooper is enabled use the snooper engine context, otherwise use the execution client context - if snooper_enabled: + if participant.snooper_enabled: EXECUTION_ENGINE_ENDPOINT = "http://{0}:{1}".format( snooper_engine_context.ip_addr, snooper_engine_context.engine_rpc_port_num, @@ -278,82 +258,90 @@ def get_beacon_config( "--enable-private-discovery", ] + supernode_cmd = [ + "--subscribe-all-data-column-subnets", + ] + + if participant.supernode: + cmd.extend(supernode_cmd) + # If checkpoint sync is enabled, add the checkpoint sync url if checkpoint_sync_enabled: if checkpoint_sync_url: cmd.append("--checkpoint-sync-url=" + checkpoint_sync_url) else: if ( - network in constants.PUBLIC_NETWORKS - or network == constants.NETWORK_NAME.ephemery + launcher.network in constants.PUBLIC_NETWORKS + or launcher.network == constants.NETWORK_NAME.ephemery ): cmd.append( - "--checkpoint-sync-url=" + constants.CHECKPOINT_SYNC_URL[network] + "--checkpoint-sync-url=" + + constants.CHECKPOINT_SYNC_URL[launcher.network] ) else: fail( "Checkpoint sync URL is required if you enabled checkpoint_sync for custom networks. Please provide a valid URL." ) - if network not in constants.PUBLIC_NETWORKS: + if launcher.network not in constants.PUBLIC_NETWORKS: cmd.append("--testnet-dir=" + constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER) if ( - network == constants.NETWORK_NAME.kurtosis - or constants.NETWORK_NAME.shadowfork in network + launcher.network == constants.NETWORK_NAME.kurtosis + or constants.NETWORK_NAME.shadowfork in launcher.network ): - if boot_cl_client_ctxs != None: + if bootnode_contexts != None: cmd.append( "--boot-nodes=" + ",".join( [ ctx.enr - for ctx in boot_cl_client_ctxs[: constants.MAX_ENR_ENTRIES] + for ctx in bootnode_contexts[: constants.MAX_ENR_ENTRIES] ] ) ) - elif network == constants.NETWORK_NAME.ephemery: + elif launcher.network == constants.NETWORK_NAME.ephemery: cmd.append( "--boot-nodes=" + shared_utils.get_devnet_enrs_list( - plan, el_cl_genesis_data.files_artifact_uuid + plan, launcher.el_cl_genesis_data.files_artifact_uuid ) ) else: # Devnets cmd.append( "--boot-nodes=" + shared_utils.get_devnet_enrs_list( - plan, el_cl_genesis_data.files_artifact_uuid + plan, launcher.el_cl_genesis_data.files_artifact_uuid ) ) else: # Public networks - cmd.append("--network=" + network) + cmd.append("--network=" + launcher.network) - if len(extra_params) > 0: + if len(participant.cl_extra_params) > 0: # this is a repeated, we convert it into Starlark - cmd.extend([param for param in extra_params]) + cmd.extend([param for param in participant.cl_extra_params]) recipe = GetHttpRequestRecipe( endpoint="/eth/v1/node/identity", port_id=constants.HTTP_PORT_ID ) files = { - constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data.files_artifact_uuid, - constants.JWT_MOUNTPOINT_ON_CLIENTS: jwt_file, + constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: launcher.el_cl_genesis_data.files_artifact_uuid, + constants.JWT_MOUNTPOINT_ON_CLIENTS: launcher.jwt_file, } if persistent: files[BEACON_DATA_DIRPATH_ON_BEACON_SERVICE_CONTAINER] = Directory( - persistent_key="data-{0}".format(service_name), + persistent_key="data-{0}".format(beacon_service_name), size=cl_volume_size, ) - env = {RUST_BACKTRACE_ENVVAR_NAME: RUST_FULL_BACKTRACE_KEYWORD} - env.update(extra_env_vars) + env_vars = {RUST_BACKTRACE_ENVVAR_NAME: RUST_FULL_BACKTRACE_KEYWORD} + env_vars.update(participant.cl_extra_env_vars) config_args = { - "image": image, + "image": participant.cl_image, "ports": used_ports, "public_ports": public_ports, "cmd": cmd, "files": files, - "env_vars": env, + "env_vars": env_vars, "private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, "ready_conditions": cl_node_ready_conditions.get_ready_conditions( constants.HTTP_PORT_ID @@ -361,9 +349,9 @@ def get_beacon_config( "labels": shared_utils.label_maker( constants.CL_TYPE.lighthouse, constants.CLIENT_TYPES.cl, - image, + participant.cl_image, el_context.client_name, - extra_labels, + participant.cl_extra_labels, ), "tolerations": tolerations, "node_selectors": node_selectors, diff --git a/src/cl/lodestar/lodestar_launcher.star b/src/cl/lodestar/lodestar_launcher.star index 8bfea661a..93f8b62be 100644 --- a/src/cl/lodestar/lodestar_launcher.star +++ b/src/cl/lodestar/lodestar_launcher.star @@ -29,9 +29,8 @@ VERBOSITY_LEVELS = { def launch( plan, launcher, - service_name, - image, - participant_log_level, + beacon_service_name, + participant, global_log_level, bootnode_contexts, el_context, @@ -41,49 +40,36 @@ def launch( cl_max_cpu, cl_min_mem, cl_max_mem, - snooper_enabled, snooper_engine_context, - blobber_enabled, - blobber_extra_params, - extra_params, - extra_env_vars, - extra_labels, persistent, cl_volume_size, tolerations, node_selectors, - use_separate_vc, - keymanager_enabled, checkpoint_sync_enabled, checkpoint_sync_url, port_publisher, participant_index, ): - beacon_service_name = "{0}".format(service_name) log_level = input_parser.get_client_log_level_or_default( - participant_log_level, global_log_level, VERBOSITY_LEVELS + participant.cl_log_level, global_log_level, VERBOSITY_LEVELS ) # Launch Beacon node beacon_config = get_beacon_config( plan, - launcher.el_cl_genesis_data, - launcher.jwt_file, - launcher.network, - image, + launcher, beacon_service_name, + participant, + log_level, bootnode_contexts, el_context, - log_level, + full_name, + node_keystore_files, cl_min_cpu, cl_max_cpu, cl_min_mem, cl_max_mem, - snooper_enabled, snooper_engine_context, - extra_params, - extra_env_vars, - extra_labels, persistent, cl_volume_size, tolerations, @@ -91,7 +77,6 @@ def launch( checkpoint_sync_enabled, checkpoint_sync_url, port_publisher, - launcher.preset, participant_index, ) @@ -104,13 +89,13 @@ def launch( ) # Blobber config - if blobber_enabled: + if participant.blobber_enabled: blobber_service_name = "{0}-{1}".format("blobber", beacon_service_name) blobber_config = blobber_launcher.get_config( blobber_service_name, node_keystore_files, beacon_http_url, - blobber_extra_params, + participant.blobber_extra_params, ) blobber_service = plan.add_service(blobber_service_name, blobber_config) @@ -146,7 +131,7 @@ def launch( ) beacon_node_metrics_info = node_metrics.new_node_metrics_info( - service_name, METRICS_PATH, beacon_metrics_url + beacon_service_name, METRICS_PATH, beacon_metrics_url ) nodes_metrics_info = [beacon_node_metrics_info] @@ -160,7 +145,7 @@ def launch( beacon_service_name=beacon_service_name, multiaddr=beacon_multiaddr, peer_id=beacon_peer_id, - snooper_enabled=snooper_enabled, + snooper_enabled=participant.snooper_enabled, snooper_engine_context=snooper_engine_context, validator_keystore_files_artifact_uuid=node_keystore_files.files_artifact_uuid if node_keystore_files @@ -170,23 +155,19 @@ def launch( def get_beacon_config( plan, - el_cl_genesis_data, - jwt_file, - network, - image, - service_name, + launcher, + beacon_service_name, + participant, + log_level, bootnode_contexts, el_context, - log_level, + full_name, + node_keystore_files, cl_min_cpu, cl_max_cpu, cl_min_mem, cl_max_mem, - snooper_enabled, snooper_engine_context, - extra_params, - extra_env_vars, - extra_labels, persistent, cl_volume_size, tolerations, @@ -194,7 +175,6 @@ def get_beacon_config( checkpoint_sync_enabled, checkpoint_sync_url, port_publisher, - preset, participant_index, ): el_client_rpc_url_str = "http://{0}:{1}".format( @@ -203,7 +183,7 @@ def get_beacon_config( ) # If snooper is enabled use the snooper engine context, otherwise use the execution client context - if snooper_enabled: + if participant.snooper_enabled: EXECUTION_ENGINE_ENDPOINT = "http://{0}:{1}".format( snooper_engine_context.ip_addr, snooper_engine_context.engine_rpc_port_num, @@ -261,24 +241,32 @@ def get_beacon_config( # ^^^^^^^^^^^^^^^^^^^ METRICS CONFIG ^^^^^^^^^^^^^^^^^^^^^ ] + supernode_cmd = [ + "--supernode", + ] + + if participant.supernode: + cmd.extend(supernode_cmd) + # If checkpoint sync is enabled, add the checkpoint sync url if checkpoint_sync_enabled: if checkpoint_sync_url: cmd.append("--checkpointSyncUrl=" + checkpoint_sync_url) else: if ( - network in constants.PUBLIC_NETWORKS - or network == constants.NETWORK_NAME.ephemery + launcher.network in constants.PUBLIC_NETWORKS + or launcher.network == constants.NETWORK_NAME.ephemery ): cmd.append( - "--checkpointSyncUrl=" + constants.CHECKPOINT_SYNC_URL[network] + "--checkpointSyncUrl=" + + constants.CHECKPOINT_SYNC_URL[launcher.network] ) else: fail( "Checkpoint sync URL is required if you enabled checkpoint_sync for custom networks. Please provide a valid URL." ) - if network not in constants.PUBLIC_NETWORKS: + if launcher.network not in constants.PUBLIC_NETWORKS: cmd.append( "--paramsFile=" + constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER @@ -290,8 +278,8 @@ def get_beacon_config( + "/genesis.ssz" ) if ( - network == constants.NETWORK_NAME.kurtosis - or constants.NETWORK_NAME.shadowfork in network + launcher.network == constants.NETWORK_NAME.kurtosis + or constants.NETWORK_NAME.shadowfork in launcher.network ): if bootnode_contexts != None: cmd.append( @@ -303,47 +291,49 @@ def get_beacon_config( ] ) ) - elif network == constants.NETWORK_NAME.ephemery: + elif launcher.network == constants.NETWORK_NAME.ephemery: cmd.append( "--bootnodes=" + shared_utils.get_devnet_enrs_list( - plan, el_cl_genesis_data.files_artifact_uuid + plan, launcher.el_cl_genesis_data.files_artifact_uuid ) ) else: # Devnets cmd.append( "--bootnodes=" + shared_utils.get_devnet_enrs_list( - plan, el_cl_genesis_data.files_artifact_uuid + plan, launcher.el_cl_genesis_data.files_artifact_uuid ) ) else: # Public testnet - cmd.append("--network=" + network) + cmd.append("--network=" + launcher.network) - if len(extra_params) > 0: + if len(participant.cl_extra_params) > 0: # this is a repeated, we convert it into Starlark - cmd.extend([param for param in extra_params]) + cmd.extend([param for param in participant.cl_extra_params]) files = { - constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data.files_artifact_uuid, - constants.JWT_MOUNTPOINT_ON_CLIENTS: jwt_file, + constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: launcher.el_cl_genesis_data.files_artifact_uuid, + constants.JWT_MOUNTPOINT_ON_CLIENTS: launcher.jwt_file, } if persistent: files[BEACON_DATA_DIRPATH_ON_SERVICE_CONTAINER] = Directory( - persistent_key="data-{0}".format(service_name), + persistent_key="data-{0}".format(beacon_service_name), size=cl_volume_size, ) - if preset == "minimal": - extra_env_vars["LODESTAR_PRESET"] = "minimal" + env_vars = participant.cl_extra_env_vars + + if launcher.preset == "minimal": + env_vars["LODESTAR_PRESET"] = "minimal" config_args = { - "image": image, + "image": participant.cl_image, "ports": used_ports, "public_ports": public_ports, "cmd": cmd, "files": files, - "env_vars": extra_env_vars, + "env_vars": env_vars, "private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, "ready_conditions": cl_node_ready_conditions.get_ready_conditions( constants.HTTP_PORT_ID @@ -351,9 +341,9 @@ def get_beacon_config( "labels": shared_utils.label_maker( constants.CL_TYPE.lodestar, constants.CLIENT_TYPES.cl, - image, + participant.cl_image, el_context.client_name, - extra_labels, + participant.cl_extra_labels, ), "tolerations": tolerations, "node_selectors": node_selectors, diff --git a/src/cl/nimbus/nimbus_launcher.star b/src/cl/nimbus/nimbus_launcher.star index 3705565a2..8ff3361c9 100644 --- a/src/cl/nimbus/nimbus_launcher.star +++ b/src/cl/nimbus/nimbus_launcher.star @@ -49,9 +49,8 @@ ENTRYPOINT_ARGS = ["sh", "-c"] def launch( plan, launcher, - service_name, - image, - participant_log_level, + beacon_service_name, + participant, global_log_level, bootnode_contexts, el_context, @@ -61,54 +60,35 @@ def launch( cl_max_cpu, cl_min_mem, cl_max_mem, - snooper_enabled, snooper_engine_context, - blobber_enabled, - blobber_extra_params, - extra_params, - extra_env_vars, - extra_labels, persistent, cl_volume_size, tolerations, node_selectors, - use_separate_vc, - keymanager_enabled, checkpoint_sync_enabled, checkpoint_sync_url, port_publisher, participant_index, ): - beacon_service_name = "{0}".format(service_name) - log_level = input_parser.get_client_log_level_or_default( - participant_log_level, global_log_level, VERBOSITY_LEVELS + participant.cl_log_level, global_log_level, VERBOSITY_LEVELS ) beacon_config = get_beacon_config( plan, - launcher.el_cl_genesis_data, - launcher.jwt_file, - keymanager_enabled, - launcher.keymanager_file, - launcher.network, - image, + launcher, beacon_service_name, + participant, + log_level, bootnode_contexts, el_context, full_name, - log_level, node_keystore_files, cl_min_cpu, cl_max_cpu, cl_min_mem, cl_max_mem, - snooper_enabled, snooper_engine_context, - extra_params, - extra_env_vars, - extra_labels, - use_separate_vc, persistent, cl_volume_size, tolerations, @@ -139,14 +119,14 @@ def launch( }, ) response = plan.request( - recipe=beacon_node_identity_recipe, service_name=service_name + recipe=beacon_node_identity_recipe, service_name=beacon_service_name ) beacon_node_enr = response["extract.enr"] beacon_multiaddr = response["extract.multiaddr"] beacon_peer_id = response["extract.peer_id"] nimbus_node_metrics_info = node_metrics.new_node_metrics_info( - service_name, BEACON_METRICS_PATH, beacon_metrics_url + beacon_service_name, BEACON_METRICS_PATH, beacon_metrics_url ) nodes_metrics_info = [nimbus_node_metrics_info] @@ -160,7 +140,7 @@ def launch( beacon_service_name=beacon_service_name, multiaddr=beacon_multiaddr, peer_id=beacon_peer_id, - snooper_enabled=snooper_enabled, + snooper_enabled=participant.snooper_enabled, snooper_engine_context=snooper_engine_context, validator_keystore_files_artifact_uuid=node_keystore_files.files_artifact_uuid if node_keystore_files @@ -170,28 +150,19 @@ def launch( def get_beacon_config( plan, - el_cl_genesis_data, - jwt_file, - keymanager_enabled, - keymanager_file, - network, - image, - service_name, + launcher, + beacon_service_name, + participant, + log_level, bootnode_contexts, el_context, full_name, - log_level, node_keystore_files, cl_min_cpu, cl_max_cpu, cl_min_mem, cl_max_mem, - snooper_enabled, snooper_engine_context, - extra_params, - extra_env_vars, - extra_labels, - use_separate_vc, persistent, cl_volume_size, tolerations, @@ -213,7 +184,7 @@ def get_beacon_config( node_keystore_files.raw_secrets_relative_dirpath, ) # If snooper is enabled use the snooper engine context, otherwise use the execution client context - if snooper_enabled: + if participant.snooper_enabled: EXECUTION_ENGINE_ENDPOINT = "http://{0}:{1}".format( snooper_engine_context.ip_addr, snooper_engine_context.engine_rpc_port_num, @@ -252,8 +223,8 @@ def get_beacon_config( "--udp-port={0}".format(discovery_port), "--tcp-port={0}".format(discovery_port), "--network={0}".format( - network - if network in constants.PUBLIC_NETWORKS + launcher.network + if launcher.network in constants.PUBLIC_NETWORKS else constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER ), "--data-dir=" + BEACON_DATA_DIRPATH_ON_SERVICE_CONTAINER, @@ -294,15 +265,22 @@ def get_beacon_config( "--keymanager-token-file=" + constants.KEYMANAGER_MOUNT_PATH_ON_CONTAINER, ] - if network not in constants.PUBLIC_NETWORKS: + supernode_cmd = [ + "--subscribe-all-subnets=true", + ] + + if participant.supernode: + cmd.append(supernode_cmd) + + if launcher.network not in constants.PUBLIC_NETWORKS: cmd.append( "--bootstrap-file=" + constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER + "/bootstrap_nodes.txt" ) if ( - network == constants.NETWORK_NAME.kurtosis - or constants.NETWORK_NAME.shadowfork in network + launcher.network == constants.NETWORK_NAME.kurtosis + or constants.NETWORK_NAME.shadowfork in launcher.network ): if bootnode_contexts == None: cmd.append("--subscribe-all-subnets") @@ -310,22 +288,22 @@ def get_beacon_config( for ctx in bootnode_contexts[: constants.MAX_ENR_ENTRIES]: cmd.append("--bootstrap-node=" + ctx.enr) - if len(extra_params) > 0: - cmd.extend([param for param in extra_params]) + if len(participant.cl_extra_params) > 0: + cmd.extend([param for param in participant.cl_extra_params]) files = { - constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data.files_artifact_uuid, - constants.JWT_MOUNTPOINT_ON_CLIENTS: jwt_file, + constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: launcher.el_cl_genesis_data.files_artifact_uuid, + constants.JWT_MOUNTPOINT_ON_CLIENTS: launcher.jwt_file, } - if node_keystore_files != None and not use_separate_vc: + if node_keystore_files != None and not participant.use_separate_vc: cmd.extend(validator_default_cmd) files[ VALIDATOR_KEYS_MOUNTPOINT_ON_CLIENTS ] = node_keystore_files.files_artifact_uuid - files[constants.KEYMANAGER_MOUNT_PATH_ON_CLIENTS] = keymanager_file + files[constants.KEYMANAGER_MOUNT_PATH_ON_CLIENTS] = launcher.keymanager_file - if keymanager_enabled: + if participant.keymanager_enabled: cmd.extend(keymanager_api_cmd) used_ports.update(vc_shared.VALIDATOR_KEYMANAGER_USED_PORTS) public_ports.update( @@ -334,17 +312,17 @@ def get_beacon_config( if persistent: files[BEACON_DATA_DIRPATH_ON_SERVICE_CONTAINER] = Directory( - persistent_key="data-{0}".format(service_name), + persistent_key="data-{0}".format(beacon_service_name), size=cl_volume_size, ) config_args = { - "image": image, + "image": participant.cl_image, "ports": used_ports, "public_ports": public_ports, "cmd": cmd, "files": files, - "env_vars": extra_env_vars, + "env_vars": participant.cl_extra_env_vars, "private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, "ready_conditions": cl_node_ready_conditions.get_ready_conditions( constants.HTTP_PORT_ID @@ -352,9 +330,9 @@ def get_beacon_config( "labels": shared_utils.label_maker( constants.CL_TYPE.nimbus, constants.CLIENT_TYPES.cl, - image, + participant.cl_image, el_context.client_name, - extra_labels, + participant.cl_extra_labels, ), "tolerations": tolerations, "node_selectors": node_selectors, diff --git a/src/cl/prysm/prysm_launcher.star b/src/cl/prysm/prysm_launcher.star index d3bcb6ef7..86ce4cdd8 100644 --- a/src/cl/prysm/prysm_launcher.star +++ b/src/cl/prysm/prysm_launcher.star @@ -33,9 +33,8 @@ VERBOSITY_LEVELS = { def launch( plan, launcher, - service_name, - image, - participant_log_level, + beacon_service_name, + participant, global_log_level, bootnode_contexts, el_context, @@ -45,48 +44,35 @@ def launch( cl_max_cpu, cl_min_mem, cl_max_mem, - snooper_enabled, snooper_engine_context, - blobber_enabled, - blobber_extra_params, - extra_params, - extra_env_vars, - extra_labels, persistent, cl_volume_size, tolerations, node_selectors, - use_separate_vc, - keymanager_enabled, checkpoint_sync_enabled, checkpoint_sync_url, port_publisher, participant_index, ): - beacon_service_name = "{0}".format(service_name) log_level = input_parser.get_client_log_level_or_default( - participant_log_level, global_log_level, VERBOSITY_LEVELS + participant.cl_log_level, global_log_level, VERBOSITY_LEVELS ) beacon_config = get_beacon_config( plan, - launcher.el_cl_genesis_data, - launcher.jwt_file, - launcher.network, - image, + launcher, beacon_service_name, + participant, + log_level, bootnode_contexts, el_context, - log_level, + full_name, + node_keystore_files, cl_min_cpu, cl_max_cpu, cl_min_mem, cl_max_mem, - snooper_enabled, snooper_engine_context, - extra_params, - extra_env_vars, - extra_labels, persistent, cl_volume_size, tolerations, @@ -94,7 +80,6 @@ def launch( checkpoint_sync_enabled, checkpoint_sync_url, port_publisher, - launcher.preset, participant_index, ) @@ -142,7 +127,7 @@ def launch( beacon_grpc_url=beacon_grpc_url, multiaddr=beacon_multiaddr, peer_id=beacon_peer_id, - snooper_enabled=snooper_enabled, + snooper_enabled=participant.snooper_enabled, snooper_engine_context=snooper_engine_context, validator_keystore_files_artifact_uuid=node_keystore_files.files_artifact_uuid if node_keystore_files @@ -152,23 +137,19 @@ def launch( def get_beacon_config( plan, - el_cl_genesis_data, - jwt_file, - network, - beacon_image, - service_name, + launcher, + beacon_service_name, + participant, + log_level, bootnode_contexts, el_context, - log_level, + full_name, + node_keystore_files, cl_min_cpu, cl_max_cpu, cl_min_mem, cl_max_mem, - snooper_enabled, snooper_engine_context, - extra_params, - extra_env_vars, - extra_labels, persistent, cl_volume_size, tolerations, @@ -176,11 +157,10 @@ def get_beacon_config( checkpoint_sync_enabled, checkpoint_sync_url, port_publisher, - preset, participant_index, ): # If snooper is enabled use the snooper engine context, otherwise use the execution client context - if snooper_enabled: + if participant.snooper_enabled: EXECUTION_ENGINE_ENDPOINT = "http://{0}:{1}".format( snooper_engine_context.ip_addr, snooper_engine_context.engine_rpc_port_num, @@ -249,33 +229,43 @@ def get_beacon_config( "--pprofport={0}".format(PROFILING_PORT_NUM), ] + supernode_cmd = [ + "--subscribe-all-subnets=true", + ] + + if participant.supernode: + cmd.extend(supernode_cmd) + # If checkpoint sync is enabled, add the checkpoint sync url if checkpoint_sync_enabled: if checkpoint_sync_url: cmd.append("--checkpoint-sync-url=" + checkpoint_sync_url) cmd.append( - "--genesis-beacon-api-url=" + constants.CHECKPOINT_SYNC_URL[network] + "--genesis-beacon-api-url=" + + constants.CHECKPOINT_SYNC_URL[launcher.network] ) else: if ( - network in constants.PUBLIC_NETWORKS - or network == constants.NETWORK_NAME.ephemery + launcher.network in constants.PUBLIC_NETWORKS + or launcher.network == constants.NETWORK_NAME.ephemery ): cmd.append( - "--checkpoint-sync-url=" + constants.CHECKPOINT_SYNC_URL[network] + "--checkpoint-sync-url=" + + constants.CHECKPOINT_SYNC_URL[launcher.network] ) cmd.append( - "--genesis-beacon-api-url=" + constants.CHECKPOINT_SYNC_URL[network] + "--genesis-beacon-api-url=" + + constants.CHECKPOINT_SYNC_URL[launcher.network] ) else: fail( "Checkpoint sync URL is required if you enabled checkpoint_sync for custom networks. Please provide a valid URL." ) - if preset == "minimal": + if launcher.preset == "minimal": cmd.append("--minimal-config=true") - if network not in constants.PUBLIC_NETWORKS: + if launcher.network not in constants.PUBLIC_NETWORKS: cmd.append("--p2p-static-id=true") cmd.append( "--chain-config-file=" @@ -289,15 +279,16 @@ def get_beacon_config( ) cmd.append("--contract-deployment-block=0") if ( - network == constants.NETWORK_NAME.kurtosis - or constants.NETWORK_NAME.shadowfork in network + launcher.network == constants.NETWORK_NAME.kurtosis + or constants.NETWORK_NAME.shadowfork in launcher.network ): if bootnode_contexts != None: for ctx in bootnode_contexts[: constants.MAX_ENR_ENTRIES]: cmd.append("--bootstrap-node=" + ctx.enr) - elif network == constants.NETWORK_NAME.ephemery: + elif launcher.network == constants.NETWORK_NAME.ephemery: cmd.append( - "--genesis-beacon-api-url=" + constants.CHECKPOINT_SYNC_URL[network] + "--genesis-beacon-api-url=" + + constants.CHECKPOINT_SYNC_URL[launcher.network] ) cmd.append( "--bootstrap-node=" @@ -311,30 +302,30 @@ def get_beacon_config( + "/bootstrap_nodes.yaml" ) else: # Public network - cmd.append("--{}".format(network)) + cmd.append("--{}".format(launcher.network)) - if len(extra_params) > 0: + if len(participant.cl_extra_params) > 0: # we do the for loop as otherwise its a proto repeated array - cmd.extend([param for param in extra_params]) + cmd.extend([param for param in participant.cl_extra_params]) files = { - constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data.files_artifact_uuid, - constants.JWT_MOUNTPOINT_ON_CLIENTS: jwt_file, + constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: launcher.el_cl_genesis_data.files_artifact_uuid, + constants.JWT_MOUNTPOINT_ON_CLIENTS: launcher.jwt_file, } if persistent: files[BEACON_DATA_DIRPATH_ON_SERVICE_CONTAINER] = Directory( - persistent_key="data-{0}".format(service_name), + persistent_key="data-{0}".format(beacon_service_name), size=cl_volume_size, ) config_args = { - "image": beacon_image, + "image": participant.cl_image, "ports": used_ports, "public_ports": public_ports, "cmd": cmd, "files": files, - "env_vars": extra_env_vars, + "env_vars": participant.cl_extra_env_vars, "private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, "ready_conditions": cl_node_ready_conditions.get_ready_conditions( constants.HTTP_PORT_ID @@ -342,9 +333,9 @@ def get_beacon_config( "labels": shared_utils.label_maker( constants.CL_TYPE.prysm, constants.CLIENT_TYPES.cl, - beacon_image, + participant.cl_image, el_context.client_name, - extra_labels, + participant.cl_extra_labels, ), "tolerations": tolerations, "node_selectors": node_selectors, @@ -369,14 +360,10 @@ def new_prysm_launcher( el_cl_genesis_data, jwt_file, network_params, - prysm_password_relative_filepath, - prysm_password_artifact_uuid, ): return struct( el_cl_genesis_data=el_cl_genesis_data, jwt_file=jwt_file, network=network_params.network, preset=network_params.preset, - prysm_password_artifact_uuid=prysm_password_artifact_uuid, - prysm_password_relative_filepath=prysm_password_relative_filepath, ) diff --git a/src/cl/teku/teku_launcher.star b/src/cl/teku/teku_launcher.star index d30c33a47..26ee015f7 100644 --- a/src/cl/teku/teku_launcher.star +++ b/src/cl/teku/teku_launcher.star @@ -36,11 +36,10 @@ VERBOSITY_LEVELS = { def launch( plan, launcher, - service_name, - image, - participant_log_level, + beacon_service_name, + participant, global_log_level, - bootnode_context, + bootnode_contexts, el_context, full_name, node_keystore_files, @@ -48,55 +47,35 @@ def launch( cl_max_cpu, cl_min_mem, cl_max_mem, - snooper_enabled, snooper_engine_context, - blobber_enabled, - blobber_extra_params, - extra_params, - extra_env_vars, - extra_labels, persistent, cl_volume_size, tolerations, node_selectors, - use_separate_vc, - keymanager_enabled, checkpoint_sync_enabled, checkpoint_sync_url, port_publisher, participant_index, ): - beacon_service_name = "{0}".format(service_name) log_level = input_parser.get_client_log_level_or_default( - participant_log_level, global_log_level, VERBOSITY_LEVELS + participant.cl_log_level, global_log_level, VERBOSITY_LEVELS ) - extra_params = [param for param in extra_params] - config = get_beacon_config( plan, - launcher.el_cl_genesis_data, - launcher.jwt_file, - keymanager_enabled, - launcher.keymanager_file, - launcher.network, - image, + launcher, beacon_service_name, - bootnode_context, + participant, + log_level, + bootnode_contexts, el_context, full_name, - log_level, node_keystore_files, cl_min_cpu, cl_max_cpu, cl_min_mem, cl_max_mem, - snooper_enabled, snooper_engine_context, - extra_params, - extra_env_vars, - extra_labels, - use_separate_vc, persistent, cl_volume_size, tolerations, @@ -107,7 +86,7 @@ def launch( participant_index, ) - beacon_service = plan.add_service(service_name, config) + beacon_service = plan.add_service(beacon_service_name, config) beacon_http_port = beacon_service.ports[constants.HTTP_PORT_ID] beacon_http_url = "http://{0}:{1}".format( @@ -129,14 +108,14 @@ def launch( }, ) response = plan.request( - recipe=beacon_node_identity_recipe, service_name=service_name + recipe=beacon_node_identity_recipe, service_name=beacon_service_name ) beacon_node_enr = response["extract.enr"] beacon_multiaddr = response["extract.multiaddr"] beacon_peer_id = response["extract.peer_id"] beacon_node_metrics_info = node_metrics.new_node_metrics_info( - service_name, BEACON_METRICS_PATH, beacon_metrics_url + beacon_service_name, BEACON_METRICS_PATH, beacon_metrics_url ) nodes_metrics_info = [beacon_node_metrics_info] @@ -150,7 +129,7 @@ def launch( beacon_service_name=beacon_service_name, multiaddr=beacon_multiaddr, peer_id=beacon_peer_id, - snooper_enabled=snooper_enabled, + snooper_enabled=participant.snooper_enabled, snooper_engine_context=snooper_engine_context, validator_keystore_files_artifact_uuid=node_keystore_files.files_artifact_uuid if node_keystore_files @@ -160,28 +139,19 @@ def launch( def get_beacon_config( plan, - el_cl_genesis_data, - jwt_file, - keymanager_enabled, - keymanager_file, - network, - image, - service_name, + launcher, + beacon_service_name, + participant, + log_level, bootnode_contexts, el_context, full_name, - log_level, node_keystore_files, cl_min_cpu, cl_max_cpu, cl_min_mem, cl_max_mem, - snooper_enabled, snooper_engine_context, - extra_params, - extra_env_vars, - extra_labels, - use_separate_vc, persistent, cl_volume_size, tolerations, @@ -203,7 +173,7 @@ def get_beacon_config( node_keystore_files.teku_secrets_relative_dirpath, ) # If snooper is enabled use the snooper engine context, otherwise use the execution client context - if snooper_enabled: + if participant.snooper_enabled: EXECUTION_ENGINE_ENDPOINT = "http://{0}:{1}".format( snooper_engine_context.ip_addr, snooper_engine_context.engine_rpc_port_num, @@ -240,8 +210,8 @@ def get_beacon_config( "--logging=" + log_level, "--log-destination=CONSOLE", "--network={0}".format( - network - if network in constants.PUBLIC_NETWORKS + launcher.network + if launcher.network in constants.PUBLIC_NETWORKS else constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER + "/config.yaml" ), "--data-path=" + BEACON_DATA_DIRPATH_ON_SERVICE_CONTAINER, @@ -291,32 +261,40 @@ def get_beacon_config( "--Xvalidator-api-unsafe-hosts-enabled=true", ] + supernode_cmd = [ + "--p2p-subscribe-all-custody-subnets-enabled=true", + ] + + if participant.supernode: + cmd.extend(supernode_cmd) + # If checkpoint sync is enabled, add the checkpoint sync url if checkpoint_sync_enabled: if checkpoint_sync_url: cmd.append("--checkpoint-sync-url=" + checkpoint_sync_url) else: if ( - network in constants.PUBLIC_NETWORKS - or network == constants.NETWORK_NAME.ephemery + launcher.network in constants.PUBLIC_NETWORKS + or launcher.network == constants.NETWORK_NAME.ephemery ): cmd.append( - "--checkpoint-sync-url=" + constants.CHECKPOINT_SYNC_URL[network] + "--checkpoint-sync-url=" + + constants.CHECKPOINT_SYNC_URL[launcher.network] ) else: fail( "Checkpoint sync URL is required if you enabled checkpoint_sync for custom networks. Please provide a valid URL." ) - if network not in constants.PUBLIC_NETWORKS: + if launcher.network not in constants.PUBLIC_NETWORKS: cmd.append( "--initial-state=" + constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER + "/genesis.ssz" ) if ( - network == constants.NETWORK_NAME.kurtosis - or constants.NETWORK_NAME.shadowfork in network + launcher.network == constants.NETWORK_NAME.kurtosis + or constants.NETWORK_NAME.shadowfork in launcher.network ): if bootnode_contexts != None: cmd.append( @@ -328,45 +306,45 @@ def get_beacon_config( ] ) ) - elif network == constants.NETWORK_NAME.ephemery: + elif launcher.network == constants.NETWORK_NAME.ephemery: cmd.append( "--p2p-discovery-bootnodes=" + shared_utils.get_devnet_enrs_list( - plan, el_cl_genesis_data.files_artifact_uuid + plan, launcher.el_cl_genesis_data.files_artifact_uuid ) ) - elif constants.NETWORK_NAME.shadowfork in network: + elif constants.NETWORK_NAME.shadowfork in launcher.network: cmd.append( "--p2p-discovery-bootnodes=" + shared_utils.get_devnet_enrs_list( - plan, el_cl_genesis_data.files_artifact_uuid + plan, launcher.el_cl_genesis_data.files_artifact_uuid ) ) else: # Devnets cmd.append( "--p2p-discovery-bootnodes=" + shared_utils.get_devnet_enrs_list( - plan, el_cl_genesis_data.files_artifact_uuid + plan, launcher.el_cl_genesis_data.files_artifact_uuid ) ) - if len(extra_params) > 0: + if len(participant.cl_extra_params) > 0: # we do the list comprehension as the default extra_params is a proto repeated string - cmd.extend([param for param in extra_params]) + cmd.extend([param for param in participant.cl_extra_params]) files = { - constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data.files_artifact_uuid, - constants.JWT_MOUNTPOINT_ON_CLIENTS: jwt_file, + constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: launcher.el_cl_genesis_data.files_artifact_uuid, + constants.JWT_MOUNTPOINT_ON_CLIENTS: launcher.jwt_file, } - if node_keystore_files != None and not use_separate_vc: + if node_keystore_files != None and not participant.use_separate_vc: cmd.extend(validator_default_cmd) files[ constants.VALIDATOR_KEYS_DIRPATH_ON_SERVICE_CONTAINER ] = node_keystore_files.files_artifact_uuid - if keymanager_enabled: - files[constants.KEYMANAGER_MOUNT_PATH_ON_CLIENTS] = keymanager_file + if participant.keymanager_enabled: + files[constants.KEYMANAGER_MOUNT_PATH_ON_CLIENTS] = launcher.keymanager_file cmd.extend(keymanager_api_cmd) used_ports.update(vc_shared.VALIDATOR_KEYMANAGER_USED_PORTS) public_ports.update( @@ -375,17 +353,17 @@ def get_beacon_config( if persistent: files[BEACON_DATA_DIRPATH_ON_SERVICE_CONTAINER] = Directory( - persistent_key="data-{0}".format(service_name), + persistent_key="data-{0}".format(beacon_service_name), size=cl_volume_size, ) config_args = { - "image": image, + "image": participant.cl_image, "ports": used_ports, "public_ports": public_ports, "cmd": cmd, "files": files, - "env_vars": extra_env_vars, + "env_vars": participant.cl_extra_env_vars, "private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, "ready_conditions": cl_node_ready_conditions.get_ready_conditions( constants.HTTP_PORT_ID @@ -393,9 +371,9 @@ def get_beacon_config( "labels": shared_utils.label_maker( constants.CL_TYPE.teku, constants.CLIENT_TYPES.cl, - image, + participant.cl_image, el_context.client_name, - extra_labels, + participant.cl_extra_labels, ), "tolerations": tolerations, "node_selectors": node_selectors, diff --git a/src/package_io/input_parser.star b/src/package_io/input_parser.star index 4b1403f6e..7c4b7418e 100644 --- a/src/package_io/input_parser.star +++ b/src/package_io/input_parser.star @@ -214,6 +214,7 @@ def input_parser(plan, input_args): vc_extra_env_vars=participant["vc_extra_env_vars"], vc_extra_labels=participant["vc_extra_labels"], builder_network_params=participant["builder_network_params"], + supernode=participant["supernode"], el_min_cpu=participant["el_min_cpu"], el_max_cpu=participant["el_max_cpu"], el_min_mem=participant["el_min_mem"], @@ -887,6 +888,7 @@ def default_participant(): "cl_max_cpu": 0, "cl_min_mem": 0, "cl_max_mem": 0, + "supernode": False, "use_separate_vc": None, "vc_type": "", "vc_image": "", diff --git a/src/package_io/sanity_check.star b/src/package_io/sanity_check.star index 9e8fbcc2e..b8d10c8f8 100644 --- a/src/package_io/sanity_check.star +++ b/src/package_io/sanity_check.star @@ -24,6 +24,7 @@ PARTICIPANT_CATEGORIES = { "cl_max_cpu", "cl_min_mem", "cl_max_mem", + "supernode", "use_separate_vc", "vc_type", "vc_image",