Skip to content

dgb: end-to-end GBT-parity KAT for embedded coinbasevalue - #274

Merged
frstrtr merged 1 commit into
masterfrom
dgb/coinbasevalue-gbt-parity-kat
Jun 20, 2026
Merged

dgb: end-to-end GBT-parity KAT for embedded coinbasevalue#274
frstrtr merged 1 commit into
masterfrom
dgb/coinbasevalue-gbt-parity-kat

Conversation

@frstrtr

@frstrtr frstrtr commented Jun 20, 2026

Copy link
Copy Markdown
Owner

What

End-to-end GBT-parity KAT for the embedded coinbasevalue. Drives a populated embedded Mempool through the production make_mempool_tx_source -> EmbeddedCoinNode -> build_work_template wiring (exactly src/c2pool/main_dgb.cpp:233) and asserts the emitted template coinbasevalue is bit-for-bit the figure digibyted getblocktemplate reports:

coinbasevalue == subsidy(next_height) + sum(included-tx fees)

across every DGB reward era (the captured p2pool-dgb-scrypt oracle vectors).

Why this slice

The existing tests pin each link in isolation:

  • dgb_embedded_tx_select_testmake_mempool_tx_source shaping + fee sum
  • dgb_embedded_coin_node_test — a stub tx source folds fees into coinbasevalue
  • dgb_work_source_test — stratum path era subsidy + GBT-verbatim

None pinned the assembled chain equals GBT. Per integrator (2026-06-20), before the embedded subsidy+fees derivation may stand in for the external-daemon GBT coinbasevalue, parity must be KAT'd as EXACTLY equal.

GBT-parity verified: for every era boundary the populated-mempool embedded coinbasevalue equals oracle_subsidy + total_fees — the digibyted GBT figure — bit-for-bit. The KAT also pins:

  • behaviour-preserving displacement: embedded (no-GBT) equals resolve_coinbase_value with the GBT figure present, when they agree;
  • the HARD INVARIANT: a present GBT coinbasevalue is returned verbatim even on divergence (embedded never overrides a live digibyted figure).

Scope / safety

  • Test-only, non-consensus — no production value change; fenced to src/impl/dgb/test/. Auto-mergeable per fenced-slice rules.
  • Subsidy oracle = dgb::CoinParams::subsidy (bit-for-bit p2pool-dgb-scrypt replica).
  • Links the full dgb_coin codec like dgb_embedded_tx_select_test; new target added to CMake + both build.yml --target allowlists (ci: build test_dgb_subsidy in both Linux test jobs (fix master-red NOT_BUILT) #143 NOT_BUILT trap).
  • 4/4 PASS locally; GPG-signed.

Pin the assembled embedded coinbase-value path: a populated Mempool driven
through the production make_mempool_tx_source -> EmbeddedCoinNode ->
build_work_template wiring (main_dgb.cpp:233) must emit

    coinbasevalue == subsidy(next_height) + sum(included-tx fees)

at every DGB reward era -- bit-for-bit the figure digibyted getblocktemplate
reports. The prior tests pinned each link in isolation (tx-select shaping,
stub-source fee fold, work-source era subsidy); none pinned the assembled
chain equals GBT. Also pins behaviour-preserving displacement (embedded ==
GBT-present path when they agree) and the HARD INVARIANT that a present GBT
coinbasevalue stays authoritative verbatim.

Test-only, non-consensus: subsidy oracle is dgb::CoinParams::subsidy
(p2pool-dgb-scrypt replica). Links the full dgb_coin codec like
dgb_embedded_tx_select_test; added to CMake + both build.yml --target
allowlists (#143 NOT_BUILT trap). 4/4 PASS.
@frstrtr
frstrtr force-pushed the dgb/coinbasevalue-gbt-parity-kat branch from 5ce02f5 to fd1e407 Compare June 20, 2026 17:10
@frstrtr
frstrtr merged commit fac36c3 into master Jun 20, 2026
30 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