Skip to content

Commit 32e3972

Browse files
fix(storage): store fork-choice votes independently (#552)
## 🗒️ Description / Motivation This PR fixes fork-choice vote tracking so validator votes are stored independently from aggregated proofs and gossip signatures. Previously, fork-choice votes were derived from bounded in-memory proof/signature buffers. When those buffers evicted old entries through FIFO cleanup, a validator’s latest vote could disappear even though the vote should still count for fork choice. This PR adds a separate proof-less vote store so fork-choice weights are not affected by proof/signature retention. ## What Changed - Updated `crates/storage/src/store.rs` - Added an independent latest-vote store keyed by validator index. - Records known fork-choice votes when aggregated payloads become known. - Records block-included attestation votes separately from proof storage. - Keeps proof buffers for aggregation/proposal behavior only. - Prunes stored votes once their target is finalized. - Updated `crates/blockchain/src/store.rs` - Inserts block-included attestation votes into the independent vote store during block processing. ## Correctness / Behavior Guarantees - Fork-choice votes no longer disappear when proof or signature buffers evict entries. - Existing proof/signature buffer behavior is preserved for aggregation and block proposal. - Latest-vote selection keeps the existing rule: higher slot wins, and same-slot ties use the canonical attestation-data root. - Finalized-target votes are pruned once they can no longer affect fork choice. ## Tests Added / Run - Added regression coverage for votes surviving aggregated proof FIFO eviction. - Added coverage for pruning finalized-target votes from the independent vote store. ## Related Issues / PRs - Closes #504 ## ✅ Verification Checklist - [x] Ran `make fmt` — clean - [x] Ran `make lint` (clippy with `-D warnings`) — clean - [x] Ran `make test` (`cargo test --workspace --profile release-fast`) — all passing --------- Co-authored-by: Tomás Grüner <47506558+MegaRedHand@users.noreply.github.com>
1 parent b4a8f78 commit 32e3972

1 file changed

Lines changed: 187 additions & 108 deletions

File tree

0 commit comments

Comments
 (0)