mirror of
https://github.com/luxfi/consensus.git
synced 2026-09-24 00:26:58 +00:00
bufferVoteLocked now dedups by (BlockID, NodeID): at most one parked vote per validator per block (a repeat from the same NodeID REPLACES, never appends), the dual of certVotes' NodeID keying. Closes single-Byzantine-ID buffer crowd-out — one NodeID can occupy at most one slot per block, so it cannot flood maxBufferedVotesPerBlock junk entries and crowd genuine validators out of the buffer fast-path. catchupRequested gains a hard cap (maxCatchupRequested=4096) + TTL sweep (catchupRequestTTL=30s) + reclaim-on-known at the tracked/decided early returns and the accept/reject/sync sites — fail-closed against a forged-ID flood whose entries layer-1 reclaim never fires for. The fetch is GATED on buffer acceptance: a vote the buffer refused fires NO fetch (no amplification), giving a bounded global fetch ceiling of min(maxBufferedVoteBlocks, maxCatchupRequested). maxBufferedVotesPerBlock raised 256->512 to cover the 500-validator tokenomics tier (alpha~334) so the buffered fast-path never silently drops genuine votes. Red probes (fetch_on_unknown_vote_red_test.go) all green under -race: TestRED_BufferedVote_DedupByNodeID, TestRED_CatchupRequested_UnboundedUnderForgedVoteIDs, TestRED_FetchStorm_NoGlobalRateLimit, TestRED_ProcessPendingFinalizesSubTwoThirdsStake (safety: no finalize without verified 2/3-stake cert preserved).