From 5ae28d46405c742da91adff525cac9291a30372a Mon Sep 17 00:00:00 2001 From: parithosh Date: Fri, 28 Jun 2024 14:26:23 +0200 Subject: [PATCH 01/13] adding op-nethermind --- .github/tests/op-node.yaml | 2 + network_params.yaml | 7 +- .../op-nethermind/op_nethermind_launcher.star | 219 ++++++++++++++++++ src/el_cl_launcher.star | 10 + src/package_io/input_parser.star | 1 + 5 files changed, 235 insertions(+), 4 deletions(-) create mode 100644 src/el/op-nethermind/op_nethermind_launcher.star diff --git a/.github/tests/op-node.yaml b/.github/tests/op-node.yaml index 0b3bf5a..871cfbf 100644 --- a/.github/tests/op-node.yaml +++ b/.github/tests/op-node.yaml @@ -6,6 +6,8 @@ optimism_package: cl_type: op-node - el_type: op-erigon cl_type: op-node + - el_type: op-nethermind + cl_type: op-node ethereum_package: participants: - el_type: geth diff --git a/network_params.yaml b/network_params.yaml index 9583e57..75d1cde 100644 --- a/network_params.yaml +++ b/network_params.yaml @@ -1,16 +1,15 @@ optimism_package: participants: - el_type: op-geth - - el_type: op-reth - - el_type: op-erigon + - el_type: op-nethermind additional_services: - blockscout ethereum_package: participants: - el_type: geth - - el_type: reth + count: 2 network_params: preset: minimal additional_services: - dora - - blockscout \ No newline at end of file + - blockscout diff --git a/src/el/op-nethermind/op_nethermind_launcher.star b/src/el/op-nethermind/op_nethermind_launcher.star new file mode 100644 index 0000000..2661107 --- /dev/null +++ b/src/el/op-nethermind/op_nethermind_launcher.star @@ -0,0 +1,219 @@ +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, 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) + 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) + + return el_context.new_el_context( + "op-nethermind", + enr, + enode, + service.ip_address, + RPC_PORT_NUM, + WS_PORT_NUM, + ENGINE_RPC_PORT_NUM, + http_url, + service_name, + [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] + ] + ) + ) + + if network not in constants.PUBLIC_NETWORKS: + cmd.append("--config=none.cfg") +# cmd.append( +# "--Init.ChainSpecPath=" +# + constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER +# + "/chainspec.json" +# ) + else: + cmd.append("--config=" + network) + + + 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/src/el_cl_launcher.star b/src/el_cl_launcher.star index 7dc838f..a788a7f 100644 --- a/src/el_cl_launcher.star +++ b/src/el_cl_launcher.star @@ -8,6 +8,7 @@ shared_utils = import_module( op_geth = import_module("./el/op-geth/op_geth_launcher.star") op_reth = import_module("./el/op-reth/op_reth_launcher.star") op_erigon = import_module("./el/op-erigon/op_erigon_launcher.star") +op_nethermind = import_module("./el/op-nethermind/op_nethermind_launcher.star") # CL op_node = import_module("./cl/op-node/op_node_launcher.star") @@ -51,6 +52,15 @@ def launch( ), "launch_method": op_erigon.launch, }, + "op-nethermind": { + "launcher": op_nethermind.new_nethermind_launcher( + el_cl_data, + jwt_file, + network_params.network, + network_params.network_id, + ), + "launch_method": op_nethermind.launch, + }, } cl_launchers = { diff --git a/src/package_io/input_parser.star b/src/package_io/input_parser.star index 24edf14..e887207 100644 --- a/src/package_io/input_parser.star +++ b/src/package_io/input_parser.star @@ -6,6 +6,7 @@ DEFAULT_EL_IMAGES = { "op-geth": "us-docker.pkg.dev/oplabs-tools-artifacts/images/op-geth:latest", "op-reth": "parithoshj/op-reth:latest", "op-erigon": "testinprod/op-erigon:latest", + "op-nethermind": "nethermindeth/nethermind:op-9b835cf", } DEFAULT_CL_IMAGES = { From 286946d39152087d824925138c18e3dc20c41471 Mon Sep 17 00:00:00 2001 From: parithosh Date: Tue, 2 Jul 2024 13:00:11 +0200 Subject: [PATCH 02/13] updating chainspec jq --- src/contracts/contract_deployer.star | 1 + src/package_io/input_parser.star | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/contracts/contract_deployer.star b/src/contracts/contract_deployer.star index 755db53..073f203 100644 --- a/src/contracts/contract_deployer.star +++ b/src/contracts/contract_deployer.star @@ -58,6 +58,7 @@ def deploy_l2_contracts( } | l1_config_env_vars | l2_config_env_vars, + files={"../../static_files/chainspec_template/gen2spec.jq":"/gen2spec.jq"}, store=[ StoreSpec( src="/network-configs", diff --git a/src/package_io/input_parser.star b/src/package_io/input_parser.star index e887207..038c17d 100644 --- a/src/package_io/input_parser.star +++ b/src/package_io/input_parser.star @@ -6,7 +6,7 @@ DEFAULT_EL_IMAGES = { "op-geth": "us-docker.pkg.dev/oplabs-tools-artifacts/images/op-geth:latest", "op-reth": "parithoshj/op-reth:latest", "op-erigon": "testinprod/op-erigon:latest", - "op-nethermind": "nethermindeth/nethermind:op-9b835cf", + "op-nethermind": "nethermindeth/nethermind:op-4fd53a3", } DEFAULT_CL_IMAGES = { From 09538335ff0d067bff54a5debfbe5d48c7801166 Mon Sep 17 00:00:00 2001 From: parithosh Date: Tue, 2 Jul 2024 13:05:01 +0200 Subject: [PATCH 03/13] add static file --- static_files/chainspec_template/gen2spec.jq | 158 ++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 static_files/chainspec_template/gen2spec.jq diff --git a/static_files/chainspec_template/gen2spec.jq b/static_files/chainspec_template/gen2spec.jq new file mode 100644 index 0000000..62bd8f5 --- /dev/null +++ b/static_files/chainspec_template/gen2spec.jq @@ -0,0 +1,158 @@ +# Removes all empty keys and values in input. +def remove_empty: + . | walk( + if type == "object" then + with_entries( + select( + .value != null and + .value != "" and + .value != [] and + .key != null and + .key != "" + ) + ) + else . + end + ) +; + +# Converts number to hex, from https://rosettacode.org/wiki/Non-decimal_radices/Convert#jq +def int_to_hex: + def stream: + recurse(if . > 0 then ./16|floor else empty end) | . % 16 ; + if . == 0 then "0x0" + else "0x" + ([stream] | reverse | .[1:] | map(if .<10 then 48+. else 87+. end) | implode) + end +; + +# Converts decimal number in string to hex. +def to_hex: + if . != null and type == "number" then .|int_to_hex else + if . != null and startswith("0x") then . else + if (. != null and . != "") then .|tonumber|int_to_hex else . end + end + end +; + +# Zero-pads hex string. +def infix_zeros_to_length(s;l): + if . != null then + (.[0:s])+("0"*(l-(.|length)))+(.[s:l]) + else . + end +; + +# This gives the consensus engine definition for the ethash engine. +def optimism: + { + "Optimism": { + "params": { + "regolithTimestamp": .config.cancunTime|to_hex, + "bedrockBlockNumber": .config.londonBlock|to_hex, + "canyonTimestamp": .config.shanghaiTime|to_hex, + "ecotoneTimestamp": .config.cancunTime|to_hex, + "fjordTimestamp": .config.pragueTime|to_hex, + "l1FeeRecipient": "0x420000000000000000000000000000000000001A", + "l1BlockAddress": "0x4200000000000000000000000000000000000015", + "canyonBaseFeeChangeDenominator": "250" + } + } + } +; + + +{ + "version": "1", + "engine": optimism, + "params": { + # Tangerine Whistle + "eip150Transition": "0x0", + + # Spurious Dragon + "eip160Transition": "0x0", + "eip161abcTransition": "0x0", + "eip161dTransition": "0x0", + "eip155Transition": "0x0", + "maxCodeSizeTransition": "0x0", + "maxCodeSize": 24576, + "maximumExtraDataSize": "0x400", + + # Byzantium + "eip140Transition": .config.byzantiumBlock|to_hex, + "eip211Transition": .config.byzantiumBlock|to_hex, + "eip214Transition": .config.byzantiumBlock|to_hex, + "eip658Transition": .config.byzantiumBlock|to_hex, + + # Constantinople + "eip145Transition": .config.constantinopleBlock|to_hex, + "eip1014Transition": .config.constantinopleBlock|to_hex, + "eip1052Transition": .config.constantinopleBlock|to_hex, + + # Petersburg + "eip1283Transition": .config.petersburgBlock|to_hex, + "eip1283DisableTransition": .config.petersburgBlock|to_hex, + + # Istanbul + "eip152Transition": .config.istanbulBlock|to_hex, + "eip1108Transition": .config.istanbulBlock|to_hex, + "eip1344Transition": .config.istanbulBlock|to_hex, + "eip1884Transition": .config.istanbulBlock|to_hex, + "eip2028Transition": .config.istanbulBlock|to_hex, + "eip2200Transition": .config.istanbulBlock|to_hex, + + # Berlin + "eip2565Transition": .config.berlinBlock|to_hex, + "eip2718Transition": .config.berlinBlock|to_hex, + "eip2929Transition": .config.berlinBlock|to_hex, + "eip2930Transition": .config.berlinBlock|to_hex, + + # London + "eip1559Transition": .config.londonBlock|to_hex, + "eip3238Transition": .config.londonBlock|to_hex, + "eip3529Transition": .config.londonBlock|to_hex, + "eip3541Transition": .config.londonBlock|to_hex, + "eip3198Transition": .config.londonBlock|to_hex, + + # Merge + "MergeForkIdTransition": .config.mergeForkBlock|to_hex, + + # Shanghai + "eip3651TransitionTimestamp": .config.shanghaiTime|to_hex, + "eip3855TransitionTimestamp": .config.shanghaiTime|to_hex, + "eip3860TransitionTimestamp": .config.shanghaiTime|to_hex, + "eip4895TransitionTimestamp": .config.shanghaiTime|to_hex, + + # Cancun + "eip4844TransitionTimestamp": .config.cancunTime|to_hex, + "eip4788TransitionTimestamp": .config.cancunTime|to_hex, + "eip1153TransitionTimestamp": .config.cancunTime|to_hex, + "eip5656TransitionTimestamp": .config.cancunTime|to_hex, + "eip6780TransitionTimestamp": .config.cancunTime|to_hex, + + #Prague + "rip7212TransitionTimestamp": .config.pragueTime|to_hex, + + # Other chain parameters + "networkID": .config.chainId|to_hex, + "chainID": .config.chainId|to_hex, + }, + "genesis": { + "seal": { + "ethereum":{ + "nonce": .nonce|infix_zeros_to_length(2;18), + "mixHash": .mixHash, + }, + }, + "difficulty": .difficulty, + "author": .coinbase, + "timestamp": .timestamp, + "parentHash": .parentHash, + "extraData": .extraData, + "gasLimit": .gasLimit, + "baseFeePerGas": .baseFeePerGas, + "blobGasUsed": .blobGasUsed, + "excessBlobGas": .excessBlobGas, + "parentBeaconBlockRoot": .parentBeaconBlockRoot, + }, + "accounts": ((.alloc|with_entries(.key|="0x"+.))), +}|remove_empty \ No newline at end of file From 51bf856657891b60fa3fd7a4f5f4638140e41ca2 Mon Sep 17 00:00:00 2001 From: Barnabas Busa Date: Tue, 2 Jul 2024 13:15:56 +0200 Subject: [PATCH 04/13] fix upload files --- src/contracts/contract_deployer.star | 12 +++++++++++- src/el/op-nethermind/op_nethermind_launcher.star | 13 +++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/contracts/contract_deployer.star b/src/contracts/contract_deployer.star index 073f203..c0c26f6 100644 --- a/src/contracts/contract_deployer.star +++ b/src/contracts/contract_deployer.star @@ -5,6 +5,8 @@ FACTORY_DEPLOYER_ADDRESS = "0x3fAB184622Dc19b6109349B94811493BF2a45362" # raw tx data for deploying Create2Factory contract to L1 FACTORY_DEPLOYER_CODE = "0xf8a58085174876e800830186a08080b853604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf31ba02222222222222222222222222222222222222222222222222222222222222222a02222222222222222222222222222222222222222222222222222222222222222" +CHAINSPEC_JQ_FILEPATH = "../../static_files/chainspec_template/gen2spec.jq" + def deploy_factory_contract( plan, @@ -46,6 +48,11 @@ def deploy_l2_contracts( l2_config_env_vars, l2_services_suffix, ): + chainspec_files_artifact = plan.upload_files( + src=CHAINSPEC_JQ_FILEPATH, + name="chainspec-config", + ) + op_genesis = plan.run_sh( name="op-deploy-l2-contracts", description="Deploying L2 contracts (takes about a minute)", @@ -58,7 +65,9 @@ def deploy_l2_contracts( } | l1_config_env_vars | l2_config_env_vars, - files={"../../static_files/chainspec_template/gen2spec.jq":"/gen2spec.jq"}, + files={ + "/workspace/optimism/packages/contracts-bedrock/deploy-config/gen2spec.jq": chainspec_files_artifact, + }, store=[ StoreSpec( src="/network-configs", @@ -103,6 +112,7 @@ def deploy_l2_contracts( "echo -n $GS_SEQUENCER_PRIVATE_KEY > /network-configs/GS_SEQUENCER_PRIVATE_KEY", "echo -n $GS_BATCHER_PRIVATE_KEY > /network-configs/GS_BATCHER_PRIVATE_KEY", "echo -n $GS_PROPOSER_PRIVATE_KEY > /network-configs/GS_PROPOSER_PRIVATE_KEY", + "cat /network-configs/genesis.json | jq --from-file /workspace/optimism/packages/contracts-bedrock/deploy-config/gen2spec.jq > /network-configs/chainspec.json", ] ), wait="300s", diff --git a/src/el/op-nethermind/op_nethermind_launcher.star b/src/el/op-nethermind/op_nethermind_launcher.star index 2661107..2840c14 100644 --- a/src/el/op-nethermind/op_nethermind_launcher.star +++ b/src/el/op-nethermind/op_nethermind_launcher.star @@ -87,7 +87,6 @@ def launch( sequencer_enabled, sequencer_context, ): - network_name = shared_utils.get_network_name(launcher.network) config = get_config( @@ -142,7 +141,6 @@ def get_config( sequencer_enabled, sequencer_context, ): - discovery_port = DISCOVERY_PORT_NUM used_ports = get_used_ports(discovery_port) cmd = [ @@ -182,15 +180,14 @@ def get_config( if network not in constants.PUBLIC_NETWORKS: cmd.append("--config=none.cfg") -# cmd.append( -# "--Init.ChainSpecPath=" -# + constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER -# + "/chainspec.json" -# ) + # cmd.append( + # "--Init.ChainSpecPath=" + # + constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER + # + "/chainspec.json" + # ) else: cmd.append("--config=" + network) - files = { constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data, constants.JWT_MOUNTPOINT_ON_CLIENTS: jwt_file, From cb22857e6b9f62e3dd370c6b807bcba4c94e8959 Mon Sep 17 00:00:00 2001 From: parithosh Date: Tue, 2 Jul 2024 13:21:42 +0200 Subject: [PATCH 05/13] adding chainspec path --- src/el/op-nethermind/op_nethermind_launcher.star | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/el/op-nethermind/op_nethermind_launcher.star b/src/el/op-nethermind/op_nethermind_launcher.star index 2840c14..a19a959 100644 --- a/src/el/op-nethermind/op_nethermind_launcher.star +++ b/src/el/op-nethermind/op_nethermind_launcher.star @@ -180,11 +180,11 @@ def get_config( if network not in constants.PUBLIC_NETWORKS: cmd.append("--config=none.cfg") - # cmd.append( - # "--Init.ChainSpecPath=" - # + constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER - # + "/chainspec.json" - # ) + cmd.append( + "--Init.ChainSpecPath=" + + constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER + + "/chainspec.json" + ) else: cmd.append("--config=" + network) From dbefac4313765da19013ad2c323f9fbf24c6dcc9 Mon Sep 17 00:00:00 2001 From: Barnabas Busa Date: Tue, 2 Jul 2024 13:26:40 +0200 Subject: [PATCH 06/13] fix upload files2 --- src/contracts/contract_deployer.star | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/contracts/contract_deployer.star b/src/contracts/contract_deployer.star index c0c26f6..d7cf05b 100644 --- a/src/contracts/contract_deployer.star +++ b/src/contracts/contract_deployer.star @@ -7,7 +7,6 @@ FACTORY_DEPLOYER_CODE = "0xf8a58085174876e800830186a08080b853604580600e600039806 CHAINSPEC_JQ_FILEPATH = "../../static_files/chainspec_template/gen2spec.jq" - def deploy_factory_contract( plan, priv_key, @@ -66,7 +65,7 @@ def deploy_l2_contracts( | l1_config_env_vars | l2_config_env_vars, files={ - "/workspace/optimism/packages/contracts-bedrock/deploy-config/gen2spec.jq": chainspec_files_artifact, + "/workspace/optimism/packages/contracts-bedrock/deploy-config/chainspec-generator/": chainspec_files_artifact, }, store=[ StoreSpec( @@ -112,7 +111,7 @@ def deploy_l2_contracts( "echo -n $GS_SEQUENCER_PRIVATE_KEY > /network-configs/GS_SEQUENCER_PRIVATE_KEY", "echo -n $GS_BATCHER_PRIVATE_KEY > /network-configs/GS_BATCHER_PRIVATE_KEY", "echo -n $GS_PROPOSER_PRIVATE_KEY > /network-configs/GS_PROPOSER_PRIVATE_KEY", - "cat /network-configs/genesis.json | jq --from-file /workspace/optimism/packages/contracts-bedrock/deploy-config/gen2spec.jq > /network-configs/chainspec.json", + "cat /network-configs/genesis.json | jq --from-file /workspace/optimism/packages/contracts-bedrock/deploy-config/chainspec-generator/gen2spec.jq > /network-configs/chainspec.json", ] ), wait="300s", From 9116478d128a01a4cc1424fcd704db5301b58d85 Mon Sep 17 00:00:00 2001 From: parithosh Date: Tue, 2 Jul 2024 13:37:58 +0200 Subject: [PATCH 07/13] updating nethermind check --- .../op-nethermind/op_nethermind_launcher.star | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/el/op-nethermind/op_nethermind_launcher.star b/src/el/op-nethermind/op_nethermind_launcher.star index a19a959..65401a5 100644 --- a/src/el/op-nethermind/op_nethermind_launcher.star +++ b/src/el/op-nethermind/op_nethermind_launcher.star @@ -104,9 +104,7 @@ def launch( service = plan.add_service(service_name, config) - enode, enr = el_admin_node_info.get_enode_enr_for_node( - plan, service_name, RPC_PORT_ID - ) + 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( @@ -114,6 +112,7 @@ def launch( ) 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( "op-nethermind", @@ -178,15 +177,14 @@ def get_config( ) ) - if network not in constants.PUBLIC_NETWORKS: - cmd.append("--config=none.cfg") - cmd.append( - "--Init.ChainSpecPath=" - + constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER - + "/chainspec.json" - ) - else: - cmd.append("--config=" + network) + # 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, From 516d2410cb550b85b3b4a3ff04abc84b5b183335 Mon Sep 17 00:00:00 2001 From: parithosh Date: Tue, 2 Jul 2024 13:40:08 +0200 Subject: [PATCH 08/13] remove enr --- src/el/op-nethermind/op_nethermind_launcher.star | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/el/op-nethermind/op_nethermind_launcher.star b/src/el/op-nethermind/op_nethermind_launcher.star index 65401a5..63d7864 100644 --- a/src/el/op-nethermind/op_nethermind_launcher.star +++ b/src/el/op-nethermind/op_nethermind_launcher.star @@ -116,7 +116,7 @@ def launch( return el_context.new_el_context( "op-nethermind", - enr, + "", enode, service.ip_address, RPC_PORT_NUM, From f221db0193e76792b7e7d5c42445396732c1af98 Mon Sep 17 00:00:00 2001 From: Barnabas Busa Date: Tue, 2 Jul 2024 14:44:56 +0200 Subject: [PATCH 09/13] fix lint --- src/contracts/contract_deployer.star | 1 + src/el/op-nethermind/op_nethermind_launcher.star | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/contracts/contract_deployer.star b/src/contracts/contract_deployer.star index d7cf05b..caa6cd5 100644 --- a/src/contracts/contract_deployer.star +++ b/src/contracts/contract_deployer.star @@ -7,6 +7,7 @@ FACTORY_DEPLOYER_CODE = "0xf8a58085174876e800830186a08080b853604580600e600039806 CHAINSPEC_JQ_FILEPATH = "../../static_files/chainspec_template/gen2spec.jq" + def deploy_factory_contract( plan, priv_key, diff --git a/src/el/op-nethermind/op_nethermind_launcher.star b/src/el/op-nethermind/op_nethermind_launcher.star index 63d7864..f045ceb 100644 --- a/src/el/op-nethermind/op_nethermind_launcher.star +++ b/src/el/op-nethermind/op_nethermind_launcher.star @@ -185,7 +185,6 @@ def get_config( + "/chainspec.json" ) - files = { constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data, constants.JWT_MOUNTPOINT_ON_CLIENTS: jwt_file, From bb183371a3d7d1478b8a352e06054fcac3813ba4 Mon Sep 17 00:00:00 2001 From: parithosh Date: Tue, 2 Jul 2024 17:00:38 +0200 Subject: [PATCH 10/13] update the gen2spec --- static_files/chainspec_template/gen2spec.jq | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/static_files/chainspec_template/gen2spec.jq b/static_files/chainspec_template/gen2spec.jq index 62bd8f5..698ec9f 100644 --- a/static_files/chainspec_template/gen2spec.jq +++ b/static_files/chainspec_template/gen2spec.jq @@ -128,13 +128,15 @@ def optimism: "eip1153TransitionTimestamp": .config.cancunTime|to_hex, "eip5656TransitionTimestamp": .config.cancunTime|to_hex, "eip6780TransitionTimestamp": .config.cancunTime|to_hex, - + #Prague "rip7212TransitionTimestamp": .config.pragueTime|to_hex, # Other chain parameters "networkID": .config.chainId|to_hex, "chainID": .config.chainId|to_hex, + + "terminalTotalDifficulty": .config.terminalTotalDifficulty|to_hex }, "genesis": { "seal": { @@ -155,4 +157,4 @@ def optimism: "parentBeaconBlockRoot": .parentBeaconBlockRoot, }, "accounts": ((.alloc|with_entries(.key|="0x"+.))), -}|remove_empty \ No newline at end of file +}|remove_empty From 908da36a1a05ce3327479bbbbf9692855b48005b Mon Sep 17 00:00:00 2001 From: parithosh Date: Wed, 3 Jul 2024 16:13:14 +0200 Subject: [PATCH 11/13] updating working changes --- README.md | 3 +++ network_params.yaml | 4 +++- src/package_io/input_parser.star | 2 +- static_files/chainspec_template/gen2spec.jq | 4 +++- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8523085..ea9e14a 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,9 @@ optimism_package: participants: - el_type: op-geth cl_type: op-node + - el_type: op-reth + - el_type: op-erigon + - el_type: op-nethermind ethereum_package: participants: - el_type: geth diff --git a/network_params.yaml b/network_params.yaml index 75d1cde..493845f 100644 --- a/network_params.yaml +++ b/network_params.yaml @@ -1,13 +1,15 @@ optimism_package: participants: - el_type: op-geth + - el_type: op-reth + - el_type: op-erigon - el_type: op-nethermind additional_services: - blockscout ethereum_package: participants: - el_type: geth - count: 2 + - el_type: reth network_params: preset: minimal additional_services: diff --git a/src/package_io/input_parser.star b/src/package_io/input_parser.star index 038c17d..7d53d1c 100644 --- a/src/package_io/input_parser.star +++ b/src/package_io/input_parser.star @@ -6,7 +6,7 @@ DEFAULT_EL_IMAGES = { "op-geth": "us-docker.pkg.dev/oplabs-tools-artifacts/images/op-geth:latest", "op-reth": "parithoshj/op-reth:latest", "op-erigon": "testinprod/op-erigon:latest", - "op-nethermind": "nethermindeth/nethermind:op-4fd53a3", + "op-nethermind": "nethermindeth/nethermind:op-c482d56", } DEFAULT_CL_IMAGES = { diff --git a/static_files/chainspec_template/gen2spec.jq b/static_files/chainspec_template/gen2spec.jq index 698ec9f..b647618 100644 --- a/static_files/chainspec_template/gen2spec.jq +++ b/static_files/chainspec_template/gen2spec.jq @@ -108,6 +108,8 @@ def optimism: # London "eip1559Transition": .config.londonBlock|to_hex, + "eip1559ElasticityMultiplier": .config.optimism.eip1559Elasticity|to_hex, + "eip1559BaseFeeMaxChangeDenominator": .config.optimism.eip1559Denominator|to_hex, "eip3238Transition": .config.londonBlock|to_hex, "eip3529Transition": .config.londonBlock|to_hex, "eip3541Transition": .config.londonBlock|to_hex, @@ -136,7 +138,7 @@ def optimism: "networkID": .config.chainId|to_hex, "chainID": .config.chainId|to_hex, - "terminalTotalDifficulty": .config.terminalTotalDifficulty|to_hex + "terminalTotalDifficulty": .config.terminalTotalDifficulty|to_hex, }, "genesis": { "seal": { From 61ddd2ed0794dbabc8e51ec4fb898ddbd15d09e0 Mon Sep 17 00:00:00 2001 From: parithosh Date: Wed, 3 Jul 2024 16:56:57 +0200 Subject: [PATCH 12/13] updating tests --- .github/tests/op-nethermind.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/tests/op-nethermind.yaml diff --git a/.github/tests/op-nethermind.yaml b/.github/tests/op-nethermind.yaml new file mode 100644 index 0000000..65caad1 --- /dev/null +++ b/.github/tests/op-nethermind.yaml @@ -0,0 +1,12 @@ +optimism_package: + participants: + - el_type: op-nethermind + cl_type: op-node +ethereum_package: + participants: + - el_type: geth + - el_type: nethermind + network_params: + preset: minimal + additional_services: + - dora From f6134a97e16169448dda83f8df3e6f79eb8038f1 Mon Sep 17 00:00:00 2001 From: Barnabas Busa Date: Thu, 4 Jul 2024 15:29:16 +0200 Subject: [PATCH 13/13] Update .github/tests/op-nethermind.yaml Signed-off-by: Barnabas Busa --- .github/tests/op-nethermind.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/tests/op-nethermind.yaml b/.github/tests/op-nethermind.yaml index 65caad1..8a9ae48 100644 --- a/.github/tests/op-nethermind.yaml +++ b/.github/tests/op-nethermind.yaml @@ -1,5 +1,6 @@ optimism_package: participants: + - el_type: op-geth - el_type: op-nethermind cl_type: op-node ethereum_package: