Repository navigation
Description
Migrated from SergioDemianLerner/rustock#263 (pull request by @SDL-A1, 2026-10-05).
Merged: yes. The commits are already in this repository's history.
Original: SergioDemianLerner/rustock#263
Mainnet, 2026-10-04: the node computed a wrong state root at #9,296,505 and stopped for good. The cause was not execution.
The canonical index had seven broken links in 8,580 blocks. #9,292,505 named a losing sibling instead of the block #9,292,506 actually builds on. REMASC settles a height 4,000 blocks later, read that index, paid the wrong set of siblings, and produced a state root the rest of the network does not share.
Two gaps let a stale pointer live that long
Nothing looked below the executed head. verify_coherence ran I3 — the canonical chain links to itself — over Scope::Delta { from: executed, to: validated_head }. A reorg rewrites pointers at and below the fork point, which is underneath that window, and a height is never examined again once execution passes it.
The window now starts COHERENCE_LOOKBACK (1,000, matching MAX_REORG_DEPTH) below the executed head — the whole of where a reorg can do damage. Two point lookups per height per sweep.
Nothing repaired a stale pointer. repair_canonical_gap existed and worked, but its only trigger was a missing entry. A stale one is not missing. And ensure_canonical_lineage could not reach it either: that walk stops at the first consistent pair, so damage below a healthy stretch is invisible to it by construction.
I3 violations now call the repair directly, alongside I5–I8.
Plus an offline repair
--repair canonical rebuilds the index by walking the head's own ancestry down through --repair-from. parent_hash is the authority: every block names its parent, and the head is on the chain this node accepted, so walking down yields the one chain the index should describe.
An index rebuild, not a re-download — the headers were all present.
Run against mainnet, 2026-10-05
repair canonical: walking #9296579 down to #9270000 (26579 blocks)
repair canonical: 7 pointer(s) rewritten, 0 hole(s) filled in 15.0s
Node stopped 04:44:31, started 04:45:17 — 46 seconds of downtime. It resumed from #9,296,504, executed past #9,296,505 for the first time in thirteen hours, and was fully caught up within three minutes. A re-scan reports zero breaks.
Tests
The new test asserts both halves: that the widened window reports the break, and that the window which shipped before provably cannot see it.
2,029 workspace tests pass.
🤖 Generated with Claude Code
Activity