refactor(forks): rewrite test call sites through the spec (Stage 4B of #686)#703
Merged
tcoratger merged 1 commit intoMay 3, 2026
Merged
Conversation
…leanEthereum#686) Tests that drive state transition, fork choice, block production, and signature verification now go through the fork's spec class instead of calling methods directly on the State / Store / SignedBlock containers. The pattern: state.process_block(block) → spec.process_block(state, block) store.on_block(signed_block) → spec.on_block(store, signed_block) signed_block.verify_signatures(vs) → spec.verify_signatures(signed_block, vs) store.produce_attestation_data(slot) → spec.produce_attestation_data(store, slot) ... Test functions consume `spec` via a new session-scoped pytest fixture defined in `tests/lean_spec/conftest.py`. Helper / library code uses a module-level `_SPEC = LstarSpec()` constant — `LstarSpec` is stateless, so a single shared instance is fine. Internal Store helpers (`aggregate`, `update_head`, `accept_new_attestations`, `update_safe_target`, `tick_interval`, `validate_attestation`, `prune_stale_attestation_data`, `extract_attestations_from_aggregated_payloads`, `compute_block_weights`) are not yet on the spec surface and are left as direct method calls — they migrate alongside the body move in the next stage. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
38 tasks
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
Stage 4B of the multi-fork architecture refactor (#686): rewrite test call sites that go through container methods to instead go through the fork's spec class.
The pattern:
How tests get `spec`
Two patterns:
Out of scope
Internal Store helpers (`aggregate`, `update_head`, `accept_new_attestations`, `update_safe_target`, `tick_interval`, `validate_attestation`, `prune_stale_attestation_data`, `extract_attestations_from_aggregated_payloads`, `compute_block_weights`) are not yet on the spec surface and are left as direct method calls — they migrate alongside the body move in the next stage.
Subspec call sites (`subspecs/sync/`, `subspecs/validator/`, etc.) are also out of scope here — they migrate when the bodies move.
Test plan
🤖 Generated with Claude Code