diff --git a/changelog/kasey_spectest-gloas-packages.md b/changelog/kasey_spectest-gloas-packages.md new file mode 100644 index 000000000000..4a0d2fadf65b --- /dev/null +++ b/changelog/kasey_spectest-gloas-packages.md @@ -0,0 +1,5 @@ +### Changed + +- Gloas spec tests moved into their own `mainnet/gloas` and `minimal/gloas` + packages, and `download_spectests.bzl` can now take spec test data from a + local directory or tarball instead of downloading a release. diff --git a/hack/update-go-spectest.sh b/hack/update-go-spectest.sh new file mode 100755 index 000000000000..991c628da8e0 --- /dev/null +++ b/hack/update-go-spectest.sh @@ -0,0 +1,31 @@ +#!/bin/bash +. "$(dirname "$0")"/common.sh + +# Script to copy generated spectest packages from the bazel build folder back to +# the source tree (the "generate-and-commit" workflow, mirroring +# update-go-ssz.sh). Each ssz_gen_spectest target emits a tree-artifact +# directory containing a methodical_test.go file and a testdata/ fixture tree; +# this script builds those targets and copies each generated directory over the +# matching location in the source tree. + +bazel query 'kind(ssz_gen_spectest, //testing/...)' | xargs bazel build $@ + +bin="$(bazel info bazel-bin)" +searchstring="/bin/" + +# Locate each generated package by its marker file and mirror the whole +# directory (methodical_test.go + testdata/) back to source. The destination is +# cleared first so fixtures no longer produced (e.g. after a config or release +# change) don't linger -- the tree-artifact has no stable file list. BUILD.bazel +# is (re)generated by gazelle after this script runs, so removing it here is +# fine. Uses cp rather than rsync to avoid a new system dependency. +while IFS= read -d $'\0' -r marker; do + src_dir="$(dirname "$marker")" + destination="${src_dir#*$searchstring}" + color "34" "$destination" + rm -rf "$destination" + mkdir -p "$destination" + cp -R "$src_dir"/. "$destination"/ + # bazel outputs are read-only; make the copies writable in the source tree. + chmod -R u+w "$destination" +done < <($findutil -L "$bin"/ -type f -name "methodical_test.go" -print0) diff --git a/testing/spectest/BUILD.bazel b/testing/spectest/BUILD.bazel new file mode 100644 index 000000000000..ef7d116c20f2 --- /dev/null +++ b/testing/spectest/BUILD.bazel @@ -0,0 +1,14 @@ +load("//tools:methodical.bzl", "ssz_gen_spectest") + +# Generates the methodical-ssz spec test package into testing/spectest/methodical +# (out_dir lands the tree-artifact directory at this package's path). It is run, +# and its output copied back into the source tree, by hack/update-go-spectest.sh +# -- the generate-and-commit workflow that mirrors hack/update-go-ssz.sh. The +# fixtures come from the un-extracted release tarball exposed by the +# consensus_spec_tests repo rule (see tools/download_spectests.bzl). +ssz_gen_spectest( + name = "methodical_spectest", + config_file = "methodical-spectest.yaml", + out_dir = "methodical", + release_tarball = "@consensus_spec_tests//:mainnet.tar.gz", +) diff --git a/testing/spectest/README.md b/testing/spectest/README.md index 8fc4e71f9652..db4a16e04845 100644 --- a/testing/spectest/README.md +++ b/testing/spectest/README.md @@ -32,3 +32,50 @@ bazel test //... --test_tag_filters=spectest --repo_env=CONSENSUS_SPEC_TESTS_VER ``` bazel test //... --test_tag_filters=spectest --repo_env=CONSENSUS_SPEC_TESTS_VERSION=nightly-21422848633 ``` + +## Using local spectest data + +To run spectests against data you already have on disk (e.g. for offline work, +or to test an unreleased spec build) instead of downloading it, use either of the +following `--repo_env` flags. A source can be a tarball **or an already-unpacked +directory tree**. Both flags take precedence over `CONSENSUS_SPEC_TESTS_VERSION` +and require no network access. All paths must be **absolute**. + +The "flavors" are the three upstream consensus-specs presets: `mainnet` and `minimal` +(preset-specific configs) and `general` (preset-independent tests: SSZ generic, BLS, +KZG). You usually only need one at a time. + +**A directory.** Point `CONSENSUS_SPEC_TESTS_DIR` at a directory and, for each +flavor, the rule uses the first of these it finds, skipping flavors that are absent: + +- `/.tar.gz` — a release-style tarball +- `/tests//` — an unpacked tree keeping the upstream `tests/` prefix +- `//` — an unpacked tree with the prefix stripped + +So both a directory of tarballs and a directory of already-extracted tests work: + +``` +bazel test //... --test_tag_filters=spectest --repo_env=CONSENSUS_SPEC_TESTS_DIR=/abs/path/to/specs +``` + +**A single flavor with any name.** Point a specific flavor at an arbitrarily-named +tarball or directly at an unpacked flavor tree with `CONSENSUS_SPEC_TESTS_` +(`GENERAL`, `MAINNET`, or `MINIMAL`): + +``` +bazel test //testing/spectest/mainnet:go_default_test --test_tag_filters=spectest \ + --repo_env=CONSENSUS_SPEC_TESTS_MAINNET=/abs/path/to/my-mainnet.tar.gz +``` + +The two mechanisms can be combined; a per-flavor override wins over the directory +entry for that flavor. When you supply only some flavors, scope the test target to +the matching preset (e.g. `//testing/spectest/mainnet/...`) rather than `//...`, since +the other flavors' filegroups will be empty. + +Notes: +- Unpacked directories are symlinked in, so no large copy is made. The raw + `@consensus_spec_tests//:.tar.gz` target (used by methodical-ssz + `gen-spectest`) only exists when you supply an actual tarball, not an unpacked dir. +- Bazel keys the repository rule on the value of the env var, not the contents of the + files. If you change data at the same path, run `bazel sync --configure` (or change + the path) to force a re-fetch. diff --git a/testing/spectest/mainnet/BUILD.bazel b/testing/spectest/mainnet/BUILD.bazel index fe06eafd8af2..e3fe5ff85b2e 100644 --- a/testing/spectest/mainnet/BUILD.bazel +++ b/testing/spectest/mainnet/BUILD.bazel @@ -199,48 +199,6 @@ go_test( "fulu__sanity__blocks_test.go", "fulu__sanity__slots_test.go", "fulu__ssz_static__ssz_static_test.go", - "gloas__epoch_processing__effective_balance_updates_test.go", - "gloas__epoch_processing__eth1_data_reset_test.go", - "gloas__epoch_processing__historical_summaries_update_test.go", - "gloas__epoch_processing__inactivity_updates_test.go", - "gloas__epoch_processing__justification_and_finalization_test.go", - "gloas__epoch_processing__participation_flag_updates_test.go", - "gloas__epoch_processing__pending_consolidations_test.go", - "gloas__epoch_processing__pending_deposits_churn_test.go", - "gloas__epoch_processing__pending_deposits_test.go", - "gloas__epoch_processing__process_builder_pending_payments_test.go", - "gloas__epoch_processing__proposer_lookahead_test.go", - "gloas__epoch_processing__randao_mixes_reset_test.go", - "gloas__epoch_processing__registry_updates_test.go", - "gloas__epoch_processing__rewards_and_penalties_test.go", - "gloas__epoch_processing__slashings_reset_test.go", - "gloas__epoch_processing__slashings_test.go", - "gloas__finality__finality_test.go", - "gloas__fork__upgrade_to_gloas_test.go", - "gloas__fork_transition__transition_test.go", - "gloas__forkchoice__forkchoice_test.go", - "gloas__operations__attestation_test.go", - "gloas__operations__attester_slashing_test.go", - "gloas__operations__block_header_test.go", - "gloas__operations__bls_to_execution_change_test.go", - "gloas__operations__builder_deposit_request_test.go", - "gloas__operations__builder_exit_request_test.go", - "gloas__operations__consolidation_test.go", - "gloas__operations__deposit_requests_test.go", - "gloas__operations__execution_payload_header_test.go", - "gloas__operations__parent_execution_payload_test.go", - "gloas__operations__payload_attestation_test.go", - "gloas__operations__proposer_slashing_test.go", - "gloas__operations__sync_committee_test.go", - "gloas__operations__voluntary_exit_churn_test.go", - "gloas__operations__voluntary_exit_test.go", - "gloas__operations__withdrawal_request_test.go", - "gloas__operations__withdrawals_test.go", - "gloas__random_test.go", - "gloas__rewards_test.go", - "gloas__sanity__blocks_test.go", - "gloas__sanity__slots_test.go", - "gloas__ssz_static__ssz_static_test.go", "phase0__epoch_processing__effective_balance_updates_test.go", "phase0__epoch_processing__epoch_processing_test.go", "phase0__epoch_processing__eth1_data_reset_test.go", @@ -319,13 +277,6 @@ go_test( "//testing/spectest/shared/fulu/rewards:go_default_library", "//testing/spectest/shared/fulu/sanity:go_default_library", "//testing/spectest/shared/fulu/ssz_static:go_default_library", - "//testing/spectest/shared/gloas/epoch_processing:go_default_library", - "//testing/spectest/shared/gloas/finality:go_default_library", - "//testing/spectest/shared/gloas/fork:go_default_library", - "//testing/spectest/shared/gloas/operations:go_default_library", - "//testing/spectest/shared/gloas/rewards:go_default_library", - "//testing/spectest/shared/gloas/sanity:go_default_library", - "//testing/spectest/shared/gloas/ssz_static:go_default_library", "//testing/spectest/shared/phase0/epoch_processing:go_default_library", "//testing/spectest/shared/phase0/finality:go_default_library", "//testing/spectest/shared/phase0/operations:go_default_library", diff --git a/testing/spectest/mainnet/gloas/BUILD.bazel b/testing/spectest/mainnet/gloas/BUILD.bazel new file mode 100644 index 000000000000..6a11712c8ecf --- /dev/null +++ b/testing/spectest/mainnet/gloas/BUILD.bazel @@ -0,0 +1,63 @@ +load("@prysm//tools/go:def.bzl", "go_test") + +go_test( + name = "go_default_test", + size = "large", + srcs = [ + "gloas__epoch_processing__effective_balance_updates_test.go", + "gloas__epoch_processing__eth1_data_reset_test.go", + "gloas__epoch_processing__historical_summaries_update_test.go", + "gloas__epoch_processing__inactivity_updates_test.go", + "gloas__epoch_processing__justification_and_finalization_test.go", + "gloas__epoch_processing__participation_flag_updates_test.go", + "gloas__epoch_processing__pending_consolidations_test.go", + "gloas__epoch_processing__pending_deposits_churn_test.go", + "gloas__epoch_processing__pending_deposits_test.go", + "gloas__epoch_processing__process_builder_pending_payments_test.go", + "gloas__epoch_processing__proposer_lookahead_test.go", + "gloas__epoch_processing__randao_mixes_reset_test.go", + "gloas__epoch_processing__registry_updates_test.go", + "gloas__epoch_processing__rewards_and_penalties_test.go", + "gloas__epoch_processing__slashings_reset_test.go", + "gloas__epoch_processing__slashings_test.go", + "gloas__finality__finality_test.go", + "gloas__fork__upgrade_to_gloas_test.go", + "gloas__fork_transition__transition_test.go", + "gloas__forkchoice__forkchoice_test.go", + "gloas__operations__attestation_test.go", + "gloas__operations__attester_slashing_test.go", + "gloas__operations__block_header_test.go", + "gloas__operations__bls_to_execution_change_test.go", + "gloas__operations__builder_deposit_request_test.go", + "gloas__operations__builder_exit_request_test.go", + "gloas__operations__consolidation_test.go", + "gloas__operations__deposit_requests_test.go", + "gloas__operations__execution_payload_header_test.go", + "gloas__operations__parent_execution_payload_test.go", + "gloas__operations__payload_attestation_test.go", + "gloas__operations__proposer_slashing_test.go", + "gloas__operations__sync_committee_test.go", + "gloas__operations__voluntary_exit_churn_test.go", + "gloas__operations__voluntary_exit_test.go", + "gloas__operations__withdrawal_request_test.go", + "gloas__operations__withdrawals_test.go", + "gloas__random_test.go", + "gloas__rewards_test.go", + "gloas__sanity__blocks_test.go", + "gloas__sanity__slots_test.go", + "gloas__ssz_static__ssz_static_test.go", + ], + data = ["@consensus_spec_tests//:test_data"], + tags = ["spectest"], + deps = [ + "//runtime/version:go_default_library", + "//testing/spectest/shared/common/forkchoice:go_default_library", + "//testing/spectest/shared/gloas/epoch_processing:go_default_library", + "//testing/spectest/shared/gloas/finality:go_default_library", + "//testing/spectest/shared/gloas/fork:go_default_library", + "//testing/spectest/shared/gloas/operations:go_default_library", + "//testing/spectest/shared/gloas/rewards:go_default_library", + "//testing/spectest/shared/gloas/sanity:go_default_library", + "//testing/spectest/shared/gloas/ssz_static:go_default_library", + ], +) diff --git a/testing/spectest/mainnet/gloas__epoch_processing__effective_balance_updates_test.go b/testing/spectest/mainnet/gloas/gloas__epoch_processing__effective_balance_updates_test.go similarity index 94% rename from testing/spectest/mainnet/gloas__epoch_processing__effective_balance_updates_test.go rename to testing/spectest/mainnet/gloas/gloas__epoch_processing__effective_balance_updates_test.go index 3cbd8f01544f..d304cf8e1f11 100644 --- a/testing/spectest/mainnet/gloas__epoch_processing__effective_balance_updates_test.go +++ b/testing/spectest/mainnet/gloas/gloas__epoch_processing__effective_balance_updates_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__epoch_processing__eth1_data_reset_test.go b/testing/spectest/mainnet/gloas/gloas__epoch_processing__eth1_data_reset_test.go similarity index 93% rename from testing/spectest/mainnet/gloas__epoch_processing__eth1_data_reset_test.go rename to testing/spectest/mainnet/gloas/gloas__epoch_processing__eth1_data_reset_test.go index 334f35f3659d..7a4098b1c5d7 100644 --- a/testing/spectest/mainnet/gloas__epoch_processing__eth1_data_reset_test.go +++ b/testing/spectest/mainnet/gloas/gloas__epoch_processing__eth1_data_reset_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__epoch_processing__historical_summaries_update_test.go b/testing/spectest/mainnet/gloas/gloas__epoch_processing__historical_summaries_update_test.go similarity index 94% rename from testing/spectest/mainnet/gloas__epoch_processing__historical_summaries_update_test.go rename to testing/spectest/mainnet/gloas/gloas__epoch_processing__historical_summaries_update_test.go index 35ccf771f68d..0aa9d13575b7 100644 --- a/testing/spectest/mainnet/gloas__epoch_processing__historical_summaries_update_test.go +++ b/testing/spectest/mainnet/gloas/gloas__epoch_processing__historical_summaries_update_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__epoch_processing__inactivity_updates_test.go b/testing/spectest/mainnet/gloas/gloas__epoch_processing__inactivity_updates_test.go similarity index 93% rename from testing/spectest/mainnet/gloas__epoch_processing__inactivity_updates_test.go rename to testing/spectest/mainnet/gloas/gloas__epoch_processing__inactivity_updates_test.go index 3b362764ffe9..7ac73887a243 100644 --- a/testing/spectest/mainnet/gloas__epoch_processing__inactivity_updates_test.go +++ b/testing/spectest/mainnet/gloas/gloas__epoch_processing__inactivity_updates_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__epoch_processing__justification_and_finalization_test.go b/testing/spectest/mainnet/gloas/gloas__epoch_processing__justification_and_finalization_test.go similarity index 94% rename from testing/spectest/mainnet/gloas__epoch_processing__justification_and_finalization_test.go rename to testing/spectest/mainnet/gloas/gloas__epoch_processing__justification_and_finalization_test.go index 9060157dbfc4..8110009c6689 100644 --- a/testing/spectest/mainnet/gloas__epoch_processing__justification_and_finalization_test.go +++ b/testing/spectest/mainnet/gloas/gloas__epoch_processing__justification_and_finalization_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__epoch_processing__participation_flag_updates_test.go b/testing/spectest/mainnet/gloas/gloas__epoch_processing__participation_flag_updates_test.go similarity index 94% rename from testing/spectest/mainnet/gloas__epoch_processing__participation_flag_updates_test.go rename to testing/spectest/mainnet/gloas/gloas__epoch_processing__participation_flag_updates_test.go index 7721861428f3..860f259532ee 100644 --- a/testing/spectest/mainnet/gloas__epoch_processing__participation_flag_updates_test.go +++ b/testing/spectest/mainnet/gloas/gloas__epoch_processing__participation_flag_updates_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__epoch_processing__pending_consolidations_test.go b/testing/spectest/mainnet/gloas/gloas__epoch_processing__pending_consolidations_test.go similarity index 93% rename from testing/spectest/mainnet/gloas__epoch_processing__pending_consolidations_test.go rename to testing/spectest/mainnet/gloas/gloas__epoch_processing__pending_consolidations_test.go index a1ce00035681..8c74b30544a7 100644 --- a/testing/spectest/mainnet/gloas__epoch_processing__pending_consolidations_test.go +++ b/testing/spectest/mainnet/gloas/gloas__epoch_processing__pending_consolidations_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__epoch_processing__pending_deposits_churn_test.go b/testing/spectest/mainnet/gloas/gloas__epoch_processing__pending_deposits_churn_test.go similarity index 93% rename from testing/spectest/mainnet/gloas__epoch_processing__pending_deposits_churn_test.go rename to testing/spectest/mainnet/gloas/gloas__epoch_processing__pending_deposits_churn_test.go index 3999ca1620f5..268a964c5b2a 100644 --- a/testing/spectest/mainnet/gloas__epoch_processing__pending_deposits_churn_test.go +++ b/testing/spectest/mainnet/gloas/gloas__epoch_processing__pending_deposits_churn_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__epoch_processing__pending_deposits_test.go b/testing/spectest/mainnet/gloas/gloas__epoch_processing__pending_deposits_test.go similarity index 93% rename from testing/spectest/mainnet/gloas__epoch_processing__pending_deposits_test.go rename to testing/spectest/mainnet/gloas/gloas__epoch_processing__pending_deposits_test.go index 571eb5f67fd5..bc2504feeb80 100644 --- a/testing/spectest/mainnet/gloas__epoch_processing__pending_deposits_test.go +++ b/testing/spectest/mainnet/gloas/gloas__epoch_processing__pending_deposits_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__epoch_processing__process_builder_pending_payments_test.go b/testing/spectest/mainnet/gloas/gloas__epoch_processing__process_builder_pending_payments_test.go similarity index 94% rename from testing/spectest/mainnet/gloas__epoch_processing__process_builder_pending_payments_test.go rename to testing/spectest/mainnet/gloas/gloas__epoch_processing__process_builder_pending_payments_test.go index 7679853ec96b..37b15779fda5 100644 --- a/testing/spectest/mainnet/gloas__epoch_processing__process_builder_pending_payments_test.go +++ b/testing/spectest/mainnet/gloas/gloas__epoch_processing__process_builder_pending_payments_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__epoch_processing__proposer_lookahead_test.go b/testing/spectest/mainnet/gloas/gloas__epoch_processing__proposer_lookahead_test.go similarity index 93% rename from testing/spectest/mainnet/gloas__epoch_processing__proposer_lookahead_test.go rename to testing/spectest/mainnet/gloas/gloas__epoch_processing__proposer_lookahead_test.go index 3ec5d3a530ac..6ce306f2ed44 100644 --- a/testing/spectest/mainnet/gloas__epoch_processing__proposer_lookahead_test.go +++ b/testing/spectest/mainnet/gloas/gloas__epoch_processing__proposer_lookahead_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__epoch_processing__randao_mixes_reset_test.go b/testing/spectest/mainnet/gloas/gloas__epoch_processing__randao_mixes_reset_test.go similarity index 93% rename from testing/spectest/mainnet/gloas__epoch_processing__randao_mixes_reset_test.go rename to testing/spectest/mainnet/gloas/gloas__epoch_processing__randao_mixes_reset_test.go index 39eed995e2fa..cf80f52b24c7 100644 --- a/testing/spectest/mainnet/gloas__epoch_processing__randao_mixes_reset_test.go +++ b/testing/spectest/mainnet/gloas/gloas__epoch_processing__randao_mixes_reset_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__epoch_processing__registry_updates_test.go b/testing/spectest/mainnet/gloas/gloas__epoch_processing__registry_updates_test.go similarity index 93% rename from testing/spectest/mainnet/gloas__epoch_processing__registry_updates_test.go rename to testing/spectest/mainnet/gloas/gloas__epoch_processing__registry_updates_test.go index 09b5deffb1d7..6814405bf72b 100644 --- a/testing/spectest/mainnet/gloas__epoch_processing__registry_updates_test.go +++ b/testing/spectest/mainnet/gloas/gloas__epoch_processing__registry_updates_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__epoch_processing__rewards_and_penalties_test.go b/testing/spectest/mainnet/gloas/gloas__epoch_processing__rewards_and_penalties_test.go similarity index 93% rename from testing/spectest/mainnet/gloas__epoch_processing__rewards_and_penalties_test.go rename to testing/spectest/mainnet/gloas/gloas__epoch_processing__rewards_and_penalties_test.go index b9ffd0652515..d1d23d1d5381 100644 --- a/testing/spectest/mainnet/gloas__epoch_processing__rewards_and_penalties_test.go +++ b/testing/spectest/mainnet/gloas/gloas__epoch_processing__rewards_and_penalties_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__epoch_processing__slashings_reset_test.go b/testing/spectest/mainnet/gloas/gloas__epoch_processing__slashings_reset_test.go similarity index 93% rename from testing/spectest/mainnet/gloas__epoch_processing__slashings_reset_test.go rename to testing/spectest/mainnet/gloas/gloas__epoch_processing__slashings_reset_test.go index 14af06af8881..d12643dfd0ce 100644 --- a/testing/spectest/mainnet/gloas__epoch_processing__slashings_reset_test.go +++ b/testing/spectest/mainnet/gloas/gloas__epoch_processing__slashings_reset_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__epoch_processing__slashings_test.go b/testing/spectest/mainnet/gloas/gloas__epoch_processing__slashings_test.go similarity index 93% rename from testing/spectest/mainnet/gloas__epoch_processing__slashings_test.go rename to testing/spectest/mainnet/gloas/gloas__epoch_processing__slashings_test.go index 343498419b86..79446e68a4e4 100644 --- a/testing/spectest/mainnet/gloas__epoch_processing__slashings_test.go +++ b/testing/spectest/mainnet/gloas/gloas__epoch_processing__slashings_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__finality__finality_test.go b/testing/spectest/mainnet/gloas/gloas__finality__finality_test.go similarity index 92% rename from testing/spectest/mainnet/gloas__finality__finality_test.go rename to testing/spectest/mainnet/gloas/gloas__finality__finality_test.go index bc7d1987674e..21aa8d1232b2 100644 --- a/testing/spectest/mainnet/gloas__finality__finality_test.go +++ b/testing/spectest/mainnet/gloas/gloas__finality__finality_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__fork__upgrade_to_gloas_test.go b/testing/spectest/mainnet/gloas/gloas__fork__upgrade_to_gloas_test.go similarity index 92% rename from testing/spectest/mainnet/gloas__fork__upgrade_to_gloas_test.go rename to testing/spectest/mainnet/gloas/gloas__fork__upgrade_to_gloas_test.go index 6f8e969d2721..06d12c792c45 100644 --- a/testing/spectest/mainnet/gloas__fork__upgrade_to_gloas_test.go +++ b/testing/spectest/mainnet/gloas/gloas__fork__upgrade_to_gloas_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__fork_transition__transition_test.go b/testing/spectest/mainnet/gloas/gloas__fork_transition__transition_test.go similarity index 92% rename from testing/spectest/mainnet/gloas__fork_transition__transition_test.go rename to testing/spectest/mainnet/gloas/gloas__fork_transition__transition_test.go index 757f541bd23c..1346a035a4df 100644 --- a/testing/spectest/mainnet/gloas__fork_transition__transition_test.go +++ b/testing/spectest/mainnet/gloas/gloas__fork_transition__transition_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__forkchoice__forkchoice_test.go b/testing/spectest/mainnet/gloas/gloas__forkchoice__forkchoice_test.go similarity index 94% rename from testing/spectest/mainnet/gloas__forkchoice__forkchoice_test.go rename to testing/spectest/mainnet/gloas/gloas__forkchoice__forkchoice_test.go index 1ece229394b3..56e135570952 100644 --- a/testing/spectest/mainnet/gloas__forkchoice__forkchoice_test.go +++ b/testing/spectest/mainnet/gloas/gloas__forkchoice__forkchoice_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__operations__attestation_test.go b/testing/spectest/mainnet/gloas/gloas__operations__attestation_test.go similarity index 92% rename from testing/spectest/mainnet/gloas__operations__attestation_test.go rename to testing/spectest/mainnet/gloas/gloas__operations__attestation_test.go index 418e7d0dc725..1f317df17f27 100644 --- a/testing/spectest/mainnet/gloas__operations__attestation_test.go +++ b/testing/spectest/mainnet/gloas/gloas__operations__attestation_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__operations__attester_slashing_test.go b/testing/spectest/mainnet/gloas/gloas__operations__attester_slashing_test.go similarity index 93% rename from testing/spectest/mainnet/gloas__operations__attester_slashing_test.go rename to testing/spectest/mainnet/gloas/gloas__operations__attester_slashing_test.go index ee284cea3df8..4dd6a3144de3 100644 --- a/testing/spectest/mainnet/gloas__operations__attester_slashing_test.go +++ b/testing/spectest/mainnet/gloas/gloas__operations__attester_slashing_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__operations__block_header_test.go b/testing/spectest/mainnet/gloas/gloas__operations__block_header_test.go similarity index 92% rename from testing/spectest/mainnet/gloas__operations__block_header_test.go rename to testing/spectest/mainnet/gloas/gloas__operations__block_header_test.go index 8ff487e8c2c7..0c817ce90266 100644 --- a/testing/spectest/mainnet/gloas__operations__block_header_test.go +++ b/testing/spectest/mainnet/gloas/gloas__operations__block_header_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__operations__bls_to_execution_change_test.go b/testing/spectest/mainnet/gloas/gloas__operations__bls_to_execution_change_test.go similarity index 93% rename from testing/spectest/mainnet/gloas__operations__bls_to_execution_change_test.go rename to testing/spectest/mainnet/gloas/gloas__operations__bls_to_execution_change_test.go index ffdb5e013f79..f7e664682775 100644 --- a/testing/spectest/mainnet/gloas__operations__bls_to_execution_change_test.go +++ b/testing/spectest/mainnet/gloas/gloas__operations__bls_to_execution_change_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__operations__builder_deposit_request_test.go b/testing/spectest/mainnet/gloas/gloas__operations__builder_deposit_request_test.go similarity index 93% rename from testing/spectest/mainnet/gloas__operations__builder_deposit_request_test.go rename to testing/spectest/mainnet/gloas/gloas__operations__builder_deposit_request_test.go index 25df5acfa583..74bc267473bc 100644 --- a/testing/spectest/mainnet/gloas__operations__builder_deposit_request_test.go +++ b/testing/spectest/mainnet/gloas/gloas__operations__builder_deposit_request_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__operations__builder_exit_request_test.go b/testing/spectest/mainnet/gloas/gloas__operations__builder_exit_request_test.go similarity index 93% rename from testing/spectest/mainnet/gloas__operations__builder_exit_request_test.go rename to testing/spectest/mainnet/gloas/gloas__operations__builder_exit_request_test.go index 89e4304116cf..8625c0719fb2 100644 --- a/testing/spectest/mainnet/gloas__operations__builder_exit_request_test.go +++ b/testing/spectest/mainnet/gloas/gloas__operations__builder_exit_request_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__operations__consolidation_test.go b/testing/spectest/mainnet/gloas/gloas__operations__consolidation_test.go similarity index 93% rename from testing/spectest/mainnet/gloas__operations__consolidation_test.go rename to testing/spectest/mainnet/gloas/gloas__operations__consolidation_test.go index be80ad368d4c..d1cd02676ee1 100644 --- a/testing/spectest/mainnet/gloas__operations__consolidation_test.go +++ b/testing/spectest/mainnet/gloas/gloas__operations__consolidation_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__operations__deposit_requests_test.go b/testing/spectest/mainnet/gloas/gloas__operations__deposit_requests_test.go similarity index 93% rename from testing/spectest/mainnet/gloas__operations__deposit_requests_test.go rename to testing/spectest/mainnet/gloas/gloas__operations__deposit_requests_test.go index 1282389b04ef..576b4cc1bb44 100644 --- a/testing/spectest/mainnet/gloas__operations__deposit_requests_test.go +++ b/testing/spectest/mainnet/gloas/gloas__operations__deposit_requests_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__operations__execution_payload_header_test.go b/testing/spectest/mainnet/gloas/gloas__operations__execution_payload_header_test.go similarity index 93% rename from testing/spectest/mainnet/gloas__operations__execution_payload_header_test.go rename to testing/spectest/mainnet/gloas/gloas__operations__execution_payload_header_test.go index d6df3aca6c24..02e7fae75781 100644 --- a/testing/spectest/mainnet/gloas__operations__execution_payload_header_test.go +++ b/testing/spectest/mainnet/gloas/gloas__operations__execution_payload_header_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__operations__parent_execution_payload_test.go b/testing/spectest/mainnet/gloas/gloas__operations__parent_execution_payload_test.go similarity index 93% rename from testing/spectest/mainnet/gloas__operations__parent_execution_payload_test.go rename to testing/spectest/mainnet/gloas/gloas__operations__parent_execution_payload_test.go index 10021a436c04..cc30c893edf5 100644 --- a/testing/spectest/mainnet/gloas__operations__parent_execution_payload_test.go +++ b/testing/spectest/mainnet/gloas/gloas__operations__parent_execution_payload_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__operations__payload_attestation_test.go b/testing/spectest/mainnet/gloas/gloas__operations__payload_attestation_test.go similarity index 93% rename from testing/spectest/mainnet/gloas__operations__payload_attestation_test.go rename to testing/spectest/mainnet/gloas/gloas__operations__payload_attestation_test.go index 30d8d1a490af..d9d71a251077 100644 --- a/testing/spectest/mainnet/gloas__operations__payload_attestation_test.go +++ b/testing/spectest/mainnet/gloas/gloas__operations__payload_attestation_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__operations__proposer_slashing_test.go b/testing/spectest/mainnet/gloas/gloas__operations__proposer_slashing_test.go similarity index 93% rename from testing/spectest/mainnet/gloas__operations__proposer_slashing_test.go rename to testing/spectest/mainnet/gloas/gloas__operations__proposer_slashing_test.go index 5b667db96bb5..672a3e01df0e 100644 --- a/testing/spectest/mainnet/gloas__operations__proposer_slashing_test.go +++ b/testing/spectest/mainnet/gloas/gloas__operations__proposer_slashing_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__operations__sync_committee_test.go b/testing/spectest/mainnet/gloas/gloas__operations__sync_committee_test.go similarity index 93% rename from testing/spectest/mainnet/gloas__operations__sync_committee_test.go rename to testing/spectest/mainnet/gloas/gloas__operations__sync_committee_test.go index 4c6f73833d61..3de8c1bde97e 100644 --- a/testing/spectest/mainnet/gloas__operations__sync_committee_test.go +++ b/testing/spectest/mainnet/gloas/gloas__operations__sync_committee_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__operations__voluntary_exit_churn_test.go b/testing/spectest/mainnet/gloas/gloas__operations__voluntary_exit_churn_test.go similarity index 93% rename from testing/spectest/mainnet/gloas__operations__voluntary_exit_churn_test.go rename to testing/spectest/mainnet/gloas/gloas__operations__voluntary_exit_churn_test.go index 7f1abb812385..4b49564762d0 100644 --- a/testing/spectest/mainnet/gloas__operations__voluntary_exit_churn_test.go +++ b/testing/spectest/mainnet/gloas/gloas__operations__voluntary_exit_churn_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__operations__voluntary_exit_test.go b/testing/spectest/mainnet/gloas/gloas__operations__voluntary_exit_test.go similarity index 93% rename from testing/spectest/mainnet/gloas__operations__voluntary_exit_test.go rename to testing/spectest/mainnet/gloas/gloas__operations__voluntary_exit_test.go index 5c7f438cb9ee..6d97f85252c6 100644 --- a/testing/spectest/mainnet/gloas__operations__voluntary_exit_test.go +++ b/testing/spectest/mainnet/gloas/gloas__operations__voluntary_exit_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__operations__withdrawal_request_test.go b/testing/spectest/mainnet/gloas/gloas__operations__withdrawal_request_test.go similarity index 93% rename from testing/spectest/mainnet/gloas__operations__withdrawal_request_test.go rename to testing/spectest/mainnet/gloas/gloas__operations__withdrawal_request_test.go index 19347f2a35d3..6c0555edd4e3 100644 --- a/testing/spectest/mainnet/gloas__operations__withdrawal_request_test.go +++ b/testing/spectest/mainnet/gloas/gloas__operations__withdrawal_request_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__operations__withdrawals_test.go b/testing/spectest/mainnet/gloas/gloas__operations__withdrawals_test.go similarity index 92% rename from testing/spectest/mainnet/gloas__operations__withdrawals_test.go rename to testing/spectest/mainnet/gloas/gloas__operations__withdrawals_test.go index 2e87a49a672e..68c3b414dae2 100644 --- a/testing/spectest/mainnet/gloas__operations__withdrawals_test.go +++ b/testing/spectest/mainnet/gloas/gloas__operations__withdrawals_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__random_test.go b/testing/spectest/mainnet/gloas/gloas__random_test.go similarity index 93% rename from testing/spectest/mainnet/gloas__random_test.go rename to testing/spectest/mainnet/gloas/gloas__random_test.go index 760ea4d1b888..cace95456fe9 100644 --- a/testing/spectest/mainnet/gloas__random_test.go +++ b/testing/spectest/mainnet/gloas/gloas__random_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__rewards_test.go b/testing/spectest/mainnet/gloas/gloas__rewards_test.go similarity index 92% rename from testing/spectest/mainnet/gloas__rewards_test.go rename to testing/spectest/mainnet/gloas/gloas__rewards_test.go index dc0f8fb148b7..299b2f141348 100644 --- a/testing/spectest/mainnet/gloas__rewards_test.go +++ b/testing/spectest/mainnet/gloas/gloas__rewards_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__sanity__blocks_test.go b/testing/spectest/mainnet/gloas/gloas__sanity__blocks_test.go similarity index 93% rename from testing/spectest/mainnet/gloas__sanity__blocks_test.go rename to testing/spectest/mainnet/gloas/gloas__sanity__blocks_test.go index 36738f17efe9..4c73b2214f7a 100644 --- a/testing/spectest/mainnet/gloas__sanity__blocks_test.go +++ b/testing/spectest/mainnet/gloas/gloas__sanity__blocks_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__sanity__slots_test.go b/testing/spectest/mainnet/gloas/gloas__sanity__slots_test.go similarity index 92% rename from testing/spectest/mainnet/gloas__sanity__slots_test.go rename to testing/spectest/mainnet/gloas/gloas__sanity__slots_test.go index db55729e7957..b27aabd398da 100644 --- a/testing/spectest/mainnet/gloas__sanity__slots_test.go +++ b/testing/spectest/mainnet/gloas/gloas__sanity__slots_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/mainnet/gloas__ssz_static__ssz_static_test.go b/testing/spectest/mainnet/gloas/gloas__ssz_static__ssz_static_test.go similarity index 92% rename from testing/spectest/mainnet/gloas__ssz_static__ssz_static_test.go rename to testing/spectest/mainnet/gloas/gloas__ssz_static__ssz_static_test.go index 3d63dce95872..3a70e8a56b04 100644 --- a/testing/spectest/mainnet/gloas__ssz_static__ssz_static_test.go +++ b/testing/spectest/mainnet/gloas/gloas__ssz_static__ssz_static_test.go @@ -1,4 +1,4 @@ -package mainnet +package gloas import ( "testing" diff --git a/testing/spectest/methodical-spectest.yaml b/testing/spectest/methodical-spectest.yaml new file mode 100644 index 000000000000..235d34936faa --- /dev/null +++ b/testing/spectest/methodical-spectest.yaml @@ -0,0 +1,222 @@ +# Spec test relationships for Prysm SSZ types. +# +# Each fork lists only the types it introduces or overrides; the generator +# (methodical-ssz RelationsAtFork) inherits every other type from the most +# recent prior fork that defined it. `name` is the consensus-spec-tests +# ssz_static container name; `type_name` is the Prysm Go type when it differs. +# +# Most types live in the default package below (proto/prysm/v1alpha1). Types +# from other packages set `package:` explicitly — the execution-layer +# containers (ExecutionPayload[Header], Withdrawal, the electra *Request types) +# live in proto/engine/v1. The generated local-mode test imports each used +# package under a distinct alias. Mappings are derived from the per-fork +# proto/prysm/v1alpha1/*.yaml and proto/engine/v1/engine.yaml ssz_methodical +# configs (canonical spec name = Go type minus fork suffix). +package: github.com/OffchainLabs/prysm/v7/proto/prysm/v1alpha1 +preset: mainnet +defs: + - fork: phase0 + types: + - name: AggregateAndProof + type_name: AggregateAttestationAndProof + - name: Attestation + - name: AttestationData + - name: AttesterSlashing + - name: BeaconBlock + - name: BeaconBlockBody + - name: BeaconBlockHeader + - name: BeaconState + - name: Checkpoint + - name: Deposit + - name: DepositData + type_name: Deposit_Data + - name: DepositMessage + - name: Eth1Data + - name: Fork + - name: ForkData + - name: HistoricalBatch + - name: IndexedAttestation + - name: PendingAttestation + - name: ProposerSlashing + - name: SignedAggregateAndProof + type_name: SignedAggregateAttestationAndProof + - name: SignedBeaconBlock + - name: SignedBeaconBlockHeader + - name: SignedVoluntaryExit + - name: SigningData + - name: Validator + - name: VoluntaryExit + - fork: altair + types: + - name: BeaconBlock + type_name: BeaconBlockAltair + - name: BeaconBlockBody + type_name: BeaconBlockBodyAltair + - name: BeaconState + type_name: BeaconStateAltair + - name: ContributionAndProof + - name: LightClientBootstrap + type_name: LightClientBootstrapAltair + - name: LightClientFinalityUpdate + type_name: LightClientFinalityUpdateAltair + - name: LightClientHeader + type_name: LightClientHeaderAltair + - name: LightClientOptimisticUpdate + type_name: LightClientOptimisticUpdateAltair + - name: LightClientUpdate + type_name: LightClientUpdateAltair + - name: SignedBeaconBlock + type_name: SignedBeaconBlockAltair + - name: SignedContributionAndProof + - name: SyncAggregate + - name: SyncAggregatorSelectionData + - name: SyncCommittee + - name: SyncCommitteeContribution + - name: SyncCommitteeMessage + - fork: bellatrix + types: + - name: BeaconBlock + type_name: BeaconBlockBellatrix + - name: BeaconBlockBody + type_name: BeaconBlockBodyBellatrix + - name: BeaconState + type_name: BeaconStateBellatrix + - name: ExecutionPayload + package: github.com/OffchainLabs/prysm/v7/proto/engine/v1 + - name: ExecutionPayloadHeader + package: github.com/OffchainLabs/prysm/v7/proto/engine/v1 + - name: PowBlock + - name: SignedBeaconBlock + type_name: SignedBeaconBlockBellatrix + - fork: capella + types: + - name: BeaconBlock + type_name: BeaconBlockCapella + - name: BeaconBlockBody + type_name: BeaconBlockBodyCapella + - name: BeaconState + type_name: BeaconStateCapella + - name: BLSToExecutionChange + - name: ExecutionPayload + type_name: ExecutionPayloadCapella + package: github.com/OffchainLabs/prysm/v7/proto/engine/v1 + - name: ExecutionPayloadHeader + type_name: ExecutionPayloadHeaderCapella + package: github.com/OffchainLabs/prysm/v7/proto/engine/v1 + - name: HistoricalSummary + - name: LightClientBootstrap + type_name: LightClientBootstrapCapella + - name: LightClientFinalityUpdate + type_name: LightClientFinalityUpdateCapella + - name: LightClientHeader + type_name: LightClientHeaderCapella + - name: LightClientOptimisticUpdate + type_name: LightClientOptimisticUpdateCapella + - name: LightClientUpdate + type_name: LightClientUpdateCapella + - name: SignedBeaconBlock + type_name: SignedBeaconBlockCapella + - name: SignedBLSToExecutionChange + - name: Withdrawal + package: github.com/OffchainLabs/prysm/v7/proto/engine/v1 + - fork: deneb + types: + - name: BeaconBlock + type_name: BeaconBlockDeneb + - name: BeaconBlockBody + type_name: BeaconBlockBodyDeneb + - name: BeaconState + type_name: BeaconStateDeneb + - name: BlobIdentifier + - name: BlobSidecar + - name: ExecutionPayload + type_name: ExecutionPayloadDeneb + package: github.com/OffchainLabs/prysm/v7/proto/engine/v1 + - name: ExecutionPayloadHeader + type_name: ExecutionPayloadHeaderDeneb + package: github.com/OffchainLabs/prysm/v7/proto/engine/v1 + - name: LightClientBootstrap + type_name: LightClientBootstrapDeneb + - name: LightClientFinalityUpdate + type_name: LightClientFinalityUpdateDeneb + - name: LightClientHeader + type_name: LightClientHeaderDeneb + - name: LightClientOptimisticUpdate + type_name: LightClientOptimisticUpdateDeneb + - name: LightClientUpdate + type_name: LightClientUpdateDeneb + - name: SignedBeaconBlock + type_name: SignedBeaconBlockDeneb + - fork: electra + types: + - name: AggregateAndProof + type_name: AggregateAttestationAndProofElectra + - name: Attestation + type_name: AttestationElectra + - name: AttesterSlashing + type_name: AttesterSlashingElectra + - name: BeaconBlock + type_name: BeaconBlockElectra + - name: BeaconBlockBody + type_name: BeaconBlockBodyElectra + - name: BeaconState + type_name: BeaconStateElectra + - name: ConsolidationRequest + package: github.com/OffchainLabs/prysm/v7/proto/engine/v1 + - name: DepositRequest + package: github.com/OffchainLabs/prysm/v7/proto/engine/v1 + - name: ExecutionRequests + package: github.com/OffchainLabs/prysm/v7/proto/engine/v1 + - name: IndexedAttestation + type_name: IndexedAttestationElectra + - name: LightClientBootstrap + type_name: LightClientBootstrapElectra + - name: LightClientFinalityUpdate + type_name: LightClientFinalityUpdateElectra + - name: LightClientUpdate + type_name: LightClientUpdateElectra + - name: PendingConsolidation + - name: PendingDeposit + - name: PendingPartialWithdrawal + - name: SignedAggregateAndProof + type_name: SignedAggregateAttestationAndProofElectra + - name: SignedBeaconBlock + type_name: SignedBeaconBlockElectra + - name: SingleAttestation + - name: WithdrawalRequest + package: github.com/OffchainLabs/prysm/v7/proto/engine/v1 + - fork: fulu + types: + - name: BeaconState + type_name: BeaconStateFulu + - name: DataColumnSidecar + - name: DataColumnsByRootIdentifier + - name: SignedBeaconBlock + type_name: SignedBeaconBlockFulu + - fork: gloas + types: + - name: BeaconBlock + type_name: BeaconBlockGloas + - name: BeaconBlockBody + type_name: BeaconBlockBodyGloas + - name: BeaconState + type_name: BeaconStateGloas + - name: Builder + - name: BuilderPendingPayment + - name: BuilderPendingWithdrawal + - name: DataColumnSidecar + type_name: DataColumnSidecarGloas + - name: ExecutionPayload + type_name: ExecutionPayloadGloas + package: github.com/OffchainLabs/prysm/v7/proto/engine/v1 + - name: ExecutionPayloadBid + - name: ExecutionPayloadEnvelope + - name: PayloadAttestation + - name: PayloadAttestationData + - name: PayloadAttestationMessage + - name: ProposerPreferences + - name: SignedBeaconBlock + type_name: SignedBeaconBlockGloas + - name: SignedExecutionPayloadBid + - name: SignedExecutionPayloadEnvelope + - name: SignedProposerPreferences diff --git a/testing/spectest/minimal/BUILD.bazel b/testing/spectest/minimal/BUILD.bazel index 950092091a92..76784a060b16 100644 --- a/testing/spectest/minimal/BUILD.bazel +++ b/testing/spectest/minimal/BUILD.bazel @@ -205,48 +205,6 @@ go_test( "fulu__sanity__blocks_test.go", "fulu__sanity__slots_test.go", "fulu__ssz_static__ssz_static_test.go", - "gloas__epoch_processing__effective_balance_updates_test.go", - "gloas__epoch_processing__eth1_data_reset_test.go", - "gloas__epoch_processing__historical_summaries_update_test.go", - "gloas__epoch_processing__inactivity_updates_test.go", - "gloas__epoch_processing__justification_and_finalization_test.go", - "gloas__epoch_processing__participation_flag_updates_test.go", - "gloas__epoch_processing__pending_consolidations_test.go", - "gloas__epoch_processing__pending_deposits_churn_test.go", - "gloas__epoch_processing__pending_deposits_test.go", - "gloas__epoch_processing__process_builder_pending_payments_test.go", - "gloas__epoch_processing__proposer_lookahead_test.go", - "gloas__epoch_processing__randao_mixes_reset_test.go", - "gloas__epoch_processing__registry_updates_test.go", - "gloas__epoch_processing__rewards_and_penalties_test.go", - "gloas__epoch_processing__slashings_reset_test.go", - "gloas__epoch_processing__slashings_test.go", - "gloas__finality__finality_test.go", - "gloas__fork__upgrade_to_gloas_test.go", - "gloas__fork_transition__transition_test.go", - "gloas__forkchoice__forkchoice_test.go", - "gloas__operations__attestation_test.go", - "gloas__operations__attester_slashing_test.go", - "gloas__operations__block_header_test.go", - "gloas__operations__bls_to_execution_change_test.go", - "gloas__operations__builder_deposit_request_test.go", - "gloas__operations__builder_exit_request_test.go", - "gloas__operations__consolidation_test.go", - "gloas__operations__deposit_requests_test.go", - "gloas__operations__execution_payload_bid_test.go", - "gloas__operations__parent_execution_payload_test.go", - "gloas__operations__payload_attestation_test.go", - "gloas__operations__proposer_slashing_test.go", - "gloas__operations__sync_committee_test.go", - "gloas__operations__voluntary_exit_churn_test.go", - "gloas__operations__voluntary_exit_test.go", - "gloas__operations__withdrawal_request_test.go", - "gloas__operations__withdrawals_test.go", - "gloas__random_test.go", - "gloas__rewards_test.go", - "gloas__sanity__blocks_test.go", - "gloas__sanity__slots_test.go", - "gloas__ssz_static__ssz_static_test.go", "phase0__epoch_processing__effective_balance_updates_test.go", "phase0__epoch_processing__epoch_processing_test.go", "phase0__epoch_processing__eth1_data_reset_test.go", @@ -329,13 +287,6 @@ go_test( "//testing/spectest/shared/fulu/rewards:go_default_library", "//testing/spectest/shared/fulu/sanity:go_default_library", "//testing/spectest/shared/fulu/ssz_static:go_default_library", - "//testing/spectest/shared/gloas/epoch_processing:go_default_library", - "//testing/spectest/shared/gloas/finality:go_default_library", - "//testing/spectest/shared/gloas/fork:go_default_library", - "//testing/spectest/shared/gloas/operations:go_default_library", - "//testing/spectest/shared/gloas/rewards:go_default_library", - "//testing/spectest/shared/gloas/sanity:go_default_library", - "//testing/spectest/shared/gloas/ssz_static:go_default_library", "//testing/spectest/shared/phase0/epoch_processing:go_default_library", "//testing/spectest/shared/phase0/finality:go_default_library", "//testing/spectest/shared/phase0/operations:go_default_library", diff --git a/testing/spectest/minimal/gloas/BUILD.bazel b/testing/spectest/minimal/gloas/BUILD.bazel new file mode 100644 index 000000000000..6a3709f3b2bb --- /dev/null +++ b/testing/spectest/minimal/gloas/BUILD.bazel @@ -0,0 +1,66 @@ +load("@prysm//tools/go:def.bzl", "go_test") + +go_test( + name = "go_default_test", + srcs = [ + "gloas__epoch_processing__effective_balance_updates_test.go", + "gloas__epoch_processing__eth1_data_reset_test.go", + "gloas__epoch_processing__historical_summaries_update_test.go", + "gloas__epoch_processing__inactivity_updates_test.go", + "gloas__epoch_processing__justification_and_finalization_test.go", + "gloas__epoch_processing__participation_flag_updates_test.go", + "gloas__epoch_processing__pending_consolidations_test.go", + "gloas__epoch_processing__pending_deposits_churn_test.go", + "gloas__epoch_processing__pending_deposits_test.go", + "gloas__epoch_processing__process_builder_pending_payments_test.go", + "gloas__epoch_processing__proposer_lookahead_test.go", + "gloas__epoch_processing__randao_mixes_reset_test.go", + "gloas__epoch_processing__registry_updates_test.go", + "gloas__epoch_processing__rewards_and_penalties_test.go", + "gloas__epoch_processing__slashings_reset_test.go", + "gloas__epoch_processing__slashings_test.go", + "gloas__finality__finality_test.go", + "gloas__fork__upgrade_to_gloas_test.go", + "gloas__fork_transition__transition_test.go", + "gloas__forkchoice__forkchoice_test.go", + "gloas__operations__attestation_test.go", + "gloas__operations__attester_slashing_test.go", + "gloas__operations__block_header_test.go", + "gloas__operations__bls_to_execution_change_test.go", + "gloas__operations__builder_deposit_request_test.go", + "gloas__operations__builder_exit_request_test.go", + "gloas__operations__consolidation_test.go", + "gloas__operations__deposit_requests_test.go", + "gloas__operations__execution_payload_bid_test.go", + "gloas__operations__parent_execution_payload_test.go", + "gloas__operations__payload_attestation_test.go", + "gloas__operations__proposer_slashing_test.go", + "gloas__operations__sync_committee_test.go", + "gloas__operations__voluntary_exit_churn_test.go", + "gloas__operations__voluntary_exit_test.go", + "gloas__operations__withdrawal_request_test.go", + "gloas__operations__withdrawals_test.go", + "gloas__random_test.go", + "gloas__rewards_test.go", + "gloas__sanity__blocks_test.go", + "gloas__sanity__slots_test.go", + "gloas__ssz_static__ssz_static_test.go", + ], + data = ["@consensus_spec_tests//:test_data"], + eth_network = "minimal", + tags = [ + "minimal", + "spectest", + ], + deps = [ + "//runtime/version:go_default_library", + "//testing/spectest/shared/common/forkchoice:go_default_library", + "//testing/spectest/shared/gloas/epoch_processing:go_default_library", + "//testing/spectest/shared/gloas/finality:go_default_library", + "//testing/spectest/shared/gloas/fork:go_default_library", + "//testing/spectest/shared/gloas/operations:go_default_library", + "//testing/spectest/shared/gloas/rewards:go_default_library", + "//testing/spectest/shared/gloas/sanity:go_default_library", + "//testing/spectest/shared/gloas/ssz_static:go_default_library", + ], +) diff --git a/testing/spectest/minimal/gloas__epoch_processing__effective_balance_updates_test.go b/testing/spectest/minimal/gloas/gloas__epoch_processing__effective_balance_updates_test.go similarity index 94% rename from testing/spectest/minimal/gloas__epoch_processing__effective_balance_updates_test.go rename to testing/spectest/minimal/gloas/gloas__epoch_processing__effective_balance_updates_test.go index 4cb0652c922e..95686019e73f 100644 --- a/testing/spectest/minimal/gloas__epoch_processing__effective_balance_updates_test.go +++ b/testing/spectest/minimal/gloas/gloas__epoch_processing__effective_balance_updates_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__epoch_processing__eth1_data_reset_test.go b/testing/spectest/minimal/gloas/gloas__epoch_processing__eth1_data_reset_test.go similarity index 93% rename from testing/spectest/minimal/gloas__epoch_processing__eth1_data_reset_test.go rename to testing/spectest/minimal/gloas/gloas__epoch_processing__eth1_data_reset_test.go index 0181cc25c73c..9dd2667161b1 100644 --- a/testing/spectest/minimal/gloas__epoch_processing__eth1_data_reset_test.go +++ b/testing/spectest/minimal/gloas/gloas__epoch_processing__eth1_data_reset_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__epoch_processing__historical_summaries_update_test.go b/testing/spectest/minimal/gloas/gloas__epoch_processing__historical_summaries_update_test.go similarity index 94% rename from testing/spectest/minimal/gloas__epoch_processing__historical_summaries_update_test.go rename to testing/spectest/minimal/gloas/gloas__epoch_processing__historical_summaries_update_test.go index 022aae56f823..601962be62ae 100644 --- a/testing/spectest/minimal/gloas__epoch_processing__historical_summaries_update_test.go +++ b/testing/spectest/minimal/gloas/gloas__epoch_processing__historical_summaries_update_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__epoch_processing__inactivity_updates_test.go b/testing/spectest/minimal/gloas/gloas__epoch_processing__inactivity_updates_test.go similarity index 93% rename from testing/spectest/minimal/gloas__epoch_processing__inactivity_updates_test.go rename to testing/spectest/minimal/gloas/gloas__epoch_processing__inactivity_updates_test.go index 856a8525eb34..93bc8f96c2e7 100644 --- a/testing/spectest/minimal/gloas__epoch_processing__inactivity_updates_test.go +++ b/testing/spectest/minimal/gloas/gloas__epoch_processing__inactivity_updates_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__epoch_processing__justification_and_finalization_test.go b/testing/spectest/minimal/gloas/gloas__epoch_processing__justification_and_finalization_test.go similarity index 94% rename from testing/spectest/minimal/gloas__epoch_processing__justification_and_finalization_test.go rename to testing/spectest/minimal/gloas/gloas__epoch_processing__justification_and_finalization_test.go index 63a5064bb16e..1e3a1c38e876 100644 --- a/testing/spectest/minimal/gloas__epoch_processing__justification_and_finalization_test.go +++ b/testing/spectest/minimal/gloas/gloas__epoch_processing__justification_and_finalization_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__epoch_processing__participation_flag_updates_test.go b/testing/spectest/minimal/gloas/gloas__epoch_processing__participation_flag_updates_test.go similarity index 94% rename from testing/spectest/minimal/gloas__epoch_processing__participation_flag_updates_test.go rename to testing/spectest/minimal/gloas/gloas__epoch_processing__participation_flag_updates_test.go index a395d14738ea..4b0c4b9b8e5c 100644 --- a/testing/spectest/minimal/gloas__epoch_processing__participation_flag_updates_test.go +++ b/testing/spectest/minimal/gloas/gloas__epoch_processing__participation_flag_updates_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__epoch_processing__pending_consolidations_test.go b/testing/spectest/minimal/gloas/gloas__epoch_processing__pending_consolidations_test.go similarity index 93% rename from testing/spectest/minimal/gloas__epoch_processing__pending_consolidations_test.go rename to testing/spectest/minimal/gloas/gloas__epoch_processing__pending_consolidations_test.go index 1d91880b79c3..55875a7b6435 100644 --- a/testing/spectest/minimal/gloas__epoch_processing__pending_consolidations_test.go +++ b/testing/spectest/minimal/gloas/gloas__epoch_processing__pending_consolidations_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__epoch_processing__pending_deposits_churn_test.go b/testing/spectest/minimal/gloas/gloas__epoch_processing__pending_deposits_churn_test.go similarity index 93% rename from testing/spectest/minimal/gloas__epoch_processing__pending_deposits_churn_test.go rename to testing/spectest/minimal/gloas/gloas__epoch_processing__pending_deposits_churn_test.go index cf675549d981..9a60397efa85 100644 --- a/testing/spectest/minimal/gloas__epoch_processing__pending_deposits_churn_test.go +++ b/testing/spectest/minimal/gloas/gloas__epoch_processing__pending_deposits_churn_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__epoch_processing__pending_deposits_test.go b/testing/spectest/minimal/gloas/gloas__epoch_processing__pending_deposits_test.go similarity index 93% rename from testing/spectest/minimal/gloas__epoch_processing__pending_deposits_test.go rename to testing/spectest/minimal/gloas/gloas__epoch_processing__pending_deposits_test.go index 16f33c3f4bd3..039554155a3a 100644 --- a/testing/spectest/minimal/gloas__epoch_processing__pending_deposits_test.go +++ b/testing/spectest/minimal/gloas/gloas__epoch_processing__pending_deposits_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__epoch_processing__process_builder_pending_payments_test.go b/testing/spectest/minimal/gloas/gloas__epoch_processing__process_builder_pending_payments_test.go similarity index 94% rename from testing/spectest/minimal/gloas__epoch_processing__process_builder_pending_payments_test.go rename to testing/spectest/minimal/gloas/gloas__epoch_processing__process_builder_pending_payments_test.go index 536afae389f8..7be7feea7463 100644 --- a/testing/spectest/minimal/gloas__epoch_processing__process_builder_pending_payments_test.go +++ b/testing/spectest/minimal/gloas/gloas__epoch_processing__process_builder_pending_payments_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__epoch_processing__proposer_lookahead_test.go b/testing/spectest/minimal/gloas/gloas__epoch_processing__proposer_lookahead_test.go similarity index 93% rename from testing/spectest/minimal/gloas__epoch_processing__proposer_lookahead_test.go rename to testing/spectest/minimal/gloas/gloas__epoch_processing__proposer_lookahead_test.go index b8906e270647..061a485b6389 100644 --- a/testing/spectest/minimal/gloas__epoch_processing__proposer_lookahead_test.go +++ b/testing/spectest/minimal/gloas/gloas__epoch_processing__proposer_lookahead_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__epoch_processing__randao_mixes_reset_test.go b/testing/spectest/minimal/gloas/gloas__epoch_processing__randao_mixes_reset_test.go similarity index 93% rename from testing/spectest/minimal/gloas__epoch_processing__randao_mixes_reset_test.go rename to testing/spectest/minimal/gloas/gloas__epoch_processing__randao_mixes_reset_test.go index 658150cb959b..4219db7fabc0 100644 --- a/testing/spectest/minimal/gloas__epoch_processing__randao_mixes_reset_test.go +++ b/testing/spectest/minimal/gloas/gloas__epoch_processing__randao_mixes_reset_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__epoch_processing__registry_updates_test.go b/testing/spectest/minimal/gloas/gloas__epoch_processing__registry_updates_test.go similarity index 93% rename from testing/spectest/minimal/gloas__epoch_processing__registry_updates_test.go rename to testing/spectest/minimal/gloas/gloas__epoch_processing__registry_updates_test.go index f139c638ea29..a61de7517ab7 100644 --- a/testing/spectest/minimal/gloas__epoch_processing__registry_updates_test.go +++ b/testing/spectest/minimal/gloas/gloas__epoch_processing__registry_updates_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__epoch_processing__rewards_and_penalties_test.go b/testing/spectest/minimal/gloas/gloas__epoch_processing__rewards_and_penalties_test.go similarity index 93% rename from testing/spectest/minimal/gloas__epoch_processing__rewards_and_penalties_test.go rename to testing/spectest/minimal/gloas/gloas__epoch_processing__rewards_and_penalties_test.go index 0207b23db0c3..a176d4c48e69 100644 --- a/testing/spectest/minimal/gloas__epoch_processing__rewards_and_penalties_test.go +++ b/testing/spectest/minimal/gloas/gloas__epoch_processing__rewards_and_penalties_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__epoch_processing__slashings_reset_test.go b/testing/spectest/minimal/gloas/gloas__epoch_processing__slashings_reset_test.go similarity index 93% rename from testing/spectest/minimal/gloas__epoch_processing__slashings_reset_test.go rename to testing/spectest/minimal/gloas/gloas__epoch_processing__slashings_reset_test.go index b4880d57d96f..d45e0d625468 100644 --- a/testing/spectest/minimal/gloas__epoch_processing__slashings_reset_test.go +++ b/testing/spectest/minimal/gloas/gloas__epoch_processing__slashings_reset_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__epoch_processing__slashings_test.go b/testing/spectest/minimal/gloas/gloas__epoch_processing__slashings_test.go similarity index 93% rename from testing/spectest/minimal/gloas__epoch_processing__slashings_test.go rename to testing/spectest/minimal/gloas/gloas__epoch_processing__slashings_test.go index 275c5e94e413..03a8546ef848 100644 --- a/testing/spectest/minimal/gloas__epoch_processing__slashings_test.go +++ b/testing/spectest/minimal/gloas/gloas__epoch_processing__slashings_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__finality__finality_test.go b/testing/spectest/minimal/gloas/gloas__finality__finality_test.go similarity index 92% rename from testing/spectest/minimal/gloas__finality__finality_test.go rename to testing/spectest/minimal/gloas/gloas__finality__finality_test.go index 77b8aa7c6b5a..11540e0f4721 100644 --- a/testing/spectest/minimal/gloas__finality__finality_test.go +++ b/testing/spectest/minimal/gloas/gloas__finality__finality_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__fork__upgrade_to_gloas_test.go b/testing/spectest/minimal/gloas/gloas__fork__upgrade_to_gloas_test.go similarity index 92% rename from testing/spectest/minimal/gloas__fork__upgrade_to_gloas_test.go rename to testing/spectest/minimal/gloas/gloas__fork__upgrade_to_gloas_test.go index d81dcee1d5a7..a84a521ca204 100644 --- a/testing/spectest/minimal/gloas__fork__upgrade_to_gloas_test.go +++ b/testing/spectest/minimal/gloas/gloas__fork__upgrade_to_gloas_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__fork_transition__transition_test.go b/testing/spectest/minimal/gloas/gloas__fork_transition__transition_test.go similarity index 92% rename from testing/spectest/minimal/gloas__fork_transition__transition_test.go rename to testing/spectest/minimal/gloas/gloas__fork_transition__transition_test.go index 00fd5e21ddd4..b1735ead74b7 100644 --- a/testing/spectest/minimal/gloas__fork_transition__transition_test.go +++ b/testing/spectest/minimal/gloas/gloas__fork_transition__transition_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__forkchoice__forkchoice_test.go b/testing/spectest/minimal/gloas/gloas__forkchoice__forkchoice_test.go similarity index 94% rename from testing/spectest/minimal/gloas__forkchoice__forkchoice_test.go rename to testing/spectest/minimal/gloas/gloas__forkchoice__forkchoice_test.go index e4cdc7c4d53d..69ff019d07ee 100644 --- a/testing/spectest/minimal/gloas__forkchoice__forkchoice_test.go +++ b/testing/spectest/minimal/gloas/gloas__forkchoice__forkchoice_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__operations__attestation_test.go b/testing/spectest/minimal/gloas/gloas__operations__attestation_test.go similarity index 92% rename from testing/spectest/minimal/gloas__operations__attestation_test.go rename to testing/spectest/minimal/gloas/gloas__operations__attestation_test.go index a859b7be2073..4ef719cd46fa 100644 --- a/testing/spectest/minimal/gloas__operations__attestation_test.go +++ b/testing/spectest/minimal/gloas/gloas__operations__attestation_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__operations__attester_slashing_test.go b/testing/spectest/minimal/gloas/gloas__operations__attester_slashing_test.go similarity index 93% rename from testing/spectest/minimal/gloas__operations__attester_slashing_test.go rename to testing/spectest/minimal/gloas/gloas__operations__attester_slashing_test.go index 3824925296ef..9a8f9cbea56b 100644 --- a/testing/spectest/minimal/gloas__operations__attester_slashing_test.go +++ b/testing/spectest/minimal/gloas/gloas__operations__attester_slashing_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__operations__block_header_test.go b/testing/spectest/minimal/gloas/gloas__operations__block_header_test.go similarity index 92% rename from testing/spectest/minimal/gloas__operations__block_header_test.go rename to testing/spectest/minimal/gloas/gloas__operations__block_header_test.go index 0c2550b1acfc..b2ad12be8cc1 100644 --- a/testing/spectest/minimal/gloas__operations__block_header_test.go +++ b/testing/spectest/minimal/gloas/gloas__operations__block_header_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__operations__bls_to_execution_change_test.go b/testing/spectest/minimal/gloas/gloas__operations__bls_to_execution_change_test.go similarity index 93% rename from testing/spectest/minimal/gloas__operations__bls_to_execution_change_test.go rename to testing/spectest/minimal/gloas/gloas__operations__bls_to_execution_change_test.go index 037ff276acfc..6b52593fa944 100644 --- a/testing/spectest/minimal/gloas__operations__bls_to_execution_change_test.go +++ b/testing/spectest/minimal/gloas/gloas__operations__bls_to_execution_change_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__operations__builder_deposit_request_test.go b/testing/spectest/minimal/gloas/gloas__operations__builder_deposit_request_test.go similarity index 93% rename from testing/spectest/minimal/gloas__operations__builder_deposit_request_test.go rename to testing/spectest/minimal/gloas/gloas__operations__builder_deposit_request_test.go index cfb9e034be33..7a5fac0c63c8 100644 --- a/testing/spectest/minimal/gloas__operations__builder_deposit_request_test.go +++ b/testing/spectest/minimal/gloas/gloas__operations__builder_deposit_request_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__operations__builder_exit_request_test.go b/testing/spectest/minimal/gloas/gloas__operations__builder_exit_request_test.go similarity index 93% rename from testing/spectest/minimal/gloas__operations__builder_exit_request_test.go rename to testing/spectest/minimal/gloas/gloas__operations__builder_exit_request_test.go index 3cc5ffdae5ec..85c6c7593a0c 100644 --- a/testing/spectest/minimal/gloas__operations__builder_exit_request_test.go +++ b/testing/spectest/minimal/gloas/gloas__operations__builder_exit_request_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__operations__consolidation_test.go b/testing/spectest/minimal/gloas/gloas__operations__consolidation_test.go similarity index 93% rename from testing/spectest/minimal/gloas__operations__consolidation_test.go rename to testing/spectest/minimal/gloas/gloas__operations__consolidation_test.go index 5ad1b3bffebc..d0f09d36d133 100644 --- a/testing/spectest/minimal/gloas__operations__consolidation_test.go +++ b/testing/spectest/minimal/gloas/gloas__operations__consolidation_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__operations__deposit_requests_test.go b/testing/spectest/minimal/gloas/gloas__operations__deposit_requests_test.go similarity index 93% rename from testing/spectest/minimal/gloas__operations__deposit_requests_test.go rename to testing/spectest/minimal/gloas/gloas__operations__deposit_requests_test.go index 719d84e94c0f..6db33fa36206 100644 --- a/testing/spectest/minimal/gloas__operations__deposit_requests_test.go +++ b/testing/spectest/minimal/gloas/gloas__operations__deposit_requests_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__operations__execution_payload_bid_test.go b/testing/spectest/minimal/gloas/gloas__operations__execution_payload_bid_test.go similarity index 93% rename from testing/spectest/minimal/gloas__operations__execution_payload_bid_test.go rename to testing/spectest/minimal/gloas/gloas__operations__execution_payload_bid_test.go index 721a7dbeb685..9c839b98f0b6 100644 --- a/testing/spectest/minimal/gloas__operations__execution_payload_bid_test.go +++ b/testing/spectest/minimal/gloas/gloas__operations__execution_payload_bid_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__operations__parent_execution_payload_test.go b/testing/spectest/minimal/gloas/gloas__operations__parent_execution_payload_test.go similarity index 93% rename from testing/spectest/minimal/gloas__operations__parent_execution_payload_test.go rename to testing/spectest/minimal/gloas/gloas__operations__parent_execution_payload_test.go index c7aaf791d478..e47a35ac9964 100644 --- a/testing/spectest/minimal/gloas__operations__parent_execution_payload_test.go +++ b/testing/spectest/minimal/gloas/gloas__operations__parent_execution_payload_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__operations__payload_attestation_test.go b/testing/spectest/minimal/gloas/gloas__operations__payload_attestation_test.go similarity index 93% rename from testing/spectest/minimal/gloas__operations__payload_attestation_test.go rename to testing/spectest/minimal/gloas/gloas__operations__payload_attestation_test.go index a048edf061d5..966fee6c3284 100644 --- a/testing/spectest/minimal/gloas__operations__payload_attestation_test.go +++ b/testing/spectest/minimal/gloas/gloas__operations__payload_attestation_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__operations__proposer_slashing_test.go b/testing/spectest/minimal/gloas/gloas__operations__proposer_slashing_test.go similarity index 93% rename from testing/spectest/minimal/gloas__operations__proposer_slashing_test.go rename to testing/spectest/minimal/gloas/gloas__operations__proposer_slashing_test.go index 5226567bec24..4d535aa791ee 100644 --- a/testing/spectest/minimal/gloas__operations__proposer_slashing_test.go +++ b/testing/spectest/minimal/gloas/gloas__operations__proposer_slashing_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__operations__sync_committee_test.go b/testing/spectest/minimal/gloas/gloas__operations__sync_committee_test.go similarity index 93% rename from testing/spectest/minimal/gloas__operations__sync_committee_test.go rename to testing/spectest/minimal/gloas/gloas__operations__sync_committee_test.go index f26c0b2d85a8..cdeb71fe480e 100644 --- a/testing/spectest/minimal/gloas__operations__sync_committee_test.go +++ b/testing/spectest/minimal/gloas/gloas__operations__sync_committee_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__operations__voluntary_exit_churn_test.go b/testing/spectest/minimal/gloas/gloas__operations__voluntary_exit_churn_test.go similarity index 93% rename from testing/spectest/minimal/gloas__operations__voluntary_exit_churn_test.go rename to testing/spectest/minimal/gloas/gloas__operations__voluntary_exit_churn_test.go index 36901d2caab4..e32da6bd6886 100644 --- a/testing/spectest/minimal/gloas__operations__voluntary_exit_churn_test.go +++ b/testing/spectest/minimal/gloas/gloas__operations__voluntary_exit_churn_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__operations__voluntary_exit_test.go b/testing/spectest/minimal/gloas/gloas__operations__voluntary_exit_test.go similarity index 93% rename from testing/spectest/minimal/gloas__operations__voluntary_exit_test.go rename to testing/spectest/minimal/gloas/gloas__operations__voluntary_exit_test.go index e23cba034859..64c9f6291394 100644 --- a/testing/spectest/minimal/gloas__operations__voluntary_exit_test.go +++ b/testing/spectest/minimal/gloas/gloas__operations__voluntary_exit_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__operations__withdrawal_request_test.go b/testing/spectest/minimal/gloas/gloas__operations__withdrawal_request_test.go similarity index 93% rename from testing/spectest/minimal/gloas__operations__withdrawal_request_test.go rename to testing/spectest/minimal/gloas/gloas__operations__withdrawal_request_test.go index 8fe2461f6357..221e06ecd521 100644 --- a/testing/spectest/minimal/gloas__operations__withdrawal_request_test.go +++ b/testing/spectest/minimal/gloas/gloas__operations__withdrawal_request_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__operations__withdrawals_test.go b/testing/spectest/minimal/gloas/gloas__operations__withdrawals_test.go similarity index 92% rename from testing/spectest/minimal/gloas__operations__withdrawals_test.go rename to testing/spectest/minimal/gloas/gloas__operations__withdrawals_test.go index b89d32e9eca6..13923e2ba64e 100644 --- a/testing/spectest/minimal/gloas__operations__withdrawals_test.go +++ b/testing/spectest/minimal/gloas/gloas__operations__withdrawals_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__random_test.go b/testing/spectest/minimal/gloas/gloas__random_test.go similarity index 93% rename from testing/spectest/minimal/gloas__random_test.go rename to testing/spectest/minimal/gloas/gloas__random_test.go index 46a399188a1c..ca938f380ca2 100644 --- a/testing/spectest/minimal/gloas__random_test.go +++ b/testing/spectest/minimal/gloas/gloas__random_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__rewards_test.go b/testing/spectest/minimal/gloas/gloas__rewards_test.go similarity index 92% rename from testing/spectest/minimal/gloas__rewards_test.go rename to testing/spectest/minimal/gloas/gloas__rewards_test.go index c5d0ad364afa..8324c0506134 100644 --- a/testing/spectest/minimal/gloas__rewards_test.go +++ b/testing/spectest/minimal/gloas/gloas__rewards_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__sanity__blocks_test.go b/testing/spectest/minimal/gloas/gloas__sanity__blocks_test.go similarity index 93% rename from testing/spectest/minimal/gloas__sanity__blocks_test.go rename to testing/spectest/minimal/gloas/gloas__sanity__blocks_test.go index 7b89e069bf97..2b70b18dd095 100644 --- a/testing/spectest/minimal/gloas__sanity__blocks_test.go +++ b/testing/spectest/minimal/gloas/gloas__sanity__blocks_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__sanity__slots_test.go b/testing/spectest/minimal/gloas/gloas__sanity__slots_test.go similarity index 92% rename from testing/spectest/minimal/gloas__sanity__slots_test.go rename to testing/spectest/minimal/gloas/gloas__sanity__slots_test.go index c763a5c2f52f..40b703d4d61a 100644 --- a/testing/spectest/minimal/gloas__sanity__slots_test.go +++ b/testing/spectest/minimal/gloas/gloas__sanity__slots_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/testing/spectest/minimal/gloas__ssz_static__ssz_static_test.go b/testing/spectest/minimal/gloas/gloas__ssz_static__ssz_static_test.go similarity index 92% rename from testing/spectest/minimal/gloas__ssz_static__ssz_static_test.go rename to testing/spectest/minimal/gloas/gloas__ssz_static__ssz_static_test.go index 50e31d3a5f6b..31136704a980 100644 --- a/testing/spectest/minimal/gloas__ssz_static__ssz_static_test.go +++ b/testing/spectest/minimal/gloas/gloas__ssz_static__ssz_static_test.go @@ -1,4 +1,4 @@ -package minimal +package gloas import ( "testing" diff --git a/tools/download_spectests.bzl b/tools/download_spectests.bzl index ebaf23854f17..bdee9c0b5c8a 100644 --- a/tools/download_spectests.bzl +++ b/tools/download_spectests.bzl @@ -1,6 +1,8 @@ # bazel build @consensus_spec_tests//:test_data # bazel build @consensus_spec_tests//:test_data --repo_env=CONSENSUS_SPEC_TESTS_VERSION=nightly # bazel build @consensus_spec_tests//:test_data --repo_env=CONSENSUS_SPEC_TESTS_VERSION=nightly- +# bazel build @consensus_spec_tests//:test_data --repo_env=CONSENSUS_SPEC_TESTS_DIR=/abs/path/to/tarballs +# bazel build @consensus_spec_tests//:test_data --repo_env=CONSENSUS_SPEC_TESTS_MAINNET=/abs/path/to/mainnet.tar.gz def _get_redirected_url(repository_ctx, url, headers): if not repository_ctx.which("curl"): @@ -9,10 +11,14 @@ def _get_redirected_url(repository_ctx, url, headers): cmd = [ "curl", "-sL", # silent + follow redirects - "-o", "NUL" if repository_ctx.os.name == "windows" else "/dev/null", - "-w", "%{url_effective}", - "-H", "Authorization: %s" % headers["Authorization"], - "-H", "Accept: %s" % headers["Accept"], + "-o", + "NUL" if repository_ctx.os.name == "windows" else "/dev/null", + "-w", + "%{url_effective}", + "-H", + "Authorization: %s" % headers["Authorization"], + "-H", + "Accept: %s" % headers["Accept"], url, ] @@ -21,11 +27,102 @@ def _get_redirected_url(repository_ctx, url, headers): fail("curl failed to resolve redirected URL: %s" % result.stderr) return result.stdout.strip() +def _local_sources(repository_ctx): + # Collect per-flavor spec test data to use from disk instead of downloading. + # A source can be either a tarball (.tar.gz) or an already-unpacked directory + # tree. Two opt-in mechanisms, which may be combined: + # + # CONSENSUS_SPEC_TESTS_DIR=/abs/dir + # For each flavor (general/mainnet/minimal) look, in order, for: + # /.tar.gz - a release-style tarball + # /tests/ - unpacked tree with the upstream tests/ prefix + # / - unpacked tree with the prefix stripped + # Only the flavors found are used; missing ones are skipped, so you can + # run a single preset by providing just e.g. mainnet. + # + # CONSENSUS_SPEC_TESTS_=/abs/path + # Point a specific flavor at an arbitrarily-named tarball or at an + # unpacked flavor tree directly, e.g. + # CONSENSUS_SPEC_TESTS_MAINNET=/tmp/my-mainnet.tar.gz or + # CONSENSUS_SPEC_TESTS_MAINNET=/data/specs/mainnet. Overrides the + # directory entry for that flavor. + # + # Returns a dict of flavor -> struct(path, is_dir). + sources = {} + requested = False + + local_dir = repository_ctx.getenv("CONSENSUS_SPEC_TESTS_DIR") or "" + if local_dir: + requested = True + if not local_dir.startswith("/"): + fail("CONSENSUS_SPEC_TESTS_DIR must be an absolute path, got: %s" % local_dir) + for flavor in repository_ctx.attr.flavors: + tarball = repository_ctx.path("%s/%s.tar.gz" % (local_dir, flavor)) + nested = repository_ctx.path("%s/tests/%s" % (local_dir, flavor)) + flat = repository_ctx.path("%s/%s" % (local_dir, flavor)) + if tarball.exists: + sources[flavor] = struct(path = tarball, is_dir = False) + elif nested.exists and nested.is_dir: + sources[flavor] = struct(path = nested, is_dir = True) + elif flat.exists and flat.is_dir: + sources[flavor] = struct(path = flat, is_dir = True) + + for flavor in repository_ctx.attr.flavors: + env = "CONSENSUS_SPEC_TESTS_%s" % flavor.upper() + override = repository_ctx.getenv(env) or "" + if override: + requested = True + if not override.startswith("/"): + fail("%s must be an absolute path, got: %s" % (env, override)) + src = repository_ctx.path(override) + if not src.exists: + fail("%s=%s does not exist" % (env, override)) + sources[flavor] = struct(path = src, is_dir = src.is_dir) + + if requested and not sources: + fail("Local spec tests requested via CONSENSUS_SPEC_TESTS_DIR/CONSENSUS_SPEC_TESTS_ " + + "but no tarballs or unpacked flavor directories (general/mainnet/minimal) were found") + + return sources + +def _install_local(repository_ctx, sources): + # Normalize every local source to the tests/ layout that the + # generated BUILD.bazel globs expect (the same layout the upstream release + # tarballs extract to). Flavors not in `sources` are simply absent; their + # filegroups resolve to empty globs, which is fine when running one preset. + print("Using local spec tests:", ", ".join(sorted(sources.keys()))) + for flavor in sources: + src = sources[flavor] + dest = "tests/%s" % flavor + if src.is_dir: + # Symlink the unpacked flavor tree into place. glob() follows the + # directory symlink when enumerating sources. + repository_ctx.symlink(src.path, dest) + else: + # Keep the raw tarball available at .tar.gz (consumed by + # e.g. methodical-ssz gen-spectest), and extract into a staging dir + # so we can normalize whatever internal prefix it uses. + archive = "%s.tar.gz" % flavor + repository_ctx.symlink(src.path, archive) + stage = "_stage/%s" % flavor + repository_ctx.extract(archive, output = stage) + nested = repository_ctx.path("%s/tests/%s" % (stage, flavor)) + flat = repository_ctx.path("%s/%s" % (stage, flavor)) + if nested.exists: + repository_ctx.symlink(nested, dest) + elif flat.exists: + repository_ctx.symlink(flat, dest) + else: + fail("Could not find flavor '%s' inside tarball %s" % (flavor, src.path)) + def _impl(repository_ctx): version = repository_ctx.getenv("CONSENSUS_SPEC_TESTS_VERSION") or repository_ctx.attr.version token = repository_ctx.getenv("GITHUB_TOKEN") or "" + local_sources = _local_sources(repository_ctx) - if version == "nightly" or version.startswith("nightly-"): + if local_sources: + _install_local(repository_ctx, local_sources) + elif version == "nightly" or version.startswith("nightly-"): print("Downloading nightly tests") if not token: fail("Error GITHUB_TOKEN is not set") @@ -41,10 +138,10 @@ def _impl(repository_ctx): fail("Error invalid run id") else: repository_ctx.download( - "https://api.github.com/repos/%s/actions/workflows/%s/runs?branch=%s&status=success&per_page=1" - % (repository_ctx.attr.repo, repository_ctx.attr.workflow, repository_ctx.attr.branch), + "https://api.github.com/repos/%s/actions/workflows/%s/runs?branch=%s&status=success&per_page=1" % + (repository_ctx.attr.repo, repository_ctx.attr.workflow, repository_ctx.attr.branch), headers = headers, - output = "runs.json" + output = "runs.json", ) run_id = json.decode(repository_ctx.read("runs.json"))["workflow_runs"][0]["id"] @@ -52,10 +149,10 @@ def _impl(repository_ctx): print("Run id:", run_id) repository_ctx.download( - "https://api.github.com/repos/%s/actions/runs/%s/artifacts" - % (repository_ctx.attr.repo, run_id), + "https://api.github.com/repos/%s/actions/runs/%s/artifacts" % + (repository_ctx.attr.repo, run_id), headers = headers, - output = "artifacts.json" + output = "artifacts.json", ) artifacts = json.decode(repository_ctx.read("artifacts.json"))["artifacts"] @@ -66,6 +163,7 @@ def _impl(repository_ctx): if name == "consensustestgen.log": continue url = artifact["archive_download_url"] + # Ugh this is the worst, bazel doesn't follow redirects... resolved_url = _get_redirected_url(repository_ctx, url, headers) repository_ctx.download_and_extract(resolved_url) @@ -76,9 +174,23 @@ def _impl(repository_ctx): for flavor in repository_ctx.attr.flavors: integrity = repository_ctx.attr.flavors[flavor] url = "%s/%s.tar.gz" % (repository_ctx.attr.release_url_template % version, flavor) - repository_ctx.download_and_extract(url, integrity = integrity) + + # Download the raw archive (cached by `integrity` in Bazel's + # content-addressable repository cache) and extract it in place, + # keeping the tarball so it can also be consumed un-extracted (e.g. + # methodical-ssz gen-spectest's --release-uri). One download serves + # both the extracted fixtures and the raw tarball. + archive = "%s.tar.gz" % flavor + repository_ctx.download(url, output = archive, integrity = integrity) + repository_ctx.extract(archive) repository_ctx.file("BUILD.bazel", """ +# Raw per-flavor archives (general.tar.gz, mainnet.tar.gz, minimal.tar.gz), +# kept un-extracted alongside the extracted fixture filegroups. Consumed by +# rules that want the tarball directly, e.g. //tools:methodical.bzl's +# ssz_gen_spectest --release-uri. +exports_files(glob(["*.tar.gz"])) + filegroup( name = "general_tests", srcs = glob(["tests/general/**/*.yaml", "tests/general/**/*.ssz_snappy"]), @@ -110,7 +222,14 @@ filegroup( consensus_spec_tests = repository_rule( implementation = _impl, - environ = ["CONSENSUS_SPEC_TESTS_VERSION", "GITHUB_TOKEN"], + environ = [ + "CONSENSUS_SPEC_TESTS_VERSION", + "GITHUB_TOKEN", + "CONSENSUS_SPEC_TESTS_DIR", + "CONSENSUS_SPEC_TESTS_GENERAL", + "CONSENSUS_SPEC_TESTS_MAINNET", + "CONSENSUS_SPEC_TESTS_MINIMAL", + ], attrs = { "version": attr.string(mandatory = True), "flavors": attr.string_dict(mandatory = True), diff --git a/tools/ssztrace/BUILD.bazel b/tools/ssztrace/BUILD.bazel new file mode 100644 index 000000000000..eda7ce82543b --- /dev/null +++ b/tools/ssztrace/BUILD.bazel @@ -0,0 +1,21 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary") +load("@prysm//tools/go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = ["main.go"], + importpath = "github.com/OffchainLabs/prysm/v7/tools/ssztrace", + visibility = ["//visibility:private"], + deps = [ + "//proto/engine/v1:go_default_library", + "//proto/prysm/v1alpha1:go_default_library", + "@com_github_golang_snappy//:go_default_library", + "@com_github_offchainlabs_methodical_ssz//ssz:go_default_library", + ], +) + +go_binary( + name = "ssztrace", + embed = [":go_default_library"], + visibility = ["//visibility:public"], +) diff --git a/tools/ssztrace/main.go b/tools/ssztrace/main.go new file mode 100644 index 000000000000..32f9ca45e59b --- /dev/null +++ b/tools/ssztrace/main.go @@ -0,0 +1,207 @@ +// Command ssztrace emits a merkleization trace (flat g -> root map, or nested +// YAML) for a gloas SSZ fixture, using prysm's methodical-ssz-generated +// HashTreeRootWith and the tracer in github.com/OffchainLabs/methodical-ssz/ssz. +// +// It is the Go side of cross-library bisection: diff its flat map against the +// Python/remerkleable tracer's (ssz-tracer/trace_flat.py) and take the highest +// generalized index whose root differs to localize a hash_tree_root +// disagreement to a single node. +// +// Usage: +// +// go run ./tools/ssztrace [-yaml] [-o out.yaml] +// +// is a spectest folder name (e.g. ExecutionPayloadBid, +// BeaconBlockBody, Attestation) — the same names used by the gloas ssz_static +// unmarshaller. holds serialized.ssz_snappy and roots.yaml. The +// trace self-verifies against the value's generated HashTreeRoot, and (when +// roots.yaml is present) against the fixture root, before emitting. +package main + +import ( + "flag" + "fmt" + "os" + "path/filepath" + "strings" + + sszlib "github.com/OffchainLabs/methodical-ssz/ssz" + enginev1 "github.com/OffchainLabs/prysm/v7/proto/engine/v1" + ethpb "github.com/OffchainLabs/prysm/v7/proto/prysm/v1alpha1" + "github.com/golang/snappy" +) + +// traceable is satisfied by the generated ssz types: deserialize a fixture and +// drive the methodical-ssz Hasher. +type traceable interface { + sszlib.HashRoot + UnmarshalSSZ([]byte) error +} + +// newObject maps a spectest folder name to the gloas Go type, mirroring +// testing/spectest/shared/gloas/ssz_static/ssz_static.go. Only consensus types +// with a generated methodical HTR are included (native-state-only and +// p2p/skipped types are omitted). +func newObject(name string) (traceable, error) { + switch name { + // Gloas-specific + case "ExecutionPayloadBid": + return ðpb.ExecutionPayloadBid{}, nil + case "SignedExecutionPayloadBid": + return ðpb.SignedExecutionPayloadBid{}, nil + case "PayloadAttestationData": + return ðpb.PayloadAttestationData{}, nil + case "PayloadAttestation": + return ðpb.PayloadAttestation{}, nil + case "PayloadAttestationMessage": + return ðpb.PayloadAttestationMessage{}, nil + case "BeaconBlock": + return ðpb.BeaconBlockGloas{}, nil + case "BeaconBlockBody": + return ðpb.BeaconBlockBodyGloas{}, nil + case "BeaconState": + return ðpb.BeaconStateGloas{}, nil + case "ExecutionPayloadEnvelope": + return ðpb.ExecutionPayloadEnvelope{}, nil + case "SignedExecutionPayloadEnvelope": + return ðpb.SignedExecutionPayloadEnvelope{}, nil + case "DataColumnSidecar": + return ðpb.DataColumnSidecarGloas{}, nil + case "Builder": + return ðpb.Builder{}, nil + case "BuilderPendingPayment": + return ðpb.BuilderPendingPayment{}, nil + case "BuilderPendingWithdrawal": + return ðpb.BuilderPendingWithdrawal{}, nil + + // Standard types that also appear in gloas fixtures + case "ExecutionPayload": + return &enginev1.ExecutionPayloadGloas{}, nil + case "ExecutionPayloadHeader": + return &enginev1.ExecutionPayloadHeaderDeneb{}, nil + case "ExecutionRequests": + return &enginev1.ExecutionRequestsGloas{}, nil + case "Attestation": + return ðpb.AttestationGloas{}, nil + case "AttestationData": + return ðpb.AttestationData{}, nil + case "AttesterSlashing": + return ðpb.AttesterSlashingGloas{}, nil + case "AggregateAndProof": + return ðpb.AggregateAttestationAndProofGloas{}, nil + case "SignedAggregateAndProof": + return ðpb.SignedAggregateAttestationAndProofGloas{}, nil + case "IndexedAttestation": + return ðpb.IndexedAttestationGloas{}, nil + case "SignedBeaconBlock": + return ðpb.SignedBeaconBlockGloas{}, nil + case "Validator": + return ðpb.Validator{}, nil + case "PendingConsolidation": + return ðpb.PendingConsolidation{}, nil + case "PendingDeposit": + return ðpb.PendingDeposit{}, nil + case "PendingPartialWithdrawal": + return ðpb.PendingPartialWithdrawal{}, nil + default: + return nil, fmt.Errorf("type %q not in ssztrace registry (add it to newObject)", name) + } +} + +func fixtureRoot(caseDir string) (string, bool) { + b, err := os.ReadFile(filepath.Join(caseDir, "roots.yaml")) // #nosec G304 -- debugging tool that reads outputs from test toolchain / other debugging tools + if err != nil { + return "", false + } + parts := strings.SplitN(string(b), "root:", 2) + if len(parts) != 2 { + return "", false + } + return strings.Trim(strings.TrimSpace(parts[1]), "'\""), true +} + +func main() { + yaml := flag.Bool("yaml", false, "emit the nested YAML tree instead of the flat g -> root map") + out := flag.String("o", "", "write to this file instead of stdout") + flag.Parse() + // Accept flags on either side of the positional args (stdlib flag stops at + // the first non-flag, so re-parse anything trailing the two positionals). + rest := flag.Args() + if len(rest) < 2 { + fmt.Fprintln(os.Stderr, "usage: ssztrace [-yaml] [-o out] ") + os.Exit(2) + } + typeName, caseDir := rest[0], rest[1] + if err := flag.CommandLine.Parse(rest[2:]); err != nil { + os.Exit(2) + } + + obj, err := newObject(typeName) + if err != nil { + fatal(err) + } + + compressed, err := os.ReadFile(filepath.Join(caseDir, "serialized.ssz_snappy")) // #nosec G304 -- debugging tool that reads outputs from test toolchain / other debugging tools + if err != nil { + fatal(fmt.Errorf("read fixture: %w", err)) + } + serialized, err := snappy.Decode(nil, compressed) + if err != nil { + fatal(fmt.Errorf("snappy decode: %w", err)) + } + if err := obj.UnmarshalSSZ(serialized); err != nil { + fatal(fmt.Errorf("unmarshal %s: %w", typeName, err)) + } + + res, err := sszlib.TraceValue(obj, typeName) + if err != nil { + fatal(err) + } + + // The trace already self-verified internally (reconstruct == generated HTR). + // Cross-check against the fixture root as a version-alignment signal only: + // a mismatch means the generated Go type and the fixture were built from + // different spec versions, which is a warning (still emit — the trace is + // faithful to whatever the Go type computes), not a tracer failure. + if want, ok := fixtureRoot(caseDir); ok { + got := fmt.Sprintf("0x%x", res.Root) + if got != want { + fmt.Fprintf(os.Stderr, "WARNING: trace root %s != fixture %s (spec-version skew; trace still self-verified)\n", got, want) + } else { + fmt.Fprintf(os.Stderr, "self-verified; root %s matches fixture\n", got) + } + } else { + fmt.Fprintf(os.Stderr, "self-verified; root 0x%x (no roots.yaml to cross-check)\n", res.Root) + } + + w := os.Stdout + if *out != "" { + f, err := os.Create(*out) + if err != nil { + fatal(err) + } + defer func() { + if err := f.Close(); err != nil { + fatal(err) + } + }() + w = f + } + + if *yaml { + err = res.WriteYAML(w) + } else { + err = res.WriteFlat(w) + } + if err != nil { + fatal(err) + } + if *out != "" { + fmt.Fprintf(os.Stderr, "wrote %s\n", *out) + } +} + +func fatal(err error) { + fmt.Fprintln(os.Stderr, "ssztrace:", err) + os.Exit(1) +}