refactor: simplify testing framework with proper OOP design#526
Merged
tcoratger merged 1 commit intoleanEthereum:mainfrom Apr 7, 2026
Merged
Conversation
Move building logic from fixture classes to spec types where it belongs. Each spec type now owns the methods that operate on its own fields: - BlockSpec: resolve_proposer_index, resolve_parent_root, build_attestations, build_signed_block, build_signed_block_with_store - AggregatedAttestationSpec: build_attestation_data, build_invalid_proof - GossipAttestationSpec: build_attestation_data, build_signed - GossipAggregatedAttestationSpec: build_attestation_data, build_signed Fixture files are now pure orchestration (~357 lines for fork_choice, ~144 for verify_signatures). Also: - Fix double fixture registration bug in BaseFixture - Fix assert tuple bug in genesis.py - Move expect_exception field + serializer to BaseConsensusFixture - Rewrite StoreChecks.validate_against_store with explicit checks - Remove dispatch tables and unused arguments - Convert all non-self methods to @staticmethod - Modernize typing imports (dict, list, type, set) - Delete dead code (_children, supports_fork, transitions_to) - Add XmssKeyManager.sign_and_aggregate for common pattern - Create test_types/utils.py for shared resolve_checkpoint - Update doc-writer agent rules for better documentation quality - Show full hex in error messages instead of truncated Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
What changed
Spec types own their building logic:
BlockSpecresolve_proposer_index,resolve_parent_root,build_attestations,build_signed_block,build_signed_block_with_storeAggregatedAttestationSpecbuild_attestation_data,build_invalid_proofGossipAttestationSpecbuild_attestation_data,build_signedGossipAggregatedAttestationSpecbuild_attestation_data,build_signedFramework cleanup:
BaseFixtureexpect_exceptionfield + serializer toBaseConsensusFixtureStoreChecks.validate_against_storewith explicit checks (no dispatch tables, no unused args)@staticmethoddict,list,type,set)_children,supports_fork,transitions_to)XmssKeyManager.sign_and_aggregatefor common patterntest_types/utils.pyfor sharedresolve_checkpointNet effect
fork_choice.py: 666 → 357 linesverify_signatures.py: 370 → 144 linesTest plan
uvx tox -e all-checkspassesuv run fill --fork=devnet --clean -n autogenerates all 123 fixtures🤖 Generated with Claude Code