Skip to content

refactor: move attestation aggregation to natural homes#512

Merged
tcoratger merged 1 commit intoleanEthereum:mainfrom
tcoratger:refactor/move-aggregation-to-natural-homes
Apr 6, 2026
Merged

refactor: move attestation aggregation to natural homes#512
tcoratger merged 1 commit intoleanEthereum:mainfrom
tcoratger:refactor/move-aggregation-to-natural-homes

Conversation

@tcoratger
Copy link
Copy Markdown
Collaborator

Summary

  • Move State.aggregate() and State._select_proofs_greedily() out of State, which only used self.validators as a read-only lookup table
  • select_greedilyAggregatedSignatureProof.select_greedily() — completes the proof lifecycle (select, aggregate, verify)
  • Aggregation orchestration → inlined into Store.aggregate() which owns all three input pools (gossip sigs, new payloads, known payloads)
  • Proof compaction → inlined in State.build_block() where it's the sole caller
  • No new files or types introduced — logic lives where readers would intuitively look for it

Test plan

  • uv run pytest tests/lean_spec/subspecs/containers/test_state_aggregation.py — 9 passed
  • uv run pytest tests/lean_spec/subspecs/forkchoice/test_store_attestations.py — 20 passed
  • uv run pytest tests/lean_spec/subspecs/forkchoice/test_attestation_target.py — 17 passed
  • uvx tox -e all-checks — all green (ruff, format, ty, codespell, mdformat)

🤖 Generated with Claude Code

Move `State.aggregate()` and `State._select_proofs_greedily()` out of
State, which only used `self.validators` as a lookup table.

- `select_greedily` → `AggregatedSignatureProof.select_greedily()`
  completes the proof lifecycle (select, aggregate, verify)
- Aggregation orchestration → `Store.aggregate()` which owns all three
  input pools (gossip sigs, new payloads, known payloads)
- Proof compaction → inlined in `State.build_block()` where it is used

No new files or types introduced. Tests updated to go through Store.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@tcoratger tcoratger merged commit 0027d58 into leanEthereum:main Apr 6, 2026
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant