Move Gloas spec tests into their own packages - #17309
Conversation
e6f59b0 to
0bb7aa1
Compare
c057083 to
f23a915
Compare
5ef6291 to
bc34380
Compare
ef2aa1f to
f77fb7b
Compare
bc34380 to
66c0cfa
Compare
f77fb7b to
76f1225
Compare
66c0cfa to
e77427a
Compare
76f1225 to
ae672ac
Compare
159e1ac to
1b96281
Compare
599d21c to
0150575
Compare
4a6e4ef to
c592869
Compare
0150575 to
1a01a0b
Compare
c592869 to
49ac6e9
Compare
1a01a0b to
369252e
Compare
terencechain
left a comment
There was a problem hiding this comment.
I think we missed a few fields in testing/spectest/methodical-spectest.yaml
| - name: DataColumnsByRootIdentifier | ||
| - name: SignedBeaconBlock | ||
| type_name: SignedBeaconBlockFulu | ||
| - fork: gloas |
There was a problem hiding this comment.
are we missing ExecutionRequests → ExecutionRequestsGloas?
and how about the following?
BuilderDepositRequest
BuilderExitRequest
AttestationGloas
AttesterSlashingGloas
IndexedAttestationGloas
AggregateAttestationAndProofGloas,
SignedAggregateAttestationAndProofGloas
|
|
||
| # 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 |
There was a problem hiding this comment.
Nit: update-go-ssz.sh does not exist any more.
| // 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 |
There was a problem hiding this comment.
Where can this script be found?
| bazel test //... --test_tag_filters=spectest --repo_env=CONSENSUS_SPEC_TESTS_VERSION=nightly-21422848633 | ||
| ``` | ||
|
|
||
| ## Using local spectest data |
There was a problem hiding this comment.
Before this PR, make test alreay had no equivalent to
bazel test //... --test_tag_filters=spectest --repo_env=CONSENSUS_SPEC_TESTS_VERSION=nightly
You can run the spectests only by using
make test mainnet-spectest minimal-spectest
but it's not possible to specify the equivalent of the --repo_env=CONSENSUS_SPEC_TESTS_VERSION value.
After this PR, this thing remains, and additionnaly, it's not possible to specify the equivalent of the --repo_env=CONSENSUS_SPEC_TESTS_DIR value.
These 2 things can be added in this current PR, or I can create a GH issue to track it, to be sure we implement this before totally remove Bazel.
369252e to
81c5678
Compare
49ac6e9 to
0d8a5ee
Compare
81c5678 to
f464594
Compare
0d8a5ee to
a10e16d
Compare
f464594 to
e29dde3
Compare
a10e16d to
71436f8
Compare
The mainnet and minimal spec test packages had grown a large flat set of gloas__* files sharing one BUILD target, so any gloas spec test run pulled in every other fork's fixtures. Move them under mainnet/gloas and minimal/gloas with their own targets. download_spectests.bzl gains CONSENSUS_SPEC_TESTS_DIR and per-flavor overrides so a working tree can be pointed at locally built spec test data, which is what makes it practical to run against a nightly or unreleased spec while devnet config values are ahead of the pinned release. Adds ssztrace, which dumps the merkleization of an SSZ object so a root mismatch against a fixture can be traced to the field that diverged.
71436f8 to
a676232
Compare
e29dde3 to
87e3a93
Compare
Move Gloas spec tests into their own packages
The mainnet and minimal spec test packages had accumulated a large flat set of
gloas__*files sharing a singlego_testtarget with every other fork. Because Bazel test targets are the unit of granularity, running any gloas spec test meant compiling and pulling in the fixtures for phase0 through fulu as well. This PR moves the gloas files intotesting/spectest/mainnet/gloasandtesting/spectest/minimal/gloaswith their own targets, so gloas can be iterated on independently.The second half of the PR is tooling for the situation this series is in: during devnet development the config values Prysm carries are ahead of the pinned consensus-spec-tests release, so fixtures often have to come from a locally built spec rather than a published tarball. Now spectest fixtures are merged upstream, but having the option to run from a local tarball instead of always trying to download from the http archive seemed like a useful capability to preserve in case we need to use fixtures like this again, or have a reason to generate our own fixtures locally.
tools/download_spectests.bzlgains two opt-in ways to source spec test data from disk.tools/ssztraceis added to make root mismatches against a fixture debuggable — it dumps the merkleization of an SSZ object so a disagreement can be localized to the field that diverged. A corresponding python tool can be found at kasey/ssz-tracer to generate merkleization traces from remerkleable, giving a developer or LLM assistant the baseline canonical trace to diff.Key changes
Spec test package split
testing/spectest/mainnet/gloas/BUILD.bazelandtesting/spectest/minimal/gloas/BUILD.bazel, each with ago_default_testtarget carrying that preset's 42 gloas test files,data = ["@consensus_spec_tests//:test_data"], and only the//testing/spectest/shared/gloas/...dependencies. The minimal target keepseth_network = "minimal"and theminimaltag; both keep thespectesttag, so existing--test_tag_filters=spectestinvocations still pick them up.srcsanddepsentries are removed fromtesting/spectest/mainnet/BUILD.bazelandtesting/spectest/minimal/BUILD.bazel.*_test.gofiles change only their package clause (package mainnet/package minimal→package gloas). Test function names, helper calls, and preset arguments are untouched.Local spec test data (
tools/download_spectests.bzl)Two new mechanisms, both taking precedence over
CONSENSUS_SPEC_TESTS_VERSIONand requiring no network access. All paths must be absolute; a source may be a tarball or an already-unpacked directory tree.CONSENSUS_SPEC_TESTS_DIR=/abs/dir— for each flavor (general,mainnet,minimal),_local_sourceslooks for<dir>/<flavor>.tar.gz, then<dir>/tests/<flavor>/, then<dir>/<flavor>/, in that order. Flavors that are absent are skipped, so supplying justmainnetis valid.CONSENSUS_SPEC_TESTS_<FLAVOR>=/abs/path(GENERAL,MAINNET,MINIMAL) — points one flavor at an arbitrarily named tarball or directly at an unpacked flavor tree, and wins over the directory entry for that flavor._install_localnormalizes each source to thetests/<flavor>layout the generatedBUILD.bazelglobs expect. Directories are symlinked (no large copy); tarballs are symlinked in as<flavor>.tar.gz, extracted to a staging dir, and then the detected internal prefix (tests/<flavor>or<flavor>) is symlinked into place.failrather than a silent fall back to downloading.environlist.Raw tarballs kept alongside extracted fixtures
repository_ctx.downloadfollowed byrepository_ctx.extractinstead ofdownload_and_extract, keeping<flavor>.tar.gzin the repo. Still one download, still integrity-checked and repository-cache-eligible.BUILD.bazelgainsexports_files(glob(["*.tar.gz"]))so rules that want the un-extracted archive can depend on@consensus_spec_tests//:<flavor>.tar.gz.methodical-ssz spec test generation
testing/spectest/methodical-spectest.yaml— the type relations config for methodical-ssz's spec test generator: each fork lists only the types it introduces or overrides (the generator inherits the rest from the most recent prior fork), withtype_namefor Prysm's fork-suffixed Go types andpackage:for theproto/engine/v1execution-layer containers. Covers phase0 through gloas, including the gloas additions (ExecutionPayloadBid,PayloadAttestation*,Builder*,ExecutionPayloadEnvelope,ProposerPreferences, and the gloas variants ofBeaconBlock/BeaconState/DataColumnSidecar).testing/spectest/BUILD.bazel— anssz_gen_spectesttarget (the rule already exists intools/methodical.bzlfrom earlier in the series) that generates intotesting/spectest/methodical, using@consensus_spec_tests//:mainnet.tar.gzas its fixture source. This is what theexports_fileschange above is for.hack/update-go-spectest.sh— the generate-and-commit script, mirroringhack/update-go-ssz.sh. It builds everyssz_gen_spectesttarget, finds each generated package by itsmethodical_test.gomarker, and mirrors the tree-artifact directory (test file plustestdata/) back into the source tree. Destinations are cleared first, since the tree artifact has no stable file list and stale fixtures would otherwise linger; copies arechmod u+wbecause Bazel outputs are read-only.No generated output is committed in this PR — only the config, the target, and the script.
tools/ssztraceA new
go_binarythat emits a merkleization trace for a gloas SSZ fixture, either as a flat generalized-index-to-root map or nested YAML, using Prysm's methodical-ssz-generatedHashTreeRootWithand the tracer ingithub.com/OffchainLabs/methodical-ssz/ssz.newObjectintools/ssztrace/main.gomaps spec test folder names to Prysm types, mirroringtesting/spectest/shared/gloas/ssz_static/ssz_static.go; only types with a generated methodical HTR are registered, and an unknown name is an error naming the function to extend.<case_dir>is read forserialized.ssz_snappyand, if present,roots.yaml. The trace self-verifies against the value's generatedHashTreeRootinternally; the fixture root is then cross-checked as a spec-version-skew signal only. A mismatch there prints a warning and still emits, because the trace is faithful to whatever the Go type computes.Behavior and configuration notes
//testing/spectest/mainnet:go_default_testor//testing/spectest/minimal:go_default_test; they are//testing/spectest/mainnet/gloas:go_default_testand//testing/spectest/minimal/gloas:go_default_test. Anything that names those preset targets explicitly needs updating; tag-filtered and//...runs are unaffected.@consensus_spec_tests//:<flavor>.tar.gzonly exists when the source is an actual tarball, not an unpacked directory, so thessz_gen_spectesttarget cannot be built against a directory-sourced repo.//testing/spectest/mainnet/...) instead of//..., since the other flavors' filegroups resolve to empty globs.bazel sync --configureor a different path to force a re-fetch.testing/spectest/README.mddocuments all of the above;tools/download_spectests.bzlalso picked up buildifier formatting churn in the pre-existing download paths.Acknowledgements
Stack created with GitHub Stacks CLI • Give Feedback 💬