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

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 remedythe bill
correct — a batch just can’t be proven as cutre-cut, re-prove; revert-and-recommit on L1time, nothing else
correct — the verifier wrongly rejects itverifier fix, an urgent-but-ordinary protocol upgradea settlement pause, governance-paced
wrong, tolerablyratify the deviationtrust, spent deliberately
wrong, unacceptablythe disaster hardforkfinalized 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:

tierwho can revert it
L2-finalizedall the operators together, by this chapter’s procedure — nobody less
L1-committedthe settler, via the ordinary batch-revert path — routine machinery
L1-executedno 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:

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:

  1. 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.
  2. 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).
  3. 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.
  4. 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

Where this lives in our stack

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.