From c9df57a8105ef9b65f1f341ca25c248c0a11408c Mon Sep 17 00:00:00 2001 From: 0xOsiris Date: Mon, 4 Nov 2024 17:32:56 -0700 Subject: [PATCH 1/5] chore(devnet): upstream unchanged dependencies --- .../src/blockscout/blockscout_launcher.star | 177 ------------- devnet/src/cl/hildr/hildr_launcher.star | 200 -------------- devnet/src/el/op-besu/op_besu_launcher.star | 228 ---------------- .../src/el/op-erigon/op_erigon_launcher.star | 227 ---------------- .../op_geth_builder_launcher.star | 245 ------------------ .../op-nethermind/op_nethermind_launcher.star | 213 --------------- devnet/src/el/op-reth/op_reth_launcher.star | 214 --------------- devnet/src/el_cl_launcher.star | 20 +- devnet/src/l2.star | 2 +- devnet/src/participant_network.star | 2 +- .../op-proposer/op_proposer_launcher.star | 91 ------- 11 files changed, 7 insertions(+), 1612 deletions(-) delete mode 100644 devnet/src/blockscout/blockscout_launcher.star delete mode 100644 devnet/src/cl/hildr/hildr_launcher.star delete mode 100644 devnet/src/el/op-besu/op_besu_launcher.star delete mode 100644 devnet/src/el/op-erigon/op_erigon_launcher.star delete mode 100644 devnet/src/el/op-geth-builder/op_geth_builder_launcher.star delete mode 100644 devnet/src/el/op-nethermind/op_nethermind_launcher.star delete mode 100644 devnet/src/el/op-reth/op_reth_launcher.star delete mode 100644 devnet/src/proposer/op-proposer/op_proposer_launcher.star diff --git a/devnet/src/blockscout/blockscout_launcher.star b/devnet/src/blockscout/blockscout_launcher.star deleted file mode 100644 index 957b85fb..00000000 --- a/devnet/src/blockscout/blockscout_launcher.star +++ /dev/null @@ -1,177 +0,0 @@ -shared_utils = import_module( - "github.com/ethpandaops/ethereum-package/src/shared_utils/shared_utils.star" -) -constants = import_module( - "github.com/ethpandaops/ethereum-package/src/package_io/constants.star" -) - -postgres = import_module("github.com/kurtosis-tech/postgres-package/main.star") - -IMAGE_NAME_BLOCKSCOUT = "blockscout/blockscout-optimism:6.6.0" -IMAGE_NAME_BLOCKSCOUT_VERIF = "ghcr.io/blockscout/smart-contract-verifier:v1.7.0" - -SERVICE_NAME_BLOCKSCOUT = "op-blockscout" - -HTTP_PORT_ID = "http" -HTTP_PORT_NUMBER = 4000 -HTTP_PORT_NUMBER_VERIF = 8050 - -BLOCKSCOUT_MIN_CPU = 100 -BLOCKSCOUT_MAX_CPU = 1000 -BLOCKSCOUT_MIN_MEMORY = 1024 -BLOCKSCOUT_MAX_MEMORY = 2048 - -BLOCKSCOUT_VERIF_MIN_CPU = 10 -BLOCKSCOUT_VERIF_MAX_CPU = 1000 -BLOCKSCOUT_VERIF_MIN_MEMORY = 10 -BLOCKSCOUT_VERIF_MAX_MEMORY = 1024 - -USED_PORTS = { - HTTP_PORT_ID: shared_utils.new_port_spec( - HTTP_PORT_NUMBER, - shared_utils.TCP_PROTOCOL, - shared_utils.HTTP_APPLICATION_PROTOCOL, - ) -} - -VERIF_USED_PORTS = { - HTTP_PORT_ID: shared_utils.new_port_spec( - HTTP_PORT_NUMBER_VERIF, - shared_utils.TCP_PROTOCOL, - shared_utils.HTTP_APPLICATION_PROTOCOL, - ) -} - - -def launch_blockscout( - plan, - l2_services_suffix, - l1_el_context, - l2_el_context, - l2oo_address, - l2_network_name, - additional_env_vars, -): - postgres_output = postgres.run( - plan, - service_name="{0}-postgres{1}".format( - SERVICE_NAME_BLOCKSCOUT, l2_services_suffix - ), - database="blockscout", - extra_configs=["max_connections=1000"], - ) - - config_verif = get_config_verif() - verif_service_name = "{0}-verif{1}".format( - SERVICE_NAME_BLOCKSCOUT, l2_services_suffix - ) - verif_service = plan.add_service(verif_service_name, config_verif) - verif_url = "http://{}:{}/api".format( - verif_service.hostname, verif_service.ports["http"].number - ) - - config_backend = get_config_backend( - postgres_output, - l1_el_context, - l2_el_context, - verif_url, - l2oo_address, - l2_network_name, - additional_env_vars, - ) - blockscout_service = plan.add_service( - "{0}{1}".format(SERVICE_NAME_BLOCKSCOUT, l2_services_suffix), config_backend - ) - plan.print(blockscout_service) - - blockscout_url = "http://{}:{}".format( - blockscout_service.hostname, blockscout_service.ports["http"].number - ) - - return blockscout_url - - -def get_config_verif(): - return ServiceConfig( - image=IMAGE_NAME_BLOCKSCOUT_VERIF, - ports=VERIF_USED_PORTS, - env_vars={ - "SMART_CONTRACT_VERIFIER__SERVER__HTTP__ADDR": "0.0.0.0:{}".format( - HTTP_PORT_NUMBER_VERIF - ) - }, - min_cpu=BLOCKSCOUT_VERIF_MIN_CPU, - max_cpu=BLOCKSCOUT_VERIF_MAX_CPU, - min_memory=BLOCKSCOUT_VERIF_MIN_MEMORY, - max_memory=BLOCKSCOUT_VERIF_MAX_MEMORY, - ) - - -def get_config_backend( - postgres_output, - l1_el_context, - l2_el_context, - verif_url, - l2oo_address, - l2_network_name, - additional_env_vars, -): - database_url = "{protocol}://{user}:{password}@{hostname}:{port}/{database}".format( - protocol="postgresql", - user=postgres_output.user, - password=postgres_output.password, - hostname=postgres_output.service.hostname, - port=postgres_output.port.number, - database=postgres_output.database, - ) - - optimism_env_vars = { - "CHAIN_TYPE": "optimism", - "INDEXER_OPTIMISM_L1_RPC": l1_el_context.rpc_http_url, - # "INDEXER_OPTIMISM_L1_PORTAL_CONTRACT": "", - # "INDEXER_OPTIMISM_L1_BATCH_START_BLOCK": "", - "INDEXER_OPTIMISM_L1_BATCH_INBOX": "0xff00000000000000000000000000000000042069", - "INDEXER_OPTIMISM_L1_BATCH_SUBMITTER": "0x776463f498A63a42Ac1AFc7c64a4e5A9ccBB4d32", - "INDEXER_OPTIMISM_L1_BATCH_BLOCKSCOUT_BLOBS_API_URL": verif_url + "/blobs", - "INDEXER_OPTIMISM_L1_BATCH_BLOCKS_CHUNK_SIZE": "4", - "INDEXER_OPTIMISM_L2_BATCH_GENESIS_BLOCK_NUMBER": "0", - "INDEXER_OPTIMISM_L1_OUTPUT_ROOTS_START_BLOCK": "0", - # "INDEXER_OPTIMISM_L1_OUTPUT_ORACLE_CONTRACT": l2oo_address, - # "INDEXER_OPTIMISM_L1_DEPOSITS_START_BLOCK": l1_deposit_start_block, - "INDEXER_OPTIMISM_L1_DEPOSITS_BATCH_SIZE": "500", - # "INDEXER_OPTIMISM_L1_WITHDRAWALS_START_BLOCK": l1_deposit_start_block, - "INDEXER_OPTIMISM_L2_WITHDRAWALS_START_BLOCK": "1", - "INDEXER_OPTIMISM_L2_MESSAGE_PASSER_CONTRACT": "0xC0D3C0d3C0d3c0d3C0d3C0D3c0D3c0d3c0D30016", - } | additional_env_vars - - return ServiceConfig( - image=IMAGE_NAME_BLOCKSCOUT, - ports=USED_PORTS, - cmd=[ - "/bin/sh", - "-c", - 'bin/blockscout eval "Elixir.Explorer.ReleaseTasks.create_and_migrate()" && bin/blockscout start', - ], - env_vars={ - "ETHEREUM_JSONRPC_VARIANT": "geth", - "ETHEREUM_JSONRPC_HTTP_URL": l2_el_context.rpc_http_url, - "ETHEREUM_JSONRPC_TRACE_URL": l2_el_context.rpc_http_url, - "DATABASE_URL": database_url, - "COIN": "opETH", - "MICROSERVICE_SC_VERIFIER_ENABLED": "true", - "MICROSERVICE_SC_VERIFIER_URL": verif_url, - "MICROSERVICE_SC_VERIFIER_TYPE": "sc_verifier", - "INDEXER_DISABLE_PENDING_TRANSACTIONS_FETCHER": "true", - "ECTO_USE_SSL": "false", - "NETWORK": l2_network_name, - "SUBNETWORK": l2_network_name, - "API_V2_ENABLED": "true", - "PORT": "{}".format(HTTP_PORT_NUMBER), - "SECRET_KEY_BASE": "56NtB48ear7+wMSf0IQuWDAAazhpb31qyc7GiyspBP2vh7t5zlCsF5QDv76chXeN", - } - | optimism_env_vars, - min_cpu=BLOCKSCOUT_MIN_CPU, - max_cpu=BLOCKSCOUT_MAX_CPU, - min_memory=BLOCKSCOUT_MIN_MEMORY, - max_memory=BLOCKSCOUT_MAX_MEMORY, - ) diff --git a/devnet/src/cl/hildr/hildr_launcher.star b/devnet/src/cl/hildr/hildr_launcher.star deleted file mode 100644 index aea3af19..00000000 --- a/devnet/src/cl/hildr/hildr_launcher.star +++ /dev/null @@ -1,200 +0,0 @@ -shared_utils = import_module( - "github.com/ethpandaops/ethereum-package/src/shared_utils/shared_utils.star" -) - -cl_context = import_module( - "github.com/ethpandaops/ethereum-package/src/cl/cl_context.star" -) - -cl_node_ready_conditions = import_module( - "github.com/ethpandaops/ethereum-package/src/cl/cl_node_ready_conditions.star" -) -constants = import_module( - "github.com/ethpandaops/ethereum-package/src/package_io/constants.star" -) - -# ---------------------------------- Beacon client ------------------------------------- - -# The Docker container runs as the "hildr" user so we can't write to root -BEACON_DATA_DIRPATH_ON_SERVICE_CONTAINER = "/data/hildr/hildr-beacon-data" -ROLLUP_CONFIG_MOUNT_PATH_ON_CONTAINER = "/network-configs/rollup.json" -# Port IDs -BEACON_TCP_DISCOVERY_PORT_ID = "tcp-discovery" -BEACON_UDP_DISCOVERY_PORT_ID = "udp-discovery" -BEACON_HTTP_PORT_ID = "http" - -# Port nums -BEACON_DISCOVERY_PORT_NUM = 9003 -BEACON_HTTP_PORT_NUM = 8547 - - -def get_used_ports(discovery_port): - used_ports = { - BEACON_TCP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - discovery_port, shared_utils.TCP_PROTOCOL, wait=None - ), - BEACON_UDP_DISCOVERY_PORT_ID: shared_utils.new_port_spec( - discovery_port, shared_utils.UDP_PROTOCOL, wait=None - ), - BEACON_HTTP_PORT_ID: shared_utils.new_port_spec( - BEACON_HTTP_PORT_NUM, - shared_utils.TCP_PROTOCOL, - shared_utils.HTTP_APPLICATION_PROTOCOL, - ), - } - return used_ports - - -ENTRYPOINT_ARGS = ["sh", "-c"] - -VERBOSITY_LEVELS = { - constants.GLOBAL_LOG_LEVEL.error: "ERROR", - constants.GLOBAL_LOG_LEVEL.warn: "WARN", - constants.GLOBAL_LOG_LEVEL.info: "INFO", - constants.GLOBAL_LOG_LEVEL.debug: "DEBUG", - constants.GLOBAL_LOG_LEVEL.trace: "TRACE", -} - - -def launch( - plan, - launcher, - service_name, - image, - el_context, - existing_cl_clients, - l1_config_env_vars, - gs_sequencer_private_key, - sequencer_enabled, -): - network_name = shared_utils.get_network_name(launcher.network) - - # beacon_node_identity_recipe = PostHttpRequestRecipe( - # endpoint="/", - # content_type="application/json", - # body='{"jsonrpc":"2.0","method":"opp2p_self","params":[],"id":1}', - # port_id=BEACON_HTTP_PORT_ID, - # extract={ - # "enr": ".result.ENR", - # "multiaddr": ".result.addresses[0]", - # "peer_id": ".result.peerID", - # }, - # ) - - config = get_beacon_config( - plan, - launcher.el_cl_genesis_data, - launcher.jwt_file, - image, - service_name, - el_context, - existing_cl_clients, - l1_config_env_vars, - gs_sequencer_private_key, - # beacon_node_identity_recipe, - sequencer_enabled, - ) - - beacon_service = plan.add_service(service_name, config) - - beacon_http_port = beacon_service.ports[BEACON_HTTP_PORT_ID] - beacon_http_url = "http://{0}:{1}".format( - beacon_service.ip_address, beacon_http_port.number - ) - - # response = plan.request( - # recipe=beacon_node_identity_recipe, service_name=service_name - # ) - - # beacon_node_enr = response["extract.enr"] - # beacon_multiaddr = response["extract.multiaddr"] - # beacon_peer_id = response["extract.peer_id"] - - return cl_context.new_cl_context( - client_name="hildr", - enr="", # beacon_node_enr, - ip_addr=beacon_service.ip_address, - http_port=beacon_http_port.number, - beacon_http_url=beacon_http_url, - beacon_service_name=service_name, - ) - - -def get_beacon_config( - plan, - el_cl_genesis_data, - jwt_file, - image, - service_name, - el_context, - existing_cl_clients, - l1_config_env_vars, - gs_sequencer_private_key, - # beacon_node_identity_recipe, - sequencer_enabled, -): - EXECUTION_ENGINE_ENDPOINT = "http://{0}:{1}".format( - el_context.ip_addr, - el_context.engine_rpc_port_num, - ) - EXECUTION_RPC_ENDPOINT = "http://{0}:{1}".format( - el_context.ip_addr, - el_context.rpc_port_num, - ) - - used_ports = get_used_ports(BEACON_DISCOVERY_PORT_NUM) - - cmd = [ - "--devnet", - "--jwt-file=" + constants.JWT_MOUNT_PATH_ON_CONTAINER, - "--l1-beacon-url={0}".format(l1_config_env_vars["CL_RPC_URL"]), - "--l1-rpc-url={0}".format(l1_config_env_vars["L1_RPC_URL"]), - "--l1-ws-rpc-url={0}".format(l1_config_env_vars["L1_WS_URL"]), - "--l2-engine-url={0}".format(EXECUTION_ENGINE_ENDPOINT), - "--l2-rpc-url={0}".format(EXECUTION_RPC_ENDPOINT), - "--rpc-addr=0.0.0.0", - "--rpc-port={0}".format(BEACON_HTTP_PORT_NUM), - "--sync-mode=full", - "--network=" + ROLLUP_CONFIG_MOUNT_PATH_ON_CONTAINER, - ] - - if sequencer_enabled: - cmd.append("--sequencer-enable") - - if len(existing_cl_clients) == 1: - cmd.append( - "--disc-boot-nodes=" - + ",".join( - [ctx.enr for ctx in existing_cl_clients[: constants.MAX_ENR_ENTRIES]] - ) - ) - - files = { - constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data, - constants.JWT_MOUNTPOINT_ON_CLIENTS: jwt_file, - } - ports = {} - ports.update(used_ports) - - return ServiceConfig( - image=image, - ports=ports, - cmd=cmd, - files=files, - private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, - # ready_conditions=ReadyCondition( - # recipe=beacon_node_identity_recipe, - # field="code", - # assertion="==", - # target_value=200, - # timeout="1m", - # ), - ) - - -def new_hildr_launcher(el_cl_genesis_data, jwt_file, network_params): - return struct( - el_cl_genesis_data=el_cl_genesis_data, - jwt_file=jwt_file, - network=network_params.network, - ) diff --git a/devnet/src/el/op-besu/op_besu_launcher.star b/devnet/src/el/op-besu/op_besu_launcher.star deleted file mode 100644 index a532b19f..00000000 --- a/devnet/src/el/op-besu/op_besu_launcher.star +++ /dev/null @@ -1,228 +0,0 @@ -shared_utils = import_module( - "github.com/ethpandaops/ethereum-package/src/shared_utils/shared_utils.star" -) - -el_context = import_module( - "github.com/ethpandaops/ethereum-package/src/el/el_context.star" -) -el_admin_node_info = import_module( - "github.com/ethpandaops/ethereum-package/src/el/el_admin_node_info.star" -) - -node_metrics = import_module( - "github.com/ethpandaops/ethereum-package/src/node_metrics_info.star" -) -constants = import_module( - "github.com/ethpandaops/ethereum-package/src/package_io/constants.star" -) - -RPC_PORT_NUM = 8545 -WS_PORT_NUM = 8546 -DISCOVERY_PORT_NUM = 30303 -ENGINE_RPC_PORT_NUM = 8551 -METRICS_PORT_NUM = 9001 - -# The min/max CPU/memory that the execution node can use -EXECUTION_MIN_CPU = 300 -EXECUTION_MIN_MEMORY = 512 - -# Port IDs -RPC_PORT_ID = "rpc" -WS_PORT_ID = "ws" -TCP_DISCOVERY_PORT_ID = "tcp-discovery" -UDP_DISCOVERY_PORT_ID = "udp-discovery" -ENGINE_RPC_PORT_ID = "engine-rpc" -ENGINE_WS_PORT_ID = "engineWs" -METRICS_PORT_ID = "metrics" - -# TODO(old) Scale this dynamically based on CPUs available and Geth nodes mining -NUM_MINING_THREADS = 1 - -METRICS_PATH = "/debug/metrics/prometheus" - -# The dirpath of the execution data directory on the client container -EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER = "/data/besu/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, - ), - 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 - ), - } - return used_ports - - -ENTRYPOINT_ARGS = ["sh", "-c"] - -VERBOSITY_LEVELS = { - constants.GLOBAL_LOG_LEVEL.error: "1", - constants.GLOBAL_LOG_LEVEL.warn: "2", - constants.GLOBAL_LOG_LEVEL.info: "3", - constants.GLOBAL_LOG_LEVEL.debug: "4", - constants.GLOBAL_LOG_LEVEL.trace: "5", -} - -BUILDER_IMAGE_STR = "builder" -SUAVE_ENABLED_GETH_IMAGE_STR = "suave" - - -def launch( - plan, - launcher, - service_name, - image, - existing_el_clients, - sequencer_enabled, - sequencer_context, -): - network_name = shared_utils.get_network_name(launcher.network) - - config = get_config( - plan, - launcher.el_cl_genesis_data, - launcher.jwt_file, - launcher.network, - launcher.network_id, - image, - service_name, - existing_el_clients, - sequencer_enabled, - sequencer_context, - ) - - service = plan.add_service(service_name, config) - - enode = el_admin_node_info.get_enode_for_node(plan, service_name, RPC_PORT_ID) - - metrics_url = "{0}:{1}".format(service.ip_address, METRICS_PORT_NUM) - besu_metrics_info = node_metrics.new_node_metrics_info( - service_name, METRICS_PATH, metrics_url - ) - - http_url = "http://{0}:{1}".format(service.ip_address, RPC_PORT_NUM) - - return el_context.new_el_context( - client_name="op-besu", - enode=enode, - ip_addr=service.ip_address, - rpc_port_num=RPC_PORT_NUM, - ws_port_num=WS_PORT_NUM, - engine_rpc_port_num=ENGINE_RPC_PORT_NUM, - rpc_http_url=http_url, - service_name=service_name, - el_metrics_info=[besu_metrics_info], - ) - - -def get_config( - plan, - el_cl_genesis_data, - jwt_file, - network, - network_id, - image, - service_name, - existing_el_clients, - sequencer_enabled, - sequencer_context, -): - discovery_port = DISCOVERY_PORT_NUM - used_ports = get_used_ports(discovery_port) - - cmd = [ - "besu", - "--genesis-file=" - + constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER - + "/genesis.json", - "--network-id={0}".format(network_id), - # "--logging=" + log_level, - "--data-path=" + EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER, - "--host-allowlist=*", - "--rpc-http-enabled=true", - "--rpc-http-host=0.0.0.0", - "--rpc-http-port={0}".format(RPC_PORT_NUM), - "--rpc-http-api=ADMIN,CLIQUE,ETH,NET,DEBUG,TXPOOL,ENGINE,TRACE,WEB3", - "--rpc-http-cors-origins=*", - "--rpc-http-max-active-connections=300", - "--rpc-ws-enabled=true", - "--rpc-ws-host=0.0.0.0", - "--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-port={0}".format(discovery_port), - "--engine-rpc-enabled=true", - "--engine-jwt-secret=" + constants.JWT_MOUNT_PATH_ON_CONTAINER, - "--engine-host-allowlist=*", - "--engine-rpc-port={0}".format(ENGINE_RPC_PORT_NUM), - "--sync-mode=FULL", - "--metrics-enabled=true", - "--metrics-host=0.0.0.0", - "--metrics-port={0}".format(METRICS_PORT_NUM), - "--bonsai-limit-trie-logs-enabled=false", - "--version-compatibility-protection=false", - ] - - # if not sequencer_enabled: - # cmd.append( - # "--rollup.sequencerhttp={0}".format(sequencer_context.beacon_http_url) - # ) - - if len(existing_el_clients) > 0: - cmd.append( - "--bootnodes=" - + ",".join( - [ - ctx.enode - for ctx in existing_el_clients[: constants.MAX_ENODE_ENTRIES] - ] - ) - ) - - cmd_str = " ".join(cmd) - - files = { - constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data, - constants.JWT_MOUNTPOINT_ON_CLIENTS: jwt_file, - } - - return ServiceConfig( - image=image, - ports=used_ports, - cmd=[cmd_str], - files=files, - entrypoint=ENTRYPOINT_ARGS, - private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, - user=User(uid=0, gid=0), - ) - - -def new_op_besu_launcher( - el_cl_genesis_data, - jwt_file, - network, - network_id, -): - return struct( - el_cl_genesis_data=el_cl_genesis_data, - jwt_file=jwt_file, - network=network, - network_id=network_id, - ) diff --git a/devnet/src/el/op-erigon/op_erigon_launcher.star b/devnet/src/el/op-erigon/op_erigon_launcher.star deleted file mode 100644 index 65c7edd6..00000000 --- a/devnet/src/el/op-erigon/op_erigon_launcher.star +++ /dev/null @@ -1,227 +0,0 @@ -shared_utils = import_module( - "github.com/ethpandaops/ethereum-package/src/shared_utils/shared_utils.star" -) -# input_parser = import_module("../../package_io/input_parser.star") -el_context = import_module( - "github.com/ethpandaops/ethereum-package/src/el/el_context.star" -) -el_admin_node_info = import_module( - "github.com/ethpandaops/ethereum-package/src/el/el_admin_node_info.star" -) - -node_metrics = import_module( - "github.com/ethpandaops/ethereum-package/src/node_metrics_info.star" -) -constants = import_module( - "github.com/ethpandaops/ethereum-package/src/package_io/constants.star" -) - -RPC_PORT_NUM = 8545 -WS_PORT_NUM = 8546 -DISCOVERY_PORT_NUM = 30303 -ENGINE_RPC_PORT_NUM = 8551 -METRICS_PORT_NUM = 9001 - -# The min/max CPU/memory that the execution node can use -EXECUTION_MIN_CPU = 300 -EXECUTION_MIN_MEMORY = 512 - -# Port IDs -RPC_PORT_ID = "rpc" -WS_PORT_ID = "ws" -TCP_DISCOVERY_PORT_ID = "tcp-discovery" -UDP_DISCOVERY_PORT_ID = "udp-discovery" -ENGINE_RPC_PORT_ID = "engine-rpc" -ENGINE_WS_PORT_ID = "engineWs" -METRICS_PORT_ID = "metrics" - -METRICS_PATH = "/debug/metrics/prometheus" - -# The dirpath of the execution data directory on the client container -EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER = "/data/op-erigon/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, - ), - 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 - ), - } - return used_ports - - -ENTRYPOINT_ARGS = ["sh", "-c"] - -VERBOSITY_LEVELS = { - constants.GLOBAL_LOG_LEVEL.error: "1", - constants.GLOBAL_LOG_LEVEL.warn: "2", - constants.GLOBAL_LOG_LEVEL.info: "3", - constants.GLOBAL_LOG_LEVEL.debug: "4", - constants.GLOBAL_LOG_LEVEL.trace: "5", -} - - -def launch( - plan, - launcher, - service_name, - image, - existing_el_clients, - sequencer_enabled, - sequencer_context, -): - network_name = shared_utils.get_network_name(launcher.network) - - config = get_config( - plan, - launcher.el_cl_genesis_data, - launcher.jwt_file, - launcher.network, - launcher.network_id, - image, - service_name, - existing_el_clients, - sequencer_enabled, - sequencer_context, - ) - - service = plan.add_service(service_name, config) - - enode, enr = el_admin_node_info.get_enode_enr_for_node( - plan, service_name, RPC_PORT_ID - ) - - metrics_url = "{0}:{1}".format(service.ip_address, METRICS_PORT_NUM) - erigon_metrics_info = node_metrics.new_node_metrics_info( - service_name, METRICS_PATH, metrics_url - ) - - http_url = "http://{0}:{1}".format(service.ip_address, RPC_PORT_NUM) - - return el_context.new_el_context( - client_name="op-erigon", - enode=enode, - ip_addr=service.ip_address, - rpc_port_num=RPC_PORT_NUM, - ws_port_num=WS_PORT_NUM, - engine_rpc_port_num=ENGINE_RPC_PORT_NUM, - enr=enr, - rpc_http_url=http_url, - service_name=service_name, - el_metrics_info=[erigon_metrics_info], - ) - - -def get_config( - plan, - el_cl_genesis_data, - jwt_file, - network, - network_id, - image, - service_name, - existing_el_clients, - sequencer_enabled, - sequencer_context, -): - init_datadir_cmd_str = "erigon init --datadir={0} {1}".format( - EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER, - constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER + "/genesis.json", - ) - - discovery_port = DISCOVERY_PORT_NUM - used_ports = get_used_ports(discovery_port) - - cmd = [ - "erigon", - "--datadir=" + EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER, - "--networkid={0}".format(network_id), - "--http", - "--http.addr=0.0.0.0", - "--http.vhosts=*", - "--http.corsdomain=*", - "--http.api=admin,engine,net,eth,web3,debug", - "--ws", - "--ws.port={0}".format(WS_PORT_NUM), - "--allow-insecure-unlock", - "--authrpc.port={0}".format(ENGINE_RPC_PORT_NUM), - "--authrpc.addr=0.0.0.0", - "--authrpc.vhosts=*", - "--authrpc.jwtsecret=" + constants.JWT_MOUNT_PATH_ON_CONTAINER, - "--nat=extip:" + constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, - "--rpc.allow-unprotected-txs", - "--metrics", - "--metrics.addr=0.0.0.0", - "--metrics.port={0}".format(METRICS_PORT_NUM), - "--port={0}".format(discovery_port), - ] - - if not sequencer_enabled: - cmd.append( - "--rollup.sequencerhttp={0}".format(sequencer_context.beacon_http_url) - ) - - if len(existing_el_clients) > 0: - cmd.append( - "--bootnodes=" - + ",".join( - [ - ctx.enode - for ctx in existing_el_clients[: constants.MAX_ENODE_ENTRIES] - ] - ) - ) - - cmd_str = " ".join(cmd) - if network not in constants.PUBLIC_NETWORKS: - subcommand_strs = [ - init_datadir_cmd_str, - cmd_str, - ] - command_str = " && ".join(subcommand_strs) - else: - command_str = cmd_str - - files = { - constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data, - constants.JWT_MOUNTPOINT_ON_CLIENTS: jwt_file, - } - - return ServiceConfig( - image=image, - ports=used_ports, - cmd=[command_str], - files=files, - entrypoint=ENTRYPOINT_ARGS, - private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, - ) - - -def new_op_erigon_launcher( - el_cl_genesis_data, - jwt_file, - network, - network_id, -): - return struct( - el_cl_genesis_data=el_cl_genesis_data, - jwt_file=jwt_file, - network=network, - network_id=network_id, - ) diff --git a/devnet/src/el/op-geth-builder/op_geth_builder_launcher.star b/devnet/src/el/op-geth-builder/op_geth_builder_launcher.star deleted file mode 100644 index 18e1127f..00000000 --- a/devnet/src/el/op-geth-builder/op_geth_builder_launcher.star +++ /dev/null @@ -1,245 +0,0 @@ -shared_utils = import_module( - "github.com/ethpandaops/ethereum-package/src/shared_utils/shared_utils.star" -) - -el_context = import_module( - "github.com/ethpandaops/ethereum-package/src/el/el_context.star" -) -el_admin_node_info = import_module( - "github.com/ethpandaops/ethereum-package/src/el/el_admin_node_info.star" -) - -node_metrics = import_module( - "github.com/ethpandaops/ethereum-package/src/node_metrics_info.star" -) -constants = import_module( - "github.com/ethpandaops/ethereum-package/src/package_io/constants.star" -) - -RPC_PORT_NUM = 8545 -WS_PORT_NUM = 8546 -DISCOVERY_PORT_NUM = 30303 -ENGINE_RPC_PORT_NUM = 8551 -METRICS_PORT_NUM = 9001 - -# The min/max CPU/memory that the execution node can use -EXECUTION_MIN_CPU = 300 -EXECUTION_MIN_MEMORY = 512 - -# Port IDs -RPC_PORT_ID = "rpc" -WS_PORT_ID = "ws" -TCP_DISCOVERY_PORT_ID = "tcp-discovery" -UDP_DISCOVERY_PORT_ID = "udp-discovery" -ENGINE_RPC_PORT_ID = "engine-rpc" -ENGINE_WS_PORT_ID = "engineWs" -METRICS_PORT_ID = "metrics" - -# TODO(old) Scale this dynamically based on CPUs available and Geth nodes mining -NUM_MINING_THREADS = 1 - -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(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_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"] - -VERBOSITY_LEVELS = { - constants.GLOBAL_LOG_LEVEL.error: "1", - constants.GLOBAL_LOG_LEVEL.warn: "2", - constants.GLOBAL_LOG_LEVEL.info: "3", - constants.GLOBAL_LOG_LEVEL.debug: "4", - constants.GLOBAL_LOG_LEVEL.trace: "5", -} - -BUILDER_IMAGE_STR = "builder" -SUAVE_ENABLED_GETH_IMAGE_STR = "suave" - - -def launch( - plan, - launcher, - service_name, - image, - existing_el_clients, - sequencer_enabled, - sequencer_context, -): - network_name = shared_utils.get_network_name(launcher.network) - - config = get_config( - plan, - launcher.el_cl_genesis_data, - launcher.jwt_file, - launcher.network, - launcher.network_id, - image, - service_name, - existing_el_clients, - sequencer_enabled, - sequencer_context, - ) - - service = plan.add_service(service_name, config) - - enode, enr = el_admin_node_info.get_enode_enr_for_node( - plan, service_name, RPC_PORT_ID - ) - - metrics_url = "{0}:{1}".format(service.ip_address, METRICS_PORT_NUM) - geth_metrics_info = node_metrics.new_node_metrics_info( - service_name, METRICS_PATH, metrics_url - ) - - http_url = "http://{0}:{1}".format(service.ip_address, RPC_PORT_NUM) - - return el_context.new_el_context( - client_name="op-geth-builder", - enode=enode, - ip_addr=service.ip_address, - rpc_port_num=RPC_PORT_NUM, - ws_port_num=WS_PORT_NUM, - engine_rpc_port_num=ENGINE_RPC_PORT_NUM, - rpc_http_url=http_url, - enr=enr, - service_name=service_name, - el_metrics_info=[geth_metrics_info], - ) - - -def get_config( - plan, - el_cl_genesis_data, - jwt_file, - network, - network_id, - image, - service_name, - existing_el_clients, - sequencer_enabled, - sequencer_context, -): - init_datadir_cmd_str = "geth init --datadir={0} --state.scheme=hash {1}".format( - EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER, - constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER + "/genesis.json", - ) - - discovery_port = DISCOVERY_PORT_NUM - used_ports = get_used_ports(discovery_port) - - cmd = [ - "geth", - "--builder", - "--builder.beacon_endpoints=", - "--builder.signing_key=", - "--builder.proposer_signing_address=", - "--networkid={0}".format(network_id), - # "--verbosity=" + verbosity_level, - "--datadir=" + EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER, - "--gcmode=archive", - "--state.scheme=hash", - "--http", - "--http.addr=0.0.0.0", - "--http.vhosts=*", - "--http.corsdomain=*", - "--http.api=admin,engine,net,eth,web3,debug", - "--ws", - "--ws.addr=0.0.0.0", - "--ws.port={0}".format(WS_PORT_NUM), - "--ws.api=admin,engine,net,eth,web3,debug", - "--ws.origins=*", - "--allow-insecure-unlock", - "--authrpc.port={0}".format(ENGINE_RPC_PORT_NUM), - "--authrpc.addr=0.0.0.0", - "--authrpc.vhosts=*", - "--authrpc.jwtsecret=" + constants.JWT_MOUNT_PATH_ON_CONTAINER, - "--syncmode=full", - "--nat=extip:" + constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, - "--rpc.allow-unprotected-txs", - "--metrics", - "--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 not sequencer_enabled: - cmd.append( - "--rollup.sequencerhttp={0}".format(sequencer_context.beacon_http_url) - ) - - if len(existing_el_clients) > 0: - cmd.append( - "--bootnodes=" - + ",".join( - [ - ctx.enode - for ctx in existing_el_clients[: constants.MAX_ENODE_ENTRIES] - ] - ) - ) - - cmd_str = " ".join(cmd) - if network not in constants.PUBLIC_NETWORKS: - subcommand_strs = [ - init_datadir_cmd_str, - cmd_str, - ] - command_str = " && ".join(subcommand_strs) - else: - command_str = cmd_str - - files = { - constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data, - constants.JWT_MOUNTPOINT_ON_CLIENTS: jwt_file, - } - - return ServiceConfig( - image=image, - ports=used_ports, - cmd=[command_str], - files=files, - entrypoint=ENTRYPOINT_ARGS, - private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, - ) - - -def new_op_geth_builder_launcher( - el_cl_genesis_data, - jwt_file, - network, - network_id, -): - return struct( - el_cl_genesis_data=el_cl_genesis_data, - jwt_file=jwt_file, - network=network, - network_id=network_id, - ) diff --git a/devnet/src/el/op-nethermind/op_nethermind_launcher.star b/devnet/src/el/op-nethermind/op_nethermind_launcher.star deleted file mode 100644 index 0d3dfd32..00000000 --- a/devnet/src/el/op-nethermind/op_nethermind_launcher.star +++ /dev/null @@ -1,213 +0,0 @@ -shared_utils = import_module( - "github.com/ethpandaops/ethereum-package/src/shared_utils/shared_utils.star" -) - -el_context = import_module( - "github.com/ethpandaops/ethereum-package/src/el/el_context.star" -) -el_admin_node_info = import_module( - "github.com/ethpandaops/ethereum-package/src/el/el_admin_node_info.star" -) - -node_metrics = import_module( - "github.com/ethpandaops/ethereum-package/src/node_metrics_info.star" -) -constants = import_module( - "github.com/ethpandaops/ethereum-package/src/package_io/constants.star" -) - -RPC_PORT_NUM = 8545 -WS_PORT_NUM = 8546 -DISCOVERY_PORT_NUM = 30303 -ENGINE_RPC_PORT_NUM = 8551 -METRICS_PORT_NUM = 9001 - -# The min/max CPU/memory that the execution node can use -EXECUTION_MIN_CPU = 300 -EXECUTION_MIN_MEMORY = 512 - -# Port IDs -RPC_PORT_ID = "rpc" -WS_PORT_ID = "ws" -TCP_DISCOVERY_PORT_ID = "tcp-discovery" -UDP_DISCOVERY_PORT_ID = "udp-discovery" -ENGINE_RPC_PORT_ID = "engine-rpc" -ENGINE_WS_PORT_ID = "engineWs" -METRICS_PORT_ID = "metrics" - -# TODO(old) Scale this dynamically based on CPUs available and Nethermind nodes mining -NUM_MINING_THREADS = 1 - -METRICS_PATH = "/debug/metrics/prometheus" - -# The dirpath of the execution data directory on the client container -EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER = "/data/nethermind/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, - ), - 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 - ), - } - return used_ports - - -VERBOSITY_LEVELS = { - constants.GLOBAL_LOG_LEVEL.error: "1", - constants.GLOBAL_LOG_LEVEL.warn: "2", - constants.GLOBAL_LOG_LEVEL.info: "3", - constants.GLOBAL_LOG_LEVEL.debug: "4", - constants.GLOBAL_LOG_LEVEL.trace: "5", -} - - -def launch( - plan, - launcher, - service_name, - image, - existing_el_clients, - sequencer_enabled, - sequencer_context, -): - network_name = shared_utils.get_network_name(launcher.network) - - config = get_config( - plan, - launcher.el_cl_genesis_data, - launcher.jwt_file, - launcher.network, - launcher.network_id, - image, - service_name, - existing_el_clients, - sequencer_enabled, - sequencer_context, - ) - - service = plan.add_service(service_name, config) - - enode = el_admin_node_info.get_enode_for_node(plan, service_name, RPC_PORT_ID) - - metrics_url = "{0}:{1}".format(service.ip_address, METRICS_PORT_NUM) - nethermind_metrics_info = node_metrics.new_node_metrics_info( - service_name, METRICS_PATH, metrics_url - ) - - http_url = "http://{0}:{1}".format(service.ip_address, RPC_PORT_NUM) - ws_url = "ws://{0}:{1}".format(service.ip_address, WS_PORT_NUM) - - return el_context.new_el_context( - client_name="op-nethermind", - enode=enode, - ip_addr=service.ip_address, - rpc_port_num=RPC_PORT_NUM, - ws_port_num=WS_PORT_NUM, - engine_rpc_port_num=ENGINE_RPC_PORT_NUM, - rpc_http_url=http_url, - ws_url=ws_url, - service_name=service_name, - el_metrics_info=[nethermind_metrics_info], - ) - - -def get_config( - plan, - el_cl_genesis_data, - jwt_file, - network, - network_id, - image, - service_name, - existing_el_clients, - sequencer_enabled, - sequencer_context, -): - discovery_port = DISCOVERY_PORT_NUM - used_ports = get_used_ports(discovery_port) - cmd = [ - "--log=debug", - "--datadir=" + EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER, - "--Init.WebSocketsEnabled=true", - "--JsonRpc.Enabled=true", - "--JsonRpc.EnabledModules=net,eth,consensus,subscribe,web3,admin", - "--JsonRpc.Host=0.0.0.0", - "--JsonRpc.Port={0}".format(RPC_PORT_NUM), - "--JsonRpc.WebSocketsPort={0}".format(WS_PORT_NUM), - "--JsonRpc.EngineHost=0.0.0.0", - "--JsonRpc.EnginePort={0}".format(ENGINE_RPC_PORT_NUM), - "--Network.ExternalIp=" + constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, - "--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), - "--Metrics.ExposeHost=0.0.0.0", - ] - if not sequencer_enabled: - cmd.append( - "--Optimism.SequencerUrl={0}".format(sequencer_context.beacon_http_url) - ) - - if len(existing_el_clients) > 0: - cmd.append( - "--Discovery.Bootnodes=" - + ",".join( - [ - ctx.enode - for ctx in existing_el_clients[: constants.MAX_ENODE_ENTRIES] - ] - ) - ) - - # TODO: Adding the chainspec and config separately as we may want to have support for public networks and shadowforks - cmd.append("--config=none.cfg") - cmd.append( - "--Init.ChainSpecPath=" - + constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER - + "/chainspec.json" - ) - - files = { - constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data, - constants.JWT_MOUNTPOINT_ON_CLIENTS: jwt_file, - } - - return ServiceConfig( - image=image, - ports=used_ports, - cmd=cmd, - files=files, - private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, - ) - - -def new_nethermind_launcher( - el_cl_genesis_data, - jwt_file, - network, - network_id, -): - return struct( - el_cl_genesis_data=el_cl_genesis_data, - jwt_file=jwt_file, - network=network, - network_id=network_id, - ) diff --git a/devnet/src/el/op-reth/op_reth_launcher.star b/devnet/src/el/op-reth/op_reth_launcher.star deleted file mode 100644 index a923fe2c..00000000 --- a/devnet/src/el/op-reth/op_reth_launcher.star +++ /dev/null @@ -1,214 +0,0 @@ -shared_utils = import_module( - "github.com/ethpandaops/ethereum-package/src/shared_utils/shared_utils.star" -) - -el_context = import_module( - "github.com/ethpandaops/ethereum-package/src/el/el_context.star" -) -el_admin_node_info = import_module( - "github.com/ethpandaops/ethereum-package/src/el/el_admin_node_info.star" -) - -node_metrics = import_module( - "github.com/ethpandaops/ethereum-package/src/node_metrics_info.star" -) -constants = import_module( - "github.com/ethpandaops/ethereum-package/src/package_io/constants.star" -) - -RPC_PORT_NUM = 8545 -WS_PORT_NUM = 8546 -DISCOVERY_PORT_NUM = 30303 -ENGINE_RPC_PORT_NUM = 9551 -METRICS_PORT_NUM = 9001 - -# The min/max CPU/memory that the execution node can use -EXECUTION_MIN_CPU = 100 -EXECUTION_MIN_MEMORY = 256 - -# Port IDs -RPC_PORT_ID = "rpc" -WS_PORT_ID = "ws" -TCP_DISCOVERY_PORT_ID = "tcp-discovery" -UDP_DISCOVERY_PORT_ID = "udp-discovery" -ENGINE_RPC_PORT_ID = "engine-rpc" -METRICS_PORT_ID = "metrics" - -# Paths -METRICS_PATH = "/metrics" - -# The dirpath of the execution data directory on the client container -EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER = "/data/op-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, - ), - 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 - ), - } - return used_ports - - -VERBOSITY_LEVELS = { - constants.GLOBAL_LOG_LEVEL.error: "v", - constants.GLOBAL_LOG_LEVEL.warn: "vv", - constants.GLOBAL_LOG_LEVEL.info: "vvv", - constants.GLOBAL_LOG_LEVEL.debug: "vvvv", - constants.GLOBAL_LOG_LEVEL.trace: "vvvvv", -} - - -def launch( - plan, - launcher, - service_name, - image, - existing_el_clients, - sequencer_enabled, - sequencer_context, -): - network_name = shared_utils.get_network_name(launcher.network) - - cl_client_name = service_name.split("-")[3] - - config = get_config( - plan, - launcher.el_cl_genesis_data, - launcher.jwt_file, - launcher.network, - launcher.network_id, - image, - service_name, - existing_el_clients, - sequencer_enabled, - sequencer_context, - ) - - service = plan.add_service(service_name, config) - - enode = el_admin_node_info.get_enode_for_node(plan, service_name, RPC_PORT_ID) - - metric_url = "{0}:{1}".format(service.ip_address, METRICS_PORT_NUM) - op_reth_metrics_info = node_metrics.new_node_metrics_info( - service_name, METRICS_PATH, metric_url - ) - - http_url = "http://{0}:{1}".format(service.ip_address, RPC_PORT_NUM) - - return el_context.new_el_context( - client_name="reth", - enode=enode, - ip_addr=service.ip_address, - rpc_port_num=RPC_PORT_NUM, - ws_port_num=WS_PORT_NUM, - engine_rpc_port_num=ENGINE_RPC_PORT_NUM, - rpc_http_url=http_url, - service_name=service_name, - el_metrics_info=[op_reth_metrics_info], - ) - - -def get_config( - plan, - el_cl_genesis_data, - jwt_file, - network, - network_id, - image, - service_name, - existing_el_clients, - sequencer_enabled, - sequencer_context, -): - public_ports = {} - discovery_port = DISCOVERY_PORT_NUM - used_ports = get_used_ports(discovery_port) - - cmd = [ - "node", - "--datadir=" + EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER, - "--chain={0}".format( - network - if network in constants.PUBLIC_NETWORKS - else constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER + "/genesis.json" - ), - "--http", - "--http.port={0}".format(RPC_PORT_NUM), - "--http.addr=0.0.0.0", - "--http.corsdomain=*", - # WARNING: The admin info endpoint is enabled so that we can easily get ENR/enode, which means - # that users should NOT store private information in these Kurtosis nodes! - "--http.api=admin,net,eth,web3,debug,trace", - "--ws", - "--ws.addr=0.0.0.0", - "--ws.port={0}".format(WS_PORT_NUM), - "--ws.api=net,eth", - "--ws.origins=*", - "--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", - "--metrics=0.0.0.0:{0}".format(METRICS_PORT_NUM), - "--discovery.port={0}".format(discovery_port), - "--port={0}".format(discovery_port), - ] - - if not sequencer_enabled: - cmd.append( - "--rollup.sequencer-http={0}".format(sequencer_context.beacon_http_url) - ) - - if len(existing_el_clients) > 0: - cmd.append( - "--bootnodes=" - + ",".join( - [ - ctx.enode - for ctx in existing_el_clients[: constants.MAX_ENODE_ENTRIES] - ] - ) - ) - - files = { - constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data, - constants.JWT_MOUNTPOINT_ON_CLIENTS: jwt_file, - } - - return ServiceConfig( - image=image, - ports=used_ports, - public_ports=public_ports, - cmd=cmd, - files=files, - private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, - ) - - -def new_op_reth_launcher( - el_cl_genesis_data, - jwt_file, - network, - network_id, -): - return struct( - el_cl_genesis_data=el_cl_genesis_data, - jwt_file=jwt_file, - network=network, - network_id=network_id, - ) diff --git a/devnet/src/el_cl_launcher.star b/devnet/src/el_cl_launcher.star index 055484e3..9a7d4637 100644 --- a/devnet/src/el_cl_launcher.star +++ b/devnet/src/el_cl_launcher.star @@ -7,18 +7,17 @@ shared_utils = import_module( # EL op_geth = import_module("./el/op-geth/op_geth_launcher.star") -op_geth_builder = import_module("./el/op-geth-builder/op_geth_builder_launcher.star") -op_reth = import_module("./el/op-reth/op_reth_launcher.star") +op_reth = import_module("github.com/ethpandaops/optimism-package/src/el/op-reth/op_reth_launcher.star") world_chain = import_module("./el/world-chain/world_chain_launcher.star") -op_erigon = import_module("./el/op-erigon/op_erigon_launcher.star") -op_nethermind = import_module("./el/op-nethermind/op_nethermind_launcher.star") -op_besu = import_module("./el/op-besu/op_besu_launcher.star") +op_erigon = import_module("github.com/ethpandaops/optimism-package/src/el/op-erigon/op_erigon_launcher.star") +op_nethermind = import_module("github.com/ethpandaops/optimism-package/src/el/op-nethermind/op_nethermind_launcher.star") +op_besu = import_module("github.com/ethpandaops/optimism-package/src/el/op-besu/op_besu_launcher.star") rollup_boost = import_module("./engine/rollup-boost/rollup_boost_launcher.star") # CL op_node = import_module("./cl/op-node/op_node_launcher.star") op_node_builder = import_module("./cl/op-node-builder/op_node_builder_launcher.star") -hildr = import_module("./cl/hildr/hildr_launcher.star") +hildr = import_module("github.com/ethpandaops/optimism-package/src/cl/hildr/hildr_launcher.star") def launch( @@ -42,15 +41,6 @@ def launch( ), "launch_method": world_chain.launch, }, - "op-geth-builder": { - "launcher": op_geth_builder.new_op_geth_builder_launcher( - el_cl_data, - jwt_file, - network_params.network, - network_params.network_id, - ), - "launch_method": op_geth_builder.launch, - }, "op-geth": { "launcher": op_geth.new_op_geth_launcher( el_cl_data, diff --git a/devnet/src/l2.star b/devnet/src/l2.star index 7bcb3150..44cc2f93 100644 --- a/devnet/src/l2.star +++ b/devnet/src/l2.star @@ -1,5 +1,5 @@ participant_network = import_module("./participant_network.star") -blockscout = import_module("./blockscout/blockscout_launcher.star") +blockscout = import_module("github.com/ethpandaops/optimism-package/src/blockscout/blockscout_launcher.star") contract_deployer = import_module("./contracts/contract_deployer.star") input_parser = import_module("./package_io/input_parser.star") static_files = import_module( diff --git a/devnet/src/participant_network.star b/devnet/src/participant_network.star index 66120be1..702cfa1b 100644 --- a/devnet/src/participant_network.star +++ b/devnet/src/participant_network.star @@ -2,7 +2,7 @@ el_cl_client_launcher = import_module("./el_cl_launcher.star") participant_module = import_module("./participant.star") input_parser = import_module("./package_io/input_parser.star") op_batcher_launcher = import_module("./batcher/op-batcher/op_batcher_launcher.star") -op_proposer_launcher = import_module("./proposer/op-proposer/op_proposer_launcher.star") +op_proposer_launcher = import_module("github.com/ethpandaops/optimism-package/src/proposer/op-proposer/op_proposer_launcher.star") def launch_participant_network( diff --git a/devnet/src/proposer/op-proposer/op_proposer_launcher.star b/devnet/src/proposer/op-proposer/op_proposer_launcher.star deleted file mode 100644 index 6b049f1c..00000000 --- a/devnet/src/proposer/op-proposer/op_proposer_launcher.star +++ /dev/null @@ -1,91 +0,0 @@ -shared_utils = import_module( - "github.com/ethpandaops/ethereum-package/src/shared_utils/shared_utils.star" -) - -constants = import_module( - "github.com/ethpandaops/ethereum-package/src/package_io/constants.star" -) - -# -# ---------------------------------- Batcher client ------------------------------------- -# The Docker container runs as the "op-proposer" user so we can't write to root -PROPOSER_DATA_DIRPATH_ON_SERVICE_CONTAINER = "/data/op-proposer/op-proposer-data" - -# Port IDs -PROPOSER_HTTP_PORT_ID = "http" - -# Port nums -PROPOSER_HTTP_PORT_NUM = 8560 - - -def get_used_ports(): - used_ports = { - PROPOSER_HTTP_PORT_ID: shared_utils.new_port_spec( - PROPOSER_HTTP_PORT_NUM, - shared_utils.TCP_PROTOCOL, - shared_utils.HTTP_APPLICATION_PROTOCOL, - ), - } - return used_ports - - -ENTRYPOINT_ARGS = ["sh", "-c"] - - -def launch( - plan, - service_name, - image, - cl_context, - l1_config_env_vars, - gs_proposer_private_key, - l2oo_address, -): - proposer_service_name = "{0}".format(service_name) - - config = get_proposer_config( - plan, - image, - service_name, - cl_context, - l1_config_env_vars, - gs_proposer_private_key, - l2oo_address, - ) - - proposer_service = plan.add_service(service_name, config) - - proposer_http_port = proposer_service.ports[PROPOSER_HTTP_PORT_ID] - proposer_http_url = "http://{0}:{1}".format( - proposer_service.ip_address, proposer_http_port.number - ) - - return "op_proposer" - - -def get_proposer_config( - plan, - image, - service_name, - cl_context, - l1_config_env_vars, - gs_proposer_private_key, - l2oo_address, -): - cmd = [ - "op-proposer", - "--poll-interval=12s", - "--rpc.port=" + str(PROPOSER_HTTP_PORT_NUM), - "--rollup-rpc=" + cl_context.beacon_http_url, - "--l2oo-address=" + str(l2oo_address), - "--private-key=" + gs_proposer_private_key, - "--l1-eth-rpc=" + l1_config_env_vars["L1_RPC_URL"], - ] - - ports = get_used_ports() - return ServiceConfig( - image=image, - ports=ports, - cmd=cmd, - private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, - ) From e74c242241e793668eba706f51f5ff6344243145 Mon Sep 17 00:00:00 2001 From: 0xOsiris Date: Tue, 5 Nov 2024 14:13:03 -0700 Subject: [PATCH 2/5] checkpoint fixtures --- .github/workflows/run-k8s.yml | 4 ++++ Justfile | 5 ++++- devnet/Justfile | 3 +++ devnet/fixtures.sh | 17 +++++++++-------- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/.github/workflows/run-k8s.yml b/.github/workflows/run-k8s.yml index 3ca6f010..628bbaf2 100644 --- a/.github/workflows/run-k8s.yml +++ b/.github/workflows/run-k8s.yml @@ -78,6 +78,10 @@ jobs: eval $(minikube -p minikube docker-env) just devnet-up + - name: Setup Fixtures + run: | + just fixtures + - name: Block Building run: | just assertor -b diff --git a/Justfile b/Justfile index 2effe290..9598bf5b 100644 --- a/Justfile +++ b/Justfile @@ -27,4 +27,7 @@ fmt: # Runs the block building assertions # NOTE: The devnet needs to be running for this to work assertor *args='': - @just ./world-chain-builder/assertor $@ \ No newline at end of file + @just ./world-chain-builder/assertor $@ + +fixtures: + @just ./devnet/fixtures \ No newline at end of file diff --git a/devnet/Justfile b/devnet/Justfile index 4cb52f80..ec2783e2 100644 --- a/devnet/Justfile +++ b/devnet/Justfile @@ -18,3 +18,6 @@ build: build-world-chain build-world-chain: docker buildx build -t world-chain-builder:latest -f ../world-chain-builder/Dockerfile ../world-chain-builder + +fixtures: + chmod +x fixtures.sh && ./fixtures.sh diff --git a/devnet/fixtures.sh b/devnet/fixtures.sh index 1b4d09e5..ad42edee 100755 --- a/devnet/fixtures.sh +++ b/devnet/fixtures.sh @@ -2,21 +2,22 @@ set -e MNEMONIC="test test test test test test test test test test test junk" # This needs to be configured to the enclave (public rpc ports are non-deterministic) -BUILDER_SOCKET="" export IDENTITY=11ff11 export INCLUSION_PROOF_URL="https://signup-orb-ethereum.stage-crypto.worldcoin.dev/inclusionProof" +kurtosis_port=$(kurtosis port print world-chain wc-admin-world-chain-builder rpc) +BUILDER_SOCKET=$(echo "$kurtosis_port" | grep -o 'http://127.0.0.1:[0-9]*') make_txs() { local fixture_file=$1 declare -a local_fixture=() for t in {0..29}; do - tx=$(cast mktx --private-key "$2" 0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF --value $3 --rpc-url "$BUILDER_SOCKET" --nonce "$t") - transaction=$(toolkit prove -t "$tx" -N "$t") - local_fixture[$t]="$transaction" + tx=$(cast mktx --private-key "$2" 0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF --value $3 --rpc-url "$BUILDER_SOCKET" --nonce "$t") + transaction=$(toolkit prove -t "$tx" -N "$t") + local_fixture[$t]="$transaction" done # Write local_fixture to a temporary file - printf '%s\n' "${local_fixture[@]}" > "$fixture_file" + printf '%s\n' "${local_fixture[@]}" >"$fixture_file" echo "Finished Process: $3" } @@ -35,14 +36,14 @@ FIXTURE=() for tmp_file in /tmp/fixture_*.tmp; do while read -r line; do FIXTURE+=("$line") - done < "$tmp_file" + done <"$tmp_file" done # Convert the FIXTURE array into a JSON-friendly format fixture_json=$(printf '%s\n' "${FIXTURE[@]}" | jq -R . | jq -s .) # Write the fixture to a JSON file -echo "{\"fixture\": $fixture_json}" > "${PWD}/fixtures/fixture.json" +echo "{\"fixture\": $fixture_json}" >"${PWD}/fixtures/fixture.json" # Clean up temporary files -rm /tmp/fixture_*.tmp \ No newline at end of file +rm /tmp/fixture_*.tmp From 03e41cbaf9998c77c8c031107cf74a1fdb05036a Mon Sep 17 00:00:00 2001 From: 0xOsiris Date: Tue, 5 Nov 2024 18:12:37 -0700 Subject: [PATCH 3/5] feat: upstream devnet to optimism-package, and cleanup --- .github/workflows/run-k8s.yml | 6 +- Justfile | 7 +- devnet/Justfile | 3 + .../op-batcher/op_batcher_launcher.star | 99 ---------- .../src/blockscout/blockscout_launcher.star | 177 ++++++++++++++++++ devnet/src/el_cl_launcher.star | 24 ++- .../rollup-boost/rollup_boost_launcher.star | 1 + devnet/src/l2.star | 2 +- devnet/src/participant_network.star | 8 +- 9 files changed, 213 insertions(+), 114 deletions(-) delete mode 100644 devnet/src/batcher/op-batcher/op_batcher_launcher.star create mode 100644 devnet/src/blockscout/blockscout_launcher.star diff --git a/.github/workflows/run-k8s.yml b/.github/workflows/run-k8s.yml index 628bbaf2..c2cd184c 100644 --- a/.github/workflows/run-k8s.yml +++ b/.github/workflows/run-k8s.yml @@ -77,11 +77,7 @@ jobs: run: | eval $(minikube -p minikube docker-env) just devnet-up - - - name: Setup Fixtures - run: | - just fixtures - + - name: Block Building run: | just assertor -b diff --git a/Justfile b/Justfile index 9598bf5b..a25c98b6 100644 --- a/Justfile +++ b/Justfile @@ -21,9 +21,14 @@ test: @just ./world-chain-builder/test # Formats the world-chain-builder -fmt: +fmt: rust-fmt devnet-fmt + +rust-fmt: @just ./world-chain-builder/fmt +devnet-fmt: + @just ./devnet/fmt + # Runs the block building assertions # NOTE: The devnet needs to be running for this to work assertor *args='': diff --git a/devnet/Justfile b/devnet/Justfile index ec2783e2..3b1eb277 100644 --- a/devnet/Justfile +++ b/devnet/Justfile @@ -21,3 +21,6 @@ build-world-chain: fixtures: chmod +x fixtures.sh && ./fixtures.sh + +fmt: + kurtosis lint --format diff --git a/devnet/src/batcher/op-batcher/op_batcher_launcher.star b/devnet/src/batcher/op-batcher/op_batcher_launcher.star deleted file mode 100644 index 33a5d684..00000000 --- a/devnet/src/batcher/op-batcher/op_batcher_launcher.star +++ /dev/null @@ -1,99 +0,0 @@ -shared_utils = import_module( - "github.com/ethpandaops/ethereum-package/src/shared_utils/shared_utils.star" -) - -constants = import_module( - "github.com/ethpandaops/ethereum-package/src/package_io/constants.star" -) - -# -# ---------------------------------- Batcher client ------------------------------------- -# The Docker container runs as the "op-batcher" user so we can't write to root -BATCHER_DATA_DIRPATH_ON_SERVICE_CONTAINER = "/data/op-batcher/op-batcher-data" - -# Port IDs -BATCHER_HTTP_PORT_ID = "http" - -# Port nums -BATCHER_HTTP_PORT_NUM = 8548 - - -def get_used_ports(): - used_ports = { - BATCHER_HTTP_PORT_ID: shared_utils.new_port_spec( - BATCHER_HTTP_PORT_NUM, - shared_utils.TCP_PROTOCOL, - shared_utils.HTTP_APPLICATION_PROTOCOL, - ), - } - return used_ports - - -ENTRYPOINT_ARGS = ["sh", "-c"] - - -def launch( - plan, - service_name, - image, - el_context, - cl_context, - l1_config_env_vars, - gs_batcher_private_key, -): - batcher_service_name = "{0}".format(service_name) - - config = get_batcher_config( - plan, - image, - service_name, - el_context, - cl_context, - l1_config_env_vars, - gs_batcher_private_key, - ) - - batcher_service = plan.add_service(service_name, config) - - batcher_http_port = batcher_service.ports[BATCHER_HTTP_PORT_ID] - batcher_http_url = "http://{0}:{1}".format( - batcher_service.ip_address, batcher_http_port.number - ) - - return "op_batcher" - - -def get_batcher_config( - plan, - image, - service_name, - el_context, - cl_context, - l1_config_env_vars, - gs_batcher_private_key, -): - cmd = [ - "op-batcher", - "--l2-eth-rpc=" + el_context.rpc_http_url, - "--rollup-rpc=" + cl_context.beacon_http_url, - "--poll-interval=1s", - "--sub-safety-margin=6", - "--num-confirmations=1", - "--safe-abort-nonce-too-low-count=3", - "--resubmission-timeout=30s", - "--rpc.addr=0.0.0.0", - "--rpc.port=" + str(BATCHER_HTTP_PORT_NUM), - "--rpc.enable-admin", - "--max-channel-duration=1", - "--l1-eth-rpc=" + l1_config_env_vars["L1_RPC_URL"], - "--private-key=" + gs_batcher_private_key, - "--data-availability-type=blobs", - ] - - ports = get_used_ports() - return ServiceConfig( - image=image, - ports=ports, - cmd=cmd, - private_ip_address_placeholder=constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, - ) diff --git a/devnet/src/blockscout/blockscout_launcher.star b/devnet/src/blockscout/blockscout_launcher.star new file mode 100644 index 00000000..957b85fb --- /dev/null +++ b/devnet/src/blockscout/blockscout_launcher.star @@ -0,0 +1,177 @@ +shared_utils = import_module( + "github.com/ethpandaops/ethereum-package/src/shared_utils/shared_utils.star" +) +constants = import_module( + "github.com/ethpandaops/ethereum-package/src/package_io/constants.star" +) + +postgres = import_module("github.com/kurtosis-tech/postgres-package/main.star") + +IMAGE_NAME_BLOCKSCOUT = "blockscout/blockscout-optimism:6.6.0" +IMAGE_NAME_BLOCKSCOUT_VERIF = "ghcr.io/blockscout/smart-contract-verifier:v1.7.0" + +SERVICE_NAME_BLOCKSCOUT = "op-blockscout" + +HTTP_PORT_ID = "http" +HTTP_PORT_NUMBER = 4000 +HTTP_PORT_NUMBER_VERIF = 8050 + +BLOCKSCOUT_MIN_CPU = 100 +BLOCKSCOUT_MAX_CPU = 1000 +BLOCKSCOUT_MIN_MEMORY = 1024 +BLOCKSCOUT_MAX_MEMORY = 2048 + +BLOCKSCOUT_VERIF_MIN_CPU = 10 +BLOCKSCOUT_VERIF_MAX_CPU = 1000 +BLOCKSCOUT_VERIF_MIN_MEMORY = 10 +BLOCKSCOUT_VERIF_MAX_MEMORY = 1024 + +USED_PORTS = { + HTTP_PORT_ID: shared_utils.new_port_spec( + HTTP_PORT_NUMBER, + shared_utils.TCP_PROTOCOL, + shared_utils.HTTP_APPLICATION_PROTOCOL, + ) +} + +VERIF_USED_PORTS = { + HTTP_PORT_ID: shared_utils.new_port_spec( + HTTP_PORT_NUMBER_VERIF, + shared_utils.TCP_PROTOCOL, + shared_utils.HTTP_APPLICATION_PROTOCOL, + ) +} + + +def launch_blockscout( + plan, + l2_services_suffix, + l1_el_context, + l2_el_context, + l2oo_address, + l2_network_name, + additional_env_vars, +): + postgres_output = postgres.run( + plan, + service_name="{0}-postgres{1}".format( + SERVICE_NAME_BLOCKSCOUT, l2_services_suffix + ), + database="blockscout", + extra_configs=["max_connections=1000"], + ) + + config_verif = get_config_verif() + verif_service_name = "{0}-verif{1}".format( + SERVICE_NAME_BLOCKSCOUT, l2_services_suffix + ) + verif_service = plan.add_service(verif_service_name, config_verif) + verif_url = "http://{}:{}/api".format( + verif_service.hostname, verif_service.ports["http"].number + ) + + config_backend = get_config_backend( + postgres_output, + l1_el_context, + l2_el_context, + verif_url, + l2oo_address, + l2_network_name, + additional_env_vars, + ) + blockscout_service = plan.add_service( + "{0}{1}".format(SERVICE_NAME_BLOCKSCOUT, l2_services_suffix), config_backend + ) + plan.print(blockscout_service) + + blockscout_url = "http://{}:{}".format( + blockscout_service.hostname, blockscout_service.ports["http"].number + ) + + return blockscout_url + + +def get_config_verif(): + return ServiceConfig( + image=IMAGE_NAME_BLOCKSCOUT_VERIF, + ports=VERIF_USED_PORTS, + env_vars={ + "SMART_CONTRACT_VERIFIER__SERVER__HTTP__ADDR": "0.0.0.0:{}".format( + HTTP_PORT_NUMBER_VERIF + ) + }, + min_cpu=BLOCKSCOUT_VERIF_MIN_CPU, + max_cpu=BLOCKSCOUT_VERIF_MAX_CPU, + min_memory=BLOCKSCOUT_VERIF_MIN_MEMORY, + max_memory=BLOCKSCOUT_VERIF_MAX_MEMORY, + ) + + +def get_config_backend( + postgres_output, + l1_el_context, + l2_el_context, + verif_url, + l2oo_address, + l2_network_name, + additional_env_vars, +): + database_url = "{protocol}://{user}:{password}@{hostname}:{port}/{database}".format( + protocol="postgresql", + user=postgres_output.user, + password=postgres_output.password, + hostname=postgres_output.service.hostname, + port=postgres_output.port.number, + database=postgres_output.database, + ) + + optimism_env_vars = { + "CHAIN_TYPE": "optimism", + "INDEXER_OPTIMISM_L1_RPC": l1_el_context.rpc_http_url, + # "INDEXER_OPTIMISM_L1_PORTAL_CONTRACT": "", + # "INDEXER_OPTIMISM_L1_BATCH_START_BLOCK": "", + "INDEXER_OPTIMISM_L1_BATCH_INBOX": "0xff00000000000000000000000000000000042069", + "INDEXER_OPTIMISM_L1_BATCH_SUBMITTER": "0x776463f498A63a42Ac1AFc7c64a4e5A9ccBB4d32", + "INDEXER_OPTIMISM_L1_BATCH_BLOCKSCOUT_BLOBS_API_URL": verif_url + "/blobs", + "INDEXER_OPTIMISM_L1_BATCH_BLOCKS_CHUNK_SIZE": "4", + "INDEXER_OPTIMISM_L2_BATCH_GENESIS_BLOCK_NUMBER": "0", + "INDEXER_OPTIMISM_L1_OUTPUT_ROOTS_START_BLOCK": "0", + # "INDEXER_OPTIMISM_L1_OUTPUT_ORACLE_CONTRACT": l2oo_address, + # "INDEXER_OPTIMISM_L1_DEPOSITS_START_BLOCK": l1_deposit_start_block, + "INDEXER_OPTIMISM_L1_DEPOSITS_BATCH_SIZE": "500", + # "INDEXER_OPTIMISM_L1_WITHDRAWALS_START_BLOCK": l1_deposit_start_block, + "INDEXER_OPTIMISM_L2_WITHDRAWALS_START_BLOCK": "1", + "INDEXER_OPTIMISM_L2_MESSAGE_PASSER_CONTRACT": "0xC0D3C0d3C0d3c0d3C0d3C0D3c0D3c0d3c0D30016", + } | additional_env_vars + + return ServiceConfig( + image=IMAGE_NAME_BLOCKSCOUT, + ports=USED_PORTS, + cmd=[ + "/bin/sh", + "-c", + 'bin/blockscout eval "Elixir.Explorer.ReleaseTasks.create_and_migrate()" && bin/blockscout start', + ], + env_vars={ + "ETHEREUM_JSONRPC_VARIANT": "geth", + "ETHEREUM_JSONRPC_HTTP_URL": l2_el_context.rpc_http_url, + "ETHEREUM_JSONRPC_TRACE_URL": l2_el_context.rpc_http_url, + "DATABASE_URL": database_url, + "COIN": "opETH", + "MICROSERVICE_SC_VERIFIER_ENABLED": "true", + "MICROSERVICE_SC_VERIFIER_URL": verif_url, + "MICROSERVICE_SC_VERIFIER_TYPE": "sc_verifier", + "INDEXER_DISABLE_PENDING_TRANSACTIONS_FETCHER": "true", + "ECTO_USE_SSL": "false", + "NETWORK": l2_network_name, + "SUBNETWORK": l2_network_name, + "API_V2_ENABLED": "true", + "PORT": "{}".format(HTTP_PORT_NUMBER), + "SECRET_KEY_BASE": "56NtB48ear7+wMSf0IQuWDAAazhpb31qyc7GiyspBP2vh7t5zlCsF5QDv76chXeN", + } + | optimism_env_vars, + min_cpu=BLOCKSCOUT_MIN_CPU, + max_cpu=BLOCKSCOUT_MAX_CPU, + min_memory=BLOCKSCOUT_MIN_MEMORY, + max_memory=BLOCKSCOUT_MAX_MEMORY, + ) diff --git a/devnet/src/el_cl_launcher.star b/devnet/src/el_cl_launcher.star index 9a7d4637..817ef0a9 100644 --- a/devnet/src/el_cl_launcher.star +++ b/devnet/src/el_cl_launcher.star @@ -6,18 +6,30 @@ shared_utils = import_module( ) # EL -op_geth = import_module("./el/op-geth/op_geth_launcher.star") -op_reth = import_module("github.com/ethpandaops/optimism-package/src/el/op-reth/op_reth_launcher.star") +op_reth = import_module( + "github.com/ethpandaops/optimism-package/src/el/op-reth/op_reth_launcher.star@914a80895376625c8866943b517df47ce4c28170" +) +op_erigon = import_module( + "github.com/ethpandaops/optimism-package/src/el/op-erigon/op_erigon_launcher.star@914a80895376625c8866943b517df47ce4c28170" +) +op_nethermind = import_module( + "github.com/ethpandaops/optimism-package/src/el/op-nethermind/op_nethermind_launcher.star" +) +op_besu = import_module( + "github.com/ethpandaops/optimism-package/src/el/op-besu/op_besu_launcher.star" +) +op_geth = import_module( + "./el/op-geth/op_geth_launcher.star@914a80895376625c8866943b517df47ce4c28170" +) world_chain = import_module("./el/world-chain/world_chain_launcher.star") -op_erigon = import_module("github.com/ethpandaops/optimism-package/src/el/op-erigon/op_erigon_launcher.star") -op_nethermind = import_module("github.com/ethpandaops/optimism-package/src/el/op-nethermind/op_nethermind_launcher.star") -op_besu = import_module("github.com/ethpandaops/optimism-package/src/el/op-besu/op_besu_launcher.star") rollup_boost = import_module("./engine/rollup-boost/rollup_boost_launcher.star") # CL op_node = import_module("./cl/op-node/op_node_launcher.star") op_node_builder = import_module("./cl/op-node-builder/op_node_builder_launcher.star") -hildr = import_module("github.com/ethpandaops/optimism-package/src/cl/hildr/hildr_launcher.star") +hildr = import_module( + "github.com/ethpandaops/optimism-package/src/cl/hildr/hildr_launcher.star" +) def launch( diff --git a/devnet/src/engine/rollup-boost/rollup_boost_launcher.star b/devnet/src/engine/rollup-boost/rollup_boost_launcher.star index b3fdd062..f8254388 100644 --- a/devnet/src/engine/rollup-boost/rollup_boost_launcher.star +++ b/devnet/src/engine/rollup-boost/rollup_boost_launcher.star @@ -16,6 +16,7 @@ WS_PORT_NUM = 8546 DISCOVERY_PORT_NUM = 30303 RPC_PORT_ID = "rpc" + def get_used_ports(discovery_port=DISCOVERY_PORT_NUM): used_ports = { RPC_PORT_ID: shared_utils.new_port_spec( diff --git a/devnet/src/l2.star b/devnet/src/l2.star index 44cc2f93..7bcb3150 100644 --- a/devnet/src/l2.star +++ b/devnet/src/l2.star @@ -1,5 +1,5 @@ participant_network = import_module("./participant_network.star") -blockscout = import_module("github.com/ethpandaops/optimism-package/src/blockscout/blockscout_launcher.star") +blockscout = import_module("./blockscout/blockscout_launcher.star") contract_deployer = import_module("./contracts/contract_deployer.star") input_parser = import_module("./package_io/input_parser.star") static_files = import_module( diff --git a/devnet/src/participant_network.star b/devnet/src/participant_network.star index 702cfa1b..bbd8d997 100644 --- a/devnet/src/participant_network.star +++ b/devnet/src/participant_network.star @@ -1,8 +1,12 @@ el_cl_client_launcher = import_module("./el_cl_launcher.star") participant_module = import_module("./participant.star") input_parser = import_module("./package_io/input_parser.star") -op_batcher_launcher = import_module("./batcher/op-batcher/op_batcher_launcher.star") -op_proposer_launcher = import_module("github.com/ethpandaops/optimism-package/src/proposer/op-proposer/op_proposer_launcher.star") +op_batcher_launcher = import_module( + "github.com/ethpandaops/optimism-package/src/batcher/op-batcher/op_batcher_launcher.star@914a80895376625c8866943b517df47ce4c28170" +) +op_proposer_launcher = import_module( + "github.com/ethpandaops/optimism-package/src/proposer/op-proposer/op_proposer_launcher.star@914a80895376625c8866943b517df47ce4c28170" +) def launch_participant_network( From 860d611ea3081387a45775fa943adbd9da8ee10b Mon Sep 17 00:00:00 2001 From: 0xOsiris Date: Tue, 5 Nov 2024 18:16:11 -0700 Subject: [PATCH 4/5] isolate formatting to kurtosis --- Justfile | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Justfile b/Justfile index a25c98b6..0ce819ab 100644 --- a/Justfile +++ b/Justfile @@ -21,14 +21,9 @@ test: @just ./world-chain-builder/test # Formats the world-chain-builder -fmt: rust-fmt devnet-fmt - -rust-fmt: +fmt: @just ./world-chain-builder/fmt -devnet-fmt: - @just ./devnet/fmt - # Runs the block building assertions # NOTE: The devnet needs to be running for this to work assertor *args='': From 4ab5fcc6e0163806851203eb157ab70f6a5bd4b9 Mon Sep 17 00:00:00 2001 From: 0xOsiris Date: Tue, 5 Nov 2024 18:26:35 -0700 Subject: [PATCH 5/5] fix: op-geth launcher --- devnet/src/el_cl_launcher.star | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devnet/src/el_cl_launcher.star b/devnet/src/el_cl_launcher.star index 817ef0a9..cef1b014 100644 --- a/devnet/src/el_cl_launcher.star +++ b/devnet/src/el_cl_launcher.star @@ -19,7 +19,7 @@ op_besu = import_module( "github.com/ethpandaops/optimism-package/src/el/op-besu/op_besu_launcher.star" ) op_geth = import_module( - "./el/op-geth/op_geth_launcher.star@914a80895376625c8866943b517df47ce4c28170" + "./el/op-geth/op_geth_launcher.star" ) world_chain = import_module("./el/world-chain/world_chain_launcher.star") rollup_boost = import_module("./engine/rollup-boost/rollup_boost_launcher.star")