Skip to content

dgb(phase-b): extract PPLNS payout-split SSOT (weights -> consensus-sorted payout outputs) - #328

Merged
frstrtr merged 1 commit into
masterfrom
dgb/pplns-payout-split
Jun 22, 2026
Merged

dgb(phase-b): extract PPLNS payout-split SSOT (weights -> consensus-sorted payout outputs)#328
frstrtr merged 1 commit into
masterfrom
dgb/pplns-payout-split

Conversation

@frstrtr

@frstrtr frstrtr commented Jun 22, 2026

Copy link
Copy Markdown
Owner

Phase B pool/share slice. Lifts steps 2-3 of generate_share_transaction into a pure compute_pplns_payout_split(): weights -> amounts -> consensus-sorted outputs + donation + v36 floor. Additive/fenced, runtime byte-unchanged (no caller wired yet; bridge for build_connection_coinbase gated on #327). KAT 4/4 vs oracle: V36 exact amounts+donation floor, pre-v36 amounts+finder fee, empty-weights all-donation, zero-amount dropped. Build EXIT=0, KAT EXIT=0. HOLD merge (integrator taps with operator push approval).

…orted payout outputs)

Lift steps 2-3 of share_check.hpp generate_share_transaction (PPLNS amount
math + consensus output ordering) into a pure, tracker-free helper
coin/pplns_payout_split.hpp: compute_pplns_payout_split(). This is the bridge
that lets the per-connection Stratum coinbase assembler draw the SAME payout
amount split the share verification SSOT enforces, so emission and verification
cannot diverge on a satoshi.

Additive/fenced: nothing calls it yet (no behavior change). Follow-ons:
(1) delegate generate_share_transaction to it (byte-identity), (2) wire it into
DGBWorkSource::build_connection_coinbase feeding ConnCoinbaseInputs.payout_outputs.

