WO-19 review — node storage redesign¶
Reviewer: Claude · Date: 17 October 2026 · Verdict: PASS, with four minor follow-ups (none blocking)
Reviewed: public E46-Tessera, branch wo-19-storage, commit fae421c (base 2a70ba8) · builder report WO-19-REPORT.md
Scope check¶
Only
src/node.cpp,include/e46/node.hpp,src/p2p.cppchanged in the source tree, plus tests, CMake anddocs/P2P.md. Header/PoW, transaction, QTL, emission, Merkle, RL sources untouched. Nothing pushed or merged; local identity unchanged.IndexEntryholds no coin set;Statecopy constructor and assignment are deleted;State next = parent.stateis gone.connectis exception-safe: any failure restores that block’s partial changes (catch (...) { restore(changes); }). Validation rules are carried over unchanged from the oldaccept_internal.
Acceptance criteria, re-run independently¶
# |
Criterion |
My result |
|---|---|---|
1 |
Builds |
dev and sanitize ( |
2 |
Differential |
on my own fresh copy of the 274-block chain: 282 pairs, 0 differences, 0 empty, 0 errors, diffed by me file by file (not only the script’s summary). Old binary verified as clean |
3 |
Existing suites |
P2P 22/22 dev and sanitize, 0 sanitizer diagnostics; datadir checks pass on both |
4 |
Real-PoW reorgs |
|
5 |
Memory |
RSS 11,424 → 5,792 KiB in my run; structure confirmed |
6 |
Unchanged |
fixture byte-identical to the original chain; GOLD not touched or copied |
Surprise exam (tests the builder did not design)¶
Test |
Result |
|---|---|
Invalid branch delivered over P2P to a live daemon (A: 2 blocks; peer serves b1 → bad2 → bad3) |
tried, rejected, rolled back; daemon alive; snapshot byte-identical to before; tip stays |
Side block at height 1 offered to a node on the real 274-block chain |
refused: “below the block-268 checkpoint”; still 274 files |
|
snapshot, getblock, balance, utxos, mempool identical to a cleanly built reference; stale control socket handled |
INVENTORY of 1,000 random (unknown) IDs |
12 ms, same as |
INVENTORY of 1,000 known confirmed txids |
1 peer 14 ms; 8 peers 58 ms vs 11 ms on |
Cold start + snapshot, 274 blocks |
23 ms vs 28 ms (faster) |
Minor follow-ups (not blocking)¶
M1. Known-txid INVENTORY decodes a block per ID.
Node::get_transactionnow decodes the whole stored block (historical_block) and the P2P inventory/next-tx paths call it just to test membership. Eight peers flooding real txids: 58 ms (was 11 ms; still ~36× better than before the 15 Oct hardening). Fix: a membership-onlyhas_transaction(txid)(index + mempool) for those checks.M2.
getblock <side-branch id>used to return the block; nowERR Block is not fully validated, even for a block that was valid while active (after a restart). Inherent to the design (decoding needs the branch’s coins) and documented; the message should say “side-branch block: body unavailable off the active chain”, and header fields could still be shown. No wallet or explorer path uses it.M3.
mark_invalidwalks every stored block back toward genesis: O(blocks × height). Only runs when an invalid branch out-works the active chain, so not a practical attack; an ancestor set would make it linear.M4.
historical_cointakes the first indexed occurrence of a txid (front()), which can be a disconnected block. Only the spent coin’s creation height could differ; outputs are identical. Prefer the active occurrence.
Recommendation¶
Merge wo-19-storage into public main. M1–M4 can go in a small follow-up, M1 first (it is a few lines).