diff --git a/.github/workflows/run-k8s.yml b/.github/workflows/run-k8s.yml index 66dc68c0..1b59634b 100644 --- a/.github/workflows/run-k8s.yml +++ b/.github/workflows/run-k8s.yml @@ -75,7 +75,7 @@ jobs: run: | eval $(minikube -p minikube docker-env) just devnet-up - + - name: Block Building run: | just assertor -b diff --git a/Justfile b/Justfile index 2effe290..0ce819ab 100644 --- a/Justfile +++ b/Justfile @@ -21,10 +21,13 @@ test: @just ./world-chain-builder/test # Formats the world-chain-builder -fmt: +fmt: @just ./world-chain-builder/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..3b1eb277 100644 --- a/devnet/Justfile +++ b/devnet/Justfile @@ -18,3 +18,9 @@ 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 + +fmt: + kurtosis lint --format 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 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/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..cef1b014 100644 --- a/devnet/src/el_cl_launcher.star +++ b/devnet/src/el_cl_launcher.star @@ -6,19 +6,30 @@ 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@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" +) 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") 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 +53,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/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/participant_network.star b/devnet/src/participant_network.star index 66120be1..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("./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( 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, - )