Repository navigation
fix(rpc): version the attester slashings pool by the wall clock - #672
MegaRedHand wants to merge 1 commit into
Conversation
GET /eth/v2/beacon/pool/attester_slashings named the fork of the head slot in `version` and Eth-Consensus-Version. The Beacon API means the active consensus version, so at a fork boundary whose block is late or missing the head lags the clock and a validator client decoded the list as the previous fork. The version now comes from the wall-clock epoch. The pooled slashings are electra-shaped, and their JSON is identical in every fork (only the SSZ bound of the attesting indices differs), so no conversion is needed. The other pool GETs carry no version, and the attestation pool reads it from the request slot already.
🤖 Kimi Code ReviewI'll review this PR focusing on the consensus-critical change from head-based to wall-clock-based fork versioning for attester slashings. Overall AssessmentThis is a correct and necessary fix for a consensus edge case at fork boundaries. The change aligns with the Beacon API specification's intent that the "active consensus version" should follow the wall clock, not the head state. Detailed Review
|
| Aspect | Assessment |
|---|---|
| Fork choice safety | No impact — this is an API presentation layer change |
| Validator client compatibility | Improved — prevents mis-decoding at fork boundaries |
| SSZ correctness | Unaffected — JSON serialization is fork-agnostic for this container |
| Spec compliance | Aligned with Beacon API "active consensus version" concept |
The critical insight in the comment (line 80-81) is correct: AttesterSlashing containers differ only in SSZ list bounds for attesting indices, which don't affect JSON representation. This means the pool can store electra-shaped slashings indefinitely without conversion overhead.
Minor Suggestions
- Line 555: Destructure tuple instead of
.0access for clarity - Line 550-551: Consider adding a brief comment explaining why
beacon_store_at(state)creates the wall-clock/head divergence, since the test setup's timing behavior may not be obvious to future readers
Verdict
Approve with minor nits. The fix is correct, well-tested, and properly documented. The edge case at fork boundaries is real and this prevents validator clients from misinterpreting fork versions when blocks are delayed or missing at transition epochs.
Automated review by Kimi (Moonshot AI) · kimi-k2.6 · custom prompt
🤖 Claude Code ReviewReview of PR 672: version the attester slashings pool by the wall clock The change is small and looks correct. I only read the diff and the code around it. I didn't build the crate or run the tests.
Two minor points, neither blocking:
I'd approve this. Automated review by Claude (Anthropic) · sonnet · custom prompt |
🤖 Codex Code ReviewLooks good overall. The change aligns the
No requested changes from me. Automated review by OpenAI Codex · gpt-5.4 · custom prompt |
Motivation
GET /eth/v2/beacon/pool/attester_slashingstook itsversionandEth-Consensus-Versionfrom the head slot's fork. Right after a fork boundary whose first block has not arrived, the head is still on the old fork while beacon-APIs means the current (wall-clock) epoch's fork. Found while auditing for the head-versus-wall-clock bug class (#663, #670).Change
versionandEth-Consensus-Versioncome fromfork_at_epochof the wall clock's epoch.proposer_slashings,voluntary_exits,bls_to_execution_changes) are not versioned by the head, so nothing else changes.cargo test -p ethlambda-rpc --lib --profile release-fast, clippy and fmt clean.