From c80886bdbf08a2fcb706acfb26739b1467330e5b Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Tue, 30 Apr 2024 14:13:19 +0100 Subject: [PATCH 01/23] use constant for private ip address placeholder --- main.star | 1 + network_params.yaml | 1 + src/el/besu/besu_launcher.star | 5 ++--- src/el/el_context.star | 2 ++ src/el/erigon/erigon_launcher.star | 7 ++----- src/el/ethereumjs/ethereumjs_launcher.star | 6 ++---- src/el/geth/geth_launcher.star | 6 ++---- src/el/nethermind/nethermind_launcher.star | 6 ++---- src/el/nimbus-eth1/nimbus_launcher.star | 4 +--- src/el/reth/reth_launcher.star | 4 +--- src/package_io/constants.star | 2 ++ src/package_io/input_parser.star | 2 ++ src/participant_network.star | 1 + 13 files changed, 21 insertions(+), 26 deletions(-) diff --git a/main.star b/main.star index db802750f..135f4d021 100644 --- a/main.star +++ b/main.star @@ -115,6 +115,7 @@ def run(plan, args={}): global_node_selectors, keymanager_enabled, parallel_keystore_generation, + args_with_right_defaults.nat_exit_ip, ) plan.print( diff --git a/network_params.yaml b/network_params.yaml index c02da9c53..5b228b8d2 100644 --- a/network_params.yaml +++ b/network_params.yaml @@ -138,3 +138,4 @@ xatu_sentry_params: global_tolerations: [] global_node_selectors: {} keymanager_enabled: false +nat_exit_ip: KURTOSIS_IP_ADDR_PLACEHOLDER diff --git a/src/el/besu/besu_launcher.star b/src/el/besu/besu_launcher.star index 2e44540b3..d36bb5691 100644 --- a/src/el/besu/besu_launcher.star +++ b/src/el/besu/besu_launcher.star @@ -29,7 +29,6 @@ UDP_DISCOVERY_PORT_ID = "udp-discovery" ENGINE_HTTP_RPC_PORT_ID = "engine-rpc" METRICS_PORT_ID = "metrics" JAVA_OPTS = {"JAVA_OPTS": "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n"} -PRIVATE_IP_ADDRESS_PLACEHOLDER = "KURTOSIS_IP_ADDR_PLACEHOLDER" USED_PORTS = { RPC_PORT_ID: shared_utils.new_port_spec( @@ -190,7 +189,7 @@ def get_config( "--rpc-ws-port={0}".format(WS_PORT_NUM), "--rpc-ws-api=ADMIN,CLIQUE,ETH,NET,DEBUG,TXPOOL,ENGINE,TRACE,WEB3", "--p2p-enabled=true", - "--p2p-host=" + PRIVATE_IP_ADDRESS_PLACEHOLDER, + "--p2p-host=" + constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, "--p2p-port={0}".format(DISCOVERY_PORT_NUM), "--engine-rpc-enabled=true", "--engine-jwt-secret=" + constants.JWT_MOUNT_PATH_ON_CONTAINER, @@ -260,7 +259,7 @@ def get_config( files=files, env_vars=extra_env_vars, entrypoint=ENTRYPOINT_ARGS, - private_ip_address_placeholder=PRIVATE_IP_ADDRESS_PLACEHOLDER, + private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, min_cpu=el_min_cpu, max_cpu=el_max_cpu, min_memory=el_min_mem, diff --git a/src/el/el_context.star b/src/el/el_context.star index a2dd8d77e..750e13ced 100644 --- a/src/el/el_context.star +++ b/src/el/el_context.star @@ -8,6 +8,7 @@ def new_el_context( engine_rpc_port_num, service_name="", el_metrics_info=None, + nat_exit_ip=None, ): return struct( service_name=service_name, @@ -19,4 +20,5 @@ def new_el_context( ws_port_num=ws_port_num, engine_rpc_port_num=engine_rpc_port_num, el_metrics_info=el_metrics_info, + nat_exit_ip=nat_exit_ip, ) diff --git a/src/el/erigon/erigon_launcher.star b/src/el/erigon/erigon_launcher.star index 23a82b7c8..614995c9e 100644 --- a/src/el/erigon/erigon_launcher.star +++ b/src/el/erigon/erigon_launcher.star @@ -27,9 +27,6 @@ UDP_DISCOVERY_PORT_ID = "udp-discovery" ENGINE_RPC_PORT_ID = "engine-rpc" METRICS_PORT_ID = "metrics" - -PRIVATE_IP_ADDRESS_PLACEHOLDER = "KURTOSIS_IP_ADDR_PLACEHOLDER" - USED_PORTS = { WS_RPC_PORT_ID: shared_utils.new_port_spec( WS_RPC_PORT_NUM, @@ -201,7 +198,7 @@ def get_config( "--http.vhosts=*", "--ws", "--allow-insecure-unlock", - "--nat=extip:" + PRIVATE_IP_ADDRESS_PLACEHOLDER, + "--nat=extip:" + constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, "--http", "--http.addr=0.0.0.0", "--http.corsdomain=*", @@ -261,7 +258,7 @@ def get_config( cmd=[command_arg_str], files=files, entrypoint=ENTRYPOINT_ARGS, - private_ip_address_placeholder=PRIVATE_IP_ADDRESS_PLACEHOLDER, + private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, min_cpu=el_min_cpu, max_cpu=el_max_cpu, min_memory=el_min_mem, diff --git a/src/el/ethereumjs/ethereumjs_launcher.star b/src/el/ethereumjs/ethereumjs_launcher.star index 570bb716e..545a3e01f 100644 --- a/src/el/ethereumjs/ethereumjs_launcher.star +++ b/src/el/ethereumjs/ethereumjs_launcher.star @@ -30,8 +30,6 @@ METRICS_PATH = "/metrics" # The dirpath of the execution data directory on the client container EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER = "/data/ethereumjs/execution-data" -PRIVATE_IP_ADDRESS_PLACEHOLDER = "KURTOSIS_IP_ADDR_PLACEHOLDER" - USED_PORTS = { RPC_PORT_ID: shared_utils.new_port_spec( RPC_PORT_NUM, shared_utils.TCP_PROTOCOL, shared_utils.HTTP_APPLICATION_PROTOCOL @@ -192,7 +190,7 @@ def get_config( "--wsEnginePort={0}".format(WS_PORT_ENGINE_NUM), "--wsEngineAddr=0.0.0.0", "--jwt-secret=" + constants.JWT_MOUNT_PATH_ON_CONTAINER, - "--extIP={0}".format(PRIVATE_IP_ADDRESS_PLACEHOLDER), + "--extIP={0}".format(constants.PRIVATE_IP_ADDRESS_PLACEHOLDER), "--sync=full", "--isSingleNode=true", "--logLevel={0}".format(verbosity_level), @@ -246,7 +244,7 @@ def get_config( cmd=cmd, files=files, entrypoint=ENTRYPOINT_ARGS, - private_ip_address_placeholder=PRIVATE_IP_ADDRESS_PLACEHOLDER, + private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, min_cpu=el_min_cpu, max_cpu=el_max_cpu, min_memory=el_min_mem, diff --git a/src/el/geth/geth_launcher.star b/src/el/geth/geth_launcher.star index a62597e3d..523917d10 100644 --- a/src/el/geth/geth_launcher.star +++ b/src/el/geth/geth_launcher.star @@ -36,8 +36,6 @@ METRICS_PATH = "/debug/metrics/prometheus" # The dirpath of the execution data directory on the client container EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER = "/data/geth/execution-data" -PRIVATE_IP_ADDRESS_PLACEHOLDER = "KURTOSIS_IP_ADDR_PLACEHOLDER" - USED_PORTS = { RPC_PORT_ID: shared_utils.new_port_spec( RPC_PORT_NUM, @@ -271,7 +269,7 @@ def get_config( "--ws.api=admin,engine,net,eth,web3,debug", "--ws.origins=*", "--allow-insecure-unlock", - "--nat=extip:" + PRIVATE_IP_ADDRESS_PLACEHOLDER, + "--nat=extip:" + constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, "--verbosity=" + verbosity_level, "--authrpc.port={0}".format(ENGINE_RPC_PORT_NUM), "--authrpc.addr=0.0.0.0", @@ -356,7 +354,7 @@ def get_config( cmd=[command_str], files=files, entrypoint=ENTRYPOINT_ARGS, - private_ip_address_placeholder=PRIVATE_IP_ADDRESS_PLACEHOLDER, + private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, min_cpu=el_min_cpu, max_cpu=el_max_cpu, min_memory=el_min_mem, diff --git a/src/el/nethermind/nethermind_launcher.star b/src/el/nethermind/nethermind_launcher.star index e18838c6b..c2925c2b4 100644 --- a/src/el/nethermind/nethermind_launcher.star +++ b/src/el/nethermind/nethermind_launcher.star @@ -29,8 +29,6 @@ UDP_DISCOVERY_PORT_ID = "udp-discovery" ENGINE_RPC_PORT_ID = "engine-rpc" METRICS_PORT_ID = "metrics" -PRIVATE_IP_ADDRESS_PLACEHOLDER = "KURTOSIS_IP_ADDR_PLACEHOLDER" - USED_PORTS = { RPC_PORT_ID: shared_utils.new_port_spec( RPC_PORT_NUM, shared_utils.TCP_PROTOCOL, shared_utils.HTTP_APPLICATION_PROTOCOL @@ -185,7 +183,7 @@ def get_config( "--JsonRpc.WebSocketsPort={0}".format(WS_PORT_NUM), "--JsonRpc.EngineHost=0.0.0.0", "--JsonRpc.EnginePort={0}".format(ENGINE_RPC_PORT_NUM), - "--Network.ExternalIp={0}".format(PRIVATE_IP_ADDRESS_PLACEHOLDER), + "--Network.ExternalIp={0}".format(constants.PRIVATE_IP_ADDRESS_PLACEHOLDER), "--Network.DiscoveryPort={0}".format(DISCOVERY_PORT_NUM), "--Network.P2PPort={0}".format(DISCOVERY_PORT_NUM), "--JsonRpc.JwtSecretFile=" + constants.JWT_MOUNT_PATH_ON_CONTAINER, @@ -253,7 +251,7 @@ def get_config( ports=USED_PORTS, cmd=cmd, files=files, - private_ip_address_placeholder=PRIVATE_IP_ADDRESS_PLACEHOLDER, + private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, min_cpu=el_min_cpu, max_cpu=el_max_cpu, min_memory=el_min_mem, diff --git a/src/el/nimbus-eth1/nimbus_launcher.star b/src/el/nimbus-eth1/nimbus_launcher.star index ef339b814..91e520c9c 100644 --- a/src/el/nimbus-eth1/nimbus_launcher.star +++ b/src/el/nimbus-eth1/nimbus_launcher.star @@ -27,8 +27,6 @@ METRICS_PATH = "/metrics" # The dirpath of the execution data directory on the client container EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER = "/data/nimbus/execution-data" -PRIVATE_IP_ADDRESS_PLACEHOLDER = "KURTOSIS_IP_ADDR_PLACEHOLDER" - USED_PORTS = { WS_RPC_PORT_ID: shared_utils.new_port_spec( WS_RPC_PORT_NUM, @@ -193,7 +191,7 @@ def get_config( "--metrics", "--metrics-address=0.0.0.0", "--metrics-port={0}".format(METRICS_PORT_NUM), - "--nat=extip:{0}".format(PRIVATE_IP_ADDRESS_PLACEHOLDER), + "--nat=extip:{0}".format(constants.PRIVATE_IP_ADDRESS_PLACEHOLDER), ] if ( network not in constants.PUBLIC_NETWORKS diff --git a/src/el/reth/reth_launcher.star b/src/el/reth/reth_launcher.star index 3a9592d09..6dfe4a4e4 100644 --- a/src/el/reth/reth_launcher.star +++ b/src/el/reth/reth_launcher.star @@ -29,8 +29,6 @@ METRICS_PATH = "/metrics" # The dirpath of the execution data directory on the client container EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER = "/data/reth/execution-data" -PRIVATE_IP_ADDRESS_PLACEHOLDER = "KURTOSIS_IP_ADDR_PLACEHOLDER" - USED_PORTS = { RPC_PORT_ID: shared_utils.new_port_spec( RPC_PORT_NUM, shared_utils.TCP_PROTOCOL, shared_utils.HTTP_APPLICATION_PROTOCOL @@ -203,7 +201,7 @@ def get_config( "--ws.port={0}".format(WS_PORT_NUM), "--ws.api=net,eth", "--ws.origins=*", - "--nat=extip:" + PRIVATE_IP_ADDRESS_PLACEHOLDER, + "--nat=extip:" + constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, "--authrpc.port={0}".format(ENGINE_RPC_PORT_NUM), "--authrpc.jwtsecret=" + constants.JWT_MOUNT_PATH_ON_CONTAINER, "--authrpc.addr=0.0.0.0", diff --git a/src/package_io/constants.star b/src/package_io/constants.star index 373d9b2e7..8573d7aaf 100644 --- a/src/package_io/constants.star +++ b/src/package_io/constants.star @@ -67,6 +67,8 @@ KEYMANAGER_P12_MOUNT_PATH_ON_CONTAINER = ( DEFAULT_SNOOPER_IMAGE = "ethpandaops/rpc-snooper:latest" +PRIVATE_IP_ADDRESS_PLACEHOLDER = "KURTOSIS_IP_ADDR_PLACEHOLDER" + GENESIS_FORK_VERSION = "0x10000038" BELLATRIX_FORK_VERSION = "0x30000038" CAPELLA_FORK_VERSION = "0x40000038" diff --git a/src/package_io/input_parser.star b/src/package_io/input_parser.star index f791d4184..e5b51b8e9 100644 --- a/src/package_io/input_parser.star +++ b/src/package_io/input_parser.star @@ -303,6 +303,7 @@ def input_parser(plan, input_args): global_tolerations=result["global_tolerations"], global_node_selectors=result["global_node_selectors"], keymanager_enabled=result["keymanager_enabled"], + nat_exit_ip=result["nat_exit_ip"], ) @@ -611,6 +612,7 @@ def default_input_args(): "global_tolerations": [], "global_node_selectors": {}, "keymanager_enabled": False, + "nat_exit_ip": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, } diff --git a/src/participant_network.star b/src/participant_network.star index 3adb99437..a177c027d 100644 --- a/src/participant_network.star +++ b/src/participant_network.star @@ -40,6 +40,7 @@ def launch_participant_network( global_node_selectors, keymanager_enabled, parallel_keystore_generation=False, + nat_exit_ip, ): network_id = network_params.network_id latest_block = "" From 88876f34561fecb808b055a8d8e1e648469422d9 Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Tue, 30 Apr 2024 14:26:23 +0100 Subject: [PATCH 02/23] el looks done? --- src/el/besu/besu_launcher.star | 4 +++- src/el/el_launcher.star | 2 ++ src/el/erigon/erigon_launcher.star | 5 ++++- src/el/ethereumjs/ethereumjs_launcher.star | 5 ++++- src/el/geth/geth_launcher.star | 5 ++++- src/el/nethermind/nethermind_launcher.star | 4 +++- src/el/nimbus-eth1/nimbus_launcher.star | 4 +++- src/el/reth/reth_launcher.star | 7 +++++-- src/participant_network.star | 1 + 9 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/el/besu/besu_launcher.star b/src/el/besu/besu_launcher.star index d36bb5691..40f23bfcc 100644 --- a/src/el/besu/besu_launcher.star +++ b/src/el/besu/besu_launcher.star @@ -79,6 +79,7 @@ def launch( el_volume_size, tolerations, node_selectors, + nat_exit_ip, ): log_level = input_parser.get_client_log_level_or_default( participant_log_level, global_log_level, VERBOSITY_LEVELS @@ -128,6 +129,7 @@ def launch( el_volume_size, tolerations, node_selectors, + nat_exit_ip, ) service = plan.add_service(service_name, config) @@ -189,7 +191,7 @@ def get_config( "--rpc-ws-port={0}".format(WS_PORT_NUM), "--rpc-ws-api=ADMIN,CLIQUE,ETH,NET,DEBUG,TXPOOL,ENGINE,TRACE,WEB3", "--p2p-enabled=true", - "--p2p-host=" + constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, + "--p2p-host=" + nat_exit_ip, "--p2p-port={0}".format(DISCOVERY_PORT_NUM), "--engine-rpc-enabled=true", "--engine-jwt-secret=" + constants.JWT_MOUNT_PATH_ON_CONTAINER, diff --git a/src/el/el_launcher.star b/src/el/el_launcher.star index 14d5226d9..72e403fc5 100644 --- a/src/el/el_launcher.star +++ b/src/el/el_launcher.star @@ -23,6 +23,7 @@ def launch( persistent, network_id, num_participants, + nat_exit_ip, ): el_launchers = { constants.EL_TYPE.geth: { @@ -147,6 +148,7 @@ def launch( participant.el_volume_size, tolerations, node_selectors, + nat_exit_ip, ) # Add participant el additional prometheus metrics for metrics_info in el_context.el_metrics_info: diff --git a/src/el/erigon/erigon_launcher.star b/src/el/erigon/erigon_launcher.star index 614995c9e..40c0eb63b 100644 --- a/src/el/erigon/erigon_launcher.star +++ b/src/el/erigon/erigon_launcher.star @@ -77,6 +77,7 @@ def launch( el_volume_size, tolerations, node_selectors, + nat_exit_ip, ): log_level = input_parser.get_client_log_level_or_default( participant_log_level, global_log_level, VERBOSITY_LEVELS @@ -128,6 +129,7 @@ def launch( el_volume_size, tolerations, node_selectors, + nat_exit_ip, ) service = plan.add_service(service_name, config) @@ -177,6 +179,7 @@ def get_config( el_volume_size, tolerations, node_selectors, + nat_exit_ip, ): init_datadir_cmd_str = "erigon init --datadir={0} {1}".format( EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER, @@ -198,7 +201,7 @@ def get_config( "--http.vhosts=*", "--ws", "--allow-insecure-unlock", - "--nat=extip:" + constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, + "--nat=extip:" + nat_exit_ip, "--http", "--http.addr=0.0.0.0", "--http.corsdomain=*", diff --git a/src/el/ethereumjs/ethereumjs_launcher.star b/src/el/ethereumjs/ethereumjs_launcher.star index 545a3e01f..52fd38ad2 100644 --- a/src/el/ethereumjs/ethereumjs_launcher.star +++ b/src/el/ethereumjs/ethereumjs_launcher.star @@ -80,6 +80,7 @@ def launch( el_volume_size, tolerations, node_selectors, + nat_exit_ip, ): log_level = input_parser.get_client_log_level_or_default( participant_log_level, global_log_level, VERBOSITY_LEVELS @@ -129,6 +130,7 @@ def launch( el_volume_size, tolerations, node_selectors, + nat_exit_ip, ) service = plan.add_service(service_name, config) @@ -173,6 +175,7 @@ def get_config( el_volume_size, tolerations, node_selectors, + nat_exit_ip, ): cmd = [ "--dataDir=" + EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER, @@ -190,7 +193,7 @@ def get_config( "--wsEnginePort={0}".format(WS_PORT_ENGINE_NUM), "--wsEngineAddr=0.0.0.0", "--jwt-secret=" + constants.JWT_MOUNT_PATH_ON_CONTAINER, - "--extIP={0}".format(constants.PRIVATE_IP_ADDRESS_PLACEHOLDER), + "--extIP={0}".format(nat_exit_ip), "--sync=full", "--isSingleNode=true", "--logLevel={0}".format(verbosity_level), diff --git a/src/el/geth/geth_launcher.star b/src/el/geth/geth_launcher.star index 523917d10..f556d9e48 100644 --- a/src/el/geth/geth_launcher.star +++ b/src/el/geth/geth_launcher.star @@ -92,6 +92,7 @@ def launch( el_volume_size, tolerations, node_selectors, + nat_exit_ip, ): log_level = input_parser.get_client_log_level_or_default( participant_log_level, global_log_level, VERBOSITY_LEVELS @@ -144,6 +145,7 @@ def launch( el_volume_size, tolerations, node_selectors, + nat_exit_ip, ) service = plan.add_service(service_name, config) @@ -194,6 +196,7 @@ def get_config( el_volume_size, tolerations, node_selectors, + nat_exit_ip, ): if "--gcmode=archive" in extra_params or "--gcmode archive" in extra_params: gcmode_archive = True @@ -269,7 +272,7 @@ def get_config( "--ws.api=admin,engine,net,eth,web3,debug", "--ws.origins=*", "--allow-insecure-unlock", - "--nat=extip:" + constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, + "--nat=extip:" + nat_exit_ip, "--verbosity=" + verbosity_level, "--authrpc.port={0}".format(ENGINE_RPC_PORT_NUM), "--authrpc.addr=0.0.0.0", diff --git a/src/el/nethermind/nethermind_launcher.star b/src/el/nethermind/nethermind_launcher.star index c2925c2b4..6c25df46a 100644 --- a/src/el/nethermind/nethermind_launcher.star +++ b/src/el/nethermind/nethermind_launcher.star @@ -76,6 +76,7 @@ def launch( el_volume_size, tolerations, node_selectors, + nat_exit_ip, ): log_level = input_parser.get_client_log_level_or_default( participant_log_level, global_log_level, VERBOSITY_LEVELS @@ -171,6 +172,7 @@ def get_config( el_volume_size, tolerations, node_selectors, + nat_exit_ip, ): cmd = [ "--log=" + log_level, @@ -183,7 +185,7 @@ def get_config( "--JsonRpc.WebSocketsPort={0}".format(WS_PORT_NUM), "--JsonRpc.EngineHost=0.0.0.0", "--JsonRpc.EnginePort={0}".format(ENGINE_RPC_PORT_NUM), - "--Network.ExternalIp={0}".format(constants.PRIVATE_IP_ADDRESS_PLACEHOLDER), + "--Network.ExternalIp={0}".format(nat_exit_ip), "--Network.DiscoveryPort={0}".format(DISCOVERY_PORT_NUM), "--Network.P2PPort={0}".format(DISCOVERY_PORT_NUM), "--JsonRpc.JwtSecretFile=" + constants.JWT_MOUNT_PATH_ON_CONTAINER, diff --git a/src/el/nimbus-eth1/nimbus_launcher.star b/src/el/nimbus-eth1/nimbus_launcher.star index 91e520c9c..d083a8ffc 100644 --- a/src/el/nimbus-eth1/nimbus_launcher.star +++ b/src/el/nimbus-eth1/nimbus_launcher.star @@ -80,6 +80,7 @@ def launch( el_volume_size, tolerations, node_selectors, + nat_exit_ip, ): log_level = input_parser.get_client_log_level_or_default( participant_log_level, global_log_level, VERBOSITY_LEVELS @@ -174,6 +175,7 @@ def get_config( el_volume_size, tolerations, node_selectors, + nat_exit_ip, ): cmd = [ "--log-level={0}".format(verbosity_level), @@ -191,7 +193,7 @@ def get_config( "--metrics", "--metrics-address=0.0.0.0", "--metrics-port={0}".format(METRICS_PORT_NUM), - "--nat=extip:{0}".format(constants.PRIVATE_IP_ADDRESS_PLACEHOLDER), + "--nat=extip:{0}".format(nat_exit_ip), ] if ( network not in constants.PUBLIC_NETWORKS diff --git a/src/el/reth/reth_launcher.star b/src/el/reth/reth_launcher.star index 6dfe4a4e4..841ff91c5 100644 --- a/src/el/reth/reth_launcher.star +++ b/src/el/reth/reth_launcher.star @@ -79,6 +79,7 @@ def launch( el_volume_size, tolerations, node_selectors, + nat_exit_ip, ): log_level = input_parser.get_client_log_level_or_default( participant_log_level, global_log_level, VERBOSITY_LEVELS @@ -128,6 +129,7 @@ def launch( el_volume_size, tolerations, node_selectors, + nat_exit_ip, ) service = plan.add_service(service_name, config) @@ -173,6 +175,7 @@ def get_config( el_volume_size, tolerations, node_selectors, + nat_exit_ip, ): init_datadir_cmd_str = "reth init --datadir={0} --chain={1}".format( EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER, @@ -201,7 +204,7 @@ def get_config( "--ws.port={0}".format(WS_PORT_NUM), "--ws.api=net,eth", "--ws.origins=*", - "--nat=extip:" + constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, + "--nat=extip:" + nat_exit_ip, "--authrpc.port={0}".format(ENGINE_RPC_PORT_NUM), "--authrpc.jwtsecret=" + constants.JWT_MOUNT_PATH_ON_CONTAINER, "--authrpc.addr=0.0.0.0", @@ -258,7 +261,7 @@ def get_config( cmd=[command_str], files=files, entrypoint=ENTRYPOINT_ARGS, - private_ip_address_placeholder=PRIVATE_IP_ADDRESS_PLACEHOLDER, + private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, min_cpu=el_min_cpu, max_cpu=el_max_cpu, min_memory=el_min_mem, diff --git a/src/participant_network.star b/src/participant_network.star index a177c027d..6be80d4b4 100644 --- a/src/participant_network.star +++ b/src/participant_network.star @@ -146,6 +146,7 @@ def launch_participant_network( persistent, network_id, num_participants, + nat_exit_ip, ) # Launch all consensus layer clients From 8699fdcee0ba8db5c71952808e482b0d1409da42 Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Tue, 30 Apr 2024 14:52:25 +0100 Subject: [PATCH 03/23] some more cleanup --- src/blobber/blobber_launcher.star | 7 +++---- src/cl/cl_launcher.star | 3 +++ src/cl/grandine/grandine_launcher.star | 9 +++++---- src/cl/lighthouse/lighthouse_launcher.star | 9 +++++---- src/cl/lodestar/lodestar_launcher.star | 9 +++++---- src/cl/nimbus/nimbus_launcher.star | 8 +++++--- src/cl/prysm/prysm_launcher.star | 9 +++++---- src/cl/teku/teku_launcher.star | 9 +++++---- src/snooper/snooper_beacon_launcher.star | 4 ---- src/snooper/snooper_engine_launcher.star | 3 --- src/vc/lodestar.star | 1 - src/vc/nimbus.star | 1 - src/vc/prysm.star | 1 - src/vc/shared.star | 2 -- src/vc/teku.star | 1 - 15 files changed, 36 insertions(+), 40 deletions(-) diff --git a/src/blobber/blobber_launcher.star b/src/blobber/blobber_launcher.star index 0927a1190..b7ad94ebc 100644 --- a/src/blobber/blobber_launcher.star +++ b/src/blobber/blobber_launcher.star @@ -10,8 +10,6 @@ BLOBBER_BEACON_PORT_UDP_ID = "discovery-udp" BLOBBER_VALIDATOR_PROXY_PORT_NUM = 5000 BLOBBER_VALIDATOR_PROXY_PORT_ID = "http" -PRIVATE_IP_ADDRESS_PLACEHOLDER = "KURTOSIS_IP_ADDR_PLACEHOLDER" - DEFAULT_BLOBBER_IMAGE = "ethpandaops/blobber:1.1.0" VALIDATOR_KEYS_MOUNTPOINT_ON_CLIENTS = "/validator-keys" @@ -76,7 +74,8 @@ def get_config( "--cl={0}".format(beacon_http_url), "--validator-key-folder={0}".format(validator_root_dirpath), "--enable-unsafe-mode", - "--external-ip={0}".format(PRIVATE_IP_ADDRESS_PLACEHOLDER), + # Does this get affected by public ip address changes? + "--external-ip={0}".format(constants.PRIVATE_IP_ADDRESS_PLACEHOLDER), "--validator-proxy-port-start={0}".format(BLOBBER_VALIDATOR_PROXY_PORT_NUM), ] @@ -90,7 +89,7 @@ def get_config( VALIDATOR_KEYS_MOUNTPOINT_ON_CLIENTS: node_keystore_files.files_artifact_uuid }, cmd=cmd, - private_ip_address_placeholder=PRIVATE_IP_ADDRESS_PLACEHOLDER, + private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, min_cpu=MIN_CPU, max_cpu=MAX_CPU, min_memory=MIN_MEMORY, diff --git a/src/cl/cl_launcher.star b/src/cl/cl_launcher.star index a1c6320e1..7ebb78727 100644 --- a/src/cl/cl_launcher.star +++ b/src/cl/cl_launcher.star @@ -31,6 +31,7 @@ def launch( validator_data, prysm_password_relative_filepath, prysm_password_artifact_uuid, + nat_exit_ip, ): plan.print("Launching CL network") @@ -175,6 +176,7 @@ def launch( node_selectors, participant.use_separate_vc, participant.keymanager_enabled, + nat_exit_ip, ) else: boot_cl_client_ctx = all_cl_contexts @@ -208,6 +210,7 @@ def launch( node_selectors, participant.use_separate_vc, participant.keymanager_enabled, + nat_exit_ip, ) # Add participant cl additional prometheus labels diff --git a/src/cl/grandine/grandine_launcher.star b/src/cl/grandine/grandine_launcher.star index dfbdbfc1a..2019e81ec 100644 --- a/src/cl/grandine/grandine_launcher.star +++ b/src/cl/grandine/grandine_launcher.star @@ -29,8 +29,6 @@ BEACON_METRICS_PATH = "/metrics" MIN_PEERS = 1 -PRIVATE_IP_ADDRESS_PLACEHOLDER = "KURTOSIS_IP_ADDR_PLACEHOLDER" - BEACON_USED_PORTS = { BEACON_TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( BEACON_DISCOVERY_PORT_NUM, shared_utils.TCP_PROTOCOL @@ -88,6 +86,7 @@ def launch( node_selectors, use_separate_vc, keymanager_enabled, + nat_exit_ip, ): beacon_service_name = "{0}".format(service_name) log_level = input_parser.get_client_log_level_or_default( @@ -148,6 +147,7 @@ def launch( cl_volume_size, tolerations, node_selectors, + nat_exit_ip, ) beacon_service = plan.add_service(service_name, config) @@ -227,6 +227,7 @@ def get_beacon_config( cl_volume_size, tolerations, node_selectors, + nat_exit_ip, ): validator_keys_dirpath = "" validator_secrets_dirpath = "" @@ -263,7 +264,7 @@ def get_beacon_config( "--eth1-rpc-urls=" + EXECUTION_ENGINE_ENDPOINT, # vvvvvvvvvvvvvvvvvvv REMOVE THESE WHEN CONNECTING TO EXTERNAL NET vvvvvvvvvvvvvvvvvvvvv "--disable-enr-auto-update", - "--enr-address=" + PRIVATE_IP_ADDRESS_PLACEHOLDER, + "--enr-address=" + nat_exit_ip, "--enr-udp-port={0}".format(BEACON_DISCOVERY_PORT_NUM), "--enr-tcp-port={0}".format(BEACON_DISCOVERY_PORT_NUM), # ^^^^^^^^^^^^^^^^^^^ REMOVE THESE WHEN CONNECTING TO EXTERNAL NET ^^^^^^^^^^^^^^^^^^^^^ @@ -376,7 +377,7 @@ def get_beacon_config( cmd=cmd, env_vars=extra_env_vars, files=files, - private_ip_address_placeholder=PRIVATE_IP_ADDRESS_PLACEHOLDER, + private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, ready_conditions=cl_node_ready_conditions.get_ready_conditions( BEACON_HTTP_PORT_ID ), diff --git a/src/cl/lighthouse/lighthouse_launcher.star b/src/cl/lighthouse/lighthouse_launcher.star index 1c404c966..c1fda74ba 100644 --- a/src/cl/lighthouse/lighthouse_launcher.star +++ b/src/cl/lighthouse/lighthouse_launcher.star @@ -32,8 +32,6 @@ BEACON_MIN_MEMORY = 256 METRICS_PATH = "/metrics" -PRIVATE_IP_ADDRESS_PLACEHOLDER = "KURTOSIS_IP_ADDR_PLACEHOLDER" - BEACON_USED_PORTS = { BEACON_TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( BEACON_DISCOVERY_PORT_NUM, shared_utils.TCP_PROTOCOL @@ -92,6 +90,7 @@ def launch( node_selectors, use_separate_vc=True, keymanager_enabled=False, + nat_exit_ip, ): beacon_service_name = "{0}".format(service_name) @@ -148,6 +147,7 @@ def launch( cl_volume_size, tolerations, node_selectors, + nat_exit_ip, ) beacon_service = plan.add_service(beacon_service_name, beacon_config) @@ -242,6 +242,7 @@ def get_beacon_config( cl_volume_size, tolerations, node_selectors, + nat_exit_ip, ): # If snooper is enabled use the snooper engine context, otherwise use the execution client context if snooper_enabled: @@ -270,7 +271,7 @@ def get_beacon_config( "--datadir=" + BEACON_DATA_DIRPATH_ON_BEACON_SERVICE_CONTAINER, # vvvvvvvvvvvvvvvvvvv REMOVE THESE WHEN CONNECTING TO EXTERNAL NET vvvvvvvvvvvvvvvvvvvvv "--disable-enr-auto-update", - "--enr-address=" + PRIVATE_IP_ADDRESS_PLACEHOLDER, + "--enr-address=" + nat_exit_ip, "--enr-udp-port={0}".format(BEACON_DISCOVERY_PORT_NUM), "--enr-tcp-port={0}".format(BEACON_DISCOVERY_PORT_NUM), # ^^^^^^^^^^^^^^^^^^^ REMOVE THESE WHEN CONNECTING TO EXTERNAL NET ^^^^^^^^^^^^^^^^^^^^^ @@ -372,7 +373,7 @@ def get_beacon_config( cmd=cmd, files=files, env_vars=env, - private_ip_address_placeholder=PRIVATE_IP_ADDRESS_PLACEHOLDER, + private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, ready_conditions=cl_node_ready_conditions.get_ready_conditions( BEACON_HTTP_PORT_ID ), diff --git a/src/cl/lodestar/lodestar_launcher.star b/src/cl/lodestar/lodestar_launcher.star index d6f422392..beb8d9420 100644 --- a/src/cl/lodestar/lodestar_launcher.star +++ b/src/cl/lodestar/lodestar_launcher.star @@ -25,8 +25,6 @@ BEACON_MIN_MEMORY = 256 METRICS_PATH = "/metrics" -PRIVATE_IP_ADDRESS_PLACEHOLDER = "KURTOSIS_IP_ADDR_PLACEHOLDER" - BEACON_USED_PORTS = { TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( DISCOVERY_PORT_NUM, shared_utils.TCP_PROTOCOL @@ -81,6 +79,7 @@ def launch( node_selectors, use_separate_vc=True, keymanager_enabled=False, + nat_exit_ip=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, ): beacon_service_name = "{0}".format(service_name) log_level = input_parser.get_client_log_level_or_default( @@ -136,6 +135,7 @@ def launch( cl_volume_size, tolerations, node_selectors, + nat_exit_ip, ) beacon_service = plan.add_service(beacon_service_name, beacon_config) @@ -234,6 +234,7 @@ def get_beacon_config( cl_volume_size, tolerations, node_selectors, + nat_exit_ip, ): el_client_rpc_url_str = "http://{0}:{1}".format( el_context.ip_addr, @@ -269,7 +270,7 @@ def get_beacon_config( "--rest.namespace=*", "--rest.port={0}".format(HTTP_PORT_NUM), "--nat=true", - "--enr.ip=" + PRIVATE_IP_ADDRESS_PLACEHOLDER, + "--enr.ip=" + nat_exit_ip, "--enr.tcp={0}".format(DISCOVERY_PORT_NUM), "--enr.udp={0}".format(DISCOVERY_PORT_NUM), # Set per Pari's recommendation to reduce noise in the logs @@ -352,7 +353,7 @@ def get_beacon_config( cmd=cmd, env_vars=extra_env_vars, files=files, - private_ip_address_placeholder=PRIVATE_IP_ADDRESS_PLACEHOLDER, + private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, ready_conditions=cl_node_ready_conditions.get_ready_conditions( BEACON_HTTP_PORT_ID ), diff --git a/src/cl/nimbus/nimbus_launcher.star b/src/cl/nimbus/nimbus_launcher.star index 712a9d050..ed26ed869 100644 --- a/src/cl/nimbus/nimbus_launcher.star +++ b/src/cl/nimbus/nimbus_launcher.star @@ -42,7 +42,6 @@ VALIDATOR_KEYS_MOUNTPOINT_ON_CLIENTS = "/data/nimbus/validator-keys" # ---------------------------------- Used Ports ---------------------------------- -PRIVATE_IP_ADDRESS_PLACEHOLDER = "KURTOSIS_IP_ADDR_PLACEHOLDER" BEACON_USED_PORTS = { BEACON_TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( BEACON_DISCOVERY_PORT_NUM, shared_utils.TCP_PROTOCOL @@ -103,6 +102,7 @@ def launch( node_selectors, use_separate_vc, keymanager_enabled, + nat_exit_ip, ): beacon_service_name = "{0}".format(service_name) @@ -163,6 +163,7 @@ def launch( cl_volume_size, tolerations, node_selectors, + nat_exit_ip, ) beacon_service = plan.add_service(beacon_service_name, beacon_config) @@ -242,6 +243,7 @@ def get_beacon_config( cl_volume_size, tolerations, node_selectors, + nat_exit_ip, ): validator_keys_dirpath = "" validator_secrets_dirpath = "" @@ -278,7 +280,7 @@ def get_beacon_config( ), "--data-dir=" + BEACON_DATA_DIRPATH_ON_SERVICE_CONTAINER, "--web3-url=" + EXECUTION_ENGINE_ENDPOINT, - "--nat=extip:" + PRIVATE_IP_ADDRESS_PLACEHOLDER, + "--nat=extip:" + nat_exit_ip, "--enr-auto-update=false", "--history={0}".format("archive" if constants.ARCHIVE_MODE else "prune"), "--rest", @@ -364,7 +366,7 @@ def get_beacon_config( cmd=cmd, env_vars=extra_env_vars, files=files, - private_ip_address_placeholder=PRIVATE_IP_ADDRESS_PLACEHOLDER, + private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, ready_conditions=cl_node_ready_conditions.get_ready_conditions( BEACON_HTTP_PORT_ID ), diff --git a/src/cl/prysm/prysm_launcher.star b/src/cl/prysm/prysm_launcher.star index 818543573..6bffc86fd 100644 --- a/src/cl/prysm/prysm_launcher.star +++ b/src/cl/prysm/prysm_launcher.star @@ -31,8 +31,6 @@ METRICS_PATH = "/metrics" MIN_PEERS = 1 -PRIVATE_IP_ADDRESS_PLACEHOLDER = "KURTOSIS_IP_ADDR_PLACEHOLDER" - BEACON_NODE_USED_PORTS = { TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( DISCOVERY_TCP_PORT_NUM, shared_utils.TCP_PROTOCOL @@ -88,6 +86,7 @@ def launch( node_selectors, use_separate_vc=True, keymanager_enabled=False, + nat_exit_ip=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, ): beacon_service_name = "{0}".format(service_name) log_level = input_parser.get_client_log_level_or_default( @@ -142,6 +141,7 @@ def launch( cl_volume_size, tolerations, node_selectors, + nat_exit_ip, ) beacon_service = plan.add_service(beacon_service_name, beacon_config) @@ -219,6 +219,7 @@ def get_beacon_config( cl_volume_size, tolerations, node_selectors, + nat_exit_ip, ): # If snooper is enabled use the snooper engine context, otherwise use the execution client context if snooper_enabled: @@ -241,7 +242,7 @@ def get_beacon_config( "--grpc-gateway-host=0.0.0.0", "--grpc-gateway-corsdomain=*", "--grpc-gateway-port={0}".format(HTTP_PORT_NUM), - "--p2p-host-ip=" + PRIVATE_IP_ADDRESS_PLACEHOLDER, + "--p2p-host-ip=" + nat_exit_ip, "--p2p-tcp-port={0}".format(DISCOVERY_TCP_PORT_NUM), "--p2p-udp-port={0}".format(DISCOVERY_UDP_PORT_NUM), "--min-sync-peers={0}".format(MIN_PEERS), @@ -335,7 +336,7 @@ def get_beacon_config( cmd=cmd, env_vars=extra_env_vars, files=files, - private_ip_address_placeholder=PRIVATE_IP_ADDRESS_PLACEHOLDER, + private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, ready_conditions=cl_node_ready_conditions.get_ready_conditions( BEACON_HTTP_PORT_ID ), diff --git a/src/cl/teku/teku_launcher.star b/src/cl/teku/teku_launcher.star index b365d857b..fc4cccbcb 100644 --- a/src/cl/teku/teku_launcher.star +++ b/src/cl/teku/teku_launcher.star @@ -31,8 +31,6 @@ BEACON_METRICS_PATH = "/metrics" MIN_PEERS = 1 -PRIVATE_IP_ADDRESS_PLACEHOLDER = "KURTOSIS_IP_ADDR_PLACEHOLDER" - BEACON_USED_PORTS = { BEACON_TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( BEACON_DISCOVERY_PORT_NUM, shared_utils.TCP_PROTOCOL @@ -90,6 +88,7 @@ def launch( node_selectors, use_separate_vc, keymanager_enabled, + nat_exit_ip, ): beacon_service_name = "{0}".format(service_name) log_level = input_parser.get_client_log_level_or_default( @@ -151,6 +150,7 @@ def launch( cl_volume_size, tolerations, node_selectors, + nat_exit_ip, ) beacon_service = plan.add_service(service_name, config) @@ -232,6 +232,7 @@ def get_beacon_config( cl_volume_size, tolerations, node_selectors, + nat_exit_ip, ): validator_keys_dirpath = "" validator_secrets_dirpath = "" @@ -271,7 +272,7 @@ def get_beacon_config( # Set per Pari's recommendation, to reduce noise in the logs "--p2p-subscribe-all-subnets-enabled=true", "--p2p-peer-lower-bound={0}".format(MIN_PEERS), - "--p2p-advertised-ip=" + PRIVATE_IP_ADDRESS_PLACEHOLDER, + "--p2p-advertised-ip=" + nat_exit_ip, "--p2p-discovery-site-local-addresses-enabled=true", "--rest-api-enabled=true", "--rest-api-docs-enabled=true", @@ -398,7 +399,7 @@ def get_beacon_config( cmd=cmd, env_vars=extra_env_vars, files=files, - private_ip_address_placeholder=PRIVATE_IP_ADDRESS_PLACEHOLDER, + private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, ready_conditions=cl_node_ready_conditions.get_ready_conditions( BEACON_HTTP_PORT_ID ), diff --git a/src/snooper/snooper_beacon_launcher.star b/src/snooper/snooper_beacon_launcher.star index fd0cc05b0..630600c3f 100644 --- a/src/snooper/snooper_beacon_launcher.star +++ b/src/snooper/snooper_beacon_launcher.star @@ -8,9 +8,6 @@ SNOOPER_BEACON_RPC_PORT_NUM = 8562 SNOOPER_BEACON_RPC_PORT_ID = "http" SNOOPER_BINARY_COMMAND = "./json_rpc_snoop" -PRIVATE_IP_ADDRESS_PLACEHOLDER = "KURTOSIS_IP_ADDR_PLACEHOLDER" - - SNOOPER_USED_PORTS = { SNOOPER_BEACON_RPC_PORT_ID: shared_utils.new_port_spec( SNOOPER_BEACON_RPC_PORT_NUM, shared_utils.TCP_PROTOCOL, wait="5s" @@ -51,7 +48,6 @@ def get_config(service_name, cl_context, node_selectors): image=constants.DEFAULT_SNOOPER_IMAGE, ports=SNOOPER_USED_PORTS, cmd=cmd, - private_ip_address_placeholder=PRIVATE_IP_ADDRESS_PLACEHOLDER, min_cpu=MIN_CPU, max_cpu=MAX_CPU, min_memory=MIN_MEMORY, diff --git a/src/snooper/snooper_engine_launcher.star b/src/snooper/snooper_engine_launcher.star index 4f818e201..6d2ef91c2 100644 --- a/src/snooper/snooper_engine_launcher.star +++ b/src/snooper/snooper_engine_launcher.star @@ -8,8 +8,6 @@ SNOOPER_ENGINE_RPC_PORT_NUM = 8561 SNOOPER_ENGINE_RPC_PORT_ID = "http" SNOOPER_BINARY_COMMAND = "./json_rpc_snoop" -PRIVATE_IP_ADDRESS_PLACEHOLDER = "KURTOSIS_IP_ADDR_PLACEHOLDER" - SNOOPER_USED_PORTS = { SNOOPER_ENGINE_RPC_PORT_ID: shared_utils.new_port_spec( SNOOPER_ENGINE_RPC_PORT_NUM, shared_utils.TCP_PROTOCOL, wait="5s" @@ -52,7 +50,6 @@ def get_config(service_name, el_context, node_selectors): image=constants.DEFAULT_SNOOPER_IMAGE, ports=SNOOPER_USED_PORTS, cmd=cmd, - private_ip_address_placeholder=PRIVATE_IP_ADDRESS_PLACEHOLDER, min_cpu=MIN_CPU, max_cpu=MAX_CPU, min_memory=MIN_MEMORY, diff --git a/src/vc/lodestar.star b/src/vc/lodestar.star index 343cca4a7..fb16f443a 100644 --- a/src/vc/lodestar.star +++ b/src/vc/lodestar.star @@ -99,7 +99,6 @@ def get_config( cmd=cmd, env_vars=extra_env_vars, files=files, - private_ip_address_placeholder=vc_shared.PRIVATE_IP_ADDRESS_PLACEHOLDER, min_cpu=vc_min_cpu, max_cpu=vc_max_cpu, min_memory=vc_min_mem, diff --git a/src/vc/nimbus.star b/src/vc/nimbus.star index 94569d658..d84fd161a 100644 --- a/src/vc/nimbus.star +++ b/src/vc/nimbus.star @@ -77,7 +77,6 @@ def get_config( cmd=cmd, env_vars=extra_env_vars, files=files, - private_ip_address_placeholder=vc_shared.PRIVATE_IP_ADDRESS_PLACEHOLDER, min_cpu=vc_min_cpu, max_cpu=vc_max_cpu, min_memory=vc_min_mem, diff --git a/src/vc/prysm.star b/src/vc/prysm.star index f853925d0..3c7368c8e 100644 --- a/src/vc/prysm.star +++ b/src/vc/prysm.star @@ -92,7 +92,6 @@ def get_config( cmd=cmd, env_vars=extra_env_vars, files=files, - private_ip_address_placeholder=vc_shared.PRIVATE_IP_ADDRESS_PLACEHOLDER, min_cpu=vc_min_cpu, max_cpu=vc_max_cpu, min_memory=vc_min_mem, diff --git a/src/vc/shared.star b/src/vc/shared.star index e5d405603..aa38feddd 100644 --- a/src/vc/shared.star +++ b/src/vc/shared.star @@ -1,7 +1,5 @@ shared_utils = import_module("../shared_utils/shared_utils.star") -PRIVATE_IP_ADDRESS_PLACEHOLDER = "KURTOSIS_IP_ADDR_PLACEHOLDER" - VALIDATOR_HTTP_PORT_NUM = 5056 VALIDATOR_HTTP_PORT_ID = "vc-http" diff --git a/src/vc/teku.star b/src/vc/teku.star index be6512ce4..91065cdc2 100644 --- a/src/vc/teku.star +++ b/src/vc/teku.star @@ -88,7 +88,6 @@ def get_config( cmd=cmd, env_vars=extra_env_vars, files=files, - private_ip_address_placeholder=vc_shared.PRIVATE_IP_ADDRESS_PLACEHOLDER, min_cpu=vc_min_cpu, max_cpu=vc_max_cpu, min_memory=vc_min_mem, From e7bcd8d1385ddfe421c69e6d942d542eff7c9441 Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Tue, 30 Apr 2024 14:56:00 +0100 Subject: [PATCH 04/23] added docs --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 97973e9a1..f0b7f86a4 100644 --- a/README.md +++ b/README.md @@ -752,6 +752,12 @@ global_node_selectors: {} # This will open up http ports to your validator services! # Defaults to false keymanager_enabled: false + +# Global paarameter to set the exit ip address of services +# if you have a service that you want to expose on a specific interfact; set that IP here +# Defaults to constants.PRIVATE_IP_ADDRESS_PLACEHOLDER +# The default value just means its the IP address of the container in which the service is running +nat_exit_ip: KURTOSIS_IP_ADDR_PLACEHOLDER ``` #### Example configurations From efe68a4b1d7e037c61e725cf91f64d7bd7123304 Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Tue, 30 Apr 2024 15:01:05 +0100 Subject: [PATCH 05/23] pass arg --- src/participant_network.star | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/participant_network.star b/src/participant_network.star index 6be80d4b4..5d6d1891f 100644 --- a/src/participant_network.star +++ b/src/participant_network.star @@ -40,7 +40,7 @@ def launch_participant_network( global_node_selectors, keymanager_enabled, parallel_keystore_generation=False, - nat_exit_ip, + nat_exit_ip=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, ): network_id = network_params.network_id latest_block = "" From 6d31795d21f29775053f958d385c3458efc3d216 Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Tue, 30 Apr 2024 15:09:51 +0100 Subject: [PATCH 06/23] cleaned a few things up --- src/blobber/blobber_launcher.star | 1 + src/cl/lighthouse/lighthouse_launcher.star | 2 +- src/el/besu/besu_launcher.star | 1 + src/el/nimbus-eth1/nimbus_launcher.star | 3 ++- src/participant_network.star | 1 + 5 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/blobber/blobber_launcher.star b/src/blobber/blobber_launcher.star index b7ad94ebc..1af3cdee2 100644 --- a/src/blobber/blobber_launcher.star +++ b/src/blobber/blobber_launcher.star @@ -1,5 +1,6 @@ shared_utils = import_module("../shared_utils/shared_utils.star") input_parser = import_module("../package_io/input_parser.star") +constants = import_module("../package_io/constants.star") cl_context = import_module("../cl/cl_context.star") blobber_context = import_module("../blobber/blobber_context.star") diff --git a/src/cl/lighthouse/lighthouse_launcher.star b/src/cl/lighthouse/lighthouse_launcher.star index c1fda74ba..7e65badda 100644 --- a/src/cl/lighthouse/lighthouse_launcher.star +++ b/src/cl/lighthouse/lighthouse_launcher.star @@ -90,7 +90,7 @@ def launch( node_selectors, use_separate_vc=True, keymanager_enabled=False, - nat_exit_ip, + nat_exit_ip=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, ): beacon_service_name = "{0}".format(service_name) diff --git a/src/el/besu/besu_launcher.star b/src/el/besu/besu_launcher.star index 40f23bfcc..9f665196e 100644 --- a/src/el/besu/besu_launcher.star +++ b/src/el/besu/besu_launcher.star @@ -175,6 +175,7 @@ def get_config( el_volume_size, tolerations, node_selectors, + nat_exit_ip, ): cmd = [ "besu", diff --git a/src/el/nimbus-eth1/nimbus_launcher.star b/src/el/nimbus-eth1/nimbus_launcher.star index d083a8ffc..2a7b4eb50 100644 --- a/src/el/nimbus-eth1/nimbus_launcher.star +++ b/src/el/nimbus-eth1/nimbus_launcher.star @@ -130,6 +130,7 @@ def launch( el_volume_size, tolerations, node_selectors, + nat_exit_ip, ) service = plan.add_service(service_name, config) @@ -246,7 +247,7 @@ def get_config( ports=USED_PORTS, cmd=cmd, files=files, - private_ip_address_placeholder=PRIVATE_IP_ADDRESS_PLACEHOLDER, + private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, min_cpu=el_min_cpu, max_cpu=el_max_cpu, min_memory=el_min_mem, diff --git a/src/participant_network.star b/src/participant_network.star index 5d6d1891f..bf2955ff5 100644 --- a/src/participant_network.star +++ b/src/participant_network.star @@ -182,6 +182,7 @@ def launch_participant_network( validator_data, prysm_password_relative_filepath, prysm_password_artifact_uuid, + nat_exit_ip, ) ethereum_metrics_exporter_context = None From be2c70e4b84012eff731ee5086d60edce10dd7b9 Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Tue, 30 Apr 2024 15:12:32 +0100 Subject: [PATCH 07/23] remove defaults --- src/cl/lighthouse/lighthouse_launcher.star | 6 +++--- src/cl/lodestar/lodestar_launcher.star | 6 +++--- src/cl/prysm/prysm_launcher.star | 6 +++--- src/el/el_context.star | 2 -- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/cl/lighthouse/lighthouse_launcher.star b/src/cl/lighthouse/lighthouse_launcher.star index 7e65badda..6ad6061d0 100644 --- a/src/cl/lighthouse/lighthouse_launcher.star +++ b/src/cl/lighthouse/lighthouse_launcher.star @@ -88,9 +88,9 @@ def launch( participant_tolerations, global_tolerations, node_selectors, - use_separate_vc=True, - keymanager_enabled=False, - nat_exit_ip=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, + use_separate_vc, + keymanager_enabled, + nat_exit_ip, ): beacon_service_name = "{0}".format(service_name) diff --git a/src/cl/lodestar/lodestar_launcher.star b/src/cl/lodestar/lodestar_launcher.star index beb8d9420..e4e337e4f 100644 --- a/src/cl/lodestar/lodestar_launcher.star +++ b/src/cl/lodestar/lodestar_launcher.star @@ -77,9 +77,9 @@ def launch( participant_tolerations, global_tolerations, node_selectors, - use_separate_vc=True, - keymanager_enabled=False, - nat_exit_ip=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, + use_separate_vc, + keymanager_enabled, + nat_exit_ip, ): beacon_service_name = "{0}".format(service_name) log_level = input_parser.get_client_log_level_or_default( diff --git a/src/cl/prysm/prysm_launcher.star b/src/cl/prysm/prysm_launcher.star index 6bffc86fd..078bc5479 100644 --- a/src/cl/prysm/prysm_launcher.star +++ b/src/cl/prysm/prysm_launcher.star @@ -84,9 +84,9 @@ def launch( participant_tolerations, global_tolerations, node_selectors, - use_separate_vc=True, - keymanager_enabled=False, - nat_exit_ip=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, + use_separate_vc, + keymanager_enabled, + nat_exit_ip, ): beacon_service_name = "{0}".format(service_name) log_level = input_parser.get_client_log_level_or_default( diff --git a/src/el/el_context.star b/src/el/el_context.star index 750e13ced..a2dd8d77e 100644 --- a/src/el/el_context.star +++ b/src/el/el_context.star @@ -8,7 +8,6 @@ def new_el_context( engine_rpc_port_num, service_name="", el_metrics_info=None, - nat_exit_ip=None, ): return struct( service_name=service_name, @@ -20,5 +19,4 @@ def new_el_context( ws_port_num=ws_port_num, engine_rpc_port_num=engine_rpc_port_num, el_metrics_info=el_metrics_info, - nat_exit_ip=nat_exit_ip, ) From c658001aafd7988a8b5f17eb55f027a5240419d4 Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Tue, 30 Apr 2024 15:15:10 +0100 Subject: [PATCH 08/23] fix nethermind --- src/el/nethermind/nethermind_launcher.star | 1 + 1 file changed, 1 insertion(+) diff --git a/src/el/nethermind/nethermind_launcher.star b/src/el/nethermind/nethermind_launcher.star index 6c25df46a..f860b12e2 100644 --- a/src/el/nethermind/nethermind_launcher.star +++ b/src/el/nethermind/nethermind_launcher.star @@ -126,6 +126,7 @@ def launch( el_volume_size, tolerations, node_selectors, + nat_exit_ip, ) service = plan.add_service(service_name, config) From fc51a1d1b768dedb57dcec41876fdfc0ff9fa1e7 Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Tue, 30 Apr 2024 15:36:56 +0100 Subject: [PATCH 09/23] public ip setting --- README.md | 1 + src/package_io/input_parser.star | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/README.md b/README.md index f0b7f86a4..401d7ab94 100644 --- a/README.md +++ b/README.md @@ -755,6 +755,7 @@ keymanager_enabled: false # Global paarameter to set the exit ip address of services # if you have a service that you want to expose on a specific interfact; set that IP here +# if you set it to auto it gets the public ip from ident.me and sets it # Defaults to constants.PRIVATE_IP_ADDRESS_PLACEHOLDER # The default value just means its the IP address of the container in which the service is running nat_exit_ip: KURTOSIS_IP_ADDR_PLACEHOLDER diff --git a/src/package_io/input_parser.star b/src/package_io/input_parser.star index e5b51b8e9..4a0918aae 100644 --- a/src/package_io/input_parser.star +++ b/src/package_io/input_parser.star @@ -147,6 +147,9 @@ def input_parser(plan, input_args): result.get("mev_type"), ) + if result["nat_exit_ip"] == "auto": + result["nat_exit_ip"] = get_public_ip(plan) + return struct( participants=[ struct( @@ -880,3 +883,10 @@ def deep_copy_participant(participant): else: part[k] = v return part + + +def get_public_ip(plan): + response = plan.run_sh( + run = "curl https://ident.me", + ) + return response.output \ No newline at end of file From 76d6788bc565ea7c5d7c8876b14d6406775d7fdb Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Tue, 30 Apr 2024 15:42:40 +0100 Subject: [PATCH 10/23] make less gheto --- src/package_io/input_parser.star | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/package_io/input_parser.star b/src/package_io/input_parser.star index 4a0918aae..dab4a1f93 100644 --- a/src/package_io/input_parser.star +++ b/src/package_io/input_parser.star @@ -887,6 +887,6 @@ def deep_copy_participant(participant): def get_public_ip(plan): response = plan.run_sh( - run = "curl https://ident.me", + run="curl -s https://ident.me", ) - return response.output \ No newline at end of file + return response.output From fb00612296ffbb4bfda5af139925ff9d18ff690a Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Tue, 30 Apr 2024 15:49:26 +0100 Subject: [PATCH 11/23] remove some more default args in favor of arg passing --- src/participant_network.star | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/participant_network.star b/src/participant_network.star index bf2955ff5..6cc832236 100644 --- a/src/participant_network.star +++ b/src/participant_network.star @@ -39,8 +39,8 @@ def launch_participant_network( global_tolerations, global_node_selectors, keymanager_enabled, - parallel_keystore_generation=False, - nat_exit_ip=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, + parallel_keystore_generation, + nat_exit_ip, ): network_id = network_params.network_id latest_block = "" From e36151d85c6b89e435fcc375ff93d5bebf2f59f4 Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Wed, 1 May 2024 11:45:20 +0100 Subject: [PATCH 12/23] migrated geth to use public ports --- README.md | 16 +++-- main.star | 2 +- network_params.yaml | 2 +- src/cl/cl_launcher.star | 6 +- src/cl/grandine/grandine_launcher.star | 8 +-- src/cl/lighthouse/lighthouse_launcher.star | 8 +-- src/cl/lodestar/lodestar_launcher.star | 8 +-- src/cl/nimbus/nimbus_launcher.star | 8 +-- src/cl/prysm/prysm_launcher.star | 8 +-- src/cl/teku/teku_launcher.star | 8 +-- src/el/besu/besu_launcher.star | 8 +-- src/el/el_launcher.star | 4 +- src/el/erigon/erigon_launcher.star | 8 +-- src/el/ethereumjs/ethereumjs_launcher.star | 8 +-- src/el/geth/geth_launcher.star | 70 ++++++++++++++-------- src/el/nethermind/nethermind_launcher.star | 8 +-- src/el/nimbus-eth1/nimbus_launcher.star | 8 +-- src/el/reth/reth_launcher.star | 8 +-- src/package_io/input_parser.star | 22 +++++-- src/participant_network.star | 6 +- 20 files changed, 130 insertions(+), 94 deletions(-) diff --git a/README.md b/README.md index 401d7ab94..d204813ab 100644 --- a/README.md +++ b/README.md @@ -753,12 +753,16 @@ global_node_selectors: {} # Defaults to false keymanager_enabled: false -# Global paarameter to set the exit ip address of services -# if you have a service that you want to expose on a specific interfact; set that IP here -# if you set it to auto it gets the public ip from ident.me and sets it -# Defaults to constants.PRIVATE_IP_ADDRESS_PLACEHOLDER -# The default value just means its the IP address of the container in which the service is running -nat_exit_ip: KURTOSIS_IP_ADDR_PLACEHOLDER +# Global paarameter to set the exit ip address of services and public ports +port_publisher: + # if you have a service that you want to expose on a specific interfact; set that IP here + # if you set it to auto it gets the public ip from ident.me and sets it + # Defaults to constants.PRIVATE_IP_ADDRESS_PLACEHOLDER + # The default value just means its the IP address of the container in which the service is running + nat_exit_ip: KURTOSIS_IP_ADDR_PLACEHOLDER + # The start value gets used as a seed for TCP and UDP discovery ports for el/cl client + # Defaults to None - no public ports + public_port_start: None ``` #### Example configurations diff --git a/main.star b/main.star index 135f4d021..a5a71ab9e 100644 --- a/main.star +++ b/main.star @@ -115,7 +115,7 @@ def run(plan, args={}): global_node_selectors, keymanager_enabled, parallel_keystore_generation, - args_with_right_defaults.nat_exit_ip, + args_with_right_defaults.port_publisher, ) plan.print( diff --git a/network_params.yaml b/network_params.yaml index 5b228b8d2..618888de1 100644 --- a/network_params.yaml +++ b/network_params.yaml @@ -138,4 +138,4 @@ xatu_sentry_params: global_tolerations: [] global_node_selectors: {} keymanager_enabled: false -nat_exit_ip: KURTOSIS_IP_ADDR_PLACEHOLDER +port_publisher: KURTOSIS_IP_ADDR_PLACEHOLDER diff --git a/src/cl/cl_launcher.star b/src/cl/cl_launcher.star index 7ebb78727..5b4373771 100644 --- a/src/cl/cl_launcher.star +++ b/src/cl/cl_launcher.star @@ -31,7 +31,7 @@ def launch( validator_data, prysm_password_relative_filepath, prysm_password_artifact_uuid, - nat_exit_ip, + port_publisher, ): plan.print("Launching CL network") @@ -176,7 +176,7 @@ def launch( node_selectors, participant.use_separate_vc, participant.keymanager_enabled, - nat_exit_ip, + port_publisher, ) else: boot_cl_client_ctx = all_cl_contexts @@ -210,7 +210,7 @@ def launch( node_selectors, participant.use_separate_vc, participant.keymanager_enabled, - nat_exit_ip, + port_publisher, ) # Add participant cl additional prometheus labels diff --git a/src/cl/grandine/grandine_launcher.star b/src/cl/grandine/grandine_launcher.star index 2019e81ec..b20292449 100644 --- a/src/cl/grandine/grandine_launcher.star +++ b/src/cl/grandine/grandine_launcher.star @@ -86,7 +86,7 @@ def launch( node_selectors, use_separate_vc, keymanager_enabled, - nat_exit_ip, + port_publisher, ): beacon_service_name = "{0}".format(service_name) log_level = input_parser.get_client_log_level_or_default( @@ -147,7 +147,7 @@ def launch( cl_volume_size, tolerations, node_selectors, - nat_exit_ip, + port_publisher, ) beacon_service = plan.add_service(service_name, config) @@ -227,7 +227,7 @@ def get_beacon_config( cl_volume_size, tolerations, node_selectors, - nat_exit_ip, + port_publisher, ): validator_keys_dirpath = "" validator_secrets_dirpath = "" @@ -264,7 +264,7 @@ def get_beacon_config( "--eth1-rpc-urls=" + EXECUTION_ENGINE_ENDPOINT, # vvvvvvvvvvvvvvvvvvv REMOVE THESE WHEN CONNECTING TO EXTERNAL NET vvvvvvvvvvvvvvvvvvvvv "--disable-enr-auto-update", - "--enr-address=" + nat_exit_ip, + "--enr-address=" + port_publisher.nat_exit_ip, "--enr-udp-port={0}".format(BEACON_DISCOVERY_PORT_NUM), "--enr-tcp-port={0}".format(BEACON_DISCOVERY_PORT_NUM), # ^^^^^^^^^^^^^^^^^^^ REMOVE THESE WHEN CONNECTING TO EXTERNAL NET ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/cl/lighthouse/lighthouse_launcher.star b/src/cl/lighthouse/lighthouse_launcher.star index 6ad6061d0..3e9dd6b21 100644 --- a/src/cl/lighthouse/lighthouse_launcher.star +++ b/src/cl/lighthouse/lighthouse_launcher.star @@ -90,7 +90,7 @@ def launch( node_selectors, use_separate_vc, keymanager_enabled, - nat_exit_ip, + port_publisher, ): beacon_service_name = "{0}".format(service_name) @@ -147,7 +147,7 @@ def launch( cl_volume_size, tolerations, node_selectors, - nat_exit_ip, + port_publisher, ) beacon_service = plan.add_service(beacon_service_name, beacon_config) @@ -242,7 +242,7 @@ def get_beacon_config( cl_volume_size, tolerations, node_selectors, - nat_exit_ip, + port_publisher, ): # If snooper is enabled use the snooper engine context, otherwise use the execution client context if snooper_enabled: @@ -271,7 +271,7 @@ def get_beacon_config( "--datadir=" + BEACON_DATA_DIRPATH_ON_BEACON_SERVICE_CONTAINER, # vvvvvvvvvvvvvvvvvvv REMOVE THESE WHEN CONNECTING TO EXTERNAL NET vvvvvvvvvvvvvvvvvvvvv "--disable-enr-auto-update", - "--enr-address=" + nat_exit_ip, + "--enr-address=" + port_publishe.nat_exit_ip, "--enr-udp-port={0}".format(BEACON_DISCOVERY_PORT_NUM), "--enr-tcp-port={0}".format(BEACON_DISCOVERY_PORT_NUM), # ^^^^^^^^^^^^^^^^^^^ REMOVE THESE WHEN CONNECTING TO EXTERNAL NET ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/cl/lodestar/lodestar_launcher.star b/src/cl/lodestar/lodestar_launcher.star index e4e337e4f..bce19b980 100644 --- a/src/cl/lodestar/lodestar_launcher.star +++ b/src/cl/lodestar/lodestar_launcher.star @@ -79,7 +79,7 @@ def launch( node_selectors, use_separate_vc, keymanager_enabled, - nat_exit_ip, + port_publisher, ): beacon_service_name = "{0}".format(service_name) log_level = input_parser.get_client_log_level_or_default( @@ -135,7 +135,7 @@ def launch( cl_volume_size, tolerations, node_selectors, - nat_exit_ip, + port_publisher, ) beacon_service = plan.add_service(beacon_service_name, beacon_config) @@ -234,7 +234,7 @@ def get_beacon_config( cl_volume_size, tolerations, node_selectors, - nat_exit_ip, + port_publisher, ): el_client_rpc_url_str = "http://{0}:{1}".format( el_context.ip_addr, @@ -270,7 +270,7 @@ def get_beacon_config( "--rest.namespace=*", "--rest.port={0}".format(HTTP_PORT_NUM), "--nat=true", - "--enr.ip=" + nat_exit_ip, + "--enr.ip=" + port_publisher.nat_exit_ip, "--enr.tcp={0}".format(DISCOVERY_PORT_NUM), "--enr.udp={0}".format(DISCOVERY_PORT_NUM), # Set per Pari's recommendation to reduce noise in the logs diff --git a/src/cl/nimbus/nimbus_launcher.star b/src/cl/nimbus/nimbus_launcher.star index ed26ed869..a6df5389a 100644 --- a/src/cl/nimbus/nimbus_launcher.star +++ b/src/cl/nimbus/nimbus_launcher.star @@ -102,7 +102,7 @@ def launch( node_selectors, use_separate_vc, keymanager_enabled, - nat_exit_ip, + port_publisher, ): beacon_service_name = "{0}".format(service_name) @@ -163,7 +163,7 @@ def launch( cl_volume_size, tolerations, node_selectors, - nat_exit_ip, + port_publisher, ) beacon_service = plan.add_service(beacon_service_name, beacon_config) @@ -243,7 +243,7 @@ def get_beacon_config( cl_volume_size, tolerations, node_selectors, - nat_exit_ip, + port_publisher, ): validator_keys_dirpath = "" validator_secrets_dirpath = "" @@ -280,7 +280,7 @@ def get_beacon_config( ), "--data-dir=" + BEACON_DATA_DIRPATH_ON_SERVICE_CONTAINER, "--web3-url=" + EXECUTION_ENGINE_ENDPOINT, - "--nat=extip:" + nat_exit_ip, + "--nat=extip:" + port_publisher.nat_exit_ip, "--enr-auto-update=false", "--history={0}".format("archive" if constants.ARCHIVE_MODE else "prune"), "--rest", diff --git a/src/cl/prysm/prysm_launcher.star b/src/cl/prysm/prysm_launcher.star index 078bc5479..0b7114fc4 100644 --- a/src/cl/prysm/prysm_launcher.star +++ b/src/cl/prysm/prysm_launcher.star @@ -86,7 +86,7 @@ def launch( node_selectors, use_separate_vc, keymanager_enabled, - nat_exit_ip, + port_publisher, ): beacon_service_name = "{0}".format(service_name) log_level = input_parser.get_client_log_level_or_default( @@ -141,7 +141,7 @@ def launch( cl_volume_size, tolerations, node_selectors, - nat_exit_ip, + port_publisher, ) beacon_service = plan.add_service(beacon_service_name, beacon_config) @@ -219,7 +219,7 @@ def get_beacon_config( cl_volume_size, tolerations, node_selectors, - nat_exit_ip, + port_publisher, ): # If snooper is enabled use the snooper engine context, otherwise use the execution client context if snooper_enabled: @@ -242,7 +242,7 @@ def get_beacon_config( "--grpc-gateway-host=0.0.0.0", "--grpc-gateway-corsdomain=*", "--grpc-gateway-port={0}".format(HTTP_PORT_NUM), - "--p2p-host-ip=" + nat_exit_ip, + "--p2p-host-ip=" + port_publisher.nat_exit_ip, "--p2p-tcp-port={0}".format(DISCOVERY_TCP_PORT_NUM), "--p2p-udp-port={0}".format(DISCOVERY_UDP_PORT_NUM), "--min-sync-peers={0}".format(MIN_PEERS), diff --git a/src/cl/teku/teku_launcher.star b/src/cl/teku/teku_launcher.star index fc4cccbcb..289dcc18e 100644 --- a/src/cl/teku/teku_launcher.star +++ b/src/cl/teku/teku_launcher.star @@ -88,7 +88,7 @@ def launch( node_selectors, use_separate_vc, keymanager_enabled, - nat_exit_ip, + port_publisher, ): beacon_service_name = "{0}".format(service_name) log_level = input_parser.get_client_log_level_or_default( @@ -150,7 +150,7 @@ def launch( cl_volume_size, tolerations, node_selectors, - nat_exit_ip, + port_publisher, ) beacon_service = plan.add_service(service_name, config) @@ -232,7 +232,7 @@ def get_beacon_config( cl_volume_size, tolerations, node_selectors, - nat_exit_ip, + port_publisher, ): validator_keys_dirpath = "" validator_secrets_dirpath = "" @@ -272,7 +272,7 @@ def get_beacon_config( # Set per Pari's recommendation, to reduce noise in the logs "--p2p-subscribe-all-subnets-enabled=true", "--p2p-peer-lower-bound={0}".format(MIN_PEERS), - "--p2p-advertised-ip=" + nat_exit_ip, + "--p2p-advertised-ip=" + port_publisher.nat_exit_ip, "--p2p-discovery-site-local-addresses-enabled=true", "--rest-api-enabled=true", "--rest-api-docs-enabled=true", diff --git a/src/el/besu/besu_launcher.star b/src/el/besu/besu_launcher.star index 9f665196e..aa71805fd 100644 --- a/src/el/besu/besu_launcher.star +++ b/src/el/besu/besu_launcher.star @@ -79,7 +79,7 @@ def launch( el_volume_size, tolerations, node_selectors, - nat_exit_ip, + port_publisher, ): log_level = input_parser.get_client_log_level_or_default( participant_log_level, global_log_level, VERBOSITY_LEVELS @@ -129,7 +129,7 @@ def launch( el_volume_size, tolerations, node_selectors, - nat_exit_ip, + port_publisher, ) service = plan.add_service(service_name, config) @@ -175,7 +175,7 @@ def get_config( el_volume_size, tolerations, node_selectors, - nat_exit_ip, + port_publisher, ): cmd = [ "besu", @@ -192,7 +192,7 @@ def get_config( "--rpc-ws-port={0}".format(WS_PORT_NUM), "--rpc-ws-api=ADMIN,CLIQUE,ETH,NET,DEBUG,TXPOOL,ENGINE,TRACE,WEB3", "--p2p-enabled=true", - "--p2p-host=" + nat_exit_ip, + "--p2p-host=" + port_publisher.nat_exit_ip, "--p2p-port={0}".format(DISCOVERY_PORT_NUM), "--engine-rpc-enabled=true", "--engine-jwt-secret=" + constants.JWT_MOUNT_PATH_ON_CONTAINER, diff --git a/src/el/el_launcher.star b/src/el/el_launcher.star index 72e403fc5..f08a4379f 100644 --- a/src/el/el_launcher.star +++ b/src/el/el_launcher.star @@ -23,7 +23,7 @@ def launch( persistent, network_id, num_participants, - nat_exit_ip, + port_publisher, ): el_launchers = { constants.EL_TYPE.geth: { @@ -148,7 +148,7 @@ def launch( participant.el_volume_size, tolerations, node_selectors, - nat_exit_ip, + port_publisher, ) # Add participant el additional prometheus metrics for metrics_info in el_context.el_metrics_info: diff --git a/src/el/erigon/erigon_launcher.star b/src/el/erigon/erigon_launcher.star index 40c0eb63b..ac9f9eb88 100644 --- a/src/el/erigon/erigon_launcher.star +++ b/src/el/erigon/erigon_launcher.star @@ -77,7 +77,7 @@ def launch( el_volume_size, tolerations, node_selectors, - nat_exit_ip, + port_publisher, ): log_level = input_parser.get_client_log_level_or_default( participant_log_level, global_log_level, VERBOSITY_LEVELS @@ -129,7 +129,7 @@ def launch( el_volume_size, tolerations, node_selectors, - nat_exit_ip, + port_publisher, ) service = plan.add_service(service_name, config) @@ -179,7 +179,7 @@ def get_config( el_volume_size, tolerations, node_selectors, - nat_exit_ip, + port_publisher, ): init_datadir_cmd_str = "erigon init --datadir={0} {1}".format( EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER, @@ -201,7 +201,7 @@ def get_config( "--http.vhosts=*", "--ws", "--allow-insecure-unlock", - "--nat=extip:" + nat_exit_ip, + "--nat=extip:" + port_publisher.nat_exit_ip, "--http", "--http.addr=0.0.0.0", "--http.corsdomain=*", diff --git a/src/el/ethereumjs/ethereumjs_launcher.star b/src/el/ethereumjs/ethereumjs_launcher.star index 52fd38ad2..cc340e5e8 100644 --- a/src/el/ethereumjs/ethereumjs_launcher.star +++ b/src/el/ethereumjs/ethereumjs_launcher.star @@ -80,7 +80,7 @@ def launch( el_volume_size, tolerations, node_selectors, - nat_exit_ip, + port_publisher, ): log_level = input_parser.get_client_log_level_or_default( participant_log_level, global_log_level, VERBOSITY_LEVELS @@ -130,7 +130,7 @@ def launch( el_volume_size, tolerations, node_selectors, - nat_exit_ip, + port_publisher, ) service = plan.add_service(service_name, config) @@ -175,7 +175,7 @@ def get_config( el_volume_size, tolerations, node_selectors, - nat_exit_ip, + port_publisher, ): cmd = [ "--dataDir=" + EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER, @@ -193,7 +193,7 @@ def get_config( "--wsEnginePort={0}".format(WS_PORT_ENGINE_NUM), "--wsEngineAddr=0.0.0.0", "--jwt-secret=" + constants.JWT_MOUNT_PATH_ON_CONTAINER, - "--extIP={0}".format(nat_exit_ip), + "--extIP={0}".format(port_publisher.nat_exit_ip), "--sync=full", "--isSingleNode=true", "--logLevel={0}".format(verbosity_level), diff --git a/src/el/geth/geth_launcher.star b/src/el/geth/geth_launcher.star index f556d9e48..8e5aa6390 100644 --- a/src/el/geth/geth_launcher.star +++ b/src/el/geth/geth_launcher.star @@ -36,27 +36,28 @@ METRICS_PATH = "/debug/metrics/prometheus" # The dirpath of the execution data directory on the client container EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER = "/data/geth/execution-data" -USED_PORTS = { - RPC_PORT_ID: shared_utils.new_port_spec( - RPC_PORT_NUM, - shared_utils.TCP_PROTOCOL, - shared_utils.HTTP_APPLICATION_PROTOCOL, - ), - WS_PORT_ID: shared_utils.new_port_spec(WS_PORT_NUM, shared_utils.TCP_PROTOCOL), - TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - DISCOVERY_PORT_NUM, shared_utils.TCP_PROTOCOL - ), - UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - DISCOVERY_PORT_NUM, shared_utils.UDP_PROTOCOL - ), - ENGINE_RPC_PORT_ID: shared_utils.new_port_spec( - ENGINE_RPC_PORT_NUM, - shared_utils.TCP_PROTOCOL, - ), - METRICS_PORT_ID: shared_utils.new_port_spec( - METRICS_PORT_NUM, shared_utils.TCP_PROTOCOL - ), -} +def get_used_ports(disovery_port = DISCOVERY_PORT_NUM): + USED_PORTS = { + RPC_PORT_ID: shared_utils.new_port_spec( + RPC_PORT_NUM, + shared_utils.TCP_PROTOCOL, + shared_utils.HTTP_APPLICATION_PROTOCOL, + ), + WS_PORT_ID: shared_utils.new_port_spec(WS_PORT_NUM, shared_utils.TCP_PROTOCOL), + TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.TCP_PROTOCOL + ), + UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.UDP_PROTOCOL + ), + ENGINE_RPC_PORT_ID: shared_utils.new_port_spec( + ENGINE_RPC_PORT_NUM, + shared_utils.TCP_PROTOCOL, + ), + METRICS_PORT_ID: shared_utils.new_port_spec( + METRICS_PORT_NUM, shared_utils.TCP_PROTOCOL + ), + } ENTRYPOINT_ARGS = ["sh", "-c"] @@ -92,7 +93,7 @@ def launch( el_volume_size, tolerations, node_selectors, - nat_exit_ip, + port_publisher, ): log_level = input_parser.get_client_log_level_or_default( participant_log_level, global_log_level, VERBOSITY_LEVELS @@ -145,7 +146,7 @@ def launch( el_volume_size, tolerations, node_selectors, - nat_exit_ip, + port_publisher, ) service = plan.add_service(service_name, config) @@ -196,7 +197,7 @@ def get_config( el_volume_size, tolerations, node_selectors, - nat_exit_ip, + port_publisher, ): if "--gcmode=archive" in extra_params or "--gcmode archive" in extra_params: gcmode_archive = True @@ -233,6 +234,21 @@ def get_config( constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER + "/genesis.json", ) + public_ports = {} + discovery_port = DISCOVERY_PORT_NUM + if port_publisher.public_port_start: + discovery_port = port_publisher.el_start + len(existing_el_clients) + public_ports = { + TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.TCP_PROTOCOL + ), + UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discvoery_port, shared_utils.UDP_PROTOCOL + ), + } + used_ports = get_used_ports(discovery) + + cmd = [ "geth", # Disable path based storage scheme for electra fork and verkle @@ -272,7 +288,7 @@ def get_config( "--ws.api=admin,engine,net,eth,web3,debug", "--ws.origins=*", "--allow-insecure-unlock", - "--nat=extip:" + nat_exit_ip, + "--nat=extip:" + port_publisher.nat_exit_ip, "--verbosity=" + verbosity_level, "--authrpc.port={0}".format(ENGINE_RPC_PORT_NUM), "--authrpc.addr=0.0.0.0", @@ -283,6 +299,7 @@ def get_config( "--metrics", "--metrics.addr=0.0.0.0", "--metrics.port={0}".format(METRICS_PORT_NUM), + "--discovery.port={0}".format(discovery_port) ] if BUILDER_IMAGE_STR in image: @@ -353,7 +370,8 @@ def get_config( ) return ServiceConfig( image=image, - ports=USED_PORTS, + ports=used_ports, + public_ports=public_ports, cmd=[command_str], files=files, entrypoint=ENTRYPOINT_ARGS, diff --git a/src/el/nethermind/nethermind_launcher.star b/src/el/nethermind/nethermind_launcher.star index f860b12e2..e76d94cbd 100644 --- a/src/el/nethermind/nethermind_launcher.star +++ b/src/el/nethermind/nethermind_launcher.star @@ -76,7 +76,7 @@ def launch( el_volume_size, tolerations, node_selectors, - nat_exit_ip, + port_publisher, ): log_level = input_parser.get_client_log_level_or_default( participant_log_level, global_log_level, VERBOSITY_LEVELS @@ -126,7 +126,7 @@ def launch( el_volume_size, tolerations, node_selectors, - nat_exit_ip, + port_publisher, ) service = plan.add_service(service_name, config) @@ -173,7 +173,7 @@ def get_config( el_volume_size, tolerations, node_selectors, - nat_exit_ip, + port_publisher, ): cmd = [ "--log=" + log_level, @@ -186,7 +186,7 @@ def get_config( "--JsonRpc.WebSocketsPort={0}".format(WS_PORT_NUM), "--JsonRpc.EngineHost=0.0.0.0", "--JsonRpc.EnginePort={0}".format(ENGINE_RPC_PORT_NUM), - "--Network.ExternalIp={0}".format(nat_exit_ip), + "--Network.ExternalIp={0}".format(port_publisher.nat_exit_ip), "--Network.DiscoveryPort={0}".format(DISCOVERY_PORT_NUM), "--Network.P2PPort={0}".format(DISCOVERY_PORT_NUM), "--JsonRpc.JwtSecretFile=" + constants.JWT_MOUNT_PATH_ON_CONTAINER, diff --git a/src/el/nimbus-eth1/nimbus_launcher.star b/src/el/nimbus-eth1/nimbus_launcher.star index 2a7b4eb50..0ea4e945b 100644 --- a/src/el/nimbus-eth1/nimbus_launcher.star +++ b/src/el/nimbus-eth1/nimbus_launcher.star @@ -80,7 +80,7 @@ def launch( el_volume_size, tolerations, node_selectors, - nat_exit_ip, + port_publisher, ): log_level = input_parser.get_client_log_level_or_default( participant_log_level, global_log_level, VERBOSITY_LEVELS @@ -130,7 +130,7 @@ def launch( el_volume_size, tolerations, node_selectors, - nat_exit_ip, + port_publisher, ) service = plan.add_service(service_name, config) @@ -176,7 +176,7 @@ def get_config( el_volume_size, tolerations, node_selectors, - nat_exit_ip, + port_publisher, ): cmd = [ "--log-level={0}".format(verbosity_level), @@ -194,7 +194,7 @@ def get_config( "--metrics", "--metrics-address=0.0.0.0", "--metrics-port={0}".format(METRICS_PORT_NUM), - "--nat=extip:{0}".format(nat_exit_ip), + "--nat=extip:{0}".format(port_publisher.nat_exit_ip), ] if ( network not in constants.PUBLIC_NETWORKS diff --git a/src/el/reth/reth_launcher.star b/src/el/reth/reth_launcher.star index 841ff91c5..46731ac62 100644 --- a/src/el/reth/reth_launcher.star +++ b/src/el/reth/reth_launcher.star @@ -79,7 +79,7 @@ def launch( el_volume_size, tolerations, node_selectors, - nat_exit_ip, + port_publisher, ): log_level = input_parser.get_client_log_level_or_default( participant_log_level, global_log_level, VERBOSITY_LEVELS @@ -129,7 +129,7 @@ def launch( el_volume_size, tolerations, node_selectors, - nat_exit_ip, + port_publisher, ) service = plan.add_service(service_name, config) @@ -175,7 +175,7 @@ def get_config( el_volume_size, tolerations, node_selectors, - nat_exit_ip, + port_publisher, ): init_datadir_cmd_str = "reth init --datadir={0} --chain={1}".format( EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER, @@ -204,7 +204,7 @@ def get_config( "--ws.port={0}".format(WS_PORT_NUM), "--ws.api=net,eth", "--ws.origins=*", - "--nat=extip:" + nat_exit_ip, + "--nat=extip:" + port_publisher.nat_exit_ip, "--authrpc.port={0}".format(ENGINE_RPC_PORT_NUM), "--authrpc.jwtsecret=" + constants.JWT_MOUNT_PATH_ON_CONTAINER, "--authrpc.addr=0.0.0.0", diff --git a/src/package_io/input_parser.star b/src/package_io/input_parser.star index dab4a1f93..83fcc130f 100644 --- a/src/package_io/input_parser.star +++ b/src/package_io/input_parser.star @@ -65,6 +65,7 @@ ATTR_TO_BE_SKIPPED_AT_ROOT = ( "tx_spammer_params", "custom_flood_params", "xatu_sentry_params", + "port_publisher" ) @@ -135,6 +136,10 @@ def input_parser(plan, input_args): for sub_attr in input_args["xatu_sentry_params"]: sub_value = input_args["xatu_sentry_params"][sub_attr] result["xatu_sentry_params"][sub_attr] = sub_value + elif attr == "port_publisher": + for sub_attr in input_args["port_publisher"]: + sub_value = input_args["port_publisher"][sub_attr] + result["port_publisher"][sub_attr] = sub_value if result.get("disable_peer_scoring"): result = enrich_disable_peer_scoring(result) @@ -147,8 +152,14 @@ def input_parser(plan, input_args): result.get("mev_type"), ) - if result["nat_exit_ip"] == "auto": - result["nat_exit_ip"] = get_public_ip(plan) + if result["port_publisher"]["nat_exit_ip"] == "auto": + result["port_publisher"]["nat_exit_ip"] = get_public_ip(plan) + + if result["port_publisher"]["public_port_start"] != None: + start = result["port_publisher"]["public_port_start"] + result["port_publisher"]["el_start"] = start + result["port_publisher"]["cl_start"] = start + len(result["participants"]) + return struct( participants=[ @@ -306,7 +317,7 @@ def input_parser(plan, input_args): global_tolerations=result["global_tolerations"], global_node_selectors=result["global_node_selectors"], keymanager_enabled=result["keymanager_enabled"], - nat_exit_ip=result["nat_exit_ip"], + port_publisher=result["port_publisher"], ) @@ -615,7 +626,10 @@ def default_input_args(): "global_tolerations": [], "global_node_selectors": {}, "keymanager_enabled": False, - "nat_exit_ip": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, + "port_publisher": { + "nat_exit_ip": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, + "public_port_start": None, + }, } diff --git a/src/participant_network.star b/src/participant_network.star index 6cc832236..54fe05027 100644 --- a/src/participant_network.star +++ b/src/participant_network.star @@ -40,7 +40,7 @@ def launch_participant_network( global_node_selectors, keymanager_enabled, parallel_keystore_generation, - nat_exit_ip, + port_publisher, ): network_id = network_params.network_id latest_block = "" @@ -146,7 +146,7 @@ def launch_participant_network( persistent, network_id, num_participants, - nat_exit_ip, + port_publisher, ) # Launch all consensus layer clients @@ -182,7 +182,7 @@ def launch_participant_network( validator_data, prysm_password_relative_filepath, prysm_password_artifact_uuid, - nat_exit_ip, + port_publisher, ) ethereum_metrics_exporter_context = None From 2a7a6413fbaacb6b8cfe39d6173564ad08b8b84f Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Wed, 1 May 2024 12:33:02 +0100 Subject: [PATCH 13/23] fix el --- src/el/besu/besu_launcher.star | 61 +++++++++++++------- src/el/erigon/erigon_launcher.star | 61 +++++++++++++------- src/el/ethereumjs/ethereumjs_launcher.star | 63 ++++++++++++++------- src/el/geth/geth_launcher.star | 14 +++-- src/el/nethermind/nethermind_launcher.star | 63 ++++++++++++++------- src/el/nimbus-eth1/nimbus_launcher.star | 65 ++++++++++++++-------- src/el/reth/reth_launcher.star | 53 ++++++++++++------ src/package_io/input_parser.star | 3 +- 8 files changed, 251 insertions(+), 132 deletions(-) diff --git a/src/el/besu/besu_launcher.star b/src/el/besu/besu_launcher.star index aa71805fd..1dcd17a50 100644 --- a/src/el/besu/besu_launcher.star +++ b/src/el/besu/besu_launcher.star @@ -30,24 +30,30 @@ ENGINE_HTTP_RPC_PORT_ID = "engine-rpc" METRICS_PORT_ID = "metrics" JAVA_OPTS = {"JAVA_OPTS": "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n"} -USED_PORTS = { - RPC_PORT_ID: shared_utils.new_port_spec( - RPC_PORT_NUM, shared_utils.TCP_PROTOCOL, shared_utils.HTTP_APPLICATION_PROTOCOL - ), - WS_PORT_ID: shared_utils.new_port_spec(WS_PORT_NUM, shared_utils.TCP_PROTOCOL), - TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - DISCOVERY_PORT_NUM, shared_utils.TCP_PROTOCOL - ), - UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - DISCOVERY_PORT_NUM, shared_utils.UDP_PROTOCOL - ), - ENGINE_HTTP_RPC_PORT_ID: shared_utils.new_port_spec( - ENGINE_HTTP_RPC_PORT_NUM, shared_utils.TCP_PROTOCOL - ), - METRICS_PORT_ID: shared_utils.new_port_spec( - METRICS_PORT_NUM, shared_utils.TCP_PROTOCOL - ), -} + +def get_used_ports(discovery_port=DISCOVERY_PORT_NUM): + used_ports = { + RPC_PORT_ID: shared_utils.new_port_spec( + RPC_PORT_NUM, + shared_utils.TCP_PROTOCOL, + shared_utils.HTTP_APPLICATION_PROTOCOL, + ), + WS_PORT_ID: shared_utils.new_port_spec(WS_PORT_NUM, shared_utils.TCP_PROTOCOL), + TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.TCP_PROTOCOL + ), + UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.UDP_PROTOCOL + ), + ENGINE_HTTP_RPC_PORT_ID: shared_utils.new_port_spec( + ENGINE_HTTP_RPC_PORT_NUM, shared_utils.TCP_PROTOCOL + ), + METRICS_PORT_ID: shared_utils.new_port_spec( + METRICS_PORT_NUM, shared_utils.TCP_PROTOCOL + ), + } + return used_ports + ENTRYPOINT_ARGS = ["sh", "-c"] @@ -177,6 +183,20 @@ def get_config( node_selectors, port_publisher, ): + public_ports = {} + discovery_port = DISCOVERY_PORT_NUM + if port_publisher.public_port_start: + discovery_port = port_publisher.el_start + len(existing_el_clients) + public_ports = { + TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.TCP_PROTOCOL + ), + UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.UDP_PROTOCOL + ), + } + used_ports = get_used_ports(discovery_port) + cmd = [ "besu", "--logging=" + log_level, @@ -193,7 +213,7 @@ def get_config( "--rpc-ws-api=ADMIN,CLIQUE,ETH,NET,DEBUG,TXPOOL,ENGINE,TRACE,WEB3", "--p2p-enabled=true", "--p2p-host=" + port_publisher.nat_exit_ip, - "--p2p-port={0}".format(DISCOVERY_PORT_NUM), + "--p2p-port={0}".format(discovery_port), "--engine-rpc-enabled=true", "--engine-jwt-secret=" + constants.JWT_MOUNT_PATH_ON_CONTAINER, "--engine-host-allowlist=*", @@ -257,7 +277,8 @@ def get_config( ) return ServiceConfig( image=image, - ports=USED_PORTS, + ports=used_ports, + public_ports=public_ports, cmd=[cmd_str], files=files, env_vars=extra_env_vars, diff --git a/src/el/erigon/erigon_launcher.star b/src/el/erigon/erigon_launcher.star index ac9f9eb88..9c96b7744 100644 --- a/src/el/erigon/erigon_launcher.star +++ b/src/el/erigon/erigon_launcher.star @@ -27,25 +27,29 @@ UDP_DISCOVERY_PORT_ID = "udp-discovery" ENGINE_RPC_PORT_ID = "engine-rpc" METRICS_PORT_ID = "metrics" -USED_PORTS = { - WS_RPC_PORT_ID: shared_utils.new_port_spec( - WS_RPC_PORT_NUM, - shared_utils.TCP_PROTOCOL, - shared_utils.HTTP_APPLICATION_PROTOCOL, - ), - TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - DISCOVERY_PORT_NUM, shared_utils.TCP_PROTOCOL - ), - UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - DISCOVERY_PORT_NUM, shared_utils.UDP_PROTOCOL - ), - ENGINE_RPC_PORT_ID: shared_utils.new_port_spec( - ENGINE_RPC_PORT_NUM, shared_utils.TCP_PROTOCOL - ), - METRICS_PORT_ID: shared_utils.new_port_spec( - METRICS_PORT_NUM, shared_utils.TCP_PROTOCOL - ), -} + +def get_used_ports(discovery_port=DISCOVERY_PORT_NUM): + used_ports = { + WS_RPC_PORT_ID: shared_utils.new_port_spec( + WS_RPC_PORT_NUM, + shared_utils.TCP_PROTOCOL, + shared_utils.HTTP_APPLICATION_PROTOCOL, + ), + TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.TCP_PROTOCOL + ), + UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.UDP_PROTOCOL + ), + ENGINE_RPC_PORT_ID: shared_utils.new_port_spec( + ENGINE_RPC_PORT_NUM, shared_utils.TCP_PROTOCOL + ), + METRICS_PORT_ID: shared_utils.new_port_spec( + METRICS_PORT_NUM, shared_utils.TCP_PROTOCOL + ), + } + return used_ports + ENTRYPOINT_ARGS = ["sh", "-c"] @@ -186,6 +190,20 @@ def get_config( constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER + "/genesis.json", ) + public_ports = {} + discovery_port = DISCOVERY_PORT_NUM + if port_publisher.public_port_start: + discovery_port = port_publisher.el_start + len(existing_el_clients) + public_ports = { + TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.TCP_PROTOCOL + ), + UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.UDP_PROTOCOL + ), + } + used_ports = get_used_ports(discovery_port) + cmd = [ "erigon", "{0}".format( @@ -196,7 +214,7 @@ def get_config( "--networkid={0}".format(networkid), "--log.console.verbosity=" + verbosity_level, "--datadir=" + EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER, - "--port={0}".format(DISCOVERY_PORT_NUM), + "--port={0}".format(discovery_port), "--http.api=eth,erigon,engine,web3,net,debug,trace,txpool,admin", "--http.vhosts=*", "--ws", @@ -257,7 +275,8 @@ def get_config( return ServiceConfig( image=image, - ports=USED_PORTS, + ports=used_ports, + public_ports=public_ports, cmd=[command_arg_str], files=files, entrypoint=ENTRYPOINT_ARGS, diff --git a/src/el/ethereumjs/ethereumjs_launcher.star b/src/el/ethereumjs/ethereumjs_launcher.star index cc340e5e8..5066b0a44 100644 --- a/src/el/ethereumjs/ethereumjs_launcher.star +++ b/src/el/ethereumjs/ethereumjs_launcher.star @@ -30,25 +30,31 @@ METRICS_PATH = "/metrics" # The dirpath of the execution data directory on the client container EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER = "/data/ethereumjs/execution-data" -USED_PORTS = { - RPC_PORT_ID: shared_utils.new_port_spec( - RPC_PORT_NUM, shared_utils.TCP_PROTOCOL, shared_utils.HTTP_APPLICATION_PROTOCOL - ), - WS_PORT_ID: shared_utils.new_port_spec(WS_PORT_NUM, shared_utils.TCP_PROTOCOL), - WS_PORT_ENGINE_ID: shared_utils.new_port_spec( - WS_PORT_ENGINE_NUM, shared_utils.TCP_PROTOCOL - ), - TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - DISCOVERY_PORT_NUM, shared_utils.TCP_PROTOCOL - ), - UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - DISCOVERY_PORT_NUM, shared_utils.UDP_PROTOCOL - ), - ENGINE_RPC_PORT_ID: shared_utils.new_port_spec( - ENGINE_RPC_PORT_NUM, shared_utils.TCP_PROTOCOL - ), - # METRICS_PORT_ID: shared_utils.new_port_spec(METRICS_PORT_NUM, shared_utils.TCP_PROTOCOL) -} + +def get_used_ports(discovery_port=DISCOVERY_PORT_NUM): + used_ports = { + RPC_PORT_ID: shared_utils.new_port_spec( + RPC_PORT_NUM, + shared_utils.TCP_PROTOCOL, + shared_utils.HTTP_APPLICATION_PROTOCOL, + ), + WS_PORT_ID: shared_utils.new_port_spec(WS_PORT_NUM, shared_utils.TCP_PROTOCOL), + WS_PORT_ENGINE_ID: shared_utils.new_port_spec( + WS_PORT_ENGINE_NUM, shared_utils.TCP_PROTOCOL + ), + TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + DISCOVERY_PORT_NUM, shared_utils.TCP_PROTOCOL + ), + UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + DISCOVERY_PORT_NUM, shared_utils.UDP_PROTOCOL + ), + ENGINE_RPC_PORT_ID: shared_utils.new_port_spec( + ENGINE_RPC_PORT_NUM, shared_utils.TCP_PROTOCOL + ), + # METRICS_PORT_ID: shared_utils.new_port_spec(METRICS_PORT_NUM, shared_utils.TCP_PROTOCOL) + } + return used_ports + ENTRYPOINT_ARGS = [] @@ -177,9 +183,23 @@ def get_config( node_selectors, port_publisher, ): + public_ports = {} + discovery_port = DISCOVERY_PORT_NUM + if port_publisher.public_port_start: + discovery_port = port_publisher.el_start + len(existing_el_clients) + public_ports = { + TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.TCP_PROTOCOL + ), + UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.UDP_PROTOCOL + ), + } + used_ports = get_used_ports(discovery_port) + cmd = [ "--dataDir=" + EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER, - "--port={0}".format(DISCOVERY_PORT_NUM), + "--port={0}".format(discovery_port), "--rpc", "--rpcAddr=0.0.0.0", "--rpcPort={0}".format(RPC_PORT_NUM), @@ -243,7 +263,8 @@ def get_config( ) return ServiceConfig( image=image, - ports=USED_PORTS, + ports=used_ports, + public_ports=public_ports, cmd=cmd, files=files, entrypoint=ENTRYPOINT_ARGS, diff --git a/src/el/geth/geth_launcher.star b/src/el/geth/geth_launcher.star index 8e5aa6390..eea4c0950 100644 --- a/src/el/geth/geth_launcher.star +++ b/src/el/geth/geth_launcher.star @@ -36,8 +36,9 @@ METRICS_PATH = "/debug/metrics/prometheus" # The dirpath of the execution data directory on the client container EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER = "/data/geth/execution-data" -def get_used_ports(disovery_port = DISCOVERY_PORT_NUM): - USED_PORTS = { + +def get_used_ports(disovery_port=DISCOVERY_PORT_NUM): + used_ports = { RPC_PORT_ID: shared_utils.new_port_spec( RPC_PORT_NUM, shared_utils.TCP_PROTOCOL, @@ -58,6 +59,8 @@ def get_used_ports(disovery_port = DISCOVERY_PORT_NUM): METRICS_PORT_NUM, shared_utils.TCP_PROTOCOL ), } + return used_ports + ENTRYPOINT_ARGS = ["sh", "-c"] @@ -243,11 +246,10 @@ def get_config( discovery_port, shared_utils.TCP_PROTOCOL ), UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - discvoery_port, shared_utils.UDP_PROTOCOL + discovery_port, shared_utils.UDP_PROTOCOL ), } - used_ports = get_used_ports(discovery) - + used_ports = get_used_ports(discovery_port) cmd = [ "geth", @@ -299,7 +301,7 @@ def get_config( "--metrics", "--metrics.addr=0.0.0.0", "--metrics.port={0}".format(METRICS_PORT_NUM), - "--discovery.port={0}".format(discovery_port) + "--discovery.port={0}".format(discovery_port), ] if BUILDER_IMAGE_STR in image: diff --git a/src/el/nethermind/nethermind_launcher.star b/src/el/nethermind/nethermind_launcher.star index e76d94cbd..7945ed6b3 100644 --- a/src/el/nethermind/nethermind_launcher.star +++ b/src/el/nethermind/nethermind_launcher.star @@ -29,24 +29,30 @@ UDP_DISCOVERY_PORT_ID = "udp-discovery" ENGINE_RPC_PORT_ID = "engine-rpc" METRICS_PORT_ID = "metrics" -USED_PORTS = { - RPC_PORT_ID: shared_utils.new_port_spec( - RPC_PORT_NUM, shared_utils.TCP_PROTOCOL, shared_utils.HTTP_APPLICATION_PROTOCOL - ), - WS_PORT_ID: shared_utils.new_port_spec(WS_PORT_NUM, shared_utils.TCP_PROTOCOL), - TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - DISCOVERY_PORT_NUM, shared_utils.TCP_PROTOCOL - ), - UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - DISCOVERY_PORT_NUM, shared_utils.UDP_PROTOCOL - ), - ENGINE_RPC_PORT_ID: shared_utils.new_port_spec( - ENGINE_RPC_PORT_NUM, shared_utils.TCP_PROTOCOL - ), - METRICS_PORT_ID: shared_utils.new_port_spec( - METRICS_PORT_NUM, shared_utils.TCP_PROTOCOL - ), -} + +def get_used_ports(discovery_port=DISCOVERY_PORT_NUM): + used_ports = { + RPC_PORT_ID: shared_utils.new_port_spec( + RPC_PORT_NUM, + shared_utils.TCP_PROTOCOL, + shared_utils.HTTP_APPLICATION_PROTOCOL, + ), + WS_PORT_ID: shared_utils.new_port_spec(WS_PORT_NUM, shared_utils.TCP_PROTOCOL), + TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + DISCOVERY_PORT_NUM, shared_utils.TCP_PROTOCOL + ), + UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + DISCOVERY_PORT_NUM, shared_utils.UDP_PROTOCOL + ), + ENGINE_RPC_PORT_ID: shared_utils.new_port_spec( + ENGINE_RPC_PORT_NUM, shared_utils.TCP_PROTOCOL + ), + METRICS_PORT_ID: shared_utils.new_port_spec( + METRICS_PORT_NUM, shared_utils.TCP_PROTOCOL + ), + } + return used_ports + VERBOSITY_LEVELS = { constants.GLOBAL_LOG_LEVEL.error: "ERROR", @@ -175,6 +181,20 @@ def get_config( node_selectors, port_publisher, ): + public_ports = {} + discovery_port = DISCOVERY_PORT_NUM + if port_publisher.public_port_start: + discovery_port = port_publisher.el_start + len(existing_el_clients) + public_ports = { + TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.TCP_PROTOCOL + ), + UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.UDP_PROTOCOL + ), + } + used_ports = get_used_ports(discovery_port) + cmd = [ "--log=" + log_level, "--datadir=" + EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER, @@ -187,8 +207,8 @@ def get_config( "--JsonRpc.EngineHost=0.0.0.0", "--JsonRpc.EnginePort={0}".format(ENGINE_RPC_PORT_NUM), "--Network.ExternalIp={0}".format(port_publisher.nat_exit_ip), - "--Network.DiscoveryPort={0}".format(DISCOVERY_PORT_NUM), - "--Network.P2PPort={0}".format(DISCOVERY_PORT_NUM), + "--Network.DiscoveryPort={0}".format(discovery_port), + "--Network.P2PPort={0}".format(discovery_port), "--JsonRpc.JwtSecretFile=" + constants.JWT_MOUNT_PATH_ON_CONTAINER, "--Metrics.Enabled=true", "--Metrics.ExposePort={0}".format(METRICS_PORT_NUM), @@ -251,7 +271,8 @@ def get_config( return ServiceConfig( image=image, - ports=USED_PORTS, + ports=used_ports, + public_ports=public_ports, cmd=cmd, files=files, private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, diff --git a/src/el/nimbus-eth1/nimbus_launcher.star b/src/el/nimbus-eth1/nimbus_launcher.star index 0ea4e945b..6baf16804 100644 --- a/src/el/nimbus-eth1/nimbus_launcher.star +++ b/src/el/nimbus-eth1/nimbus_launcher.star @@ -27,29 +27,32 @@ METRICS_PATH = "/metrics" # The dirpath of the execution data directory on the client container EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER = "/data/nimbus/execution-data" -USED_PORTS = { - WS_RPC_PORT_ID: shared_utils.new_port_spec( - WS_RPC_PORT_NUM, - shared_utils.TCP_PROTOCOL, - shared_utils.HTTP_APPLICATION_PROTOCOL, - ), - TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - DISCOVERY_PORT_NUM, - shared_utils.TCP_PROTOCOL, - ), - UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - DISCOVERY_PORT_NUM, - shared_utils.UDP_PROTOCOL, - ), - ENGINE_RPC_PORT_ID: shared_utils.new_port_spec( - ENGINE_RPC_PORT_NUM, - shared_utils.TCP_PROTOCOL, - ), - METRICS_PORT_ID: shared_utils.new_port_spec( - METRICS_PORT_NUM, - shared_utils.TCP_PROTOCOL, - ), -} + +def get_used_ports(discovery_port=DISCOVERY_PORT_NUM): + used_ports = { + WS_RPC_PORT_ID: shared_utils.new_port_spec( + WS_RPC_PORT_NUM, + shared_utils.TCP_PROTOCOL, + shared_utils.HTTP_APPLICATION_PROTOCOL, + ), + TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + DISCOVERY_PORT_NUM, + shared_utils.TCP_PROTOCOL, + ), + UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + DISCOVERY_PORT_NUM, + shared_utils.UDP_PROTOCOL, + ), + ENGINE_RPC_PORT_ID: shared_utils.new_port_spec( + ENGINE_RPC_PORT_NUM, + shared_utils.TCP_PROTOCOL, + ), + METRICS_PORT_ID: shared_utils.new_port_spec( + METRICS_PORT_NUM, + shared_utils.TCP_PROTOCOL, + ), + } + return used_ports VERBOSITY_LEVELS = { constants.GLOBAL_LOG_LEVEL.error: "ERROR", @@ -178,6 +181,21 @@ def get_config( node_selectors, port_publisher, ): + + public_ports = {} + discovery_port = DISCOVERY_PORT_NUM + if port_publisher.public_port_start: + discovery_port = port_publisher.el_start + len(existing_el_clients) + public_ports = { + TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.TCP_PROTOCOL + ), + UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.UDP_PROTOCOL + ), + } + used_ports = get_used_ports(discovery_port) + cmd = [ "--log-level={0}".format(verbosity_level), "--data-dir=" + EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER, @@ -195,6 +213,7 @@ def get_config( "--metrics-address=0.0.0.0", "--metrics-port={0}".format(METRICS_PORT_NUM), "--nat=extip:{0}".format(port_publisher.nat_exit_ip), + "--tcp-port={0}".format(discovery_port), ] if ( network not in constants.PUBLIC_NETWORKS diff --git a/src/el/reth/reth_launcher.star b/src/el/reth/reth_launcher.star index 46731ac62..6f8909a13 100644 --- a/src/el/reth/reth_launcher.star +++ b/src/el/reth/reth_launcher.star @@ -29,24 +29,26 @@ METRICS_PATH = "/metrics" # The dirpath of the execution data directory on the client container EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER = "/data/reth/execution-data" -USED_PORTS = { - RPC_PORT_ID: shared_utils.new_port_spec( - RPC_PORT_NUM, shared_utils.TCP_PROTOCOL, shared_utils.HTTP_APPLICATION_PROTOCOL - ), - WS_PORT_ID: shared_utils.new_port_spec(WS_PORT_NUM, shared_utils.TCP_PROTOCOL), - TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - DISCOVERY_PORT_NUM, shared_utils.TCP_PROTOCOL - ), - UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - DISCOVERY_PORT_NUM, shared_utils.UDP_PROTOCOL - ), - ENGINE_RPC_PORT_ID: shared_utils.new_port_spec( - ENGINE_RPC_PORT_NUM, shared_utils.TCP_PROTOCOL - ), - METRICS_PORT_ID: shared_utils.new_port_spec( - METRICS_PORT_NUM, shared_utils.TCP_PROTOCOL - ), -} +def get_used_ports(discovery_port=DISCOVERY_PORT_NUM): + used_ports = { + RPC_PORT_ID: shared_utils.new_port_spec( + RPC_PORT_NUM, shared_utils.TCP_PROTOCOL, shared_utils.HTTP_APPLICATION_PROTOCOL + ), + WS_PORT_ID: shared_utils.new_port_spec(WS_PORT_NUM, shared_utils.TCP_PROTOCOL), + TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + DISCOVERY_PORT_NUM, shared_utils.TCP_PROTOCOL + ), + UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + DISCOVERY_PORT_NUM, shared_utils.UDP_PROTOCOL + ), + ENGINE_RPC_PORT_ID: shared_utils.new_port_spec( + ENGINE_RPC_PORT_NUM, shared_utils.TCP_PROTOCOL + ), + METRICS_PORT_ID: shared_utils.new_port_spec( + METRICS_PORT_NUM, shared_utils.TCP_PROTOCOL + ), + } + return used_ports ENTRYPOINT_ARGS = ["sh", "-c"] @@ -182,6 +184,20 @@ def get_config( constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER + "/genesis.json", ) + public_ports = {} + discovery_port = DISCOVERY_PORT_NUM + if port_publisher.public_port_start: + discovery_port = port_publisher.el_start + len(existing_el_clients) + public_ports = { + TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.TCP_PROTOCOL + ), + UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.UDP_PROTOCOL + ), + } + used_ports = get_used_ports(discovery_port) + cmd = [ "reth", "node", @@ -209,6 +225,7 @@ def get_config( "--authrpc.jwtsecret=" + constants.JWT_MOUNT_PATH_ON_CONTAINER, "--authrpc.addr=0.0.0.0", "--metrics=0.0.0.0:{0}".format(METRICS_PORT_NUM), + "--discovery.port={0}".format(discovery_port) ] if network == constants.NETWORK_NAME.kurtosis: if len(existing_el_clients) > 0: diff --git a/src/package_io/input_parser.star b/src/package_io/input_parser.star index 83fcc130f..8fa8b6f59 100644 --- a/src/package_io/input_parser.star +++ b/src/package_io/input_parser.star @@ -65,7 +65,7 @@ ATTR_TO_BE_SKIPPED_AT_ROOT = ( "tx_spammer_params", "custom_flood_params", "xatu_sentry_params", - "port_publisher" + "port_publisher", ) @@ -160,7 +160,6 @@ def input_parser(plan, input_args): result["port_publisher"]["el_start"] = start result["port_publisher"]["cl_start"] = start + len(result["participants"]) - return struct( participants=[ struct( From 1f18f6d2e182509f5021239c0252e91af0d08227 Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Wed, 1 May 2024 12:33:17 +0100 Subject: [PATCH 14/23] ran linter --- src/el/nimbus-eth1/nimbus_launcher.star | 4 ++-- src/el/reth/reth_launcher.star | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/el/nimbus-eth1/nimbus_launcher.star b/src/el/nimbus-eth1/nimbus_launcher.star index 6baf16804..573a97fb0 100644 --- a/src/el/nimbus-eth1/nimbus_launcher.star +++ b/src/el/nimbus-eth1/nimbus_launcher.star @@ -54,6 +54,7 @@ def get_used_ports(discovery_port=DISCOVERY_PORT_NUM): } return used_ports + VERBOSITY_LEVELS = { constants.GLOBAL_LOG_LEVEL.error: "ERROR", constants.GLOBAL_LOG_LEVEL.warn: "WARN", @@ -181,7 +182,6 @@ def get_config( node_selectors, port_publisher, ): - public_ports = {} discovery_port = DISCOVERY_PORT_NUM if port_publisher.public_port_start: @@ -213,7 +213,7 @@ def get_config( "--metrics-address=0.0.0.0", "--metrics-port={0}".format(METRICS_PORT_NUM), "--nat=extip:{0}".format(port_publisher.nat_exit_ip), - "--tcp-port={0}".format(discovery_port), + "--tcp-port={0}".format(discovery_port), ] if ( network not in constants.PUBLIC_NETWORKS diff --git a/src/el/reth/reth_launcher.star b/src/el/reth/reth_launcher.star index 6f8909a13..053e18725 100644 --- a/src/el/reth/reth_launcher.star +++ b/src/el/reth/reth_launcher.star @@ -29,10 +29,13 @@ METRICS_PATH = "/metrics" # The dirpath of the execution data directory on the client container EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER = "/data/reth/execution-data" + def get_used_ports(discovery_port=DISCOVERY_PORT_NUM): used_ports = { RPC_PORT_ID: shared_utils.new_port_spec( - RPC_PORT_NUM, shared_utils.TCP_PROTOCOL, shared_utils.HTTP_APPLICATION_PROTOCOL + RPC_PORT_NUM, + shared_utils.TCP_PROTOCOL, + shared_utils.HTTP_APPLICATION_PROTOCOL, ), WS_PORT_ID: shared_utils.new_port_spec(WS_PORT_NUM, shared_utils.TCP_PROTOCOL), TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( @@ -50,6 +53,7 @@ def get_used_ports(discovery_port=DISCOVERY_PORT_NUM): } return used_ports + ENTRYPOINT_ARGS = ["sh", "-c"] VERBOSITY_LEVELS = { @@ -196,7 +200,7 @@ def get_config( discovery_port, shared_utils.UDP_PROTOCOL ), } - used_ports = get_used_ports(discovery_port) + used_ports = get_used_ports(discovery_port) cmd = [ "reth", @@ -225,7 +229,7 @@ def get_config( "--authrpc.jwtsecret=" + constants.JWT_MOUNT_PATH_ON_CONTAINER, "--authrpc.addr=0.0.0.0", "--metrics=0.0.0.0:{0}".format(METRICS_PORT_NUM), - "--discovery.port={0}".format(discovery_port) + "--discovery.port={0}".format(discovery_port), ] if network == constants.NETWORK_NAME.kurtosis: if len(existing_el_clients) > 0: From bd3f5ac598d28f74aab5ff131b08f5ca6ea08749 Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Wed, 1 May 2024 12:33:56 +0100 Subject: [PATCH 15/23] ran linter --- src/el/nimbus-eth1/nimbus_launcher.star | 3 ++- src/el/reth/reth_launcher.star | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/el/nimbus-eth1/nimbus_launcher.star b/src/el/nimbus-eth1/nimbus_launcher.star index 573a97fb0..a3a2090be 100644 --- a/src/el/nimbus-eth1/nimbus_launcher.star +++ b/src/el/nimbus-eth1/nimbus_launcher.star @@ -263,7 +263,8 @@ def get_config( return ServiceConfig( image=image, - ports=USED_PORTS, + ports=used_ports, + public_ports=public_ports, cmd=cmd, files=files, private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, diff --git a/src/el/reth/reth_launcher.star b/src/el/reth/reth_launcher.star index 053e18725..f8a29afa0 100644 --- a/src/el/reth/reth_launcher.star +++ b/src/el/reth/reth_launcher.star @@ -278,7 +278,8 @@ def get_config( return ServiceConfig( image=image, - ports=USED_PORTS, + ports=used_ports, + public_ports=public_ports, cmd=[command_str], files=files, entrypoint=ENTRYPOINT_ARGS, From 3f1f8c9ea235aa39c19c30d487d413f3addcef29 Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Wed, 1 May 2024 12:53:36 +0100 Subject: [PATCH 16/23] done with cl clients --- src/cl/grandine/grandine_launcher.star | 57 ++++++++++++------- src/cl/lighthouse/lighthouse_launcher.star | 65 ++++++++++++++-------- src/cl/lodestar/lodestar_launcher.star | 57 ++++++++++++------- src/cl/nimbus/nimbus_launcher.star | 62 +++++++++++++-------- src/cl/prysm/prysm_launcher.star | 57 +++++++++++++------ src/cl/teku/teku_launcher.star | 50 ++++++++++++----- src/el/ethereumjs/ethereumjs_launcher.star | 4 +- src/el/nethermind/nethermind_launcher.star | 4 +- src/el/nimbus-eth1/nimbus_launcher.star | 4 +- src/el/reth/reth_launcher.star | 4 +- 10 files changed, 240 insertions(+), 124 deletions(-) diff --git a/src/cl/grandine/grandine_launcher.star b/src/cl/grandine/grandine_launcher.star index b20292449..8fa338b17 100644 --- a/src/cl/grandine/grandine_launcher.star +++ b/src/cl/grandine/grandine_launcher.star @@ -29,20 +29,23 @@ BEACON_METRICS_PATH = "/metrics" MIN_PEERS = 1 -BEACON_USED_PORTS = { - BEACON_TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - BEACON_DISCOVERY_PORT_NUM, shared_utils.TCP_PROTOCOL - ), - BEACON_UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - BEACON_DISCOVERY_PORT_NUM, shared_utils.UDP_PROTOCOL - ), - BEACON_HTTP_PORT_ID: shared_utils.new_port_spec( - BEACON_HTTP_PORT_NUM, shared_utils.TCP_PROTOCOL - ), - BEACON_METRICS_PORT_ID: shared_utils.new_port_spec( - BEACON_METRICS_PORT_NUM, shared_utils.TCP_PROTOCOL - ), -} + +def get_used_ports(discovery_port): + beacon_used_ports = { + BEACON_TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.TCP_PROTOCOL + ), + BEACON_UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.UDP_PROTOCOL + ), + BEACON_HTTP_PORT_ID: shared_utils.new_port_spec( + BEACON_HTTP_PORT_NUM, shared_utils.TCP_PROTOCOL + ), + BEACON_METRICS_PORT_ID: shared_utils.new_port_spec( + BEACON_METRICS_PORT_NUM, shared_utils.TCP_PROTOCOL + ), + } + return beacon_used_ports ENTRYPOINT_ARGS = ["sh", "-c"] @@ -251,6 +254,21 @@ def get_beacon_config( el_context.ip_addr, el_context.engine_rpc_port_num, ) + + public_ports = {} + discovery_port = BEACON_DISCOVERY_PORT_NUM + if port_publisher.public_port_start: + discovery_port = port_publisher.cl_start + len(bootnode_contexts) + public_ports = { + BEACON_TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.TCP_PROTOCOL + ), + BEACON_UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.UDP_PROTOCOL + ), + } + used_ports = get_used_ports(discovery_port) + cmd = [ "--network={0}".format( network if network in constants.PUBLIC_NETWORKS else "custom" @@ -258,15 +276,15 @@ def get_beacon_config( "--data-dir=" + BEACON_DATA_DIRPATH_ON_SERVICE_CONTAINER, "--http-address=0.0.0.0", "--http-port={0}".format(BEACON_HTTP_PORT_NUM), - "--libp2p-port={0}".format(BEACON_DISCOVERY_PORT_NUM), - "--discovery-port={0}".format(BEACON_DISCOVERY_PORT_NUM), + "--libp2p-port={0}".format(discovery_port), + "--discovery-port={0}".format(discovery_port), "--jwt-secret=" + constants.JWT_MOUNT_PATH_ON_CONTAINER, "--eth1-rpc-urls=" + EXECUTION_ENGINE_ENDPOINT, # vvvvvvvvvvvvvvvvvvv REMOVE THESE WHEN CONNECTING TO EXTERNAL NET vvvvvvvvvvvvvvvvvvvvv "--disable-enr-auto-update", "--enr-address=" + port_publisher.nat_exit_ip, - "--enr-udp-port={0}".format(BEACON_DISCOVERY_PORT_NUM), - "--enr-tcp-port={0}".format(BEACON_DISCOVERY_PORT_NUM), + "--enr-udp-port={0}".format(discovery_port), + "--enr-tcp-port={0}".format(discovery_port), # ^^^^^^^^^^^^^^^^^^^ REMOVE THESE WHEN CONNECTING TO EXTERNAL NET ^^^^^^^^^^^^^^^^^^^^^ # vvvvvvvvvvvvvvvvvvv METRICS CONFIG vvvvvvvvvvvvvvvvvvvvv "--metrics", @@ -354,7 +372,7 @@ def get_beacon_config( } ports = {} - ports.update(BEACON_USED_PORTS) + ports.update(used_ports) if node_keystore_files != None and not use_separate_vc: cmd.extend(validator_default_cmd) files[ @@ -374,6 +392,7 @@ def get_beacon_config( return ServiceConfig( image=image, ports=ports, + public_ports=public_ports, cmd=cmd, env_vars=extra_env_vars, files=files, diff --git a/src/cl/lighthouse/lighthouse_launcher.star b/src/cl/lighthouse/lighthouse_launcher.star index 3e9dd6b21..481ae787b 100644 --- a/src/cl/lighthouse/lighthouse_launcher.star +++ b/src/cl/lighthouse/lighthouse_launcher.star @@ -32,24 +32,28 @@ BEACON_MIN_MEMORY = 256 METRICS_PATH = "/metrics" -BEACON_USED_PORTS = { - BEACON_TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - BEACON_DISCOVERY_PORT_NUM, shared_utils.TCP_PROTOCOL - ), - BEACON_UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - BEACON_DISCOVERY_PORT_NUM, shared_utils.UDP_PROTOCOL - ), - BEACON_HTTP_PORT_ID: shared_utils.new_port_spec( - BEACON_HTTP_PORT_NUM, - shared_utils.TCP_PROTOCOL, - shared_utils.HTTP_APPLICATION_PROTOCOL, - ), - BEACON_METRICS_PORT_ID: shared_utils.new_port_spec( - BEACON_METRICS_PORT_NUM, - shared_utils.TCP_PROTOCOL, - shared_utils.HTTP_APPLICATION_PROTOCOL, - ), -} + +def get_used_ports(discovery_port): + beacon_used_ports = { + BEACON_TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.TCP_PROTOCOL + ), + BEACON_UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.UDP_PROTOCOL + ), + BEACON_HTTP_PORT_ID: shared_utils.new_port_spec( + BEACON_HTTP_PORT_NUM, + shared_utils.TCP_PROTOCOL, + shared_utils.HTTP_APPLICATION_PROTOCOL, + ), + BEACON_METRICS_PORT_ID: shared_utils.new_port_spec( + BEACON_METRICS_PORT_NUM, + shared_utils.TCP_PROTOCOL, + shared_utils.HTTP_APPLICATION_PROTOCOL, + ), + } + return beacon_used_ports + VERBOSITY_LEVELS = { constants.GLOBAL_LOG_LEVEL.error: "error", @@ -256,6 +260,20 @@ def get_beacon_config( el_context.engine_rpc_port_num, ) + public_ports = {} + discovery_port = BEACON_DISCOVERY_PORT_NUM + if port_publisher.public_port_start: + discovery_port = port_publisher.cl_start + len(boot_cl_client_ctxs) + public_ports = { + BEACON_TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.TCP_PROTOCOL + ), + BEACON_UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.UDP_PROTOCOL + ), + } + used_ports = get_used_ports(discovery_port) + # NOTE: If connecting to the merge devnet remotely we DON'T want the following flags; when they're not set, the node's external IP address is auto-detected # from the peers it communicates with but when they're set they basically say "override the autodetection and # use what I specify instead." This requires having a know external IP address and port, which we definitely won't @@ -271,13 +289,13 @@ def get_beacon_config( "--datadir=" + BEACON_DATA_DIRPATH_ON_BEACON_SERVICE_CONTAINER, # vvvvvvvvvvvvvvvvvvv REMOVE THESE WHEN CONNECTING TO EXTERNAL NET vvvvvvvvvvvvvvvvvvvvv "--disable-enr-auto-update", - "--enr-address=" + port_publishe.nat_exit_ip, - "--enr-udp-port={0}".format(BEACON_DISCOVERY_PORT_NUM), - "--enr-tcp-port={0}".format(BEACON_DISCOVERY_PORT_NUM), + "--enr-address=" + port_publisher.nat_exit_ip, + "--enr-udp-port={0}".format(discovery_port), + "--enr-tcp-port={0}".format(discovery_port), # ^^^^^^^^^^^^^^^^^^^ REMOVE THESE WHEN CONNECTING TO EXTERNAL NET ^^^^^^^^^^^^^^^^^^^^^ "--listen-address=0.0.0.0", "--port={0}".format( - BEACON_DISCOVERY_PORT_NUM + discovery_port ), # NOTE: Remove for connecting to external net! "--http", "--http-address=0.0.0.0", @@ -369,7 +387,8 @@ def get_beacon_config( env.update(extra_env_vars) return ServiceConfig( image=image, - ports=BEACON_USED_PORTS, + ports=used_ports, + public_ports=public_ports, cmd=cmd, files=files, env_vars=env, diff --git a/src/cl/lodestar/lodestar_launcher.star b/src/cl/lodestar/lodestar_launcher.star index bce19b980..35fc3b53b 100644 --- a/src/cl/lodestar/lodestar_launcher.star +++ b/src/cl/lodestar/lodestar_launcher.star @@ -25,20 +25,24 @@ BEACON_MIN_MEMORY = 256 METRICS_PATH = "/metrics" -BEACON_USED_PORTS = { - TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - DISCOVERY_PORT_NUM, shared_utils.TCP_PROTOCOL - ), - UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - DISCOVERY_PORT_NUM, shared_utils.UDP_PROTOCOL - ), - BEACON_HTTP_PORT_ID: shared_utils.new_port_spec( - HTTP_PORT_NUM, shared_utils.TCP_PROTOCOL - ), - METRICS_PORT_ID: shared_utils.new_port_spec( - METRICS_PORT_NUM, shared_utils.TCP_PROTOCOL - ), -} + +def get_used_ports(discovery_port): + beacon_used_ports = { + TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.TCP_PROTOCOL + ), + UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.UDP_PROTOCOL + ), + BEACON_HTTP_PORT_ID: shared_utils.new_port_spec( + HTTP_PORT_NUM, shared_utils.TCP_PROTOCOL + ), + METRICS_PORT_ID: shared_utils.new_port_spec( + METRICS_PORT_NUM, shared_utils.TCP_PROTOCOL + ), + } + return beacon_used_ports + VERBOSITY_LEVELS = { constants.GLOBAL_LOG_LEVEL.error: "error", @@ -253,11 +257,25 @@ def get_beacon_config( el_context.engine_rpc_port_num, ) + public_ports = {} + discovery_port = BEACON_DISCOVERY_PORT_NUM + if port_publisher.public_port_start: + discovery_port = port_publisher.cl_start + len(bootnode_contexts) + public_ports = { + TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.TCP_PROTOCOL + ), + UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.UDP_PROTOCOL + ), + } + used_ports = get_used_ports(discovery_port) + cmd = [ "beacon", "--logLevel=" + log_level, - "--port={0}".format(DISCOVERY_PORT_NUM), - "--discoveryPort={0}".format(DISCOVERY_PORT_NUM), + "--port={0}".format(discovery_port), + "--discoveryPort={0}".format(discovery_port), "--dataDir=" + BEACON_DATA_DIRPATH_ON_SERVICE_CONTAINER, "--eth1.depositContractDeployBlock=0", "--network.connectToDiscv5Bootnodes=true", @@ -271,8 +289,8 @@ def get_beacon_config( "--rest.port={0}".format(HTTP_PORT_NUM), "--nat=true", "--enr.ip=" + port_publisher.nat_exit_ip, - "--enr.tcp={0}".format(DISCOVERY_PORT_NUM), - "--enr.udp={0}".format(DISCOVERY_PORT_NUM), + "--enr.tcp={0}".format(discovery_port), + "--enr.udp={0}".format(discovery_port), # Set per Pari's recommendation to reduce noise in the logs "--subscribeAllSubnets=true", "--jwt-secret=" + constants.JWT_MOUNT_PATH_ON_CONTAINER, @@ -349,7 +367,8 @@ def get_beacon_config( ) return ServiceConfig( image=image, - ports=BEACON_USED_PORTS, + ports=used_ports, + public_ports=public_ports, cmd=cmd, env_vars=extra_env_vars, files=files, diff --git a/src/cl/nimbus/nimbus_launcher.star b/src/cl/nimbus/nimbus_launcher.star index a6df5389a..e8d41f06c 100644 --- a/src/cl/nimbus/nimbus_launcher.star +++ b/src/cl/nimbus/nimbus_launcher.star @@ -42,24 +42,27 @@ VALIDATOR_KEYS_MOUNTPOINT_ON_CLIENTS = "/data/nimbus/validator-keys" # ---------------------------------- Used Ports ---------------------------------- -BEACON_USED_PORTS = { - BEACON_TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - BEACON_DISCOVERY_PORT_NUM, shared_utils.TCP_PROTOCOL - ), - BEACON_UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - BEACON_DISCOVERY_PORT_NUM, shared_utils.UDP_PROTOCOL - ), - BEACON_HTTP_PORT_ID: shared_utils.new_port_spec( - BEACON_HTTP_PORT_NUM, - shared_utils.TCP_PROTOCOL, - shared_utils.HTTP_APPLICATION_PROTOCOL, - ), - BEACON_METRICS_PORT_ID: shared_utils.new_port_spec( - BEACON_METRICS_PORT_NUM, - shared_utils.TCP_PROTOCOL, - shared_utils.HTTP_APPLICATION_PROTOCOL, - ), -} +def get_used_ports(disovery_port): + used_ports = { + BEACON_TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.TCP_PROTOCOL + ), + BEACON_UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.UDP_PROTOCOL + ), + BEACON_HTTP_PORT_ID: shared_utils.new_port_spec( + BEACON_HTTP_PORT_NUM, + shared_utils.TCP_PROTOCOL, + shared_utils.HTTP_APPLICATION_PROTOCOL, + ), + BEACON_METRICS_PORT_ID: shared_utils.new_port_spec( + BEACON_METRICS_PORT_NUM, + shared_utils.TCP_PROTOCOL, + shared_utils.HTTP_APPLICATION_PROTOCOL, + ), + } + return used_ports + VERBOSITY_LEVELS = { constants.GLOBAL_LOG_LEVEL.error: "ERROR", @@ -268,11 +271,25 @@ def get_beacon_config( el_context.engine_rpc_port_num, ) + public_ports = {} + discovery_port = BEACON_DISCOVERY_PORT_NUM + if port_publisher.public_port_start: + discovery_port = port_publisher.cl_start + len(bootnode_contexts) + public_ports = { + BEACON_TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.TCP_PROTOCOL + ), + BEACON_UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.UDP_PROTOCOL + ), + } + used_ports = get_used_ports(discovery_port) + cmd = [ "--non-interactive=true", "--log-level=" + log_level, - "--udp-port={0}".format(BEACON_DISCOVERY_PORT_NUM), - "--tcp-port={0}".format(BEACON_DISCOVERY_PORT_NUM), + "--udp-port={0}".format(discovery_port), + "--tcp-port={0}".format(discovery_port), "--network={0}".format( network if network in constants.PUBLIC_NETWORKS @@ -342,7 +359,7 @@ def get_beacon_config( constants.JWT_MOUNTPOINT_ON_CLIENTS: jwt_file, } ports = {} - ports.update(BEACON_USED_PORTS) + ports.update(used_ports) if node_keystore_files != None and not use_separate_vc: cmd.extend(validator_default_cmd) files[ @@ -362,7 +379,8 @@ def get_beacon_config( return ServiceConfig( image=image, - ports=ports, + ports=used_ports, + public_ports=public_ports, cmd=cmd, env_vars=extra_env_vars, files=files, diff --git a/src/cl/prysm/prysm_launcher.star b/src/cl/prysm/prysm_launcher.star index 0b7114fc4..aad2a04ed 100644 --- a/src/cl/prysm/prysm_launcher.star +++ b/src/cl/prysm/prysm_launcher.star @@ -31,21 +31,27 @@ METRICS_PATH = "/metrics" MIN_PEERS = 1 -BEACON_NODE_USED_PORTS = { - TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - DISCOVERY_TCP_PORT_NUM, shared_utils.TCP_PROTOCOL - ), - UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - DISCOVERY_UDP_PORT_NUM, shared_utils.UDP_PROTOCOL - ), - RPC_PORT_ID: shared_utils.new_port_spec(RPC_PORT_NUM, shared_utils.TCP_PROTOCOL), - BEACON_HTTP_PORT_ID: shared_utils.new_port_spec( - HTTP_PORT_NUM, shared_utils.TCP_PROTOCOL - ), - BEACON_MONITORING_PORT_ID: shared_utils.new_port_spec( - BEACON_MONITORING_PORT_NUM, shared_utils.TCP_PROTOCOL - ), -} + +def get_used_ports(discovery_port): + beacon_used_ports = { + TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.TCP_PROTOCOL + ), + UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.UDP_PROTOCOL + ), + RPC_PORT_ID: shared_utils.new_port_spec( + RPC_PORT_NUM, shared_utils.TCP_PROTOCOL + ), + BEACON_HTTP_PORT_ID: shared_utils.new_port_spec( + HTTP_PORT_NUM, shared_utils.TCP_PROTOCOL + ), + BEACON_MONITORING_PORT_ID: shared_utils.new_port_spec( + BEACON_MONITORING_PORT_NUM, shared_utils.TCP_PROTOCOL + ), + } + return used_ports + VERBOSITY_LEVELS = { constants.GLOBAL_LOG_LEVEL.error: "error", @@ -233,6 +239,20 @@ def get_beacon_config( el_context.engine_rpc_port_num, ) + public_ports = {} + discovery_port = BEACON_DISCOVERY_PORT_NUM + if port_publisher.public_port_start: + discovery_port = port_publisher.cl_start + len(bootnode_contexts) + public_ports = { + TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.TCP_PROTOCOL + ), + UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.UDP_PROTOCOL + ), + } + used_ports = get_used_ports(discovery_port) + cmd = [ "--accept-terms-of-use=true", # it's mandatory in order to run the node "--datadir=" + BEACON_DATA_DIRPATH_ON_SERVICE_CONTAINER, @@ -243,8 +263,8 @@ def get_beacon_config( "--grpc-gateway-corsdomain=*", "--grpc-gateway-port={0}".format(HTTP_PORT_NUM), "--p2p-host-ip=" + port_publisher.nat_exit_ip, - "--p2p-tcp-port={0}".format(DISCOVERY_TCP_PORT_NUM), - "--p2p-udp-port={0}".format(DISCOVERY_UDP_PORT_NUM), + "--p2p-tcp-port={0}".format(discovery_port), + "--p2p-udp-port={0}".format(discovery_port), "--min-sync-peers={0}".format(MIN_PEERS), "--verbosity=" + log_level, "--slots-per-archive-point={0}".format(32 if constants.ARCHIVE_MODE else 8192), @@ -332,7 +352,8 @@ def get_beacon_config( return ServiceConfig( image=beacon_image, - ports=BEACON_NODE_USED_PORTS, + ports=used_ports, + public_ports=public_ports, cmd=cmd, env_vars=extra_env_vars, files=files, diff --git a/src/cl/teku/teku_launcher.star b/src/cl/teku/teku_launcher.star index 289dcc18e..167212e96 100644 --- a/src/cl/teku/teku_launcher.star +++ b/src/cl/teku/teku_launcher.star @@ -31,20 +31,23 @@ BEACON_METRICS_PATH = "/metrics" MIN_PEERS = 1 -BEACON_USED_PORTS = { - BEACON_TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - BEACON_DISCOVERY_PORT_NUM, shared_utils.TCP_PROTOCOL - ), - BEACON_UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - BEACON_DISCOVERY_PORT_NUM, shared_utils.UDP_PROTOCOL - ), - BEACON_HTTP_PORT_ID: shared_utils.new_port_spec( - BEACON_HTTP_PORT_NUM, shared_utils.TCP_PROTOCOL - ), - BEACON_METRICS_PORT_ID: shared_utils.new_port_spec( - BEACON_METRICS_PORT_NUM, shared_utils.TCP_PROTOCOL - ), -} + +def get_used_ports(discovery_port): + used_ports = { + BEACON_TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.TCP_PROTOCOL + ), + BEACON_UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.UDP_PROTOCOL + ), + BEACON_HTTP_PORT_ID: shared_utils.new_port_spec( + BEACON_HTTP_PORT_NUM, shared_utils.TCP_PROTOCOL + ), + BEACON_METRICS_PORT_ID: shared_utils.new_port_spec( + BEACON_METRICS_PORT_NUM, shared_utils.TCP_PROTOCOL + ), + } + return used_ports ENTRYPOINT_ARGS = ["sh", "-c"] @@ -256,6 +259,21 @@ def get_beacon_config( el_context.ip_addr, el_context.engine_rpc_port_num, ) + + public_ports = {} + discovery_port = BEACON_DISCOVERY_PORT_NUM + if port_publisher.public_port_start: + discovery_port = port_publisher.cl_start + len(bootnode_contexts) + public_ports = { + BEACON_TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.TCP_PROTOCOL + ), + BEACON_UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( + discovery_port, shared_utils.UDP_PROTOCOL + ), + } + used_ports = get_used_ports(discovery_port) + cmd = [ "--logging=" + log_level, "--log-destination=CONSOLE", @@ -274,6 +292,7 @@ def get_beacon_config( "--p2p-peer-lower-bound={0}".format(MIN_PEERS), "--p2p-advertised-ip=" + port_publisher.nat_exit_ip, "--p2p-discovery-site-local-addresses-enabled=true", + "--p2p-port={0}".format(discovery_port), "--rest-api-enabled=true", "--rest-api-docs-enabled=true", "--rest-api-interface=0.0.0.0", @@ -375,7 +394,7 @@ def get_beacon_config( constants.JWT_MOUNTPOINT_ON_CLIENTS: jwt_file, } ports = {} - ports.update(BEACON_USED_PORTS) + ports.update(used_ports) if node_keystore_files != None and not use_separate_vc: cmd.extend(validator_default_cmd) files[ @@ -396,6 +415,7 @@ def get_beacon_config( return ServiceConfig( image=image, ports=ports, + public_ports=public_ports, cmd=cmd, env_vars=extra_env_vars, files=files, diff --git a/src/el/ethereumjs/ethereumjs_launcher.star b/src/el/ethereumjs/ethereumjs_launcher.star index 5066b0a44..187e422e9 100644 --- a/src/el/ethereumjs/ethereumjs_launcher.star +++ b/src/el/ethereumjs/ethereumjs_launcher.star @@ -43,10 +43,10 @@ def get_used_ports(discovery_port=DISCOVERY_PORT_NUM): WS_PORT_ENGINE_NUM, shared_utils.TCP_PROTOCOL ), TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - DISCOVERY_PORT_NUM, shared_utils.TCP_PROTOCOL + discovery_port, shared_utils.TCP_PROTOCOL ), UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - DISCOVERY_PORT_NUM, shared_utils.UDP_PROTOCOL + discovery_port, shared_utils.UDP_PROTOCOL ), ENGINE_RPC_PORT_ID: shared_utils.new_port_spec( ENGINE_RPC_PORT_NUM, shared_utils.TCP_PROTOCOL diff --git a/src/el/nethermind/nethermind_launcher.star b/src/el/nethermind/nethermind_launcher.star index 7945ed6b3..4e8ae8dc9 100644 --- a/src/el/nethermind/nethermind_launcher.star +++ b/src/el/nethermind/nethermind_launcher.star @@ -39,10 +39,10 @@ def get_used_ports(discovery_port=DISCOVERY_PORT_NUM): ), WS_PORT_ID: shared_utils.new_port_spec(WS_PORT_NUM, shared_utils.TCP_PROTOCOL), TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - DISCOVERY_PORT_NUM, shared_utils.TCP_PROTOCOL + discovery_port, shared_utils.TCP_PROTOCOL ), UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - DISCOVERY_PORT_NUM, shared_utils.UDP_PROTOCOL + discovery_port, shared_utils.UDP_PROTOCOL ), ENGINE_RPC_PORT_ID: shared_utils.new_port_spec( ENGINE_RPC_PORT_NUM, shared_utils.TCP_PROTOCOL diff --git a/src/el/nimbus-eth1/nimbus_launcher.star b/src/el/nimbus-eth1/nimbus_launcher.star index a3a2090be..30fdd0966 100644 --- a/src/el/nimbus-eth1/nimbus_launcher.star +++ b/src/el/nimbus-eth1/nimbus_launcher.star @@ -36,11 +36,11 @@ def get_used_ports(discovery_port=DISCOVERY_PORT_NUM): shared_utils.HTTP_APPLICATION_PROTOCOL, ), TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - DISCOVERY_PORT_NUM, + discovery_port, shared_utils.TCP_PROTOCOL, ), UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - DISCOVERY_PORT_NUM, + discovery_port, shared_utils.UDP_PROTOCOL, ), ENGINE_RPC_PORT_ID: shared_utils.new_port_spec( diff --git a/src/el/reth/reth_launcher.star b/src/el/reth/reth_launcher.star index f8a29afa0..3c39b9249 100644 --- a/src/el/reth/reth_launcher.star +++ b/src/el/reth/reth_launcher.star @@ -39,10 +39,10 @@ def get_used_ports(discovery_port=DISCOVERY_PORT_NUM): ), WS_PORT_ID: shared_utils.new_port_spec(WS_PORT_NUM, shared_utils.TCP_PROTOCOL), TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - DISCOVERY_PORT_NUM, shared_utils.TCP_PROTOCOL + discovery_port, shared_utils.TCP_PROTOCOL ), UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - DISCOVERY_PORT_NUM, shared_utils.UDP_PROTOCOL + discovery_port, shared_utils.UDP_PROTOCOL ), ENGINE_RPC_PORT_ID: shared_utils.new_port_spec( ENGINE_RPC_PORT_NUM, shared_utils.TCP_PROTOCOL From 73725aabf56025bca43983fcfbe634e97690f3df Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Wed, 1 May 2024 12:59:52 +0100 Subject: [PATCH 17/23] at least interprets --- src/cl/lodestar/lodestar_launcher.star | 2 +- src/cl/nimbus/nimbus_launcher.star | 2 +- src/cl/prysm/prysm_launcher.star | 4 ++-- src/el/geth/geth_launcher.star | 2 +- src/package_io/input_parser.star | 9 ++++++++- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/cl/lodestar/lodestar_launcher.star b/src/cl/lodestar/lodestar_launcher.star index 35fc3b53b..2c2de71dc 100644 --- a/src/cl/lodestar/lodestar_launcher.star +++ b/src/cl/lodestar/lodestar_launcher.star @@ -258,7 +258,7 @@ def get_beacon_config( ) public_ports = {} - discovery_port = BEACON_DISCOVERY_PORT_NUM + discovery_port = DISCOVERY_PORT_NUM if port_publisher.public_port_start: discovery_port = port_publisher.cl_start + len(bootnode_contexts) public_ports = { diff --git a/src/cl/nimbus/nimbus_launcher.star b/src/cl/nimbus/nimbus_launcher.star index e8d41f06c..51f204204 100644 --- a/src/cl/nimbus/nimbus_launcher.star +++ b/src/cl/nimbus/nimbus_launcher.star @@ -42,7 +42,7 @@ VALIDATOR_KEYS_MOUNTPOINT_ON_CLIENTS = "/data/nimbus/validator-keys" # ---------------------------------- Used Ports ---------------------------------- -def get_used_ports(disovery_port): +def get_used_ports(discovery_port): used_ports = { BEACON_TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( discovery_port, shared_utils.TCP_PROTOCOL diff --git a/src/cl/prysm/prysm_launcher.star b/src/cl/prysm/prysm_launcher.star index aad2a04ed..d2ca3cada 100644 --- a/src/cl/prysm/prysm_launcher.star +++ b/src/cl/prysm/prysm_launcher.star @@ -33,7 +33,7 @@ MIN_PEERS = 1 def get_used_ports(discovery_port): - beacon_used_ports = { + used_ports = { TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( discovery_port, shared_utils.TCP_PROTOCOL ), @@ -240,7 +240,7 @@ def get_beacon_config( ) public_ports = {} - discovery_port = BEACON_DISCOVERY_PORT_NUM + discovery_port = DISCOVERY_TCP_PORT_NUM if port_publisher.public_port_start: discovery_port = port_publisher.cl_start + len(bootnode_contexts) public_ports = { diff --git a/src/el/geth/geth_launcher.star b/src/el/geth/geth_launcher.star index eea4c0950..7b61a14e5 100644 --- a/src/el/geth/geth_launcher.star +++ b/src/el/geth/geth_launcher.star @@ -37,7 +37,7 @@ METRICS_PATH = "/debug/metrics/prometheus" EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER = "/data/geth/execution-data" -def get_used_ports(disovery_port=DISCOVERY_PORT_NUM): +def get_used_ports(discovery_port=DISCOVERY_PORT_NUM): used_ports = { RPC_PORT_ID: shared_utils.new_port_spec( RPC_PORT_NUM, diff --git a/src/package_io/input_parser.star b/src/package_io/input_parser.star index 8fa8b6f59..f12d278b2 100644 --- a/src/package_io/input_parser.star +++ b/src/package_io/input_parser.star @@ -316,7 +316,12 @@ def input_parser(plan, input_args): global_tolerations=result["global_tolerations"], global_node_selectors=result["global_node_selectors"], keymanager_enabled=result["keymanager_enabled"], - port_publisher=result["port_publisher"], + port_publisher=struct( + public_port_start=result["port_publisher"]["public_port_start"], + nat_exit_ip=result["port_publisher"]["nat_exit_ip"], + el_start=result["port_publisher"]["el_start"], + cl_start=result["port_publisher"]["cl_start"], + ), ) @@ -628,6 +633,8 @@ def default_input_args(): "port_publisher": { "nat_exit_ip": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, "public_port_start": None, + "el_start": None, + "cl_start": None, }, } From c547e64860bf6bda47a02ee3a2ecec10a309651c Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Wed, 1 May 2024 13:13:13 +0100 Subject: [PATCH 18/23] needs some private and public port fixing --- .github/tests/mix-public.yaml | 18 ++++++++++++++++++ .github/tests/mix.yaml | 2 +- .github/workflows/per-pr.yml | 1 + src/cl/grandine/grandine_launcher.star | 4 +++- src/cl/lighthouse/lighthouse_launcher.star | 4 +++- src/cl/lodestar/lodestar_launcher.star | 4 +++- src/cl/nimbus/nimbus_launcher.star | 4 +++- src/cl/prysm/prysm_launcher.star | 4 +++- src/cl/teku/teku_launcher.star | 4 +++- 9 files changed, 38 insertions(+), 7 deletions(-) create mode 100644 .github/tests/mix-public.yaml diff --git a/.github/tests/mix-public.yaml b/.github/tests/mix-public.yaml new file mode 100644 index 000000000..01fe74a7b --- /dev/null +++ b/.github/tests/mix-public.yaml @@ -0,0 +1,18 @@ +participants: + - el_type: geth + cl_type: teku + - el_type: nethermind + cl_type: prysm + - el_type: erigon + cl_type: nimbus + - el_type: besu + cl_type: lighthouse + - el_type: reth + cl_type: lodestar + - el_type: nimbus + cl_type: teku + - el_type: ethereumjs + cl_type: grandine +additional_services: [] +port_publisher: + public_port_start: 50000 diff --git a/.github/tests/mix.yaml b/.github/tests/mix.yaml index 04c945aa1..b79ebdc15 100644 --- a/.github/tests/mix.yaml +++ b/.github/tests/mix.yaml @@ -13,4 +13,4 @@ participants: cl_type: teku - el_type: ethereumjs cl_type: grandine -additional_services: [] +additional_services: [] \ No newline at end of file diff --git a/.github/workflows/per-pr.yml b/.github/workflows/per-pr.yml index 4fe5f5ca3..8ac427491 100644 --- a/.github/workflows/per-pr.yml +++ b/.github/workflows/per-pr.yml @@ -33,6 +33,7 @@ jobs: "./.github/tests/mev-mock.yaml", "./.github/tests/mix-with-tools.yaml", "./.github/tests/mix-persistence.yaml", + "./.github/tests/mix-public.yaml", "./network_params.yaml" ] runs-on: ubuntu-latest diff --git a/src/cl/grandine/grandine_launcher.star b/src/cl/grandine/grandine_launcher.star index 8fa338b17..b2c24c951 100644 --- a/src/cl/grandine/grandine_launcher.star +++ b/src/cl/grandine/grandine_launcher.star @@ -258,7 +258,9 @@ def get_beacon_config( public_ports = {} discovery_port = BEACON_DISCOVERY_PORT_NUM if port_publisher.public_port_start: - discovery_port = port_publisher.cl_start + len(bootnode_contexts) + discovery_port = port_publisher.cl_start + if bootnode_contexts and len(bootnode_contexts) > 0: + discovery_port = discovery_port + len(bootnode_contexts) public_ports = { BEACON_TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( discovery_port, shared_utils.TCP_PROTOCOL diff --git a/src/cl/lighthouse/lighthouse_launcher.star b/src/cl/lighthouse/lighthouse_launcher.star index 481ae787b..1e1ee4582 100644 --- a/src/cl/lighthouse/lighthouse_launcher.star +++ b/src/cl/lighthouse/lighthouse_launcher.star @@ -263,7 +263,9 @@ def get_beacon_config( public_ports = {} discovery_port = BEACON_DISCOVERY_PORT_NUM if port_publisher.public_port_start: - discovery_port = port_publisher.cl_start + len(boot_cl_client_ctxs) + discovery_port = port_publisher.cl_start + if boot_cl_client_ctxs and len(boot_cl_client_ctxs) > 0: + discovery_port = discovery_port + len(boot_cl_client_ctxs) public_ports = { BEACON_TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( discovery_port, shared_utils.TCP_PROTOCOL diff --git a/src/cl/lodestar/lodestar_launcher.star b/src/cl/lodestar/lodestar_launcher.star index 2c2de71dc..4d2b97e9a 100644 --- a/src/cl/lodestar/lodestar_launcher.star +++ b/src/cl/lodestar/lodestar_launcher.star @@ -260,7 +260,9 @@ def get_beacon_config( public_ports = {} discovery_port = DISCOVERY_PORT_NUM if port_publisher.public_port_start: - discovery_port = port_publisher.cl_start + len(bootnode_contexts) + discovery_port = port_publisher.cl_start + if bootnode_contexts and len(bootnode_contexts) > 0: + discovery_port = discovery_port + len(bootnode_contexts) public_ports = { TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( discovery_port, shared_utils.TCP_PROTOCOL diff --git a/src/cl/nimbus/nimbus_launcher.star b/src/cl/nimbus/nimbus_launcher.star index 51f204204..9750425aa 100644 --- a/src/cl/nimbus/nimbus_launcher.star +++ b/src/cl/nimbus/nimbus_launcher.star @@ -274,7 +274,9 @@ def get_beacon_config( public_ports = {} discovery_port = BEACON_DISCOVERY_PORT_NUM if port_publisher.public_port_start: - discovery_port = port_publisher.cl_start + len(bootnode_contexts) + discovery_port = port_publisher.cl_start + if bootnode_contexts and len(bootnode_contexts) > 0: + discovery_port = discovery_port + len(bootnode_contexts) public_ports = { BEACON_TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( discovery_port, shared_utils.TCP_PROTOCOL diff --git a/src/cl/prysm/prysm_launcher.star b/src/cl/prysm/prysm_launcher.star index d2ca3cada..02179e06b 100644 --- a/src/cl/prysm/prysm_launcher.star +++ b/src/cl/prysm/prysm_launcher.star @@ -242,7 +242,9 @@ def get_beacon_config( public_ports = {} discovery_port = DISCOVERY_TCP_PORT_NUM if port_publisher.public_port_start: - discovery_port = port_publisher.cl_start + len(bootnode_contexts) + discovery_port = port_publisher.cl_start + if bootnode_contexts and len(bootnode_contexts) > 0: + discovery_port = discovery_port + len(bootnode_contexts) public_ports = { TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( discovery_port, shared_utils.TCP_PROTOCOL diff --git a/src/cl/teku/teku_launcher.star b/src/cl/teku/teku_launcher.star index 167212e96..90d6e3a05 100644 --- a/src/cl/teku/teku_launcher.star +++ b/src/cl/teku/teku_launcher.star @@ -263,7 +263,9 @@ def get_beacon_config( public_ports = {} discovery_port = BEACON_DISCOVERY_PORT_NUM if port_publisher.public_port_start: - discovery_port = port_publisher.cl_start + len(bootnode_contexts) + discovery_port = port_publisher.cl_start + if bootnode_contexts and len(bootnode_contexts) > 0: + discovery_port = discovery_port + len(bootnode_contexts) public_ports = { BEACON_TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( discovery_port, shared_utils.TCP_PROTOCOL From b69412195f4c213a56c27fab3c5132d7a45ca89e Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Wed, 1 May 2024 13:56:32 +0100 Subject: [PATCH 19/23] fix reth --- src/el/geth/geth_launcher.star | 1 + src/el/reth/reth_launcher.star | 1 + 2 files changed, 2 insertions(+) diff --git a/src/el/geth/geth_launcher.star b/src/el/geth/geth_launcher.star index 7b61a14e5..cff68c758 100644 --- a/src/el/geth/geth_launcher.star +++ b/src/el/geth/geth_launcher.star @@ -302,6 +302,7 @@ def get_config( "--metrics.addr=0.0.0.0", "--metrics.port={0}".format(METRICS_PORT_NUM), "--discovery.port={0}".format(discovery_port), + "--port={0}".format(discovery_port), ] if BUILDER_IMAGE_STR in image: diff --git a/src/el/reth/reth_launcher.star b/src/el/reth/reth_launcher.star index 3c39b9249..3608c9680 100644 --- a/src/el/reth/reth_launcher.star +++ b/src/el/reth/reth_launcher.star @@ -230,6 +230,7 @@ def get_config( "--authrpc.addr=0.0.0.0", "--metrics=0.0.0.0:{0}".format(METRICS_PORT_NUM), "--discovery.port={0}".format(discovery_port), + "--port={0}".format(discovery_port), ] if network == constants.NETWORK_NAME.kurtosis: if len(existing_el_clients) > 0: From da4f52e51990f0bb7c1d84f1a06e2789cc21f104 Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Wed, 1 May 2024 13:57:17 +0100 Subject: [PATCH 20/23] update --- network_params.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/network_params.yaml b/network_params.yaml index 618888de1..6ecb7c0b9 100644 --- a/network_params.yaml +++ b/network_params.yaml @@ -138,4 +138,6 @@ xatu_sentry_params: global_tolerations: [] global_node_selectors: {} keymanager_enabled: false -port_publisher: KURTOSIS_IP_ADDR_PLACEHOLDER +port_publisher: + public_port_start: None + nat_exit_ip: KURTOSIS_IP_ADDR_PLACEHOLDER From 7f9e6d8bceeb91f29fa9baf650055c503cd68bc6 Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Wed, 1 May 2024 14:00:46 +0100 Subject: [PATCH 21/23] none -> null --- network_params.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/network_params.yaml b/network_params.yaml index 6ecb7c0b9..8a8786726 100644 --- a/network_params.yaml +++ b/network_params.yaml @@ -139,5 +139,5 @@ global_tolerations: [] global_node_selectors: {} keymanager_enabled: false port_publisher: - public_port_start: None + public_port_start: null nat_exit_ip: KURTOSIS_IP_ADDR_PLACEHOLDER From d959dac65f64919e21a9d5d469edc63153d32cc4 Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Wed, 1 May 2024 16:18:44 +0100 Subject: [PATCH 22/23] yeet extra infromation from default params --- src/package_io/input_parser.star | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/package_io/input_parser.star b/src/package_io/input_parser.star index f12d278b2..64357d025 100644 --- a/src/package_io/input_parser.star +++ b/src/package_io/input_parser.star @@ -633,8 +633,6 @@ def default_input_args(): "port_publisher": { "nat_exit_ip": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, "public_port_start": None, - "el_start": None, - "cl_start": None, }, } From 5378f052637c51ce027184547399137159e40cf1 Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Wed, 1 May 2024 16:21:44 +0100 Subject: [PATCH 23/23] fix error due to eyeting --- src/package_io/input_parser.star | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/package_io/input_parser.star b/src/package_io/input_parser.star index 64357d025..99c3baa5a 100644 --- a/src/package_io/input_parser.star +++ b/src/package_io/input_parser.star @@ -319,8 +319,8 @@ def input_parser(plan, input_args): port_publisher=struct( public_port_start=result["port_publisher"]["public_port_start"], nat_exit_ip=result["port_publisher"]["nat_exit_ip"], - el_start=result["port_publisher"]["el_start"], - cl_start=result["port_publisher"]["cl_start"], + el_start=result["port_publisher"].get("el_start"), + cl_start=result["port_publisher"].get("cl_start"), ), )