You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
segbuild shares the node's BTC block cache, so segments are incomplete for any cold reader #410
segbuild shares the node's BtcBlockCache, so a segment is built against a cache warmed by the segments before it. The Bridge's deep walks — a peg-in's confirmation count, a pegout's UTXO selection — are then served from memory, those trie nodes are never read, never promoted into the window store, and never sealed into the segment. The segment is complete only for a reader whose cache happens to be warm the same way; a cold reader gets None for a node the chain has.
This is the §6.9d hazard in docs/trie-segments-design.md and the cause of the false consensus-divergence report in #374.
Measured
A whole-chain re-execution (9,429,718 blocks, 106 segments) reading state through the segment set with an archival trie behind it recorded every read a segment could not serve:
reads served by the fallback
510,219
distinct nodes
499,385
blocks responsible
133
segments affected
77 of 106
absent from both stores
0
Every one of the 133 blocks performs a deep Bridge walk. 29 segments contain none and are already self-contained.
Fix
Give segbuild its ownBtcBlockCache rather than cloning the node's. Private rather than merely cleared, because clear() on the shared Arc would wipe the live node's cache at every segment boundary while it syncs. ~2 MB at the default 10,000 entries.
Clear it at the top of build_range, so the build's read set matches a replay that starts cold at the same boundary.
Clearing beats disabling: the cache still pays for itself within a range, and a disabled cache would make the build read a superset of what any replay needs.
Cost
The nodes the fix adds are exactly the ones the measurement found missing: ~6,486 per affected segment (~646 KB), ~48.6 MB over the whole set — 0.029% of 161 GB. It does not grow as segments get shorter, because the cost attaches to blocks rather than to segments: 133 blocks perform a deep walk whatever the cut points are.
Validation
A replay without a fallback that still verifies every root. A replay with one cannot test this — the archive silently covers every hole, which is how the defect survived this long.
Note
Existing segments are not repaired by this. 77 of them need repair_segments, which re-executes only the 133 blocks that exposed holes and works on a writable copy (~101 GB for the affected subset). Until the builder is fixed, a node that resumes building adds fresh holes to the set being repaired.
Activity