Chapter 12 · ~15 min
DISASTER! — the worst can happen
Finalized and settled are two different promises — the taxonomy of their disagreement, and the remedies priced by what they spend.
What you’ll walk away with
- Why the committee can be unanimously wrong: verify-before-vote is replication, not diversity — and the one independent check in the loop votes at settlement time
- The four classes of “finalized but will not settle”, and the remedy ladder priced by what each remedy spends: time, a pause, trust, finalized blocks
- Why the disaster hardfork is constitutional rather than convenient — keys can’t do it, it’s loud forever, and its floor is L1-executed state
The page chapter 8 can’t triage
It’s 3:47 am again. The page says settlement lag — batches stopped settling,
prover-side failures. You run chapter 8’s drill without thinking now: count the
committee — all four up. Staleness — none; blocks are finalizing on the second.
Evidence counters — zero. withhold, invalid — zero everywhere. Every instrument
that chapter gave you agrees: the chain is healthy.
And it is. That’s what makes this the worst page. The chain is fine; the machinery that turns finalized blocks into settled L1 state is rejecting what the committee finalized. Two dashboards, each green by its own lights, disagreeing about reality.
Both are right. Understanding how that’s possible — and exactly what to do about it — is this chapter.
Nobody lied
Rewind to chapter 7. When Theodora proposes a block, Zoe re-executes it before voting — inputs bounded by the validity rules, outcome compared bit for bit. She’s the reason a lying proposer costs one wasted view instead of a corrupted chain.
But re-executes it with what? With the same state-transition build — the same
zksync_os — that Theodora used to make the block, and that Basil and Justinian run
too. Now suppose that shared binary has a bug: some path charges the wrong fee, or
honors an operation the spec forbids. Theodora’s proposal contains the bug’s output.
Zoe’s re-execution reproduces it faithfully. The comparison passes. Four validators,
one opinion, zero dissent — and wrong. Nobody misbehaved. Not even Justinian.
The committee proves agreement, not correctness. Four copies of the same calculator can be unanimously wrong — and sign a certificate saying so.
Verify-before-vote is replication, not diversity: it catches a proposer that lies, never a binary that is honestly wrong on every machine at once. The one independent implementation in the loop is the proving stack — same spec, different machinery — and it renders its verdict at settlement time, minutes to hours after users were told “final”. BFT finality and settled finality are two different promises, kept by different machinery, and a state-transition bug is the one crack between them.
(Chapter 1’s aside showed the committee catching a broken prover. This chapter is the mirror image: the prover catching what the whole committee missed. Defense in depth, pointed the other way.)
One calibration before the remedies: everything below is rare by construction — chapter 9’s entire harness exists to keep it that way. This chapter isn’t a prediction. It exists so that if one of these ever fires, the response is a runbook rather than a 3 am invention.
For the rigor-minded: why not just run two different binaries?
The structural fix for replication-not-diversity is execution diversity: N independently implemented state transitions, so a bug must fire identically in different codebases to slip through. The wider industry does practice this at the client level, and it costs exactly what it sounds like: building and forever maintaining N implementations of a hard spec, plus deciding what happens when they disagree at the tip. Where our stack invests instead, today, is one implementation tested six ways (chapter 9) plus one genuinely independent late checker that already has to exist — the circuit. Whether diversity ever gets added is a roadmap question; the repo, as always, is the source of truth for what’s deployed.
One question, then a ladder
When settlement lags and the provers are unhappy, triage starts with one question, and it’s answerable by machine:
Is the chain’s state wrong, or is it merely unprovable as packaged?
Independent re-execution of the affected range answers it, and the answer selects the class. There are four, ordered by what the remedy costs:
| the state is… | the remedy | the bill |
|---|---|---|
| correct — a batch just can’t be proven as cut | re-cut, re-prove; revert-and-recommit on L1 | time, nothing else |
| correct — the verifier wrongly rejects it | verifier fix, an urgent-but-ordinary protocol upgrade | a settlement pause, governance-paced |
| wrong, tolerably | ratify the deviation | trust, spent deliberately |
| wrong, unacceptably | the disaster hardfork | finalized blocks |
Two structural facts about this table. The first two classes never touch history — no governance, no ceremony, users never know. And the line between the last two is a judgment, not a computation: whether a deviation can be ratified or must be excised is a governance decision. What the system owes governance is a safe mechanical path for either answer.
Classes one and two: history never moves
An unprovable batch — resource exhaustion, witness too large, a prover defect — means the state is fine and the packaging isn’t. Batch boundaries are not consensus-fixed: uncommitted batches can be re-cut freely, and a committed-but-unexecuted batch can be reverted on L1 and re-committed in a different shape — commit discovery treats superseded commitments as routine. Re-shape, re-prove, move on. The committee never hears about it.
A verifier that rejects a correct outcome is the same diagnosis with a stubborner patient: the chain computed exactly what the spec says, and the judge is wrong. The state stands; the fix is a verifier upgrade, shipped urgently but through the ordinary protocol-upgrade machinery. The detail worth engraving: sequencing continues throughout. The chain does not stop because settlement paused. Deposits keep flowing — they ride finalized L1, not our batches. Withdrawals wait with settlement; that’s the whole bill, paced by governance.
Class three: ratify it, in the open
Now re-execution disagrees with the chain. The recorded history deviates from the spec — say a fee path undercharged: 80 collected where 90 was owed, bounded range, known cause — and governance judges the deviation acceptable. The remedy is to ratify it: an emergency protocol upgrade, authorized through the security council, that lets the affected range settle. History — the thing users hold receipts against — stands. The spec is amended to acknowledge what the chain actually did, and the state-transition fix ships alongside so the deviation stays bounded to its range.
This spends trust, deliberately and visibly — which is exactly why it lives behind governance rather than behind a knob. And the permanent record matters as much as the remedy: a ratified deviation becomes part of the chain’s definition — the spec, plus the ratified deviations at their recorded heights — and the postmortem documents it as such. Ratification is the opposite of a cover-up: it’s a deviation made permanent, public record. (The disaster doc is candid that a pre-armed, faster authorization lane is a designed-for evolution; what exists today is the deliberate one. As ever, the doc is the source of truth.)
Class four: the fork
And then there’s the deviation that must not be ratified — an operation the spec forbids, executed for someone’s gain. Blessing it into the chain’s definition would launder theft with a council signature. The only honest exit left is to discard the poisoned suffix and re-execute: the disaster hardfork, an operator-coordinated era change that abandons finalized blocks above an agreed height N.
Hold on. Chapter 8 told you un-finalizing a block is a category error — and that stays true. Inside the protocol there is still no such thing: no message, no vote, no quorum of keys can revert finality. What this section describes is not an undo inside the system. It’s the operators, outside the system, agreeing to abandon it above N and start a new era that permanently remembers the old one. Three properties make that constitutional rather than convenient, and all three are enforced by machinery rather than by memory:
- Operators fork; keys cannot. A fork is configuration, deployed out of band —
there is deliberately no in-protocol path, because any such path would be a
standing “compromise a quorum of keys, rewrite history” channel. And the honest-
majority requirement enforces itself by arithmetic: a new era adopted by a quorum
produces a live chain; stragglers on the dead era disrupt only themselves; a fork
adopted by less than a quorum produces no live chain on either side. A mandatory
consensus.protocol_versionbump partitions the network at the handshake, so forked and un-forked nodes can’t exchange a single interpretable byte. - The fork is loud, forever. The finality store is never touched: the abandoned era’s certificates stay on every node as the permanent, auditable record that finalized blocks were overridden — by whom, and from where. The truncation tool additionally exports every discarded block to a tombstone archive with a manifest naming each block, its hash, and its consensus digest: raw material for the postmortem and for anyone who acted on the old tip.
- The floor is L1-executed state. N must sit at or above the last block of the last batch executed on L1 — and the tool verifies that floor against L1 directly, never against local watermarks, which can lag exactly when it matters. Irreversibility comes in three tiers, and the fork lives strictly in the first:
| tier | who can revert it |
|---|---|
| L2-finalized | all the operators together, by this chapter’s procedure — nobody less |
| L1-committed | the settler, via the ordinary batch-revert path — routine machinery |
| L1-executed | no one. Reversing it would be an L1 emergency upgrade — a different document’s disaster |
Fork day, compressed
The full numbered runbook lives in the disaster doc — it’s the reference, and if you’re ever actually here, you’ll be reading it, not this page. What this guide owes you is the shape, because every step is a chapter you’ve already read wearing work clothes:
L1 first, consensus second. Reverting the committed-but-unexecuted batches above N is the settler’s jurisdiction, done and verified before anyone touches an era. So the settler is stopped first and held down — its recovery machinery would otherwise faithfully recreate and re-commit the exact batches being discarded; that’s not a bug, that’s chapter 8’s crash-recovery design working against you. Then the rest of the committee halts, observers included.
Truncation. Every node whose chain extends past N runs
zksync-os-server truncate-to --to-block N — the one genuinely new primitive. It
refuses to run on a live node, below the L1 floor, or on a state backend that
couldn’t replay afterwards (FullDiffs only); it exports the tombstone before
cutting; and it truncates the write-ahead log, the state diffs, and the
repositories — a forked node must not keep serving discarded receipts over RPC.
What it deliberately leaves: the finality store (the evidence), the merkle tree
(it rewinds itself on replay), preimages. Every cut is idempotent — an interrupted
run re-runs safely.
The cross-check. Every node’s tombstone manifest records
hash_at_truncation_point, and they must all agree. This is chapter 8’s
fingerprint discipline at its most consequential: a disagreeing node skipped a
step, and the runbook stops until someone finds out which.
The new era. Each validator clears its consensus engine state (the era guard
requires a deliberate clear — exactly as in a re-migration) and deploys the fork
config: consensus.genesis_height = N, the bumped protocol version, the committee
schedule re-anchored at epoch 0 of the new era, and one more thing —
consensus:
acknowledge_fork: "<N>:<block hash at N>"
Nobody forks by config accident. The era guard refuses to override a recorded era without the acknowledgment, refuses an acknowledgment whose height or hash doesn’t match the node’s own chain, and refuses a chain that doesn’t end exactly at N. (On a registry-governed chain, the fork schedule is a config entry — chapter 11’s break-glass precedence, doing precisely the job it was kept for.)
The binary, before the restart. The state-transition fix that motivated the fork must roll to every node before it restarts — a precondition, not a follow-up. Re-execution from N re-ingests the discarded window’s transactions through ordinary channels (deposits re-land from their L1 cursors; users resubmit), and under the unpatched binary they would re-execute the very deviation the fork exists to expel. The tombstoned blocks themselves are never replayed into the new era; they’re only mined for the postmortem.
Restart — settler last. Validators come back, fingerprints agree, blocks finalize from N+1. The settler returns only after the L1 revert is verified — and if someone jumps the gun, a backstop guard refuses to start a settler whose L1 shows committed batches past its local chain, naming the revert step in the error. The guard exists to catch a runbook mistake, not to perform the revert.
For the rigor-minded: why the new era can’t collide with the old one
Epoch numbering restarts at zero in a new era, so anything the finality store keys by epoch — custody transitions, registry derivations, floor caches — is scoped by era to keep a dead era’s records from shadowing the live one’s. Certificates are digest-keyed and global, which is exactly right: they’re the permanent evidence, and both eras’ certificates coexist forever. Consensus heights are era-relative (the anchor is height zero), so the new era cleanly restarts its own epoch arithmetic no matter where the old one stood. None of this is fork-special — it’s the same era machinery every migration uses, which is why the fork could be built mostly from parts that already existed.
The fork is a tested feature
Everything above is executable, and runs as such:
- The arithmetic is pinned in simulation (lib/consensus/sim/tests/fork_back.rs): a quorum fork abandons the suffix and lives; stragglers on the dead era strand without disrupting it; a below-quorum fork freezes both eras until a quorum forms — the constitutional cost, as a passing test. A real-STF scenario forks a chain with actual execution and proves every validator re-converges to identical state.
- The choreography runs against real nodes, real storage, and a real L1 (integration-tests/tests/node/fork.rs): halt, truncate through the tool, fork configs, restart, resume, settle — including the settler backstop refusing a premature restart.
- And the disaster doc closes with a devnet rehearsal: the full runbook, by hand, on the local consensus devnet you met in chapter 10 — recommended once per operator generation. Its phrase, worth keeping: that rehearsal is the difference between a runbook and a legend.
Blast radius is detection depth
Last idea, and it reframes the whole chapter. The fork unwinds everything above N cleanly inside the system — but every block between the deviation and its detection is suffix to discard, and everything that consumed those blocks is outside the fork’s reach: L1 execution is excluded by the floor (that’s what the floor is for), and whoever else credited the old tip gets a tombstone manifest and a postmortem. So the damage a class-four incident does is not fixed by the remedy — it’s fixed by how early something independent screamed.
That turns “how quickly does a proving failure page a human” from a batching detail into a safety parameter. The prover isn’t just the checker of record; it’s the canary that decides how deep the excision goes.
Your turn: run fork day
The drill below is this chapter as a control room. Top lane: the L2 chain, finality checkmarks and all. Bottom lane: L1 settlement — batches committing, proving, executing — with the dashed line between them marking the L1-executed floor. Across the top sits the committee, Theodora’s node doubling as the settler, exactly like the devnet. Ten steps take one class-four incident from healthy loop to healed loop, and the buttons inside the scene are yours — nothing advances past a decision until you make it. Missions:
- Run it clean, end to end. Pause at step 3 and watch two things: the certificates never leave the poisoned blocks, and the chain keeps growing while settlement chokes — that growth is blast radius, accumulating.
- Reset and do it wrong on purpose: try every anchor on offer, skip the L1 revert, restart without the acknowledgment, acknowledge on the settler only. The drill hides three machine refusals and one judgment call — collect all four (the completion line keeps score).
- Sit with the judgment call for a second. The tool happily accepts N = 15, because no tool can know which block is poisoned — and it accepts N = 12 too, which works and wastes two good finalized blocks. Say out loud whose job that knowledge is.
- Watch blocks 13 and 14 across the whole drill: they survive the fork untouched while their batch is reverted and re-cut around them — batches are packaging, blocks are history. Then, after the heal, read the annotation: same batch number, new shape, the floor moved up. The discarded window’s transactions came back through mempools and deposit cursors — the tombstone itself never replays; it exists for the postmortem.
The four things to keep
- Verify-before-vote is replication, not diversity: a shared state-transition bug gets unanimously certified, and the proving stack — the one independent implementation — finds out at settlement time. Two promises, one crack.
- Triage is one question: is the state wrong, or merely unprovable as packaged? Re-execution answers it, and the remedy ladder prices the four answers: time → a pause → trust → finalized blocks. The first two never touch history; between the last two is governance judgment, not computation.
- Ratification is a deviation made permanent public record — never a cover-up (the quiet patch doesn’t even un-stick settlement). Some deviations must be expelled precisely because ratifying them would work.
- The fork is constitutional: keys can’t do it, arithmetic gates it (below-quorum adoption freezes both eras), certificates and tombstones make it loud forever, the floor is L1-executed state, and L1 goes first. And it’s rehearsed — in simulation, in integration, on the devnet.
Where this lives in our stack
- The reference is docs/src/consensus/disaster.md — the taxonomy table, the full numbered runbook, the guard list, and the devnet rehearsal walkthrough. If this chapter’s scenario ever pages you, that page is the one you open. Triage starts from the settlement-lag row of the alarm table in docs/src/consensus/operating.md.
- The truncation tool is node/bin/src/truncate.rs —
its module doc lists exactly what it touches, what it deliberately leaves, and
every guard, in the same order this chapter told them. The era guards and
consensus.acknowledge_forkparsing live in node/bin/src/consensus.rs; the settler backstop is in the node’s startup path in node/bin/src/lib.rs. - The proof it works: lib/consensus/sim/tests/fork_back.rs (the fork’s arithmetic, including the below-quorum freeze) and integration-tests/tests/node/fork.rs (the full drill on real storage and a real L1, plus the backstop).
- The era machinery the fork reuses — anchors, migration guards, era-relative heights — is documented in docs/src/consensus/enabling.md under “Migrating an existing chain into a committee”.
Next: this whole chapter leaned on one quiet assumption — that consensus itself did its job. The blocks were finalized correctly by a working protocol; it was the state that went wrong. The last chapter pulls that thread: what if the layer below is wrong — the algorithm’s math, the library that implements it, the glue we wrote around it? There’s no runbook for a wrong proof. What there is instead is an inventory: every belief named, every belief watched. One more chapter.