From e10cb2694ef1b114aa0b96ffa8d396b2bc2e10cf Mon Sep 17 00:00:00 2001 From: Barnabas Busa Date: Fri, 5 Jul 2024 11:05:14 +0200 Subject: [PATCH 1/6] feat: add sanity check --- src/package_io/input_parser.star | 3 + src/package_io/sanity_check.star | 218 +++++++++++++++++++++++++++++++ 2 files changed, 221 insertions(+) create mode 100644 src/package_io/sanity_check.star diff --git a/src/package_io/input_parser.star b/src/package_io/input_parser.star index 84411604c..7a761a90a 100644 --- a/src/package_io/input_parser.star +++ b/src/package_io/input_parser.star @@ -4,6 +4,8 @@ genesis_constants = import_module( "../prelaunch_data_generator/genesis_constants/genesis_constants.star" ) +sanity_check = import_module("./sanity_check.star") + DEFAULT_EL_IMAGES = { "geth": "ethereum/client-go:latest", "erigon": "ethpandaops/erigon:main", @@ -78,6 +80,7 @@ ATTR_TO_BE_SKIPPED_AT_ROOT = ( def input_parser(plan, input_args): + sanity_check.sanity_check(plan, input_args) result = parse_network_params(plan, input_args) # add default eth2 input params diff --git a/src/package_io/sanity_check.star b/src/package_io/sanity_check.star new file mode 100644 index 000000000..f4d048f38 --- /dev/null +++ b/src/package_io/sanity_check.star @@ -0,0 +1,218 @@ +PARTICIPANT_CATEGORIES = { + "participants": [ + "el_type", + "el_image", + "el_log_level", + "el_extra_env_vars", + "el_extra_labels", + "el_extra_params", + "el_tolerations", + "el_volume_size", + "el_min_cpu", + "el_max_cpu", + "el_min_mem", + "el_max_mem", + "cl_type", + "cl_image", + "cl_log_level", + "cl_extra_env_vars", + "cl_extra_labels", + "cl_extra_params", + "cl_tolerations", + "cl_volume_size", + "cl_min_cpu", + "cl_max_cpu", + "cl_min_mem", + "cl_max_mem", + "use_separate_vc", + "vc_type", + "vc_image", + "vc_count", + "vc_log_level", + "vc_extra_env_vars", + "vc_extra_labels", + "vc_extra_params", + "vc_tolerations", + "vc_min_cpu", + "vc_max_cpu", + "vc_min_mem", + "vc_max_mem", + "validator_count", + "node_selectors", + "tolerations", + "count", + "snooper_enabled", + "ethereum_metrics_exporter_enabled", + "xatu_sentry_enabled", + "prometheus_config", + "blobber_enabled", + "blobber_extra_params", + "builder_network_params", + "keymanager_enabled", + ], + "participants_matrix": [ + "el", + "cl", + "vc", + ], +} + +SUBCATEGORY_PARAMS = { + "network_params": [ + "network", + "network_id", + "deposit_contract_address", + "seconds_per_slot", + "num_validator_keys_per_node", + "preregistered_validator_keys_mnemonic", + "preregistered_validator_count", + "genesis_delay", + "max_per_epoch_activation_churn_limit", + "churn_limit_quotient", + "ejection_balance", + "eth1_follow_distance", + "min_validator_withdrawability_delay", + "shard_committee_period", + "deneb_fork_epoch", + "electra_fork_epoch", + "eip7594_fork_epoch", + "eip7594_fork_version", + "eof_activation_fork_epoch", + "network_sync_base_url", + "data_column_sidecar_subnet_count", + "samples_per_slot", + "custody_requirement", + "target_number_of_peers", + "preset", + "additional_preloaded_contracts", + "devnet_repo", + ], + "dora_params": [ + "image", + "env", + ], + "tx_spammer_params": [ + "tx_spammer_extra_args", + ], + "goomy_blob_params": [ + "goomy_blob_args", + ], + "assertoor_params": [ + "image", + "run_stability_check", + "run_block_proposal_check", + "run_transaction_test", + "run_blob_transaction_test", + "run_opcodes_transaction_test", + "run_lifecycle_test", + "tests", + ], + "mev_params": [ + "mev_relay_image", + "mev_builder_image", + "mev_builder_cl_image", + "mev_boost_image", + "mev_boost_args", + "mev_relay_api_extra_args", + "mev_relay_housekeeper_extra_args", + "mev_relay_website_extra_args", + "mev_builder_extra_args", + "mev_builder_prometheus_config", + "mev_flood_image", + "mev_flood_extra_args", + "mev_flood_seconds_per_bundle", + "custom_flood_params", + ], + "xatu_sentry_params": [ + "xatu_sentry_image", + "xatu_server_addr", + "xatu_server_tls", + "xatu_server_headers", + "beacon_subscriptions", + ], + "port_publisher_params": [ + "nat_exit_ip", + "el", + "cl", + "vc", + "additional_services", + ], +} + +ADDITIONAL_SERVICES_PARAMS = [ + "assertoor", + "broadcaster", + "tx_spammer", + "blob_spammer", + "custom_flood", + "goomy_blob", + "el_forkmon", + "blockscout", + "beacon_metrics_gazer", + "dora", + "full_beaconchain_explorer", + "prometheus_grafana", + "blobscan", + "dugtrio", + "blutgang", + "forky", + "apache", + "tracoor", +] + +ADDITIONAL_CATEGORY_PARAMS = { + "wait_for_finalization": "", + "global_log_level": "", + "snooper_enabled": "", + "ethereum_metrics_exporter_enabled": "", + "parallel_keystore_generation": "", + "disable_peer_scoring": "", + "grafana_additional_dashboards": "", + "persistent": "", + "mev_type": "", + "xatu_sentry_enabled": "", + "apache_port": "", + "global_tolerations": "", + "global_node_selectors": "", + "keymanager_enabled": "", + "checkpoint_sync_enabled": "", + "checkpoint_sync_url": "", +} + + +def deep_validate_params(plan, input_args, category, allowed_params): + if category in input_args: + for item in input_args[category]: + for param in item.keys(): + if param not in allowed_params: + fail("Invalid parameter {0} for {1}".format(param, category)) + + +def validate_params(plan, input_args, category, allowed_params): + if category in input_args: + for param in input_args[category].keys(): + if param not in allowed_params: + fail("Invalid parameter {0} for {1}".format(param, category)) + + +def sanity_check(plan, input_args): + for participant in PARTICIPANT_CATEGORIES.keys(): + deep_validate_params( + plan, input_args, participant, PARTICIPANT_CATEGORIES[participant] + ) + + for subcategories in SUBCATEGORY_PARAMS.keys(): + validate_params( + plan, input_args, subcategories, SUBCATEGORY_PARAMS[subcategories] + ) + + if "additional_services" in input_args: + for additional_services in input_args["additional_services"]: + if additional_services not in ADDITIONAL_SERVICES_PARAMS: + fail("Invalid additional service {0}".format(additional_services)) + + for additional_categories in ADDITIONAL_CATEGORY_PARAMS.keys(): + if additional_categories not in input_args: + fail("Invalid category {0}".format(additional_categories)) + + plan.print("Sanity check passed") From a80543bf572cf3d27c36bb1c8696a032e54c5ab1 Mon Sep 17 00:00:00 2001 From: Barnabas Busa Date: Fri, 5 Jul 2024 11:39:47 +0200 Subject: [PATCH 2/6] fix formatting root params --- .github/tests/mev.yaml | 1 - network_params.yaml | 3 ++- src/package_io/sanity_check.star | 17 +++++++++++++---- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/tests/mev.yaml b/.github/tests/mev.yaml index e28975985..74bde2e6f 100644 --- a/.github/tests/mev.yaml +++ b/.github/tests/mev.yaml @@ -11,7 +11,6 @@ additional_services: - dora - prometheus_grafana mev_params: - launch_custom_flood: true mev_relay_image: flashbots/mev-boost-relay:latest network_params: seconds_per_slot: 3 diff --git a/network_params.yaml b/network_params.yaml index cd51bb2dc..77b25f786 100644 --- a/network_params.yaml +++ b/network_params.yaml @@ -83,7 +83,6 @@ network_params: target_number_of_peers: 70 additional_preloaded_contracts: {} devnet_repo: ethpandaops - checkpoint_sync_enabled: false additional_services: [] dora_params: image: "" @@ -146,6 +145,8 @@ apache_port: 40000 global_tolerations: [] global_node_selectors: {} keymanager_enabled: false +checkpoint_sync_enabled: false +checkpoint_sync_url: "" port_publisher: nat_exit_ip: KURTOSIS_IP_ADDR_PLACEHOLDER el: diff --git a/src/package_io/sanity_check.star b/src/package_io/sanity_check.star index f4d048f38..d307ae745 100644 --- a/src/package_io/sanity_check.star +++ b/src/package_io/sanity_check.star @@ -130,7 +130,7 @@ SUBCATEGORY_PARAMS = { "xatu_server_headers", "beacon_subscriptions", ], - "port_publisher_params": [ + "port_publisher": [ "nat_exit_ip", "el", "cl", @@ -211,8 +211,17 @@ def sanity_check(plan, input_args): if additional_services not in ADDITIONAL_SERVICES_PARAMS: fail("Invalid additional service {0}".format(additional_services)) - for additional_categories in ADDITIONAL_CATEGORY_PARAMS.keys(): - if additional_categories not in input_args: - fail("Invalid category {0}".format(additional_categories)) + for param in input_args.keys(): + combined_keys = ( + PARTICIPANT_CATEGORIES.keys() + + SUBCATEGORY_PARAMS.keys() + + ADDITIONAL_CATEGORY_PARAMS.keys() + ) + combined_keys.append("additional_services") + + if param not in combined_keys: + fail("Invalid parameter {0}".format(param)) + else: + plan.print("Valid parameter {0}".format(param)) plan.print("Sanity check passed") From 8e650d999706a94c1add724254040da11fbd43aa Mon Sep 17 00:00:00 2001 From: Barnabas Busa Date: Fri, 5 Jul 2024 11:40:41 +0200 Subject: [PATCH 3/6] fix names --- src/package_io/sanity_check.star | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/package_io/sanity_check.star b/src/package_io/sanity_check.star index d307ae745..ff73571f6 100644 --- a/src/package_io/sanity_check.star +++ b/src/package_io/sanity_check.star @@ -212,16 +212,14 @@ def sanity_check(plan, input_args): fail("Invalid additional service {0}".format(additional_services)) for param in input_args.keys(): - combined_keys = ( + combined_root_params = ( PARTICIPANT_CATEGORIES.keys() + SUBCATEGORY_PARAMS.keys() + ADDITIONAL_CATEGORY_PARAMS.keys() ) - combined_keys.append("additional_services") + combined_root_params.append("additional_services") - if param not in combined_keys: + if param not in combined_root_params: fail("Invalid parameter {0}".format(param)) - else: - plan.print("Valid parameter {0}".format(param)) plan.print("Sanity check passed") From 73d8ffeb80fa7035ba24f0557860f40c29458f52 Mon Sep 17 00:00:00 2001 From: Barnabas Busa Date: Fri, 5 Jul 2024 11:44:26 +0200 Subject: [PATCH 4/6] fix readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 28b6ecfd6..0a27725aa 100644 --- a/README.md +++ b/README.md @@ -286,7 +286,7 @@ participants: # Whether to use a separate validator client attached to the CL client. # Defaults to false for clients that can run both in one process (Teku, Nimbus) - use_separate_vc: false + use_separate_vc: true # VC (Validator Client) Specific flags # The type of validator client that should be used From 3146d31ffcc286ce51b3c22a68dbfd95c39b0d66 Mon Sep 17 00:00:00 2001 From: Barnabas Busa Date: Fri, 5 Jul 2024 13:54:40 +0200 Subject: [PATCH 5/6] fix eof fork epoch name --- README.md | 2 +- src/package_io/sanity_check.star | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0a27725aa..2639f8985 100644 --- a/README.md +++ b/README.md @@ -501,7 +501,7 @@ network_params: # EOF activation fork epoch (EL only fork) # Defaults to null - eof_activation_fork_epoch: null + eof_activation_epoch: null # Network sync base url for syncing public networks from a custom snapshot (mostly useful for shadowforks) # Defaults to "https://ethpandaops-ethereum-node-snapshots.ams3.cdn.digitaloceanspaces.com/ diff --git a/src/package_io/sanity_check.star b/src/package_io/sanity_check.star index ff73571f6..40086783b 100644 --- a/src/package_io/sanity_check.star +++ b/src/package_io/sanity_check.star @@ -77,7 +77,7 @@ SUBCATEGORY_PARAMS = { "electra_fork_epoch", "eip7594_fork_epoch", "eip7594_fork_version", - "eof_activation_fork_epoch", + "eof_activation_epoch", "network_sync_base_url", "data_column_sidecar_subnet_count", "samples_per_slot", From 81df67c1a5aa0ada376c6f1a3c57c80e70e834e0 Mon Sep 17 00:00:00 2001 From: Barnabas Busa Date: Fri, 5 Jul 2024 14:25:50 +0200 Subject: [PATCH 6/6] fix participants matrix --- src/package_io/sanity_check.star | 121 ++++++++++++++++++++++++++----- 1 file changed, 103 insertions(+), 18 deletions(-) diff --git a/src/package_io/sanity_check.star b/src/package_io/sanity_check.star index 40086783b..bda5992e2 100644 --- a/src/package_io/sanity_check.star +++ b/src/package_io/sanity_check.star @@ -50,11 +50,54 @@ PARTICIPANT_CATEGORIES = { "builder_network_params", "keymanager_enabled", ], - "participants_matrix": [ - "el", - "cl", - "vc", - ], +} + +PARTICIPANT_MATRIX_PARAMS = { + "participants_matrix": { + "el": [ + "el_type", + "el_image", + "el_log_level", + "el_extra_env_vars", + "el_extra_labels", + "el_extra_params", + "el_tolerations", + "el_volume_size", + "el_min_cpu", + "el_max_cpu", + "el_min_mem", + "el_max_mem", + ], + "cl": [ + "cl_type", + "cl_image", + "cl_log_level", + "cl_extra_env_vars", + "cl_extra_labels", + "cl_extra_params", + "cl_tolerations", + "cl_volume_size", + "cl_min_cpu", + "cl_max_cpu", + "cl_min_mem", + "cl_max_mem", + "use_separate_vc", + ], + "vc": [ + "vc_type", + "vc_image", + "vc_count", + "vc_log_level", + "vc_extra_env_vars", + "vc_extra_labels", + "vc_extra_params", + "vc_tolerations", + "vc_min_cpu", + "vc_max_cpu", + "vc_min_mem", + "vc_max_mem", + ], + }, } SUBCATEGORY_PARAMS = { @@ -185,41 +228,83 @@ def deep_validate_params(plan, input_args, category, allowed_params): for item in input_args[category]: for param in item.keys(): if param not in allowed_params: - fail("Invalid parameter {0} for {1}".format(param, category)) + fail( + "Invalid parameter {0} for {1}. Allowed fields: {2}".format( + param, category, allowed_params + ) + ) def validate_params(plan, input_args, category, allowed_params): if category in input_args: for param in input_args[category].keys(): if param not in allowed_params: - fail("Invalid parameter {0} for {1}".format(param, category)) + fail( + "Invalid parameter {0} for {1}. Allowed fields: {2}".format( + param, category, allowed_params + ) + ) def sanity_check(plan, input_args): - for participant in PARTICIPANT_CATEGORIES.keys(): - deep_validate_params( - plan, input_args, participant, PARTICIPANT_CATEGORIES[participant] - ) - - for subcategories in SUBCATEGORY_PARAMS.keys(): - validate_params( - plan, input_args, subcategories, SUBCATEGORY_PARAMS[subcategories] - ) + # Checks participants + deep_validate_params( + plan, input_args, "participants", PARTICIPANT_CATEGORIES["participants"] + ) + # Checks participants_matrix + if "participants_matrix" in input_args: + for sub_matrix_participant in input_args["participants_matrix"]: + if ( + sub_matrix_participant + not in PARTICIPANT_MATRIX_PARAMS["participants_matrix"] + ): + fail( + "Invalid parameter {0} for participants_matrix, allowed fields: {1}".format( + sub_matrix_participant, + PARTICIPANT_MATRIX_PARAMS["participants_matrix"].keys(), + ) + ) + else: + deep_validate_params( + plan, + input_args["participants_matrix"], + sub_matrix_participant, + PARTICIPANT_MATRIX_PARAMS["participants_matrix"][ + sub_matrix_participant + ], + ) + # Checks additional services if "additional_services" in input_args: for additional_services in input_args["additional_services"]: if additional_services not in ADDITIONAL_SERVICES_PARAMS: - fail("Invalid additional service {0}".format(additional_services)) + fail( + "Invalid additional_services {0}, allowed fields: {1}".format( + additional_services, ADDITIONAL_SERVICES_PARAMS + ) + ) + # Checks subcategories + for subcategories in SUBCATEGORY_PARAMS.keys(): + validate_params( + plan, input_args, subcategories, SUBCATEGORY_PARAMS[subcategories] + ) + # Checks everything else for param in input_args.keys(): combined_root_params = ( PARTICIPANT_CATEGORIES.keys() + + PARTICIPANT_MATRIX_PARAMS.keys() + SUBCATEGORY_PARAMS.keys() + ADDITIONAL_CATEGORY_PARAMS.keys() ) combined_root_params.append("additional_services") if param not in combined_root_params: - fail("Invalid parameter {0}".format(param)) + fail( + "Invalid parameter {0}, allowed fields {1}".format( + param, combined_root_params + ) + ) + # If everything passes, print a message plan.print("Sanity check passed")