KAT dgb_pplns_payout_split_test: V36 exact amounts + >=1 sat donation floor,
pre-V36 amounts + 0.5%% finder fee, empty-weights bootstrap, zero-amount drop;
all against hand-computed p2pool v36 data.py oracle vectors. Registered in the
test CMakeLists and both build.yml dgb --target allowlists (#143 NOT_BUILT trap).
@frstrtr
frstrtr force-pushed the dgb/pplns-payout-split branch from 34726f1 to fb543dc Compare June 22, 2026 14:17
@frstrtr
frstrtr merged commit e7567e4 into master Jun 22, 2026
32 checks passed
frstrtr added a commit that referenced this pull request Jun 22, 2026
Same bar as the #328 payout-split invariance KAT: prove the #333 lift of
generate_share_transaction() step-1 into compute_pplns_weight_walk() moves
ZERO weight. Embed the pre-refactor inline walk verbatim as
legacy_inline_weight_walk() and assert the helper reproduces it weight-for-
weight (per-script weights, total_weight, total_donation_weight) across a
battery: V36 decay path, pre-V36 grandparent-start + max_weight cap,
donation split, full-donation zero-addr-weight share, the insufficient-depth
guard (both throw identically), null/absent parents, and a chain exceeding the
real_chain_length window. Each weight map is then fed through the #328
payout-split SSOT and the outputs + donation asserted byte-identical, closing
the end-to-end no-payout-satoshi-drifts proof shared by the emission and
verification paths. dgb_share_test 28/28.
frstrtr added a commit that referenced this pull request Jun 22, 2026
build_connection_coinbase_from_pplns delegates the payout split to
compute_pplns_payout_split() -- the same helper generate_share_transaction
(the share verification path, #329) calls -- instead of taking pre-resolved
payout_outputs/donation_amount. The coinbase a miner hashes per-connection and
the coinbase the share check enforces are now byte-identical on every payout
satoshi by construction: one payout implementation, not two kept in agreement.

Pure delegation + field forwarding into build_connection_coinbase_parts; no
inline payout arithmetic. dgb-tree-only. 4 delegation-identity KATs
(V36, pre-V36 finder fee, segwit/ref forwarding, value anchor); 8/8 green.
Stacks on the #328/#329 PPLNS SSOT stack.
frstrtr added a commit that referenced this pull request Jun 22, 2026
Extract generate_share_transaction() step-1 PPLNS tracker walk into
dgb::coin::compute_pplns_weight_walk(), the producer-side counterpart of
the steps 2-3 lift in pplns_payout_split.hpp (#328). The share-verification
path and the per-connection Stratum coinbase emission path now draw one
tracker-walk implementation, so the weight map a miner hashes cannot drift
from the one the verifier enforces.

Verbatim lift: exact V36 depth-decay vs pre-V36 grandparent-start branch,
the data.py insufficient-depth guard, and the block-target/spread max_weight
cap are unchanged. Result type is deduced from the tracker (decltype) to
avoid the share_tracker.hpp <-> share_check.hpp include cycle.

KAT WeightWalkSSOTContract locks the helper contract (verbatim V36 forward +
safe-empty on null/absent parent); the unchanged generate_share_transaction
fixtures prove value-level byte-identity. dgb_share_test 27/27,
dgb_connection_coinbase_test 8/8.
frstrtr added a commit that referenced this pull request Jun 22, 2026
Same bar as the #328 payout-split invariance KAT: prove the #333 lift of
generate_share_transaction() step-1 into compute_pplns_weight_walk() moves
ZERO weight. Embed the pre-refactor inline walk verbatim as
legacy_inline_weight_walk() and assert the helper reproduces it weight-for-
weight (per-script weights, total_weight, total_donation_weight) across a
battery: V36 decay path, pre-V36 grandparent-start + max_weight cap,
donation split, full-donation zero-addr-weight share, the insufficient-depth
guard (both throw identically), null/absent parents, and a chain exceeding the
real_chain_length window. Each weight map is then fed through the #328
payout-split SSOT and the outputs + donation asserted byte-identical, closing
the end-to-end no-payout-satoshi-drifts proof shared by the emission and
verification paths. dgb_share_test 28/28.
frstrtr added a commit that referenced this pull request Jun 23, 2026
dgb(phase-b): extract PPLNS payout-split SSOT (weights -> consensus-sorted payout outputs)
frstrtr added a commit that referenced this pull request Jun 23, 2026
build_connection_coinbase_from_pplns delegates the payout split to
compute_pplns_payout_split() -- the same helper generate_share_transaction
(the share verification path, #329) calls -- instead of taking pre-resolved
payout_outputs/donation_amount. The coinbase a miner hashes per-connection and
the coinbase the share check enforces are now byte-identical on every payout
satoshi by construction: one payout implementation, not two kept in agreement.

Pure delegation + field forwarding into build_connection_coinbase_parts; no
inline payout arithmetic. dgb-tree-only. 4 delegation-identity KATs
(V36, pre-V36 finder fee, segwit/ref forwarding, value anchor); 8/8 green.
Stacks on the #328/#329 PPLNS SSOT stack.
frstrtr added a commit that referenced this pull request Jun 23, 2026
Extract generate_share_transaction() step-1 PPLNS tracker walk into
dgb::coin::compute_pplns_weight_walk(), the producer-side counterpart of
the steps 2-3 lift in pplns_payout_split.hpp (#328). The share-verification
path and the per-connection Stratum coinbase emission path now draw one
tracker-walk implementation, so the weight map a miner hashes cannot drift
from the one the verifier enforces.

Verbatim lift: exact V36 depth-decay vs pre-V36 grandparent-start branch,
the data.py insufficient-depth guard, and the block-target/spread max_weight
cap are unchanged. Result type is deduced from the tracker (decltype) to
avoid the share_tracker.hpp <-> share_check.hpp include cycle.

KAT WeightWalkSSOTContract locks the helper contract (verbatim V36 forward +
safe-empty on null/absent parent); the unchanged generate_share_transaction
fixtures prove value-level byte-identity. dgb_share_test 27/27,
dgb_connection_coinbase_test 8/8.
frstrtr added a commit that referenced this pull request Jun 23, 2026
Same bar as the #328 payout-split invariance KAT: prove the #333 lift of
generate_share_transaction() step-1 into compute_pplns_weight_walk() moves
ZERO weight. Embed the pre-refactor inline walk verbatim as
legacy_inline_weight_walk() and assert the helper reproduces it weight-for-
weight (per-script weights, total_weight, total_donation_weight) across a
battery: V36 decay path, pre-V36 grandparent-start + max_weight cap,
donation split, full-donation zero-addr-weight share, the insufficient-depth
guard (both throw identically), null/absent parents, and a chain exceeding the
real_chain_length window. Each weight map is then fed through the #328
payout-split SSOT and the outputs + donation asserted byte-identical, closing
the end-to-end no-payout-satoshi-drifts proof shared by the emission and
verification paths. dgb_share_test 28/28.
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