Skip to content

dgb(#82): SSOT gentx coinbase assembler + oracle-pinned round-trip KAT - #171

Merged
frstrtr merged 1 commit into
masterfrom
dgb/gentx-coinbase-ssot
Jun 18, 2026
Merged

dgb(#82): SSOT gentx coinbase assembler + oracle-pinned round-trip KAT#171
frstrtr merged 1 commit into
masterfrom
dgb/gentx-coinbase-ssot

Conversation

@frstrtr

@frstrtr frstrtr commented Jun 18, 2026

Copy link
Copy Markdown
Owner

What

Per integrator [2026-06-19T00:00 +04] adjudication: the coinbase-byte factor + round-trip KAT, scoped to factor + KAT only (won-block-reaches-network wiring is fix #82, kept separate).

  • Extract 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()`. Pure (already-built scripts/amounts; no tracker/share-template dep) so it is directly KAT-able. This is the one builder that `create_local_share()` and the won-block reconstruction body will consume in follow-up slices — the ":2731 same-format" comment is the smell being deleted, not a third builder.
  • 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. PASS proves build → non-witness serialize → double-SHA256 == oracle bytes and txid, not mere self-consistency.

Coverage

  • No-segwit layout (payouts ++ donation ++ op_return)
  • Witness-commitment-first layout — the only DGB↔BCH divergence is the gated segwit predicate at serialize time, exercised here
  • Isolation guard: toggling the predicate changes only vout-count + one prepended 0-value commitment vout

Verification

Out of scope (sequenced, not absorbed)

HOLD merge.

…-trip KAT

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.
@frstrtr
frstrtr force-pushed the dgb/gentx-coinbase-ssot branch from 5089c6e to 79d7a33 Compare June 18, 2026 21:26
@frstrtr
frstrtr merged commit 6b7454a into master Jun 18, 2026
17 checks passed
frstrtr added a commit that referenced this pull request Jun 19, 2026
…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.
frstrtr added a commit that referenced this pull request Jun 19, 2026
…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.
frstrtr added a commit that referenced this pull request Jun 19, 2026
…icate pin

Pins the one real DGB<->BCH coinbase divergence: BCH gates the SegWit
commitment vout on is_segwit_activated(version), which the p2poolBCH oracle
derives from getattr(net,"SEGWIT_ACTIVATION_VERSION",0) -> 0 -> false for
every share version. Asserts the predicate is OFF across v17..v36 (and the
sentinel stays disabled), so a regression re-introducing a non-zero
SEGWIT_ACTIVATION_VERSION (the old stray-17 port -> sharechain fork) fails CI.
Wired into BCH_ABLA_TESTS (pure, header-only over share_types.hpp).
Byte-vector half (full coinbase vs oracle ground-truth) is the follow slice.

Separate BCH-lane PR per per-coin isolation; #171 stays DGB-tree only.
p2pool-merged-v36 surface: none.
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