Skip to content

dgb: pin V36 decayed-PPLNS weights with bit-exact KAT - #191

Merged
frstrtr merged 1 commit into
masterfrom
dgb/pplns-decay-kat
Jun 19, 2026
Merged

dgb: pin V36 decayed-PPLNS weights with bit-exact KAT#191
frstrtr merged 1 commit into
masterfrom
dgb/pplns-decay-kat

Conversation

@frstrtr

@frstrtr frstrtr commented Jun 19, 2026

Copy link
Copy Markdown
Owner

Closes the guard-test gap from the Phase B share-weight/PPLNS conformance audit.

What

Adds DGB_share_test.DecayedPPLNSWeightsKAT to the existing dgb_share_test target. share_test.cpp already locked sharechain-identity + consensus params (#131/#137/#141/#161) but nothing pinned the decay constants or the weight recurrence in DensePPLNSWindow::compute_v36_weights().

What it pins

  • DECAY_PRECISION=40, LN2_MICRO=693147, half_life=max(chain_len/4,1)
  • per-step s_decay_per factor + full depth-0..7 s_decay_table
  • per-script address weights, total_weight, total_donation_weight over a hand-built 4-entry window (incl. zero-donation, partial, and full-donation entries)

Ground truth is re-derived independently with bigint integer math mirroring the exact fixed-point ops (iterative mul128_shift) — not the codes own output — so any drift in a constant or in the weight math fails loudly.

Conformance (3-bucket)

Decayed-PPLNS = bucket-2 v36-native shared structure, conformed to the V36 MASTER reference decayed-weight path (NOT the legacy flat-weight oracle, which is pre-v36 compat). DGB == ltc == merged-v36 ref — clean v37 migration.

Isolation / CI

Single-coin (src/impl/dgb/test only). Appended to the existing dgb_share_test target which is already in BOTH build.yml --target allowlists, so no new CI registration (#143 trap avoided).

Local: dgb_share_test 7/7 PASS, build EXIT=0.

Add DecayedPPLNSWeightsKAT to dgb_share_test, closing the gap left by the
Phase B share-weight/PPLNS conformance audit: share_test.cpp guarded the
sharechain-identity and consensus params but nothing pinned the decay
constants or the weight recurrence in DensePPLNSWindow::compute_v36_weights().

The KAT pins DECAY_PRECISION=40 / LN2_MICRO=693147 / half_life=max(len/4,1),
the full depth-0..7 decay table, the per-step decay factor, and the per-script
address/donation/total weights for a hand-built window. Ground truth is
re-derived independently with bigint integer math mirroring the exact
fixed-point ops (iterative mul128_shift), so a drift in any constant or in the
weight math fails loudly. Conforms to the V36 MASTER reference decayed-weight
path, not the legacy flat-weight oracle.

Appended to the existing dgb_share_test target (already in both build.yml
--target allowlists), so no new CI registration is required.
@frstrtr
frstrtr merged commit 39ef837 into master Jun 19, 2026
16 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