Skip to content

dash(s6): merkle-root-equality conformance precondition - #130

Merged
frstrtr merged 7 commits into
masterfrom
dash/s6-conformance
Jun 17, 2026
Merged

dash(s6): merkle-root-equality conformance precondition#130
frstrtr merged 7 commits into
masterfrom
dash/s6-conformance

Conversation

@frstrtr

@frstrtr frstrtr commented Jun 17, 2026

Copy link
Copy Markdown
Owner

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

  • Cross-checks the production gentx+merkle_link reconstruction (dash::coinbase::merkle_branches_raw building the index-0 branch + dash::check_merkle_link walking it) against an independent in-test canonical reduction (pairwise SHA256d, duplicate-last on odd).
  • Pins both against out-of-band CPython double-SHA256 KAT vectors (so the pins are not circular with the C++ under test), across 1 / even / odd-duplicate-last tree shapes.
  • Single-tx case: gentx IS the root, branch empty, walk is identity.

False-green guard: test_dash_conformance registered in test/CMakeLists.txt AND in BOTH build.yml --target lists — 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).

frstrtr added 7 commits June 17, 2026 15:38
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
frstrtr marked this pull request as ready for review June 17, 2026 18:50
@frstrtr
frstrtr merged commit 8d700a8 into master Jun 17, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant