Skip to content

dgb(#82): collapse inline gentx serializers onto SSOT (consume #171) - #172

Closed
frstrtr wants to merge 9 commits into
dgb/gentx-coinbase-ssotfrom
dgb/gentx-coinbase-consume
Closed

dgb(#82): collapse inline gentx serializers onto SSOT (consume #171)#172
frstrtr wants to merge 9 commits into
dgb/gentx-coinbase-ssotfrom
dgb/gentx-coinbase-consume

Conversation

@frstrtr

@frstrtr frstrtr commented Jun 18, 2026

Copy link
Copy Markdown
Owner

Stacked on #171 (dgb/gentx-coinbase-ssot). HOLD merge — do not land until #171 is in and the share-path KAT below is added.

What

Collapses the two open-coded coinbase serializers onto the #171 SSOT dgb::coin::assemble_gentx_coinbase():

  • generate_share_transaction (share_check.hpp, verification path)
  • create_local_share (emission path)

Each site now builds only its per-share inputs (coinbase script, optional segwit witness-commitment script, PPLNS payouts, donation, OP_RETURN ref commitment) and hands them to the assembler, which owns wire framing (version|vin|vouts|locktime) + txid. PackStream tx is reconstructed from the SSOT bytes so the V36 hash_link diagnostics are byte-unchanged. emission == verification == one source.

Guardrails honored

  • NO oracle vector regeneration.
  • Single-coin scope: src/impl/dgb/ only; no bitcoin_family/ or core/ touch.
  • net -120/+46 in share_check.hpp (two inline framers deleted).

Evidence (head efcd1e1)

  • dgb build EXIT=0
  • dgb_share_test 5/5 PASS
  • dgb_gentx_coinbase_test 3/3 PASS (oracle vectors unchanged)

REMAINING acceptance item (#2/#3)

A behavioral KAT that drives generate_share_transaction THROUGH the SSOT (not just the pure helper) — the collapse is the thing under test. dgb_share_test has no share-fixture scaffolding today, so this is a follow-up commit on this branch before merge.

The leak harness wraps the run in `timeout 180`, but QtWebEngine spawns
Chromium zygote/helper child processes that survive when timeout SIGTERMs
only the immediate child. The orphans keep the xvfb-run pipe open, so the
job hangs to the 360-min runner default instead of finishing. A job-level
timeout-minutes makes the runner force-kill the whole process tree, so a
hung gate costs ~20 min, not hours. continue-on-error semantics are
unchanged (gate stays advisory during Qt bring-up).
frstrtr added a commit that referenced this pull request Jun 18, 2026
…its SSOT framing

Round-trip equivalence KAT (op_return ref_hash is share-derived, cannot pin a
fixed oracle vector): generate_share_transaction(share) txid == verbatim
re-derivation through the SAME assemble_gentx_coinbase SSOT. Proves the #172
collapse behaviorally, not structurally. 3/3 PASS, txid 9e2b78d5. Wired into
ctest + BOTH build.yml allowlists in this commit (#143 NOT_BUILT trap).
@frstrtr

frstrtr commented Jun 18, 2026

Copy link
Copy Markdown
Owner Author

Share-path KAT landed @438d9533 (GPG-signed).

dgb_gentx_share_path_test 3/3 PASS:

  • GenerateShareTransactionEmitsSsotFraming — round-trip equivalence (op_return ref_hash is share-derived, so no fixed oracle vector; proves consumption, not just the pure helper), txid 9e2b78d5
  • Deterministic
  • CoinbaseInputsAreLoadBearing (mutating inputs diverges txid)

Wired into ctest + BOTH build.yml --target allowlists in the same commit (#143 NOT_BUILT trap avoided). Single-coin scope: no touch outside src/impl/dgb/. HOLD merge — stacked on #171; land #171 (CLEAN rollup) first, no self-merge.

)

Phase B conformance: audited the DGB pool/share constant + tracker
score-period layer against the frstrtr/p2pool-dgb-scrypt oracle
(networks/digibyte.py + bitcoin/networks/digibyte.py) and confirmed
full conformance. Lock the previously-unguarded params against drift in
share_test.cpp (target already in both build.yml allowlists):

  SPREAD=24, TARGET_LOOKBEHIND=100, REAL_CHAIN_LENGTH=2880,
  BLOCK_MAX_SIZE=32000000, BLOCK_MAX_WEIGHT=128000000,
  CoinParams::BLOCK_PERIOD=75 (PARENT.BLOCK_PERIOD, tracker score() denom),
  MAX_TARGET = 2**256//2**20 - 1 = 2^236-1.

Test-only, single-coin, strictly inside src/impl/dgb/test/. No shared
base / bitcoin_family / src/core touched. dgb_share_test 6/6 PASS.

Co-authored-by: frstrtr <frstrtr@users.noreply.github.com>
frstrtr and others added 3 commits June 19, 2026 03:26
…-trip KAT (#171)

Factor the p2pool non-witness coinbase (gentx) wire layout out of
generate_share_transaction() (share_check.hpp:933, the verification SSOT)
into coin/gentx_coinbase.hpp::assemble_gentx_coinbase() so emission and
verification cannot diverge on a byte. Pure: takes already-built
scripts/amounts (no tracker/share-template dependency) so it is directly
KAT-able; this is the single builder that create_local_share() and the
won-block reconstruction body will consume in follow-up slices.

KAT vectors are GROUND-TRUTH from the canonical oracle
frstrtr/p2pool-dgb-scrypt (util/pack.py byte logic + bitcoin/data.py
tx_id_type; donation script 4104ffd0...ac), not self-generated, so a PASS
proves build -> non-witness serialize -> double-SHA256 == oracle bytes/txid,
not mere self-consistency. Covers the no-segwit and witness-commitment-first
layouts; the only DGB<->BCH divergence is the gated segwit predicate at
serialize time. dgb_gentx_coinbase_test 3/3 PASS, build EXIT=0; target wired
into ctest + BOTH build.yml --target allowlists (#143 NOT_BUILT trap avoided).

Scope: factor + KAT only. The won-block-reaches-network wiring (m_on_block_found
and submit_block_hex) is fix #82 and stays separate.

Co-authored-by: frstrtr <frstrtr@users.noreply.github.com>
…tree (#175)

Lay down src/impl/nmc/coin as the P0 structural foundation for embedded
merge-mined Namecoin under a BTC parent (DOGE-under-LTC analog):
header_chain.hpp (AuxPow header interface, parent-powhash path), block.hpp,
transaction.{hpp,cpp}, coin_smoke.cpp TU, plus CMake wiring (nmc_coin lib).

Fences (per integrator ACK msgid 5823428726...):
- btc tree READ-ONLY: NMC consumes src/impl/btc public header types only.
- AuxPow merkle-branch proof walk + block-validation = P0-DEFER stubs.
- vector<AuxChain> stays nmc-local; no lift into bitcoin_family/src/core.
- chain_id / auxpow_activation_height (cited ~19200) / genesis kept as -1
  TO-CONFIRM sentinels, NOT compiled constants — pinning gated on VMID 219
  nmc-testnet landing (chainparams + namecoind ground-truth).

nmc_coin smoke target builds clean (cmake --build --target nmc_coin, exit 0).

Co-authored-by: frstrtr <frstrtr@users.noreply.github.com>
Lands aux_merkle_root() in nmc::coin (header_chain.hpp): the merge-mining
merkle-branch walk that AuxPow::check_proof() will consume for step-1
(chain-merkle-root, aux block hash -> merged-mining root) and step-3
(parent tx-merkle-root, coinbase txid -> parent block merkle root).

Byte-faithful port of legacy libcoind/data.cpp check_merkle_link() -- the
same SSOT btc/ltc use -- kept NMC-LOCAL per coin fence #4 (only core/*
Hash + PackStream; no btc/ltc include). Per-level index bit selects LEFT vs
RIGHT sibling, folded with SHA256d of the 64-byte concatenation; an index
that does not fit branch.size() bits is rejected.

check_proof() stays a P-DEFER stub: marker-scan, parent tx-merkle recompute
and parent PoW are the next sub-slice, so NMC still MUST NOT block-validate
off this leaf.

Test: nmc_auxpow_merkle_test (gtest) pins the walk with INDEPENDENTLY
derived expected roots (empty-branch identity, left/right sibling order,
two-step per-level fold, index-overflow guard). Registered in both
test/CMakeLists.txt and the build.yml --target allowlist. 5/5 PASS, exit 0.
frstrtr added a commit that referenced this pull request Jun 19, 2026
…its SSOT framing

Round-trip equivalence KAT (op_return ref_hash is share-derived, cannot pin a
fixed oracle vector): generate_share_transaction(share) txid == verbatim
re-derivation through the SAME assemble_gentx_coinbase SSOT. Proves the #172
collapse behaviorally, not structurally. 3/3 PASS, txid 9e2b78d5. Wired into
ctest + BOTH build.yml allowlists in this commit (#143 NOT_BUILT trap).
frstrtr added a commit that referenced this pull request Jun 19, 2026
generate_share_transaction computes the coinbase via assemble_gentx_coinbase
(the SSOT proven by #172) but returned only the gentx_hash, discarding the
bytes. reconstruct_won_block needs the exact non-witness coinbase bytes -- it
is block tx[0] and its txid is the merkle leaf -- not just the hash.

Add an optional out_gentx (GentxCoinbase*) param, default nullptr: zero change
for the verification callers, surfaces {bytes,txid} for the reconstructor. KAT
proves the exposed bytes hash to the returned gentx_hash and deserialize into
the coinbase MutableTransaction that assemble_won_block frames, round-tripping
byte-identically (non-witness). Single-coin (src/impl/dgb/ only); reuses the
existing #172 dgb_gentx_share_path_test target (no new allowlist entry).
frstrtr and others added 4 commits June 19, 2026 05:12
ci(qt): cap Qt WebEngine leak gate with timeout-minutes: 20
nmc(P1): AuxPow merkle-proof walk primitive + KAT (DOGE-M3 analog)
…coinbase

generate_share_transaction (verification path) and create_local_share
(emission path) each open-coded the coinbase wire layout
(version|vin|vouts|locktime) and the txid double-SHA256. Two byte paths
pinned to the same oracle vector = proven-equivalent, not unified: a
third edit could still diverge them.

Collapse both onto dgb::coin::assemble_gentx_coinbase() (coin/gentx_coinbase.hpp,
the #171 SSOT) so emission == verification == one source. Each call site
now only builds its per-share inputs (coinbase script, optional segwit
witness-commitment script, PPLNS payout outputs, donation, OP_RETURN ref
commitment) and hands them to the assembler; the assembler owns wire
framing + txid. PackStream tx is reconstructed from the SSOT bytes so the
downstream V36 hash_link diagnostics are byte-for-byte unchanged.

No oracle vector regeneration. Single-coin scope: src/impl/dgb/ only.
dgb build EXIT=0; dgb_share_test 5/5; dgb_gentx_coinbase_test 3/3.
…its SSOT framing

Round-trip equivalence KAT (op_return ref_hash is share-derived, cannot pin a
fixed oracle vector): generate_share_transaction(share) txid == verbatim
re-derivation through the SAME assemble_gentx_coinbase SSOT. Proves the #172
collapse behaviorally, not structurally. 3/3 PASS, txid 9e2b78d5. Wired into
ctest + BOTH build.yml allowlists in this commit (#143 NOT_BUILT trap).
@frstrtr
frstrtr force-pushed the dgb/gentx-coinbase-consume branch from 438d953 to cadec97 Compare June 19, 2026 01:44
frstrtr added a commit that referenced this pull request Jun 19, 2026
generate_share_transaction computes the coinbase via assemble_gentx_coinbase
(the SSOT proven by #172) but returned only the gentx_hash, discarding the
bytes. reconstruct_won_block needs the exact non-witness coinbase bytes -- it
is block tx[0] and its txid is the merkle leaf -- not just the hash.

Add an optional out_gentx (GentxCoinbase*) param, default nullptr: zero change
for the verification callers, surfaces {bytes,txid} for the reconstructor. KAT
proves the exposed bytes hash to the returned gentx_hash and deserialize into
the coinbase MutableTransaction that assemble_won_block frames, round-tripping
byte-identically (non-witness). Single-coin (src/impl/dgb/ only); reuses the
existing #172 dgb_gentx_share_path_test target (no new allowlist entry).
@frstrtr frstrtr changed the title dgb(#82): collapse inline gentx serializers onto SSOT (consume #171) [WIP: share-path KAT pending] dgb(#82): collapse inline gentx serializers onto SSOT (consume #171) Jun 19, 2026
@frstrtr

frstrtr commented Jun 19, 2026

Copy link
Copy Markdown
Owner Author

Superseded — reconciliation: dgb/gentx-coinbase-consume is fully on master (ahead=0 behind=80; git cherry empty). gentx-coinbase SSOT + share-path KAT landed via the merged reconstruct chain. Branch preserved, not deleted.

@frstrtr frstrtr closed this Jun 19, 2026
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