Skip to content

test(dash): G1 difficulty/vardiff parity KAT — share-diff floor + per-share min_work oracle pin#628

Merged
frstrtr merged 1 commit into
masterfrom
dash/g1-difficulty-parity-kat
Jul 5, 2026
Merged

test(dash): G1 difficulty/vardiff parity KAT — share-diff floor + per-share min_work oracle pin#628
frstrtr merged 1 commit into
masterfrom
dash/g1-difficulty-parity-kat

Conversation

@frstrtr

@frstrtr frstrtr commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Non-fenced, consensus-NEUTRAL warm-lane slice authorized by integrator (keep the migration-gating byte-parity groundwork landable without an operator tap).

What

New pure/socket-free KAT test/test_dash_difficulty_parity.cpp (6 tests) pinning the DASH sharechain difficulty surface to oracle-EXACT arithmetic from frstrtr/p2pool-dash (networks/dash.py + bitcoin/data.py):

  1. share-diff floor byte-exactnessdash::SharechainConfig::max_target() mainnet 0xFFFF*2**208, testnet 2**256//2**20-1.
  2. per-share min_workchain::target_to_average_attempts(floor) = 2**256//(target+1) → mainnet 4295032833 (0x100010001), testnet 1048576 (2**20). This is the quantity ShareIndex accumulates from m_max_bits (share_chain.hpp:228).
  3. min_work accumulation identity — per_share*N (DASH-floor numbers).
  4. floor bits roundtrip — m_max_bits <-> floor target, exponent 0x1d.

Every expected value derived INDEPENDENTLY from the oracle integer formula (derive comments inline), not read back from the SUT — true parity pin, not a tautology.

Why a DASH-specific KAT

The cross-coin APS-over-chain accumulation is already pinned LTC-instantiated in test_compute_share_target.cpp. This closes the DASH-lane gap: the config floor + min_work-per-share numbers differ (p2pool-dash, not p2pool-ltc) and had no dedicated KAT.

Verify

Built + ran on workstation Linux x86_64: ctest -R ^DashDifficultyParity → 100% 6/6, non-hollow (out of 6). GPG-signed (50AB1379285EFE76).

No prod-consensus mutation (read-only difficulty accounting). Review-gated → integrator verify (oracle + full CI) → operator tap. No self-merge.

@frstrtr frstrtr force-pushed the dash/g1-difficulty-parity-kat branch from fd064d6 to c2ef6a7 Compare July 4, 2026 00:31
frstrtr added a commit that referenced this pull request Jul 4, 2026
Rebase-clean union of the #628-vs-#630 add_executable collision left
target_link_libraries(test_dash_share_messages) opened but unterminated
with add_executable(test_dash_stratum_binding) interleaved into it,
producing CMake parse error at test/CMakeLists.txt:322 (missing ending
) and breaking configure on all platforms (macOS/Windows failed fast;
Linux would follow). Split into two complete, separate target blocks.
Configure clean; test_dash_stratum_binding builds; ctest 6/6.
frstrtr added a commit that referenced this pull request Jul 4, 2026
Rebase-clean union of the #628-vs-#630 add_executable collision left
target_link_libraries(test_dash_share_messages) opened but unterminated
with add_executable(test_dash_stratum_binding) interleaved into it,
producing CMake parse error at test/CMakeLists.txt:322 (missing ending
) and breaking configure on all platforms (macOS/Windows failed fast;
Linux would follow). Split into two complete, separate target blocks.
Configure clean; test_dash_stratum_binding builds; ctest 6/6.
@frstrtr frstrtr force-pushed the dash/g1-difficulty-parity-kat branch from c2ef6a7 to 870ed06 Compare July 4, 2026 19:25
frstrtr added a commit that referenced this pull request Jul 4, 2026
#630)

* test(dash): S8 stratum-binding contract KAT (extranonce2 nonce64-slot)

Fenced test-only slice: pins the get_work() -> stratum job BINDING contract
(coinbase nonce64 / extranonce2 slot geometry + coinb1/coinb2 split and
reassembly that partitions the miner search space) against oracle
frstrtr/p2pool-dash @9a0a609 work.py:21,421,436-438.

6 KATs, all derived independently of the SUT (oracle contract + Python
sha256d goldens):
  Extranonce2WidthOraclePin  EXTRANONCE2_SIZE == COINBASE_NONCE_LENGTH == 8
  SplitBoundaryGeometry      coinb1=bytes[:off], coinb2=bytes[off+8:]
  ZeroNonceIsIdentity        zero nonce reassembles gentx byte-for-byte (:437)
  SlotIsolation              only the 8 slot bytes move across extranonce2
  BindingInjectivity         distinct extranonce2 -> distinct coinbase leaf
  GoldenLeafHashes           independent sha256d byte-parity anchors

Pure/socket-free/node-free (synthetic CoinbaseLayout, no dashd, no
sharechain). Touches only test/ + build.yml allowlist -> IDENTIFIER-neutral,
non-consensus, independently landable ahead of the migration GO. No
self-merge.

* fix(dash): untangle test/CMakeLists.txt stratum-binding merge resolution

Rebase-clean union of the #628-vs-#630 add_executable collision left
target_link_libraries(test_dash_share_messages) opened but unterminated
with add_executable(test_dash_stratum_binding) interleaved into it,
producing CMake parse error at test/CMakeLists.txt:322 (missing ending
) and breaking configure on all platforms (macOS/Windows failed fast;
Linux would follow). Split into two complete, separate target blocks.
Configure clean; test_dash_stratum_binding builds; ctest 6/6.

---------

Co-authored-by: frstrtr <frstrtr@users.noreply.github.com>
@frstrtr frstrtr force-pushed the dash/g1-difficulty-parity-kat branch from 870ed06 to fcd8424 Compare July 4, 2026 20:03
frstrtr added a commit that referenced this pull request Jul 4, 2026
…fix #628 NOT_BUILT red)

The Release+ASan/UBSan job build --target list omitted test_dash_difficulty_parity,
so the target was never built there and ctest reported "could not find executable"
(NOT_BUILT sentinel -> red). The first (Release) job already listed it; CMake wiring
is correct and the target builds+links (6/6 DashDifficultyParity pass locally). Add the
target to the second allowlist to match.
frstrtr added a commit that referenced this pull request Jul 4, 2026
…fix #628 NOT_BUILT red)

The Release+ASan/UBSan job build --target list omitted test_dash_difficulty_parity,
so the target was never built there and ctest reported "could not find executable"
(NOT_BUILT sentinel -> red). The first (Release) job already listed it; CMake wiring
is correct and the target builds+links (6/6 DashDifficultyParity pass locally). Add the
target to the second allowlist to match.
@frstrtr frstrtr force-pushed the dash/g1-difficulty-parity-kat branch from 6e9c085 to c689cf5 Compare July 4, 2026 21:44
…-share min_work oracle pin

Pins dash::SharechainConfig::max_target() byte-exactness (mainnet 0xFFFF*2**208,
testnet 2**256//2**20-1) and chain::target_to_average_attempts(floor) per-share
min_work (mainnet 4295032833, testnet 1048576) to oracle-independent values
derived from frstrtr/p2pool-dash bitcoin/data.py, plus the min_work accumulation
identity and floor bits roundtrip. Pure/socket-free; 6/6 on Linux x86_64 ctest.
Consensus-neutral (read-only difficulty accounting), independently-landable.
@frstrtr frstrtr force-pushed the dash/g1-difficulty-parity-kat branch from c689cf5 to b3c397a Compare July 4, 2026 22:31
@frstrtr frstrtr merged commit 2fe5ef7 into master Jul 5, 2026
22 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