diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..e25d2a2 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,37 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +# This is the top-most .editorconfig file (do not search in parent directories) +root = true + +# 4 space indentation for all starlark files +[*.star] +indent_style = space +indent_size = 4 + +# 4 space indentation for all python files +[*.py] + +# 2 space indentation for all yaml files +[*.yml, *.yaml] +indent_style = space +indent_size = 2 + +# 2 space indentation for all json files +[*.json] +indent_style = space +indent_size = 2 + +[*.yaml] +indent_style = space +indent_size = 2 diff --git a/dependencies/constants.star b/dependencies/constants.star deleted file mode 100644 index c6804c5..0000000 --- a/dependencies/constants.star +++ /dev/null @@ -1,406 +0,0 @@ -EL_TYPE = struct( - geth_builder="geth-builder", - geth="geth", - erigon="erigon", - nethermind="nethermind", - besu="besu", - reth="reth", - reth_builder="reth-builder", - ethereumjs="ethereumjs", - nimbus="nimbus", -) - -CL_TYPE = struct( - lighthouse="lighthouse", - teku="teku", - nimbus="nimbus", - prysm="prysm", - lodestar="lodestar", - grandine="grandine", -) - -VC_TYPE = struct( - lighthouse="lighthouse", - lodestar="lodestar", - nimbus="nimbus", - prysm="prysm", - teku="teku", -) - -GLOBAL_LOG_LEVEL = struct( - info="info", - error="error", - warn="warn", - debug="debug", - trace="trace", -) - -CLIENT_TYPES = struct( - el="execution", - cl="beacon", - validator="validator", -) - -VALIDATING_REWARDS_ACCOUNT = "0x8943545177806ED17B9F23F0a21ee5948eCaa776" -MAX_ENR_ENTRIES = 20 -MAX_ENODE_ENTRIES = 20 - -GENESIS_VALIDATORS_ROOT_PLACEHOLDER = "GENESIS_VALIDATORS_ROOT_PLACEHOLDER" - -ARCHIVE_MODE = True - -GENESIS_DATA_MOUNTPOINT_ON_CLIENTS = "/network-configs" -GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER = GENESIS_DATA_MOUNTPOINT_ON_CLIENTS - -VALIDATOR_KEYS_DIRPATH_ON_SERVICE_CONTAINER = "/validator-keys" - -JWT_MOUNTPOINT_ON_CLIENTS = "/jwt" -JWT_MOUNT_PATH_ON_CONTAINER = JWT_MOUNTPOINT_ON_CLIENTS + "/jwtsecret" - -KEYMANAGER_MOUNT_PATH_ON_CLIENTS = "/keymanager" -KEYMANAGER_MOUNT_PATH_ON_CONTAINER = ( - KEYMANAGER_MOUNT_PATH_ON_CLIENTS + "/keymanager.txt" -) - -MOCK_MEV_TYPE = "mock" -FLASHBOTS_MEV_TYPE = "flashbots" -MEV_RS_MEV_TYPE = "mev-rs" - -DEFAULT_SNOOPER_IMAGE = "ethpandaops/rpc-snooper:latest" -DEFAULT_FLASHBOTS_RELAY_IMAGE = "flashbots/mev-boost-relay:0.27" -DEFAULT_FLASHBOTS_BUILDER_IMAGE = "flashbots/builder:latest" -DEFAULT_FLASHBOTS_MEV_BOOST_IMAGE = "flashbots/mev-boost" -DEFAULT_MEV_RS_IMAGE = "ethpandaops/mev-rs:main" -DEFAULT_MEV_RS_IMAGE_MINIMAL = "ethpandaops/mev-rs:main-minimal" -DEFAULT_MEV_PUBKEY = "0xa55c1285d84ba83a5ad26420cd5ad3091e49c55a813eee651cd467db38a8c8e63192f47955e9376f6b42f6d190571cb5" -DEFAULT_MEV_SECRET_KEY = ( - "0x607a11b45a7219cc61a3d9c5fd08c7eebd602a6a19a977f8d3771d5711a550f2" -) - -PRIVATE_IP_ADDRESS_PLACEHOLDER = "KURTOSIS_IP_ADDR_PLACEHOLDER" - -GENESIS_FORK_VERSION = "0x10000038" -BELLATRIX_FORK_VERSION = "0x30000038" -CAPELLA_FORK_VERSION = "0x40000038" -DENEB_FORK_VERSION = "0x50000038" -ELECTRA_FORK_VERSION = "0x60000038" -EIP7594_FORK_VERSION = "0x70000038" - -ETHEREUM_GENESIS_GENERATOR = struct( - capella_genesis="ethpandaops/ethereum-genesis-generator:2.0.12", # Deprecated (no support for minimal config) - deneb_genesis="ethpandaops/ethereum-genesis-generator:3.1.2", # Default - verkle_support_genesis="ethpandaops/ethereum-genesis-generator:3.0.0-rc.19", # soon to be deneb genesis, waiting for rebase - verkle_genesis="ethpandaops/ethereum-genesis-generator:verkle-gen-v1.0.0", -) - -NETWORK_NAME = struct( - mainnet="mainnet", - sepolia="sepolia", - holesky="holesky", - ephemery="ephemery", - kurtosis="kurtosis", - verkle="verkle", - shadowfork="shadowfork", -) - -PUBLIC_NETWORKS = ( - "mainnet", - "sepolia", - "holesky", -) - -NETWORK_ID = { - "mainnet": 1, - "sepolia": 11155111, - "holesky": 17000, -} - -CHECKPOINT_SYNC_URL = { - "mainnet": "https://beaconstate.info", - "sepolia": "https://checkpoint-sync.sepolia.ethpandaops.io", - "holesky": "https://checkpoint-sync.holesky.ethpandaops.io", - "ephemery": "https://checkpointz.bordel.wtf/", -} - -GENESIS_VALIDATORS_ROOT = { - "mainnet": "0x4b363db94e286120d76eb905340fdd4e54bfe9f06bf33ff6cf5ad27f511bfe95", - "sepolia": "0xd8ea171f3c94aea21ebc42a1ed61052acf3f9209c00e4efbaaddac09ed9b8078", - "holesky": "0x9143aa7c615a7f7115e2b6aac319c03529df8242ae705fba9df39b79c59fa8b1", -} - -DEPOSIT_CONTRACT_ADDRESS = { - "mainnet": "0x00000000219ab540356cBB839Cbe05303d7705Fa", - "sepolia": "0x7f02C3E3c98b133055B8B348B2Ac625669Ed295D", - "holesky": "0x4242424242424242424242424242424242424242", - "ephemery": "0x4242424242424242424242424242424242424242", -} - -GENESIS_TIME = { - "mainnet": 1606824023, - "sepolia": 1655733600, - "holesky": 1695902400, -} - -VOLUME_SIZE = { - "mainnet": { - "geth_volume_size": 1000000, # 1TB - "erigon_volume_size": 3000000, # 3TB - "nethermind_volume_size": 1000000, # 1TB - "besu_volume_size": 1000000, # 1TB - "reth_volume_size": 3000000, # 3TB - "ethereumjs_volume_size": 1000000, # 1TB - "nimbus_eth1_volume_size": 1000000, # 1TB - "prysm_volume_size": 500000, # 500GB - "lighthouse_volume_size": 500000, # 500GB - "teku_volume_size": 500000, # 500GB - "nimbus_volume_size": 500000, # 500GB - "lodestar_volume_size": 500000, # 500GB - "grandine_volume_size": 500000, # 500GB - }, - "sepolia": { - "geth_volume_size": 300000, # 300GB - "erigon_volume_size": 500000, # 500GB - "nethermind_volume_size": 300000, # 300GB - "besu_volume_size": 300000, # 300GB - "reth_volume_size": 500000, # 500GB - "ethereumjs_volume_size": 300000, # 300GB - "nimbus_eth1_volume_size": 300000, # 300GB - "prysm_volume_size": 150000, # 150GB - "lighthouse_volume_size": 150000, # 150GB - "teku_volume_size": 150000, # 150GB - "nimbus_volume_size": 150000, # 150GB - "lodestar_volume_size": 150000, # 150GB - "grandine_volume_size": 150000, # 150GB - }, - "holesky": { - "geth_volume_size": 100000, # 100GB - "erigon_volume_size": 200000, # 200GB - "nethermind_volume_size": 100000, # 100GB - "besu_volume_size": 100000, # 100GB - "reth_volume_size": 200000, # 200GB - "ethereumjs_volume_size": 100000, # 100GB - "nimbus_eth1_volume_size": 100000, # 100GB - "prysm_volume_size": 100000, # 100GB - "lighthouse_volume_size": 100000, # 100GB - "teku_volume_size": 100000, # 100GB - "nimbus_volume_size": 100000, # 100GB - "lodestar_volume_size": 100000, # 100GB - "grandine_volume_size": 100000, # 100GB - }, - "devnets": { - "geth_volume_size": 100000, # 100GB - "erigon_volume_size": 200000, # 200GB - "nethermind_volume_size": 100000, # 100GB - "besu_volume_size": 100000, # 100GB - "reth_volume_size": 200000, # 200GB - "ethereumjs_volume_size": 100000, # 100GB - "nimbus_eth1_volume_size": 100000, # 100GB - "prysm_volume_size": 100000, # 100GB - "lighthouse_volume_size": 100000, # 100GB - "teku_volume_size": 100000, # 100GB - "nimbus_volume_size": 100000, # 100GB - "lodestar_volume_size": 100000, # 100GB - "grandine_volume_size": 100000, # 100GB - }, - "ephemery": { - "geth_volume_size": 5000, # 5GB - "erigon_volume_size": 3000, # 3GB - "nethermind_volume_size": 3000, # 3GB - "besu_volume_size": 3000, # 3GB - "reth_volume_size": 3000, # 3GB - "ethereumjs_volume_size": 3000, # 3GB - "nimbus_eth1_volume_size": 3000, # 3GB - "prysm_volume_size": 1000, # 1GB - "lighthouse_volume_size": 1000, # 1GB - "teku_volume_size": 1000, # 1GB - "nimbus_volume_size": 1000, # 1GB - "lodestar_volume_size": 1000, # 1GB - "grandine_volume_size": 1000, # 1GB - }, - "kurtosis": { - "geth_volume_size": 5000, # 5GB - "erigon_volume_size": 3000, # 3GB - "nethermind_volume_size": 3000, # 3GB - "besu_volume_size": 3000, # 3GB - "reth_volume_size": 3000, # 3GB - "ethereumjs_volume_size": 3000, # 3GB - "nimbus_eth1_volume_size": 3000, # 3GB - "prysm_volume_size": 1000, # 1GB - "lighthouse_volume_size": 1000, # 1GB - "teku_volume_size": 1000, # 1GB - "nimbus_volume_size": 1000, # 1GB - "lodestar_volume_size": 1000, # 1GB - "grandine_volume_size": 1000, # 1GB - }, -} - -RAM_CPU_OVERRIDES = { - "mainnet": { - "geth_max_mem": 16384, # 16GB - "geth_max_cpu": 4000, # 4 cores - "erigon_max_mem": 16384, # 16GB - "erigon_max_cpu": 4000, # 4 cores - "nethermind_max_mem": 16384, # 16GB - "nethermind_max_cpu": 4000, # 4 cores - "besu_max_mem": 16384, # 16GB - "besu_max_cpu": 4000, # 4 cores - "reth_max_mem": 16384, # 16GB - "reth_max_cpu": 4000, # 4 cores - "ethereumjs_max_mem": 16384, # 16GB - "ethereumjs_max_cpu": 4000, # 4 cores - "nimbus_eth1_max_mem": 16384, # 16GB - "nimbus_eth1_max_cpu": 4000, # 4 cores - "prysm_max_mem": 16384, # 16GB - "prysm_max_cpu": 4000, # 4 cores - "lighthouse_max_mem": 16384, # 16GB - "lighthouse_max_cpu": 4000, # 4 cores - "teku_max_mem": 16384, # 16GB - "teku_max_cpu": 4000, # 4 cores - "nimbus_max_mem": 16384, # 16GB - "nimbus_max_cpu": 4000, # 4 cores - "lodestar_max_mem": 16384, # 16GB - "lodestar_max_cpu": 4000, # 4 cores - "grandine_max_mem": 16384, # 16GB - "grandine_max_cpu": 4000, # 4 cores - }, - "sepolia": { - "geth_max_mem": 4096, # 4GB - "geth_max_cpu": 1000, # 1 core - "erigon_max_mem": 4096, # 4GB - "erigon_max_cpu": 1000, # 1 core - "nethermind_max_mem": 4096, # 4GB - "nethermind_max_cpu": 1000, # 1 core - "besu_max_mem": 4096, # 4GB - "besu_max_cpu": 1000, # 1 core - "reth_max_mem": 4096, # 4GB - "reth_max_cpu": 1000, # 1 core - "ethereumjs_max_mem": 4096, # 4GB - "ethereumjs_max_cpu": 1000, # 1 core - "nimbus_eth1_max_mem": 4096, # 4GB - "nimbus_eth1_max_cpu": 1000, # 1 core - "prysm_max_mem": 4096, # 4GB - "prysm_max_cpu": 1000, # 1 core - "lighthouse_max_mem": 4096, # 4GB - "lighthouse_max_cpu": 1000, # 1 core - "teku_max_mem": 4096, # 4GB - "teku_max_cpu": 1000, # 1 core - "nimbus_max_mem": 4096, # 4GB - "nimbus_max_cpu": 1000, # 1 core - "lodestar_max_mem": 4096, # 4GB - "lodestar_max_cpu": 1000, # 1 core - "grandine_max_mem": 4096, # 4GB - "grandine_max_cpu": 1000, # 1 core - }, - "holesky": { - "geth_max_mem": 8192, # 8GB - "geth_max_cpu": 2000, # 2 cores - "erigon_max_mem": 8192, # 8GB - "erigon_max_cpu": 2000, # 2 cores - "nethermind_max_mem": 8192, # 8GB - "nethermind_max_cpu": 2000, # 2 cores - "besu_max_mem": 8192, # 8GB - "besu_max_cpu": 2000, # 2 cores - "reth_max_mem": 8192, # 8GB - "reth_max_cpu": 2000, # 2 cores - "ethereumjs_max_mem": 8192, # 8GB - "ethereumjs_max_cpu": 2000, # 2 cores - "nimbus_eth1_max_mem": 8192, # 8GB - "nimbus_eth1_max_cpu": 2000, # 2 cores - "prysm_max_mem": 8192, # 8GB - "prysm_max_cpu": 2000, # 2 cores - "lighthouse_max_mem": 8192, # 8GB - "lighthouse_max_cpu": 2000, # 2 cores - "teku_max_mem": 8192, # 8GB - "teku_max_cpu": 2000, # 2 cores - "nimbus_max_mem": 8192, # 8GB - "nimbus_max_cpu": 2000, # 2 cores - "lodestar_max_mem": 8192, # 8GB - "lodestar_max_cpu": 2000, # 2 cores - "grandine_max_mem": 8192, # 8GB - "grandine_max_cpu": 2000, # 2 cores - }, - "devnets": { - "geth_max_mem": 4096, # 4GB - "geth_max_cpu": 1000, # 1 core - "erigon_max_mem": 4096, # 4GB - "erigon_max_cpu": 1000, # 1 core - "nethermind_max_mem": 4096, # 4GB - "nethermind_max_cpu": 1000, # 1 core - "besu_max_mem": 4096, # 4GB - "besu_max_cpu": 1000, # 1 core - "reth_max_mem": 4096, # 4GB - "reth_max_cpu": 1000, # 1 core - "ethereumjs_max_mem": 4096, # 4GB - "ethereumjs_max_cpu": 1000, # 1 core - "nimbus_eth1_max_mem": 4096, # 4GB - "nimbus_eth1_max_cpu": 1000, # 1 core - "prysm_max_mem": 4096, # 4GB - "prysm_max_cpu": 1000, # 1 core - "lighthouse_max_mem": 4096, # 4GB - "lighthouse_max_cpu": 1000, # 1 core - "teku_max_mem": 4096, # 4GB - "teku_max_cpu": 1000, # 1 core - "nimbus_max_mem": 4096, # 4GB - "nimbus_max_cpu": 1000, # 1 core - "lodestar_max_mem": 4096, # 4GB - "lodestar_max_cpu": 1000, # 1 core - "grandine_max_mem": 4096, # 4GB - "grandine_max_cpu": 1000, # 1 core - }, - "ephemery": { - "geth_max_mem": 1024, # 1GB - "geth_max_cpu": 1000, # 1 core - "erigon_max_mem": 1024, # 1GB - "erigon_max_cpu": 1000, # 1 core - "nethermind_max_mem": 1024, # 1GB - "nethermind_max_cpu": 1000, # 1 core - "besu_max_mem": 1024, # 1GB - "besu_max_cpu": 1000, # 1 core - "reth_max_mem": 1024, # 1GB - "reth_max_cpu": 1000, # 1 core - "ethereumjs_max_mem": 1024, # 1GB - "ethereumjs_max_cpu": 1000, # 1 core - "nimbus_eth1_max_mem": 1024, # 1GB - "nimbus_eth1_max_cpu": 1000, # 1 core - "prysm_max_mem": 1024, # 1GB - "prysm_max_cpu": 1000, # 1 core - "lighthouse_max_mem": 1024, # 1GB - "lighthouse_max_cpu": 1000, # 1 core - "teku_max_mem": 1024, # 1GB - "teku_max_cpu": 1000, # 1 core - "nimbus_max_mem": 1024, # 1GB - "nimbus_max_cpu": 1000, # 1 core - "lodestar_max_mem": 1024, # 1GB - "lodestar_max_cpu": 1000, # 1 core - "grandine_max_mem": 1024, # 1GB - "grandine_max_cpu": 1000, # 1 core - }, - "kurtosis": { - "geth_max_mem": 1024, # 1GB - "geth_max_cpu": 1000, # 1 core - "erigon_max_mem": 1024, # 1GB - "erigon_max_cpu": 1000, # 1 core - "nethermind_max_mem": 1024, # 1GB - "nethermind_max_cpu": 1000, # 1 core - "besu_max_mem": 1024, # 1GB - "besu_max_cpu": 1000, # 1 core - "reth_max_mem": 1024, # 1GB - "reth_max_cpu": 1000, # 1 core - "ethereumjs_max_mem": 1024, # 1GB - "ethereumjs_max_cpu": 1000, # 1 core - "nimbus_eth1_max_mem": 1024, # 1GB - "nimbus_eth1_max_cpu": 1000, # 1 core - "prysm_max_mem": 1024, # 1GB - "prysm_max_cpu": 1000, # 1 core - "lighthouse_max_mem": 1024, # 1GB - "lighthouse_max_cpu": 1000, # 1 core - "teku_max_mem": 2048, # 2GB - "teku_max_cpu": 1000, # 1 core - "nimbus_max_mem": 1024, # 1GB - "nimbus_max_cpu": 1000, # 1 core - "lodestar_max_mem": 2048, # 2GB - "lodestar_max_cpu": 1000, # 1 core - "grandine_max_mem": 2048, # 2GB - "grandine_max_cpu": 1000, # 1 core - }, -} diff --git a/dependencies/ethereum.star b/dependencies/ethereum.star deleted file mode 100644 index ddfd9a3..0000000 --- a/dependencies/ethereum.star +++ /dev/null @@ -1,7 +0,0 @@ -ethereum_package = import_module( - "github.com/kurtosis-tech/ethereum-package/main.star@3.0.0" -) - -def run(plan, args): - plan.print("here") - ethereum_package.run(plan, args) \ No newline at end of file diff --git a/dependencies/genesis_constants.star b/dependencies/genesis_constants.star deleted file mode 100644 index dca2a8b..0000000 --- a/dependencies/genesis_constants.star +++ /dev/null @@ -1,65 +0,0 @@ -def new_prefunded_account(address, private_key): - return struct(address=address, private_key=private_key) - - -# This information was generated by: -# 1) https://iancoleman.io/bip39/ -# 2) Enter the mnemonic (unless you use the default) -# 3) Copying the pubkey/priv key outputted information -PRE_FUNDED_ACCOUNTS = [ - # m/44'/60'/0'/0/0 - new_prefunded_account( - "0x8943545177806ED17B9F23F0a21ee5948eCaa776", - "bcdf20249abf0ed6d944c0288fad489e33f66b3960d9e6229c1cd214ed3bbe31", - ), - # m/44'/60'/0'/0/1 - new_prefunded_account( - "0xE25583099BA105D9ec0A67f5Ae86D90e50036425", - "39725efee3fb28614de3bacaffe4cc4bd8c436257e2c8bb887c4b5c4be45e76d", - ), - # m/44'/60'/0'/0/2 - new_prefunded_account( - "0x614561D2d143621E126e87831AEF287678B442b8", - "53321db7c1e331d93a11a41d16f004d7ff63972ec8ec7c25db329728ceeb1710", - ), - # m/44'/60'/0'/0/3 - new_prefunded_account( - "0xf93Ee4Cf8c6c40b329b0c0626F28333c132CF241", - "ab63b23eb7941c1251757e24b3d2350d2bc05c3c388d06f8fe6feafefb1e8c70", - ), - # m/44'/60'/0'/0/4 - new_prefunded_account( - "0x802dCbE1B1A97554B4F50DB5119E37E8e7336417", - "5d2344259f42259f82d2c140aa66102ba89b57b4883ee441a8b312622bd42491", - ), - # m/44'/60'/0'/0/5 - new_prefunded_account( - "0xAe95d8DA9244C37CaC0a3e16BA966a8e852Bb6D6", - "27515f805127bebad2fb9b183508bdacb8c763da16f54e0678b16e8f28ef3fff", - ), - # m/44'/60'/0'/0/6 - new_prefunded_account( - "0x2c57d1CFC6d5f8E4182a56b4cf75421472eBAEa4", - "7ff1a4c1d57e5e784d327c4c7651e952350bc271f156afb3d00d20f5ef924856", - ), - # m/44'/60'/0'/0/7 - new_prefunded_account( - "0x741bFE4802cE1C4b5b00F9Df2F5f179A1C89171A", - "3a91003acaf4c21b3953d94fa4a6db694fa69e5242b2e37be05dd82761058899", - ), - # m/44'/60'/0'/0/8 - new_prefunded_account( - "0xc3913d4D8bAb4914328651C2EAE817C8b78E1f4c", - "bb1d0f125b4fb2bb173c318cdead45468474ca71474e2247776b2b4c0fa2d3f5", - ), - # m/44'/60'/0'/0/9 - new_prefunded_account( - "0x65D08a056c17Ae13370565B04cF77D2AfA1cB9FA", - "850643a0224065ecce3882673c21f56bcf6eef86274cc21cadff15930b59fc8c", - ), - # m/44'/60'/0'/0/10 - new_prefunded_account( - "0x3e95dFbBaF6B348396E6674C7871546dCC568e56", - "94eb3102993b41ec55c241060f47daa0f6372e2e3ad7e91612ae36c364042e44", - ), -] diff --git a/dependencies/shared_utils.star b/dependencies/shared_utils.star deleted file mode 100644 index 4cc9fed..0000000 --- a/dependencies/shared_utils.star +++ /dev/null @@ -1,223 +0,0 @@ -constants = import_module("./constants.star") - -TCP_PROTOCOL = "TCP" -UDP_PROTOCOL = "UDP" -HTTP_APPLICATION_PROTOCOL = "http" -NOT_PROVIDED_APPLICATION_PROTOCOL = "" -NOT_PROVIDED_WAIT = "not-provided-wait" - - -def new_template_and_data(template, template_data_json): - return struct(template=template, data=template_data_json) - - -def path_join(*args): - joined_path = "/".join(args) - return joined_path.replace("//", "/") - - -def path_base(path): - split_path = path.split("/") - return split_path[-1] - - -def path_dir(path): - split_path = path.split("/") - if len(split_path) <= 1: - return "." - split_path = split_path[:-1] - return "/".join(split_path) or "/" - - -def new_port_spec( - number, - transport_protocol, - application_protocol=NOT_PROVIDED_APPLICATION_PROTOCOL, - wait=NOT_PROVIDED_WAIT, -): - if wait == NOT_PROVIDED_WAIT: - return PortSpec( - number=number, - transport_protocol=transport_protocol, - application_protocol=application_protocol, - ) - - return PortSpec( - number=number, - transport_protocol=transport_protocol, - application_protocol=application_protocol, - wait=wait, - ) - - -def read_file_from_service(plan, service_name, filename): - output = plan.exec( - service_name=service_name, - description="Reading {} from {}".format(filename, service_name), - recipe=ExecRecipe( - command=["/bin/sh", "-c", "cat {} | tr -d '\n'".format(filename)] - ), - ) - return output["output"] - - -def zfill_custom(value, width): - return ("0" * (width - len(str(value)))) + str(value) - - -def label_maker( - client, client_type, connected_client, extra_labels -): # add image back later - labels = { - "ethereum-package.client": client, - "ethereum-package.client-type": client_type, - # "ethereum-package.client-image": image.replace("/", "-").replace(":", "-"), - "ethereum-package.connected-client": connected_client, - } - labels.update(extra_labels) # Add extra_labels to the labels dictionary - return labels - - -def get_devnet_enodes(plan, filename): - enode_list = plan.run_python( - description="Getting devnet enodes", - files={constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: filename}, - wait=None, - run=""" -with open("/network-configs/bootnode.txt") as bootnode_file: - bootnodes = [] - for line in bootnode_file: - line = line.strip() - bootnodes.append(line) -print(",".join(bootnodes), end="") - """, - ) - return enode_list.output - - -def get_devnet_enrs_list(plan, filename): - enr_list = plan.run_python( - description="Creating devnet enrs list", - files={constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: filename}, - wait=None, - run=""" -with open("/network-configs/bootstrap_nodes.txt") as bootnode_file: - bootnodes = [] - for line in bootnode_file: - line = line.strip() - bootnodes.append(line) -print(",".join(bootnodes), end="") - """, - ) - return enr_list.output - - -def read_genesis_timestamp_from_config(plan, filename): - value = plan.run_python( - description="Reading genesis timestamp from config", - files={constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: filename}, - wait=None, - packages=["PyYAML"], - run=""" -import yaml -with open("/network-configs/config.yaml", "r") as f: - yaml_data = yaml.safe_load(f) - -min_genesis_time = int(yaml_data.get("MIN_GENESIS_TIME", 0)) -genesis_delay = int(yaml_data.get("GENESIS_DELAY", 0)) -print(min_genesis_time + genesis_delay, end="") - """, - ) - return value.output - - -def read_genesis_network_id_from_config(plan, filename): - value = plan.run_python( - description="Reading genesis network id from config", - files={constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: filename}, - wait=None, - packages=["PyYAML"], - run=""" -import yaml -with open("/network-configs/config.yaml", "r") as f: - yaml_data = yaml.safe_load(f) -network_id = int(yaml_data.get("DEPOSIT_NETWORK_ID", 0)) -print(network_id, end="") - """, - ) - return value.output - - -def get_network_name(network): - network_name = network - if ( - network != constants.NETWORK_NAME.kurtosis - and network != constants.NETWORK_NAME.ephemery - and constants.NETWORK_NAME.shadowfork not in network - and network not in constants.PUBLIC_NETWORKS - ): - network_name = "devnets" - - if constants.NETWORK_NAME.shadowfork in network: - network_name = network.split("-shadowfork")[0] - - return network_name - - -# this is a python procedure so that Kurtosis can do idempotent runs -# time.now() runs everytime bringing non determinism -# note that the timestamp it returns is a string -def get_final_genesis_timestamp(plan, padding): - result = plan.run_python( - description="Getting final genesis timestamp", - run=""" -import time -import sys -padding = int(sys.argv[1]) -print(int(time.time()+padding), end="") -""", - args=[str(padding)], - store=[StoreSpec(src="/tmp", name="final-genesis-timestamp")], - ) - return result.output - - -def calculate_devnet_url(network): - sf_suffix_mapping = {"hsf": "-hsf-", "gsf": "-gsf-", "ssf": "-ssf-"} - shadowfork = "sf-" in network - - if shadowfork: - for suffix, delimiter in sf_suffix_mapping.items(): - if delimiter in network: - network_parts = network.split(delimiter, 1) - network_type = suffix - else: - network_parts = network.split("-devnet-", 1) - network_type = "devnet" - - devnet_name, devnet_number = network_parts[0], network_parts[1] - devnet_category = devnet_name.split("-")[0] - devnet_subname = ( - devnet_name.split("-")[1] + "-" if len(devnet_name.split("-")) > 1 else "" - ) - - return "github.com/ethpandaops/{0}-devnets/network-configs/{1}{2}-{3}".format( - devnet_category, devnet_subname, network_type, devnet_number - ) - - -def get_client_names(participant, index, participant_contexts, participant_configs): - index_str = zfill_custom(index + 1, len(str(len(participant_contexts)))) - participant_config = participant_configs[index] - cl_client = participant.cl_context - el_client = participant.el_context - vc_client = participant.vc_context - full_name = ( - "{0}-{1}-{2}".format(index_str, el_client.client_name, cl_client.client_name) - + "-{0}".format(vc_client.client_name) - if vc_client != None and cl_client.client_name != vc_client.client_name - else "{0}-{1}-{2}".format( - index_str, el_client.client_name, cl_client.client_name - ) - ) - return full_name, cl_client, el_client, participant_config diff --git a/input_parser.star b/input_parser.star deleted file mode 100644 index c634876..0000000 --- a/input_parser.star +++ /dev/null @@ -1,1029 +0,0 @@ -constants = import_module("./dependencies/constants.star") -shared_utils = import_module("./dependencies/shared_utils.star") -genesis_constants = import_module("./dependencies/genesis_constants.star") - -DEFAULT_EL_IMAGES = { - "geth": "ethereum/client-go:latest", - "erigon": "ethpandaops/erigon:devel", - "nethermind": "nethermindeth/nethermind:master", - "besu": "hyperledger/besu:latest", - "reth": "ghcr.io/paradigmxyz/reth", - "ethereumjs": "ethpandaops/ethereumjs:master", - "nimbus": "ethpandaops/nimbus-eth1:master", -} - -DEFAULT_CL_IMAGES = { - "lighthouse": "sigp/lighthouse:latest", - "teku": "consensys/teku:latest", - "nimbus": "statusim/nimbus-eth2:multiarch-latest", - "prysm": "gcr.io/prysmaticlabs/prysm/beacon-chain:latest", - "lodestar": "chainsafe/lodestar:latest", - "grandine": "ethpandaops/grandine:master", -} - -DEFAULT_CL_IMAGES_MINIMAL = { - "lighthouse": "ethpandaops/lighthouse:stable-minimal", - "teku": "consensys/teku:latest", - "nimbus": "ethpandaops/nimbus-eth2:stable-minimal", - "prysm": "ethpandaops/prysm-beacon-chain:develop-minimal", - "lodestar": "chainsafe/lodestar:latest", - "grandine": "ethpandaops/grandine:master-minimal", -} - -DEFAULT_VC_IMAGES = { - "lighthouse": "sigp/lighthouse:latest", - "lodestar": "chainsafe/lodestar:latest", - "nimbus": "statusim/nimbus-validator-client:multiarch-latest", - "prysm": "gcr.io/prysmaticlabs/prysm/validator:latest", - "teku": "consensys/teku:latest", - "grandine": "ethpandaops/grandine:master", -} - -DEFAULT_VC_IMAGES_MINIMAL = { - "lighthouse": "ethpandaops/lighthouse:stable-minimal", - "lodestar": "chainsafe/lodestar:latest", - "nimbus": "ethpandaops/nimbus-validator-client:stable-minimal", - "prysm": "ethpandaops/prysm-validator:develop-minimal", - "teku": "consensys/teku:latest", - "grandine": "ethpandaops/grandine:master-minimal", -} - -# Placeholder value for the deneb fork epoch if electra is being run -# TODO: This is a hack, and should be removed once we electra is rebased on deneb -HIGH_DENEB_VALUE_FORK_VERKLE = 2000000000 - -# MEV Params -MEV_BOOST_PORT = 18550 -MEV_BOOST_SERVICE_NAME_PREFIX = "mev-boost" - -# Minimum number of validators required for a network to be valid is 64 -MIN_VALIDATORS = 64 - -DEFAULT_ADDITIONAL_SERVICES = [ - "tx_spammer", - "blob_spammer", - "el_forkmon", - "beacon_metrics_gazer", - "dora", - "prometheus_grafana", -] - -ATTR_TO_BE_SKIPPED_AT_ROOT = ( - "network_params", - "participants", - "mev_params", - "assertoor_params", - "goomy_blob_params", - "tx_spammer_params", - "custom_flood_params", - "xatu_sentry_params", - "port_publisher", -) - -def input_parser(plan, input_args): - result = parse_network_params(plan, input_args) - - # add default eth2 input params - result["mev_params"] = get_default_mev_params( - result.get("mev_type"), result["network_params"]["preset"] - ) - if ( - result["network_params"]["network"] == constants.NETWORK_NAME.kurtosis - or constants.NETWORK_NAME.shadowfork in result["network_params"]["network"] - ): - result["additional_services"] = DEFAULT_ADDITIONAL_SERVICES - else: - result["additional_services"] = [] - result["grafana_additional_dashboards"] = [] - result["tx_spammer_params"] = get_default_tx_spammer_params() - result["custom_flood_params"] = get_default_custom_flood_params() - result["disable_peer_scoring"] = False - result["goomy_blob_params"] = get_default_goomy_blob_params() - result["assertoor_params"] = get_default_assertoor_params() - result["xatu_sentry_params"] = get_default_xatu_sentry_params() - result["persistent"] = False - result["parallel_keystore_generation"] = False - result["global_tolerations"] = [] - result["global_node_selectors"] = {} - - if constants.NETWORK_NAME.shadowfork in result["network_params"]["network"]: - shadow_base = result["network_params"]["network"].split("-shadowfork")[0] - result["network_params"][ - "deposit_contract_address" - ] = constants.DEPOSIT_CONTRACT_ADDRESS[shadow_base] - - if constants.NETWORK_NAME.shadowfork in result["network_params"]["network"]: - shadow_base = result["network_params"]["network"].split("-shadowfork")[0] - result["network_params"][ - "deposit_contract_address" - ] = constants.DEPOSIT_CONTRACT_ADDRESS[shadow_base] - - for attr in input_args: - value = input_args[attr] - # if its inserted we use the value inserted - if attr not in ATTR_TO_BE_SKIPPED_AT_ROOT and attr in input_args: - result[attr] = value - # custom eth2 attributes config - elif attr == "mev_params": - for sub_attr in input_args["mev_params"]: - sub_value = input_args["mev_params"][sub_attr] - result["mev_params"][sub_attr] = sub_value - elif attr == "tx_spammer_params": - for sub_attr in input_args["tx_spammer_params"]: - sub_value = input_args["tx_spammer_params"][sub_attr] - result["tx_spammer_params"][sub_attr] = sub_value - elif attr == "custom_flood_params": - for sub_attr in input_args["custom_flood_params"]: - sub_value = input_args["custom_flood_params"][sub_attr] - result["custom_flood_params"][sub_attr] = sub_value - elif attr == "goomy_blob_params": - for sub_attr in input_args["goomy_blob_params"]: - sub_value = input_args["goomy_blob_params"][sub_attr] - result["goomy_blob_params"][sub_attr] = sub_value - elif attr == "assertoor_params": - for sub_attr in input_args["assertoor_params"]: - sub_value = input_args["assertoor_params"][sub_attr] - result["assertoor_params"][sub_attr] = sub_value - elif attr == "xatu_sentry_params": - for sub_attr in input_args["xatu_sentry_params"]: - sub_value = input_args["xatu_sentry_params"][sub_attr] - result["xatu_sentry_params"][sub_attr] = sub_value - elif attr == "port_publisher": - for sub_attr in input_args["port_publisher"]: - sub_value = input_args["port_publisher"][sub_attr] - result["port_publisher"][sub_attr] = sub_value - - if result.get("disable_peer_scoring"): - result = enrich_disable_peer_scoring(result) - - if result.get("mev_type") in ( - constants.MOCK_MEV_TYPE, - constants.FLASHBOTS_MEV_TYPE, - constants.MEV_RS_MEV_TYPE, - ): - result = enrich_mev_extra_params( - result, - MEV_BOOST_SERVICE_NAME_PREFIX, - MEV_BOOST_PORT, - result.get("mev_type"), - ) - elif result.get("mev_type") == None: - pass - else: - fail( - "Unsupported MEV type: {0}, please use 'mock', 'flashbots' or 'mev-rs' type".format( - result.get("mev_type") - ) - ) - - if result["port_publisher"]["nat_exit_ip"] == "auto": - result["port_publisher"]["nat_exit_ip"] = get_public_ip(plan) - - if result["port_publisher"]["public_port_start"] != None: - start = result["port_publisher"]["public_port_start"] - result["port_publisher"]["el_start"] = start - result["port_publisher"]["cl_start"] = start + len(result["participants"]) - - return struct( - participants=[ - struct( - el_type=participant["el_type"], - el_image=participant["el_image"], - el_log_level=participant["el_log_level"], - el_volume_size=participant["el_volume_size"], - el_extra_params=participant["el_extra_params"], - el_extra_env_vars=participant["el_extra_env_vars"], - el_extra_labels=participant["el_extra_labels"], - el_tolerations=participant["el_tolerations"], - cl_type=participant["cl_type"], - cl_image=participant["cl_image"], - cl_log_level=participant["cl_log_level"], - cl_volume_size=participant["cl_volume_size"], - cl_extra_env_vars=participant["cl_extra_env_vars"], - cl_tolerations=participant["cl_tolerations"], - use_separate_vc=participant["use_separate_vc"], - vc_type=participant["vc_type"], - vc_image=participant["vc_image"], - vc_log_level=participant["vc_log_level"], - vc_tolerations=participant["vc_tolerations"], - cl_extra_params=participant["cl_extra_params"], - cl_extra_labels=participant["cl_extra_labels"], - vc_extra_params=participant["vc_extra_params"], - vc_extra_env_vars=participant["vc_extra_env_vars"], - vc_extra_labels=participant["vc_extra_labels"], - builder_network_params=participant["builder_network_params"], - el_min_cpu=participant["el_min_cpu"], - el_max_cpu=participant["el_max_cpu"], - el_min_mem=participant["el_min_mem"], - el_max_mem=participant["el_max_mem"], - cl_min_cpu=participant["cl_min_cpu"], - cl_max_cpu=participant["cl_max_cpu"], - cl_min_mem=participant["cl_min_mem"], - cl_max_mem=participant["cl_max_mem"], - vc_min_cpu=participant["vc_min_cpu"], - vc_max_cpu=participant["vc_max_cpu"], - vc_min_mem=participant["vc_min_mem"], - vc_max_mem=participant["vc_max_mem"], - validator_count=participant["validator_count"], - tolerations=participant["tolerations"], - node_selectors=participant["node_selectors"], - snooper_enabled=participant["snooper_enabled"], - count=participant["count"], - ethereum_metrics_exporter_enabled=participant[ - "ethereum_metrics_exporter_enabled" - ], - xatu_sentry_enabled=participant["xatu_sentry_enabled"], - prometheus_config=struct( - scrape_interval=participant["prometheus_config"]["scrape_interval"], - labels=participant["prometheus_config"]["labels"], - ), - blobber_enabled=participant["blobber_enabled"], - blobber_extra_params=participant["blobber_extra_params"], - keymanager_enabled=participant["keymanager_enabled"], - ) - for participant in result["participants"] - ], - network_params=struct( - preregistered_validator_keys_mnemonic=result["network_params"][ - "preregistered_validator_keys_mnemonic" - ], - preregistered_validator_count=result["network_params"][ - "preregistered_validator_count" - ], - num_validator_keys_per_node=result["network_params"][ - "num_validator_keys_per_node" - ], - network_id=result["network_params"]["network_id"], - deposit_contract_address=result["network_params"][ - "deposit_contract_address" - ], - seconds_per_slot=result["network_params"]["seconds_per_slot"], - genesis_delay=result["network_params"]["genesis_delay"], - max_churn=result["network_params"]["max_churn"], - ejection_balance=result["network_params"]["ejection_balance"], - eth1_follow_distance=result["network_params"]["eth1_follow_distance"], - deneb_fork_epoch=result["network_params"]["deneb_fork_epoch"], - electra_fork_epoch=result["network_params"]["electra_fork_epoch"], - eip7594_fork_epoch=result["network_params"]["eip7594_fork_epoch"], - eip7594_fork_version=result["network_params"]["eip7594_fork_version"], - network=result["network_params"]["network"], - min_validator_withdrawability_delay=result["network_params"][ - "min_validator_withdrawability_delay" - ], - shard_committee_period=result["network_params"]["shard_committee_period"], - network_sync_base_url=result["network_params"]["network_sync_base_url"], - preset=result["network_params"]["preset"], - ), - mev_params=struct( - mev_relay_image=result["mev_params"]["mev_relay_image"], - mev_builder_image=result["mev_params"]["mev_builder_image"], - mev_builder_cl_image=result["mev_params"]["mev_builder_cl_image"], - mev_builder_extra_data=result["mev_params"]["mev_builder_extra_data"], - mev_boost_image=result["mev_params"]["mev_boost_image"], - mev_boost_args=result["mev_params"]["mev_boost_args"], - mev_relay_api_extra_args=result["mev_params"]["mev_relay_api_extra_args"], - mev_relay_housekeeper_extra_args=result["mev_params"][ - "mev_relay_housekeeper_extra_args" - ], - mev_relay_website_extra_args=result["mev_params"][ - "mev_relay_website_extra_args" - ], - mev_builder_extra_args=result["mev_params"]["mev_builder_extra_args"], - mev_flood_image=result["mev_params"]["mev_flood_image"], - mev_flood_extra_args=result["mev_params"]["mev_flood_extra_args"], - mev_flood_seconds_per_bundle=result["mev_params"][ - "mev_flood_seconds_per_bundle" - ], - ) - if result["mev_params"] - else None, - tx_spammer_params=struct( - tx_spammer_extra_args=result["tx_spammer_params"]["tx_spammer_extra_args"], - ), - goomy_blob_params=struct( - goomy_blob_args=result["goomy_blob_params"]["goomy_blob_args"], - ), - apache_port=result["apache_port"], - assertoor_params=struct( - image=result["assertoor_params"]["image"], - run_stability_check=result["assertoor_params"]["run_stability_check"], - run_block_proposal_check=result["assertoor_params"][ - "run_block_proposal_check" - ], - run_lifecycle_test=result["assertoor_params"]["run_lifecycle_test"], - run_transaction_test=result["assertoor_params"]["run_transaction_test"], - run_blob_transaction_test=result["assertoor_params"][ - "run_blob_transaction_test" - ], - run_opcodes_transaction_test=result["assertoor_params"][ - "run_opcodes_transaction_test" - ], - tests=result["assertoor_params"]["tests"], - ), - custom_flood_params=struct( - interval_between_transactions=result["custom_flood_params"][ - "interval_between_transactions" - ], - ), - additional_services=result["additional_services"], - wait_for_finalization=result["wait_for_finalization"], - global_log_level=result["global_log_level"], - mev_type=result["mev_type"], - snooper_enabled=result["snooper_enabled"], - ethereum_metrics_exporter_enabled=result["ethereum_metrics_exporter_enabled"], - xatu_sentry_enabled=result["xatu_sentry_enabled"], - parallel_keystore_generation=result["parallel_keystore_generation"], - grafana_additional_dashboards=result["grafana_additional_dashboards"], - disable_peer_scoring=result["disable_peer_scoring"], - persistent=result["persistent"], - xatu_sentry_params=struct( - xatu_sentry_image=result["xatu_sentry_params"]["xatu_sentry_image"], - xatu_server_addr=result["xatu_sentry_params"]["xatu_server_addr"], - xatu_server_headers=result["xatu_sentry_params"]["xatu_server_headers"], - beacon_subscriptions=result["xatu_sentry_params"]["beacon_subscriptions"], - xatu_server_tls=result["xatu_sentry_params"]["xatu_server_tls"], - ), - global_tolerations=result["global_tolerations"], - global_node_selectors=result["global_node_selectors"], - keymanager_enabled=result["keymanager_enabled"], - port_publisher=struct( - public_port_start=result["port_publisher"]["public_port_start"], - nat_exit_ip=result["port_publisher"]["nat_exit_ip"], - el_start=result["port_publisher"].get("el_start"), - cl_start=result["port_publisher"].get("cl_start"), - ), - ) - - -def parse_network_params(plan, input_args): - result = default_input_args() - if input_args.get("network_params", {}).get("preset") == "minimal": - result["network_params"] = default_minimal_network_params() - for attr in input_args: - value = input_args[attr] - # if its insterted we use the value inserted - if attr not in ATTR_TO_BE_SKIPPED_AT_ROOT and attr in input_args: - result[attr] = value - elif attr == "network_params": - for sub_attr in input_args["network_params"]: - sub_value = input_args["network_params"][sub_attr] - result["network_params"][sub_attr] = sub_value - elif attr == "participants": - participants = [] - for participant in input_args["participants"]: - new_participant = default_participant() - for sub_attr, sub_value in participant.items(): - # if the value is set in input we set it in participant - new_participant[sub_attr] = sub_value - for _ in range(0, new_participant["count"]): - participant_copy = deep_copy_participant(new_participant) - participants.append(participant_copy) - result["participants"] = participants - - total_participant_count = 0 - actual_num_validators = 0 - # validation of the above defaults - for index, participant in enumerate(result["participants"]): - el_type = participant["el_type"] - cl_type = participant["cl_type"] - vc_type = participant["vc_type"] - - if ( - cl_type in (constants.CL_TYPE.nimbus) - and (result["network_params"]["seconds_per_slot"] < 12) - and result["network_params"]["preset"] == "mainnet" - ): - fail( - "nimbus can't be run with slot times below 12 seconds with " - + result["network_params"]["preset"] - + " preset" - ) - - if ( - cl_type in (constants.CL_TYPE.nimbus) - and (result["network_params"]["seconds_per_slot"] != 6) - and result["network_params"]["preset"] == "minimal" - ): - fail( - "nimbus can't be run with slot times different than 6 seconds with " - + result["network_params"]["preset"] - + " preset" - ) - - el_image = participant["el_image"] - if el_image == "": - default_image = DEFAULT_EL_IMAGES.get(el_type, "") - if default_image == "": - fail( - "{0} received an empty image name and we don't have a default for it".format( - el_type - ) - ) - participant["el_image"] = default_image - - cl_image = participant["cl_image"] - if cl_image == "": - if result["network_params"]["preset"] == "minimal": - default_image = DEFAULT_CL_IMAGES_MINIMAL.get(cl_type, "") - else: - default_image = DEFAULT_CL_IMAGES.get(cl_type, "") - if default_image == "": - fail( - "{0} received an empty image name and we don't have a default for it".format( - cl_type - ) - ) - participant["cl_image"] = default_image - - if participant["use_separate_vc"] == None: - # Default to false for CL clients that can run validator clients - # in the same process. - if ( - cl_type - in ( - constants.CL_TYPE.nimbus, - constants.CL_TYPE.teku, - constants.CL_TYPE.grandine, - ) - and vc_type == "" - ): - participant["use_separate_vc"] = False - else: - participant["use_separate_vc"] = True - - if vc_type == "": - # Defaults to matching the chosen CL client - vc_type = cl_type - participant["vc_type"] = vc_type - - vc_image = participant["vc_image"] - if vc_image == "": - if cl_image == "" or vc_type != cl_type: - # If the validator client image is also empty, default to the image for the chosen CL client - if result["network_params"]["preset"] == "minimal": - default_image = DEFAULT_VC_IMAGES_MINIMAL.get(vc_type, "") - else: - default_image = DEFAULT_VC_IMAGES.get(vc_type, "") - else: - if cl_type == "prysm": - default_image = cl_image.replace("beacon-chain", "validator") - elif cl_type == "nimbus": - default_image = cl_image.replace( - "nimbus-eth2", "nimbus-validator-client" - ) - else: - default_image = cl_image - if default_image == "": - fail( - "{0} received an empty image name and we don't have a default for it".format( - vc_type - ) - ) - participant["vc_image"] = default_image - - snooper_enabled = participant["snooper_enabled"] - if snooper_enabled == None: - participant["snooper_enabled"] = result["snooper_enabled"] - - keymanager_enabled = participant["keymanager_enabled"] - if keymanager_enabled == None: - participant["keymanager_enabled"] = result["keymanager_enabled"] - - ethereum_metrics_exporter_enabled = participant[ - "ethereum_metrics_exporter_enabled" - ] - if ethereum_metrics_exporter_enabled == None: - participant["ethereum_metrics_exporter_enabled"] = result[ - "ethereum_metrics_exporter_enabled" - ] - - xatu_sentry_enabled = participant["xatu_sentry_enabled"] - if xatu_sentry_enabled == None: - participant["xatu_sentry_enabled"] = result["xatu_sentry_enabled"] - - blobber_enabled = participant["blobber_enabled"] - if blobber_enabled: - # unless we are running lighthouse, we don't support blobber - if participant["cl_type"] != constants.CL_TYPE.lighthouse: - fail( - "blobber is not supported for {0} client".format( - participant["cl_type"] - ) - ) - - validator_count = participant["validator_count"] - if validator_count == None: - participant["validator_count"] = result["network_params"][ - "num_validator_keys_per_node" - ] - - actual_num_validators += participant["validator_count"] - - cl_extra_params = participant.get("cl_extra_params", []) - participant["cl_extra_params"] = cl_extra_params - - vc_extra_params = participant.get("vc_extra_params", []) - participant["vc_extra_params"] = vc_extra_params - - total_participant_count += participant["count"] - - if total_participant_count == 1: - for index, participant in enumerate(result["participants"]): - # If there is only one participant, we run lodestar as a single node mode - if participant["cl_type"] == constants.CL_TYPE.lodestar: - participant["cl_extra_params"].append("--sync.isSingleNode") - participant["cl_extra_params"].append( - "--network.allowPublishToZeroPeers" - ) - - if result["network_params"]["network_id"].strip() == "": - fail("network_id is empty or spaces it needs to be of non zero length") - - if result["network_params"]["deposit_contract_address"].strip() == "": - fail( - "deposit_contract_address is empty or spaces it needs to be of non zero length" - ) - - if ( - result["network_params"]["network"] == "kurtosis" - or constants.NETWORK_NAME.shadowfork in result["network_params"]["network"] - ): - if ( - result["network_params"]["preregistered_validator_keys_mnemonic"].strip() - == "" - ): - fail( - "preregistered_validator_keys_mnemonic is empty or spaces it needs to be of non zero length" - ) - - if result["network_params"]["seconds_per_slot"] == 0: - fail("seconds_per_slot is 0 needs to be > 0 ") - - if ( - result["network_params"]["network"] == constants.NETWORK_NAME.kurtosis - or constants.NETWORK_NAME.shadowfork in result["network_params"]["network"] - ): - if MIN_VALIDATORS > actual_num_validators: - fail( - "We require at least {0} validators but got {1}".format( - MIN_VALIDATORS, actual_num_validators - ) - ) - else: - # Don't allow validators on non-kurtosis networks - for participant in result["participants"]: - participant["validator_count"] = 0 - - if result["network_params"]["preset"] not in ["mainnet", "minimal"]: - fail( - "preset " - + result["network_params"]["preset"] - + " is not supported, it can only be mainnet or minimal" - ) - - if result["network_params"]["preset"] == "minimal": - if result["network_params"]["deneb_fork_epoch"] > 0: - fail("minimal preset only supports deneb genesis fork epoch") - - return result - - -def get_client_log_level_or_default( - participant_log_level, global_log_level, client_log_levels -): - log_level = client_log_levels.get(participant_log_level, "") - if log_level == "": - log_level = client_log_levels.get(global_log_level, "") - if log_level == "": - fail( - "No participant log level defined, and the client log level has no mapping for global log level '{0}'".format( - global_log_level - ) - ) - return log_level - - -def get_client_tolerations( - specific_container_toleration, participant_tolerations, global_tolerations -): - toleration_list = [] - tolerations = [] - tolerations = specific_container_toleration if specific_container_toleration else [] - if not tolerations: - tolerations = participant_tolerations if participant_tolerations else [] - if not tolerations: - tolerations = global_tolerations if global_tolerations else [] - - if tolerations != []: - for toleration_data in tolerations: - if toleration_data.get("toleration_seconds"): - toleration_list.append( - Toleration( - key=toleration_data.get("key", ""), - value=toleration_data.get("value", ""), - operator=toleration_data.get("operator", ""), - effect=toleration_data.get("effect", ""), - toleration_seconds=toleration_data.get("toleration_seconds"), - ) - ) - # Gyani has to fix this in the future - # https://github.com/kurtosis-tech/kurtosis/issues/2093 - else: - toleration_list.append( - Toleration( - key=toleration_data.get("key", ""), - value=toleration_data.get("value", ""), - operator=toleration_data.get("operator", ""), - effect=toleration_data.get("effect", ""), - ) - ) - - return toleration_list - - -def get_client_node_selectors(participant_node_selectors, global_node_selectors): - node_selectors = {} - node_selectors = participant_node_selectors if participant_node_selectors else {} - if node_selectors == {}: - node_selectors = global_node_selectors if global_node_selectors else {} - - return node_selectors - - -def default_input_args(): - network_params = default_network_params() - participants = [default_participant()] - return { - "participants": participants, - "network_params": network_params, - "wait_for_finalization": False, - "global_log_level": "info", - "snooper_enabled": False, - "ethereum_metrics_exporter_enabled": False, - "parallel_keystore_generation": False, - "disable_peer_scoring": False, - "persistent": False, - "mev_type": None, - "xatu_sentry_enabled": False, - "apache_port": 40000, - "global_tolerations": [], - "global_node_selectors": {}, - "keymanager_enabled": False, - "port_publisher": { - "nat_exit_ip": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER, - "public_port_start": None, - }, - } - - -def default_network_params(): - return { - "network": "kurtosis", - "network_id": "3151908", - "deposit_contract_address": "0x4242424242424242424242424242424242424242", - "seconds_per_slot": 12, - "num_validator_keys_per_node": 64, - "preregistered_validator_keys_mnemonic": "giant issue aisle success illegal bike spike question tent bar rely arctic volcano long crawl hungry vocal artwork sniff fantasy very lucky have athlete", - "preregistered_validator_count": 0, - "genesis_delay": 20, - "max_churn": 8, - "ejection_balance": 16000000000, - "eth1_follow_distance": 2048, - "min_validator_withdrawability_delay": 256, - "shard_committee_period": 256, - "deneb_fork_epoch": 0, - "electra_fork_epoch": 100000000, - "eip7594_fork_epoch": 100000001, - "eip7594_fork_version": "0x70000038", - "network_sync_base_url": "https://ethpandaops-ethereum-node-snapshots.ams3.digitaloceanspaces.com/", - "preset": "mainnet", - } - - -def default_minimal_network_params(): - return { - "network": "kurtosis", - "network_id": "3151908", - "deposit_contract_address": "0x4242424242424242424242424242424242424242", - "seconds_per_slot": 6, - "num_validator_keys_per_node": 64, - "preregistered_validator_keys_mnemonic": "giant issue aisle success illegal bike spike question tent bar rely arctic volcano long crawl hungry vocal artwork sniff fantasy very lucky have athlete", - "preregistered_validator_count": 0, - "genesis_delay": 20, - "max_churn": 4, - "ejection_balance": 16000000000, - "eth1_follow_distance": 16, - "min_validator_withdrawability_delay": 256, - "shard_committee_period": 64, - "deneb_fork_epoch": 0, - "electra_fork_epoch": 100000000, - "eip7594_fork_epoch": 100000001, - "eip7594_fork_version": "0x70000038", - "network_sync_base_url": "https://ethpandaops-ethereum-node-snapshots.ams3.digitaloceanspaces.com/", - "preset": "minimal", - } - - -def default_participant(): - return { - "el_type": "geth", - "el_image": "", - "el_log_level": "", - "el_extra_env_vars": {}, - "el_extra_labels": {}, - "el_extra_params": [], - "el_tolerations": [], - "el_volume_size": 0, - "el_min_cpu": 0, - "el_max_cpu": 0, - "el_min_mem": 0, - "el_max_mem": 0, - "cl_type": "lighthouse", - "cl_image": "", - "cl_log_level": "", - "cl_extra_env_vars": {}, - "cl_extra_labels": {}, - "cl_extra_params": [], - "cl_tolerations": [], - "cl_volume_size": 0, - "cl_min_cpu": 0, - "cl_max_cpu": 0, - "cl_min_mem": 0, - "cl_max_mem": 0, - "use_separate_vc": None, - "vc_type": "", - "vc_image": "", - "vc_log_level": "", - "vc_extra_env_vars": {}, - "vc_extra_labels": {}, - "vc_extra_params": [], - "vc_tolerations": [], - "vc_min_cpu": 0, - "vc_max_cpu": 0, - "vc_min_mem": 0, - "vc_max_mem": 0, - "validator_count": None, - "node_selectors": {}, - "tolerations": [], - "count": 1, - "snooper_enabled": None, - "ethereum_metrics_exporter_enabled": None, - "xatu_sentry_enabled": None, - "prometheus_config": { - "scrape_interval": "15s", - "labels": None, - }, - "blobber_enabled": False, - "blobber_extra_params": [], - "builder_network_params": None, - "keymanager_enabled": None, - } - - -def get_default_mev_params(mev_type, preset): - mev_relay_image = constants.DEFAULT_FLASHBOTS_RELAY_IMAGE - mev_builder_image = constants.DEFAULT_FLASHBOTS_BUILDER_IMAGE - if preset == "minimal": - mev_builder_cl_image = DEFAULT_CL_IMAGES_MINIMAL[constants.CL_TYPE.lighthouse] - else: - mev_builder_cl_image = DEFAULT_CL_IMAGES[constants.CL_TYPE.lighthouse] - mev_builder_extra_data = None - mev_boost_image = constants.DEFAULT_FLASHBOTS_MEV_BOOST_IMAGE - mev_boost_args = ["mev-boost", "--relay-check"] - mev_relay_api_extra_args = [] - mev_relay_housekeeper_extra_args = [] - mev_relay_website_extra_args = [] - mev_builder_extra_args = [] - mev_flood_image = "flashbots/mev-flood" - mev_flood_extra_args = [] - mev_flood_seconds_per_bundle = 15 - mev_builder_prometheus_config = { - "scrape_interval": "15s", - "labels": None, - } - - if mev_type == constants.MEV_RS_MEV_TYPE: - if preset == "minimal": - mev_relay_image = constants.DEFAULT_MEV_RS_IMAGE_MINIMAL - mev_builder_image = constants.DEFAULT_MEV_RS_IMAGE_MINIMAL - mev_builder_cl_image = DEFAULT_CL_IMAGES_MINIMAL[ - constants.CL_TYPE.lighthouse - ] - mev_boost_image = constants.DEFAULT_MEV_RS_IMAGE_MINIMAL - else: - mev_relay_image = constants.DEFAULT_MEV_RS_IMAGE - mev_builder_image = constants.DEFAULT_MEV_RS_IMAGE - mev_builder_cl_image = DEFAULT_CL_IMAGES[constants.CL_TYPE.lighthouse] - mev_boost_image = constants.DEFAULT_MEV_RS_IMAGE - mev_builder_extra_data = "0x68656C6C6F20776F726C640A" # "hello world\n" - mev_builder_extra_args = ["--mev-builder-config=" + "/config/config.toml"] - - return { - "mev_relay_image": mev_relay_image, - "mev_builder_image": mev_builder_image, - "mev_builder_cl_image": mev_builder_cl_image, - "mev_builder_extra_data": mev_builder_extra_data, - "mev_builder_extra_args": mev_builder_extra_args, - "mev_boost_image": mev_boost_image, - "mev_boost_args": mev_boost_args, - "mev_relay_api_extra_args": mev_relay_api_extra_args, - "mev_relay_housekeeper_extra_args": mev_relay_housekeeper_extra_args, - "mev_relay_website_extra_args": mev_relay_website_extra_args, - "mev_flood_image": mev_flood_image, - "mev_flood_extra_args": mev_flood_extra_args, - "mev_flood_seconds_per_bundle": mev_flood_seconds_per_bundle, - "mev_builder_prometheus_config": mev_builder_prometheus_config, - } - - -def get_default_tx_spammer_params(): - return {"tx_spammer_extra_args": []} - - -def get_default_goomy_blob_params(): - return {"goomy_blob_args": []} - - -def get_default_assertoor_params(): - return { - "image": "", - "run_stability_check": True, - "run_block_proposal_check": True, - "run_lifecycle_test": False, - "run_transaction_test": False, - "run_blob_transaction_test": False, - "run_opcodes_transaction_test": False, - "tests": [], - } - - -def get_default_xatu_sentry_params(): - return { - "xatu_sentry_image": "ethpandaops/xatu:latest", - "xatu_server_addr": "localhost:8080", - "xatu_server_headers": {}, - "xatu_server_tls": False, - "beacon_subscriptions": [ - "attestation", - "block", - "chain_reorg", - "finalized_checkpoint", - "head", - "voluntary_exit", - "contribution_and_proof", - "blob_sidecar", - ], - } - - -def get_default_custom_flood_params(): - # this is a simple script that increases the balance of the coinbase address at a cadence - return {"interval_between_transactions": 1} - - -def enrich_disable_peer_scoring(parsed_arguments_dict): - for index, participant in enumerate(parsed_arguments_dict["participants"]): - if participant["cl_type"] == "lighthouse": - participant["cl_extra_params"].append("--disable-peer-scoring") - if participant["cl_type"] == "prysm": - participant["cl_extra_params"].append("--disable-peer-scorer") - if participant["cl_type"] == "teku": - participant["cl_extra_params"].append("--Xp2p-gossip-scoring-enabled") - if participant["cl_type"] == "lodestar": - participant["cl_extra_params"].append("--disablePeerScoring") - if participant["cl_type"] == "grandine": - participant["cl_extra_params"].append("--disable-peer-scoring") - return parsed_arguments_dict - - -# TODO perhaps clean this up into a map -def enrich_mev_extra_params(parsed_arguments_dict, mev_prefix, mev_port, mev_type): - for index, participant in enumerate(parsed_arguments_dict["participants"]): - index_str = shared_utils.zfill_custom( - index + 1, len(str(len(parsed_arguments_dict["participants"]))) - ) - mev_url = "http://{0}-{1}-{2}-{3}:{4}".format( - MEV_BOOST_SERVICE_NAME_PREFIX, - index_str, - participant["cl_type"], - participant["el_type"], - mev_port, - ) - - if participant["cl_type"] == "lighthouse": - participant["vc_extra_params"].append("--builder-proposals") - participant["cl_extra_params"].append("--builder={0}".format(mev_url)) - if participant["cl_type"] == "lodestar": - participant["vc_extra_params"].append("--builder") - participant["cl_extra_params"].append("--builder") - participant["cl_extra_params"].append("--builder.urls={0}".format(mev_url)) - if participant["cl_type"] == "nimbus": - participant["vc_extra_params"].append("--payload-builder=true") - participant["cl_extra_params"].append("--payload-builder=true") - participant["cl_extra_params"].append( - "--payload-builder-url={0}".format(mev_url) - ) - if participant["cl_type"] == "teku": - participant["vc_extra_params"].append( - "--validators-builder-registration-default-enabled=true" - ) - participant["cl_extra_params"].append( - "--builder-endpoint={0}".format(mev_url) - ) - if participant["cl_type"] == "prysm": - participant["vc_extra_params"].append("--enable-builder") - participant["cl_extra_params"].append( - "--http-mev-relay={0}".format(mev_url) - ) - if participant["cl_type"] == "grandine": - participant["cl_extra_params"].append("--builder-url={0}".format(mev_url)) - - num_participants = len(parsed_arguments_dict["participants"]) - index_str = shared_utils.zfill_custom( - num_participants + 1, len(str(num_participants + 1)) - ) - if mev_type == constants.FLASHBOTS_MEV_TYPE: - mev_participant = default_participant() - mev_participant["el_type"] = "geth-builder" - mev_participant.update( - { - "el_image": parsed_arguments_dict["mev_params"]["mev_builder_image"], - "cl_image": parsed_arguments_dict["mev_params"]["mev_builder_cl_image"], - "cl_extra_params": [ - "--always-prepare-payload", - "--prepare-payload-lookahead", - "12000", - "--disable-peer-scoring", - ], - # TODO(maybe) make parts of this more passable like the mev-relay-endpoint & forks - "el_extra_params": [ - "--builder", - "--builder.remote_relay_endpoint=http://mev-relay-api:9062", - "--builder.beacon_endpoints=http://cl-{0}-lighthouse-geth-builder:4000".format( - index_str - ), - "--builder.bellatrix_fork_version={0}".format( - constants.BELLATRIX_FORK_VERSION - ), - "--builder.genesis_fork_version={0}".format( - constants.GENESIS_FORK_VERSION - ), - "--builder.genesis_validators_root={0}".format( - constants.GENESIS_VALIDATORS_ROOT_PLACEHOLDER - ), - '--miner.extradata="Illuminate Dmocratize Dstribute"', - "--builder.algotype=greedy", - "--metrics.builder", - ] - + parsed_arguments_dict["mev_params"]["mev_builder_extra_args"], - "el_extra_env_vars": { - "BUILDER_TX_SIGNING_KEY": "0x" - + genesis_constants.PRE_FUNDED_ACCOUNTS[0].private_key - }, - "validator_count": 0, - "prometheus_config": parsed_arguments_dict["mev_params"][ - "mev_builder_prometheus_config" - ], - } - ) - - parsed_arguments_dict["participants"].append(mev_participant) - - if mev_type == constants.MEV_RS_MEV_TYPE: - mev_participant = default_participant() - mev_participant["el_type"] = "reth-builder" - mev_participant.update( - { - "el_image": parsed_arguments_dict["mev_params"]["mev_builder_image"], - "cl_image": parsed_arguments_dict["mev_params"]["mev_builder_cl_image"], - "cl_extra_params": [ - "--always-prepare-payload", - "--prepare-payload-lookahead", - "12000", - "--disable-peer-scoring", - ], - "el_extra_params": parsed_arguments_dict["mev_params"][ - "mev_builder_extra_args" - ], - "validator_count": 0, - } - ) - parsed_arguments_dict["participants"].append(mev_participant) - return parsed_arguments_dict - - -def deep_copy_participant(participant): - part = {} - for k, v in participant.items(): - if type(v) == type([]): - part[k] = list(v) - else: - part[k] = v - return part - - -def get_public_ip(plan): - response = plan.run_sh( - run="curl -s https://ident.me", - ) - return response.output diff --git a/main.star b/main.star index 2b1980a..1f93afc 100644 --- a/main.star +++ b/main.star @@ -1,21 +1,30 @@ -input_parser = import_module("./input_parser.star") -ethereum_package = import_module("./dependencies/ethereum.star") -constants = import_module("./dependencies/constants.star") +input_parser = import_module("./src/package_io/input_parser.star") +ethereum_package = import_module("github.com/kurtosis-tech/ethereum-package/main.star@add-arbitrary-contract-def") def run(plan,args={}): """Deploy a Optimism L2 with a local L1. Args: - args(json): Configures other aspects of the environment. + args(yaml): Configures other aspects of the environment. Returns: A full deployment of Optimism L2 """ # Parse the values for the args - args_with_right_defaults = input_parser.input_parser(plan, args) + plan.print("Parsing the L1 input args") + + ethereum_args = args["ethereum_package"] # Deploy the L1 plan.print("Deploying a local L1") - ethereum_package.run(plan, args) + ethereum_package.run(plan, ethereum_args) + + # Parse the values for the args + plan.print("Parsing the L2 input args") + optimism_args = args["optimism_package"] + # Deploy the L2 + plan.print("Deploying a local L2") + args_with_right_defaults = input_parser.input_parser(plan, optimism_args) + plan.print(args_with_right_defaults) diff --git a/network_params.yaml b/network_params.yaml index ec24e35..862ce97 100644 --- a/network_params.yaml +++ b/network_params.yaml @@ -1,12 +1,14 @@ -participants: - - el_type: geth - el_image: ethereum/client-go:latest - cl_type: lighthouse - cl_image: sigp/lighthouse:latest -network_params: - network: kurtosis - network_id: "3151908" -additional_services: [] -snooper_enabled: false - +optimism_package: + participants: + - el_type: op-geth + el_image: us-docker.pkg.dev/oplabs-tools-artifacts/images/op-geth:latest + cl_type: op-node + cl_image: us-docker.pkg.dev/oplabs-tools-artifacts/images/op-node:develop +ethereum_package: + participants: + - count: 2 + network_params: + additional_preloaded_contracts: '{"0x123463a4B065722E99115D6c222f267d9cABb524": {"balance": "2ETH","code": "0x1234","storage": {}}}' + additional_services: + - dora diff --git a/src/cl/op-node/op_node_launcher.star b/src/cl/op-node/op_node_launcher.star new file mode 100644 index 0000000..e69de29 diff --git a/src/el/op-geth/op_geth_launcher.star b/src/el/op-geth/op_geth_launcher.star new file mode 100644 index 0000000..e69de29 diff --git a/src/package_io/input_parser.star b/src/package_io/input_parser.star new file mode 100644 index 0000000..72637e8 --- /dev/null +++ b/src/package_io/input_parser.star @@ -0,0 +1,95 @@ +ethereum_package_input_parser = import_module("github.com/kurtosis-tech/ethereum-package/src/package_io/input_parser.star") + +DEFAULT_EL_IMAGES = { + "op-geth": "us-docker.pkg.dev/oplabs-tools-artifacts/images/op-geth:latest", +} + +DEFAULT_CL_IMAGES = { + "op-node": "us-docker.pkg.dev/oplabs-tools-artifacts/images/op-node:develop", +} + +DEFAULT_BATCHER_IMAGES = { + "op-batcher": "us-docker.pkg.dev/oplabs-tools-artifacts/images/op-batcher:develop", +} + +DEFAULT_PROPOSER_IMAGES = { + "op-proposer": "us-docker.pkg.dev/oplabs-tools-artifacts/images/op-proposer:develop", +} + +ATTR_TO_BE_SKIPPED_AT_ROOT = ( + "network_params", + "participants", +) + +def input_parser(plan, input_args): + result = parse_network_params(plan, input_args) + + return struct( + participants=[ + struct( + el_type=participant["el_type"], + el_image=participant["el_image"], + cl_type=participant["cl_type"], + cl_image=participant["cl_image"], + count=participant["count"], + ) + for participant in result["participants"] + ], + network_params=struct( + network=result["network_params"]["network"], + ), + ) + +def parse_network_params(plan, input_args): + result = default_input_args(input_args) + + for attr in input_args: + value = input_args[attr] + # if its insterted we use the value inserted + if attr not in ATTR_TO_BE_SKIPPED_AT_ROOT and attr in input_args: + result[attr] = value + elif attr == "network_params": + for sub_attr in input_args["network_params"]: + sub_value = input_args["network_params"][sub_attr] + result["network_params"][sub_attr] = sub_value + elif attr == "participants": + participants = [] + for participant in input_args["participants"]: + new_participant = default_participant() + for sub_attr, sub_value in participant.items(): + # if the value is set in input we set it in participant + new_participant[sub_attr] = sub_value + for _ in range(0, new_participant["count"]): + participant_copy = ethereum_package_input_parser.deep_copy_participant(new_participant) + participants.append(participant_copy) + result["participants"] = participants + + for index, participant in enumerate(result["participants"]): + el_type = participant["el_type"] + cl_type = participant["cl_type"] + el_image = participant["el_image"] + cl_image = participant["cl_image"] + + return result + +def default_input_args(input_args): + network_params = default_network_params() + participants = [default_participant()] + return { + "participants": participants, + "network_params": network_params, + } + +def default_network_params(): + return { + "network": "kurtosis", + } + +def default_participant(): + return { + "el_type": "op-geth", + "el_image": "", + "cl_type": "op-node", + "cl_image": "", + "count": 1, + }