mirror of
https://github.com/luxfi/consensus.git
synced 2026-09-24 00:26:58 +00:00
Root cause of the testnet VM-layer lag: applyBranchFinalization swallowed VM.Accept's error (_ = vmb.Accept(ctx)) and marked the block finalized + advanced decidedFloor/finalizedThrough regardless. When the EVM refused a consensus-finalized block (empty-block rejection), consensus finalized it anyway and the durable floor ran AHEAD of the EVM accepted head (floor 427 while EVM stuck at 415) — a permanent divergence. FIX (fail-closed): VM.Accept is now called BEFORE committing a block's finality and its error is CHECKED. applyBranchFinalization accepts ascending, commits each block's finality only after the VM applied it, STOPS at the first VM.Accept error, and returns highestAccepted = the highest height the VM actually applied. acceptWithCertCore advances the durable floor ONLY to highestAccepted (never past it) and propagates the error — the chain HALTS at an un-appliable block rather than diverging. Losers are pruned + the serving cert stored only on a full clean accept. This kills the divergence at its source (defense-in-depth even after the VM-side fix that makes finalized-empty blocks appliable). Existing finalize/cert/accept/view-change/RED suites green. Co-authored-by: Hanzo Dev <[email protected]>