dgb: bind AutoRatchet {mint,vote} selector to the share-mint path (Phase B) - #294
Merged
Merged
Conversation
Phase B pool/share. run_loop_mint.hpp::mint_local_share_with_ratchet is the
live create_local_share() caller seam: it asks dgb_select_mint_versions for the
{share_version, desired_version} pair and forwards it to an injected create
step, replacing the previously hardcoded 36/36 default. A bootstrap VOTING node
now mints the DGB baseline 35 while voting 36, so it cannot skip ahead of the
older DGB sharechain. No new policy: get_share_version owns the work-weighted
gate. Header-only, injected create step keeps it off the ~30-arg create surface.
+2 KAT in dgb_share_test (24/24): version pair threaded not hardcoded (35!=36
proves both fields independent), result returned verbatim, stamp stable while
VOTING.
frstrtr
added a commit
that referenced
this pull request
Jun 21, 2026
…ssify->dispatch) [#82 leg-2 / Stage 4d] Replace the Stage-4a mining_submit stub with the live hot path. Reconstruct the 80-byte DGB block header from the JobSnapshot + miner inputs (coinbase = coinb1||en1||en2||coinb2; merkle ascent from the coinbase txid; header = version|prev|merkle|ntime|nbits|nonce, all little-endian / prevhash reversed to internal order), run the DGB-Scrypt PoW digest through the #286 scrypt_pow SSOT, expand both compact targets via compact_to_target, and classify via the Stage-4d submit_classify SSOT (tighten-first): WonBlock -> serialize the full block (BIP144 coinbase witness when segwit active) and hand it to the dual-path broadcaster submit_block_fn (P2P relay + submitblock RPC fallback, #82); scream-never-drop on a won block that reaches no sink. ShareAccept -> forward the found-share fields to try_mint_share (the #295 producer seam -> #294 mint bind); degrades to accepted-without- credit when no mint fn is wired (no silent drop). Reject -> stratum low-difficulty error. work_source.cpp / work_source_test.cpp only; per-coin isolation held. The header layout is byte-for-byte Bitcoin (only the PoW digest differs, Scrypt); no share format, coinbase commitment, or PPLNS math touched -> p2pool-merged-v36 surface NONE. +3 KATs pin the three-way ladder dispatch by job targets (23/23).
frstrtr
added a commit
that referenced
this pull request
Jun 21, 2026
…ssify->dispatch) [#82 leg-2 / Stage 4d] (#297) Replace the Stage-4a mining_submit stub with the live hot path. Reconstruct the 80-byte DGB block header from the JobSnapshot + miner inputs (coinbase = coinb1||en1||en2||coinb2; merkle ascent from the coinbase txid; header = version|prev|merkle|ntime|nbits|nonce, all little-endian / prevhash reversed to internal order), run the DGB-Scrypt PoW digest through the #286 scrypt_pow SSOT, expand both compact targets via compact_to_target, and classify via the Stage-4d submit_classify SSOT (tighten-first): WonBlock -> serialize the full block (BIP144 coinbase witness when segwit active) and hand it to the dual-path broadcaster submit_block_fn (P2P relay + submitblock RPC fallback, #82); scream-never-drop on a won block that reaches no sink. ShareAccept -> forward the found-share fields to try_mint_share (the #295 producer seam -> #294 mint bind); degrades to accepted-without- credit when no mint fn is wired (no silent drop). Reject -> stratum low-difficulty error. work_source.cpp / work_source_test.cpp only; per-coin isolation held. The header layout is byte-for-byte Bitcoin (only the PoW digest differs, Scrypt); no share format, coinbase commitment, or PPLNS math touched -> p2pool-merged-v36 surface NONE. +3 KATs pin the three-way ladder dispatch by job targets (23/23). Co-authored-by: frstrtr <frstrtr@users.noreply.github.com>
frstrtr
added a commit
that referenced
this pull request
Jun 23, 2026
…ssify->dispatch) [#82 leg-2 / Stage 4d] (#297) Replace the Stage-4a mining_submit stub with the live hot path. Reconstruct the 80-byte DGB block header from the JobSnapshot + miner inputs (coinbase = coinb1||en1||en2||coinb2; merkle ascent from the coinbase txid; header = version|prev|merkle|ntime|nbits|nonce, all little-endian / prevhash reversed to internal order), run the DGB-Scrypt PoW digest through the #286 scrypt_pow SSOT, expand both compact targets via compact_to_target, and classify via the Stage-4d submit_classify SSOT (tighten-first): WonBlock -> serialize the full block (BIP144 coinbase witness when segwit active) and hand it to the dual-path broadcaster submit_block_fn (P2P relay + submitblock RPC fallback, #82); scream-never-drop on a won block that reaches no sink. ShareAccept -> forward the found-share fields to try_mint_share (the #295 producer seam -> #294 mint bind); degrades to accepted-without- credit when no mint fn is wired (no silent drop). Reject -> stratum low-difficulty error. work_source.cpp / work_source_test.cpp only; per-coin isolation held. The header layout is byte-for-byte Bitcoin (only the PoW digest differs, Scrypt); no share format, coinbase commitment, or PPLNS math touched -> p2pool-merged-v36 surface NONE. +3 KATs pin the three-way ladder dispatch by job targets (23/23). Co-authored-by: frstrtr <frstrtr@users.noreply.github.com>
frstrtr
added a commit
that referenced
this pull request
Jun 23, 2026
…mer seam Re-lands the #294 mint_local_share_with_ratchet helper, which was lost from master in the #292/#293/#294 stacked squash-merge (no #294 merge commit reaches origin/master; the primitives dgb_select_mint_versions + create_local_share survive). This is the consumer adapter DGBWorkSource::MintShareFn binds to (work_source.hpp:197): on a ShareAccept submission it parses the 80-byte reconstructed header, asks the live AutoRatchet for the {mint, vote} version pair, and inserts the share via create_local_share, returning the minted hash (NULL on a malformed header / fail-closed). Authored against master createlocal_share signature (authoritative). Duck-typed on the inputs so the header does not pull the stratum work_source TU in. Pure adapter: tracker-insertion thread-safety is the caller bind point concern. KAT (dgb_share_test, no new exe): 80-byte header parse round-trip, short-buffer fail-closed, and adapter fail-closed + template instantiation drift-guard against create_local_share. 25/25 green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase B pool/share. Closes the gap integrator flagged: the {mint,vote} selector finally gets a live create_local_share() caller bound.
What
src/impl/dgb/run_loop_mint.hpp::mint_local_share_with_ratchet(ratchet, tracker, best_share, createFn)— asksdgb_select_mint_versionsfor the{share_version, desired_version}pair and forwards it into the create step, replacing the hardcoded 36/36 default oncreate_local_shares trailing version args.create_local_sharesurface (the run-loop binds every other field; this helper only chooses+forwards the version pair).Why it matters
A freshly-started VOTING node now mints DGB baseline 35 while voting 36 — it cannot skip ahead of the older DGB sharechain (oracle 22761e7, SUCCESSOR=None). No new policy:
get_share_versionstill owns the work-weighted 60%-gate (#249/#289).Tests
+2 KAT in dgb_share_test, 24/24 green:
Landing
Stacked on #293 (needs
auto_ratchet_wire.hpp). Order: 292 -> 293 -> this; rebase to master once the 292->293 stack lands. Consensus-adjacent (selects minted version) -> surface-for-tap, HOLD, no self-merge.