dash(s6): merkle-root-equality conformance precondition - #130
Merged
Conversation
Cross-check the production gentx+merkle_link reconstruction (coinbase::merkle_branches_raw + check_merkle_link, index 0) against an independent in-test canonical reduction and out-of-band CPython double-SHA256 KAT vectors, across 1/even/odd-duplicate-last tree shapes. This locks the merkle-root-equality invariant that all downstream V36 conformance comparisons against the older p2pool-dash oracle depend on. Registers test_dash_conformance in test/CMakeLists.txt and in BOTH build.yml --target lists (avoids the X11Kat-class false-green where a CMake target absent from CI --target never builds and reports Not Run).
Pin the DASH-specific payout entry wire format (masternode/superblock/ platform payments) against frstrtr/p2pool-dash data.py packed_payments: CompactSize-prefixed payee VarStr + LE64 amount, CompactSize vector count. KATs computed out-of-band with CPython (not circular). Adds round-trip inverse check. test_dash_conformance 9/9 green (Linux x86_64).
…culty KAT) Pin dash::coinbase::bits_to_difficulty() == p2pool-dash bitcoin_data.target_to_difficulty (difficulty_1 = 0xffff*2**208 / target). Six out-of-band CPython KAT vectors (compact size 0x1b..0x20, diff 4.7e-10..1.6e4); lossless top-64 truncation, agree to last ULP. test_dash_conformance now 13/13.
Pin dash::pplns::compute_payouts floored-proportional split (per-share weight = bits_to_difficulty, worker/donation split by m_donation/65535, dust drop, always-emitted donation residue line) against out-of-band CPython KAT vectors, no node dependency. Test-local synthetic ShareChain scaffolding: minimal back-linked DashShares carrying only the fields compute_payouts reads, owned by the chain (ShareVariants::destroy). bits fixed to 0x1d00ffff (difficulty exactly 1.0) so weights are integer and running sums are bit-exact in any order, leaving only the split fractions, which IEEE-double C++ and CPython evaluate identically -> reproducible non-circular KAT. Three cases: proportional split (A 2 shares / B 1 share, V=1 DASH -> 66666666 / 33333333 / donation 1, sorted by script), donation-weight split (10% donation -> 90000762 worker / 9999238 donation), cold-chain fallback to single fallback-script payout. ctest -R DashConformance 16/16 green Linux x86_64. No build.yml change (same test_dash_conformance exe, gtest auto-discovers).
Conform DASH older-than-v35 -> v36 negotiation to frstrtr/p2pool-dash (Option A). Two tallies kept deliberately apart (F10 version-gate trap): plain per-share get_desired_version_counts drives the 60%% SUCCESSOR confirmed-state guard / AutoRatchet; a separate work-weighted get_desired_version_weights drives the v36 95%% activation gate. Out-of-band CPython KATs, non-circular, on synthetic back-linked DashShare chains via ShareVariants. src/impl/dash only; ctest -R DashConformance 20/20.
frstrtr
marked this pull request as ready for review
June 17, 2026 18:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
S6 slice 1 — establishes the merkle-root-equality invariant that all downstream V36 conformance comparisons (against DASH's OWN older-than-v35 oracle, frstrtr/p2pool-dash) depend on. No node dependency.
What it does
dash::coinbase::merkle_branches_rawbuilding the index-0 branch +dash::check_merkle_linkwalking it) against an independent in-test canonical reduction (pairwise SHA256d, duplicate-last on odd).False-green guard:
test_dash_conformanceregistered in test/CMakeLists.txt AND in BOTH build.yml--targetlists — the X11Kat-class trap (CMake target absent from CI --target → Not Run, macOS/smokes false-green) is explicitly avoided.Local Linux x86_64: built clean, ctest 3/3 (tests 361-363 ran, real nonzero count).
Follow-on (gated, not in this slice): real captured-corpus KAT vectors from a live Dash node (VM200/201), pending integrator node-state green (.157 VOTING / .82 dup=0 / .145 re-peered). External dashd-RPC fallback retained, not touched.
HEAD: 2698890 (GPG-signed).