mirror of
https://github.com/luxfi/consensus.git
synced 2026-09-24 00:26:58 +00:00
Fixes the mainnet 1085755 freeze: consensus finalized an outer envelope (topology logs "finalized block via α-of-K quorum cert voters=4") but the local EVM never Accepted, so the inner head stayed frozen at the parent while the height was network-final. ROOT: under pChainHeight=0 anyone-can-propose, every validator wraps the SAME inner execution block in its OWN outer proposervm envelope. Votes are canonical-keyed (they bind the inner commitment, not the envelope), so an α-of-K cert forms — but its Position.BlockID names ONE specific envelope. HandleIncomingCert did a STRICT pendingBlocks[cert.Position.BlockID] lookup; a node holding a DIFFERENT alias envelope of the same inner block missed it and requestCatchup'd for a redundant alias instead of finalizing the local wrapper it already held and verified. The α-of-K cert existed network-wide, yet the local VM.Accept was never called → the EVM head froze. FIX: on the envelope-miss path, resolve the LOCAL wrapper of the cert's CANONICAL id (pendingByCanonicalLocked) and finalize THAT via the sole finalizer (AcceptWithCert → FinalizeBranch), rebasing the verified cert onto the local envelope (copy Position, swap only the transport ids BlockID/ParentID — outer ids are not signed, so the α votes verify unchanged). Full canonical-tuple + height equality is required and the rebased cert RE-VERIFIES against the local epoch before finalizing; a forged or epoch-mismatched cert falls back to catch-up. One certified inner block, any wrapper of it Accepts the identical execution — no fork (per-height gate keys on the canonical id; a duplicate envelope of an already-final canonical is idempotent). Regression (fail-on-old / pass-on-new): - TestEVMAcceptGap_InnerHeadAdvancesOnSiblingCert — inner VM lastAccepted lags at the parent, must advance to H after a sibling-wrapper cert finalizes. - TestStormAlias_PeerCertFinalizesLocalWrapper_EVMAccepts — local wrapper VM.Accept called exactly once; height finalizes to the canonical inner id. - TestStormAlias_NoLocalWrapper_FallsBackToCatchup — no over-reach: a node holding no wrapper of the certified inner block defers to catch-up. Full engine/chain suite green; -race safety set (Fix1/1085013 self-finality floor, inversion sub-quorum/epoch, decentralization, RoundView fork bounds, incident_1082814, ViewChange mainnet committee) green. Co-authored-by: Hanzo Dev <[email protected]>