WO-19 — node storage redesign¶
Status: DONE WO-19 — builder acceptance complete, ready for independent review.
Date: 17 October 2026.
Handoff: private main at 92c8ded, decision #33.
Code: public ~/Documents/E46Tessera, branch wo-19-storage.
Base: 2a70ba8.
Final commit: fae421cf80d5f525949533bad3a84123518d3ea9.
Commits, in order: 8db681b (storage/checkpoint), 718e17f (bounded four-worker fixture tool), fae421c (startup deferred-branch regression and fix). No push, merge, rebase, or amend. Public working tree is clean; local identity remains 3xc@users.noreply.github.com. This report and evidence are in the private repo, left for the owner/reviewer to commit.
Implementation¶
IndexEntryholds header, raw record, identity/ancestry, height/work, pool totals, size and validation flags. It contains noStateor coin set.Stateis noncopyable; the node owns one active tip state.Active blocks have undo containing original spent/overwritten coins, created outpoints, added commitments, previous pools and at most 11 prior timestamps. Disconnect restores those changes. Detached branches retain their raw records, not their undo.
Side admission performs checks independent of spent coins. Full witness/spend validation waits until cumulative work strictly exceeds the active tip. A failed switch reconnects the original branch, marks the failure and descendants invalid and logs the reason. Stored rejected records have byte-bound local rejection metadata so restart does not retry them.
Startup first indexes all branch headers, then validates the strongest eligible chain. A regression demonstrated that the earlier implementation could transiently activate a losing branch in filename order. It failed before this fix and passes afterward on both builds.
mine_onexplicitly requires the active tip. Historical active-block reads reconstruct from raw records and the transaction index. Deferred side bodies are not exposed bygetblockas fully validated blocks; this limitation is documented.Removed the P2P total 4,096-block ceiling. Kept the 512 side-branch budget, held-checkpoint policy, 1 GiB disk floor and the existing transport bounds. Transport remains v1.
Acceptance evidence¶
All final evidence is preserved in artifacts/WO-19, including per-command differential outputs, daemon logs, rollback outputs, mined fixtures, compiler flags, and a SHA-256 manifest.
Criterion |
Evidence and result |
|---|---|
1. Builds |
Both presets configured with |
2. Differential |
Old binary built from detached |
3. Existing suites |
22/22 P2P milestones on dev and 22/22 on sanitize; both end |
4. Real-PoW reorgs |
Both builds end |
5. Linear storage |
Structural: |
6. Unchanged boundaries |
Original 274 chain records still match pre-task hashes, with no additions/removals. Record serialization remains |
Exact reorg evidence¶
PASS one-block switch, equal-work stability, abandoned record and restart
BALANCE deep before_A=7019042970 after_A=0 after_B=10528564455
PASS two-block disconnect, three-block connect, balances and restart
PASS restart indexes losing side branch without decoding or connecting it
Rejected branch 4361de35637a2dc818ed36f5c6c4341ecc23e05ffad38d97e5fd86390d94298d: Stored transaction spends an unknown output
PASS invalid second block rolls back exact state, descendants rejected without retry, restart preserved
PASS rollback: 6 byte-identical snapshot/mempool/balance/utxos outputs after restart
PASS all branch stores reproduce identical snapshots after explicit rebuild
ALL STORAGE REORG CHECKS PASSED
The owner generated the real-PoW fixtures locally. The final resumed invocation used one worker, not four, and completed b3, bad2, bad3 in 832.855 s, 167.919 s, 219.719 s respectively. Every generated block used unchanged testnet bits 494927871 (0x1d7fffff); no target reduction or validation bypass. Earlier completed b1/b2 were reused and all records validated by the exercise. The test tool also supports an optional 1–4 worker argument and a shared wall-clock deadline.
Reproduction¶
Working evidence root: /tmp/e46s-ij5l4kil. Original chain ~/E46-testnet/chain-wo17 was only read to copy/hash it; every node run used disposable copies. Old detached worktree: /tmp/e46s-ij5l4kil/old. The preserved private evidence includes the seven branch records, so repeating reorg checks does not require mining again.
From the public repo (use fresh output directory names on each repetition):
cmake --preset dev -DE46_BUILD_STORAGE_TESTS=ON
cmake --build --preset dev
cmake --preset sanitize -DE46_BUILD_STORAGE_TESTS=ON
cmake --build --preset sanitize
python3 tests/storage_replay.py \
--old /tmp/e46s-ij5l4kil/old/build/dev/e46-node \
--new build/dev/e46-node --chain /tmp/e46s-ij5l4kil/fixture \
--output /tmp/e46-review-diff
python3 tests/p2p_integration.py --node build/dev/e46-node \
--chain /tmp/e46s-ij5l4kil/fixture --payment /tmp/e46s-ij5l4kil/payment.tx.hex
ASAN_OPTIONS=detect_leaks=0 python3 tests/p2p_integration.py \
--node build/sanitize/e46-node --chain /tmp/e46s-ij5l4kil/fixture \
--payment /tmp/e46s-ij5l4kil/payment.tx.hex
python3 tests/datadir_defaults.py --node build/dev/e46-node
ASAN_OPTIONS=detect_leaks=0 python3 tests/datadir_defaults.py --node build/sanitize/e46-node
python3 tests/storage_reorg.py --tool build/dev/e46-storage-checks \
--node build/dev/e46-node --fixtures /tmp/e46s-ij5l4kil/branches \
--output /tmp/e46-review-reorg
ASAN_OPTIONS=detect_leaks=0 python3 tests/storage_reorg.py \
--tool build/sanitize/e46-storage-checks --node build/sanitize/e46-node \
--fixtures /tmp/e46s-ij5l4kil/branches --output /tmp/e46-review-reorg-san
./build/dev/e46-storage-checks stats /tmp/e46s-ij5l4kil/fixture
Limits and remaining scope¶
RSS is a single 274-record measurement, not a 10,000-block benchmark; linear storage is supported by structure and the counter. Reorg fixtures cover ordinary coinbase balances and an invalid ordinary spend, not a new QTL relay or dependent-mempool resurrection exercise. The existing newest-first disconnected-transaction reconsideration behavior is preserved. Post-quantum transport (#32), public binding/deployment and other queued work were not started. No open consensus decision was needed for this storage change. Independent reviewer acceptance is still to follow.