mirror of
https://github.com/luxfi/consensus.git
synced 2026-09-24 00:26:58 +00:00
Table test locking the dynamic BFT committee (effectiveCommittee/bftCommittee) the finality gates size from the LIVE validator set — the owner's "prove each rung" gate. Rungs (genuine n-validator chain, presetK=n so the minBFTCommittee floor is inert): n=1 → 1-of-1 (single validator self-finalizes; no peer to fork against) n=2 → 2-of-2 (f=0; a 1-of-2 quorum violates 2α−n>f, so BOTH must agree — safety) n=3 → 3-of-3 (>⅔ of 3 is 3; 2-of-3 is exactly ⅔, not a supermajority) n=4 → 3-of-4 (2f+1) n=5 → 4-of-5 (the mainnet C-Chain rung) Each rung: assert effectiveCommittee == (n, bftAlpha(n)), drive a symmetric sibling storm (every validator builds a competing block on genesis), and require the fleet to converge on ONE finalized head (no fork/double-finalization). Plus the two tricky low rungs: n=1 self-finalizes correctly, and n=2 with a peer down must NOT self-finalize on one vote (2-of-2 fail-closed) — the safety boundary between "genuine single validator" and "any larger set". The 21→5/α4 SHRINK of a large preset + the minBFTCommittee=4 floor (1085013 guard) are covered by TestViewChange_MainnetParams_5Validators_CommitteeFromStakeSource + TestFix1_*. Test-only; effectiveCommittee shipped v1.35.33. Passes under -race. Co-authored-by: Hanzo Dev <[email protected]>