[dash][S5] block-replay harness — BIP152 compact-block reassembly (additive, single-coin) - #118
Conversation
…dditive-only
Port vendor/blockencodings.{hpp,cpp} into src/impl/dash/coin/vendor/
additive-only; SERIALIZE_METHODS->C2POOL_SERIALIZE_METHODS collision
rename (4 sites). dash_block_replay static lib target wired in
CMakeLists.txt. TX_WITH_WITNESS consumed read-only from bitcoin_family
(no shared-layer touch). BlockDumper + rpc.hpp held out of smoke.
Stacked on #114 (S4-pre) tip fadf44d — replay path needs
block.hpp/transaction.hpp from #114 diff.
Add test_dash_block_replay (10 cases) over the vendored blockencodings port (foundation bdecc5c): full round-trip with all txs missing, serialize/deserialize-then-reassemble wire round-trip, mempool- and extra_txn-satisfied short IDs, and the documented INVALID rejection paths (null header, empty body, too-few/too-many getblocktxn txs), plus BlockTransactionsRequest/BlockTransactions wire round-trips. Wires test_dash_block_replay into test/CMakeLists.txt linking the additive dash_block_replay static lib; no ltc/pool SCC dependency. ctest -R DashBlockReplay: 10/10 green on Linux x86_64.
test_dash_block_replay is registered via gtest_add_tests in test/CMakeLists.txt but was absent from the build.yml --target lists, so CI never built the binary and ctest reported all 10 DashBlockReplay cases as "Not Run" (10/592 fail). Add the target to both the Linux x86_64 and ASan+UBSan build lists, alongside the sibling test_dash_x11_kat / test_dash_header_chain dash targets. Additive, single-coin, no API change.
|
Review verdict (ltc-doge-production-steward, LTC+DOGE production / consensus perspective): GREEN — approve the additive slice. (Posted as a comment; same-account self-review blocks a formal GitHub Approve.) Consensus correctness — PASS. The BIP-152 reassembly is a faithful port of dashcore blockencodings: short-ID derivation (SipHash-2-4 over SHA256(header||nonce), 6-byte mask, SHORTTXIDS_LENGTH==6 static_assert), the prefilled-index walk (lastprefilledindex += index+1, uint16 overflow + shorttxids+i bound), the collision guards (bucket_size>12 to FAILED, size-mismatch to FAILED), the mempool/extra_txn short-ID matching with have_txn de-dup, and the FillBlock missing-tx fill order + too-few/too-many INVALID checks all match upstream semantics. The witness-hash to serialized-hash adaptation (InitData extra_txn compare, GetShortID input) is correct for DASH specifically because DASH has no segwit, so txid == wtxid == Hash(pack(tx)); encoder and decoder use the same hash, so it is internally consistent. One load-bearing follow-up gate (non-blocking here). Adaptation #3 removes the CheckBlock() call from FillBlock, so the reassembler does NOT verify the reconstructed tx set hashes to the header merkle root. That is fine for THIS PR — the lib is additive and unlinked (no live code path), test-only — but it is a hard precondition for the S6 PR that wires FillBlock into the block-receive path: the merkle-root equality check MUST exist at the consuming layer, or a peer can hand us a block whose reassembled body diverges from its header. Recommend gating the integration PR on demonstrating that check. Isolation — PASS. 6 files, all under src/impl/dash/, test/, or build.yml; no other coin src/impl tree touched. build.yml is a pure ctest-target append (test_dash_block_replay next to test_dash_header_chain in both job blocks) — same class as the x11_kat/header_chain additions, NOT a per-coin source-presence guard relaxation. dash_block_replay static lib + test exe are additive; nothing else links them. Note: wire byte-parity rests on the round-trip property in the tests, not an external dashcore corpus (Corpus-KAT fenced per operator). Acknowledged, out of scope. CI green @4f0c9c88, replay 333-342 / 592 pass. — ltc-doge-production-steward |
S5: DASH block-replay (replay stage)
Stacked on #114 (S4-pre, merged). Additive-only, dash-isolated.
Commits
bdecc5c2feat(dash): S5 block-replay foundation — port vendor/blockencodings additive-only32ee7fcatest(dash): S5 block-replay — BIP152 compact-block reassembly ctest (10 gtest cases)Scope
blockencodings+dash_block_replaystatic lib (additive, no shared-src edits)test_dash_block_replay.cpp: 10 gtest cases, BIP152 compact-block reassemblyLocal verification (Linux x86_64)
ctest -R DashBlockReplay→ 10/10 passing (run from build/, real count confirmed)Notes
SAFE-ADDITIVE.