dgb(share): rewire weight-decay arithmetic onto coin/share_weight_decay.hpp SSOT (#450 follow-on, value-invariant) - #526
Closed
frstrtr wants to merge 1 commit into
Closed
Conversation
…ay.hpp SSOT Delegate the three open-coded copies of the V36 PPLNS exponential weight-decay rate (DensePPLNSWindow::init_decay_table, get_v36_decayed_cumulative_weights, dump_v36_pplns_walk) onto the #450 coin/share_weight_decay.hpp SSOT: half_life(), decay_per_share() and the DECAY_SCALE/DECAY_PRECISION constants now come from one source instead of three inline literal copies of half_life = max(chain_length / 4, 1) decay_per = SCALE - (SCALE * 693147) / (1e6 * half_life) Byte-identity preserved: the uint288 hot-path decayed-attempts widening and the mul128_shift decay_fp walk stay open-coded (the consensus/wire bytes); only the rate constants + half_life/decay_per move to the SSOT. Zero 693147 literals remain in share_tracker.hpp. A value-invariance KAT (DgbWeightDecay.RewireConstantsValueInvariant + DecayedCumulativeWeightVectorInvariant) recomputes the full decayed- cumulative-weight vector over a depth(64) x chain-length sweep via the OLD literal expressions vs the SSOT helpers and asserts equality. FENCED to src/impl/dgb/; no shared/bitcoin_family/core touch. No build.yml or CMakeLists churn (test + target pre-exist).
Owner
Author
|
Superseded by #525 (merged @470892d50) which landed the identical weight-decay arithmetic rewire onto coin/share_weight_decay.hpp SSOT. Net diff vs master is fully subsumed (constants->DECAY_PRECISION/DECAY_SCALE, decay_per->decay_per_share(), half_life->half_life() at all three sites). Closing as redundant; branch preserved (no --delete-branch). |
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.
#450 follow-on — share_weight_decay SSOT rewire (work-only, NO self-merge)
Closes the FENCED-but-not-rewired state of the #450 SSOT lift. The three open-coded copies of the V36 PPLNS exponential weight-decay rate in
src/impl/dgb/share_tracker.hppnow delegate tocoin/share_weight_decay.hpp:DensePPLNSWindow::init_decay_tablehalf_life/decay_perliteralsweight_decay::decay_per_share()get_v36_decayed_cumulative_weights(hot path)weight_decay::half_life/decay_per_share+DECAY_SCALE/DECAY_PRECISIONdump_v36_pplns_walk(GENTX-mismatch diag)Zero
693147literals remain in share_tracker.hpp.Byte-identity discipline (the line drawn, per integrator)
(att * uint288(decay_fp)) >> 40).mul128_shiftdecay_fpwalk stays open-coded.Value-invariance KAT (the merge proof)
dgb_share_weight_decay_test:RewireConstantsValueInvariant— old open-codedhalf_life/decay_perliteral expressions vs SSOT helpers over a chain-length sweep{8640,2880,3600,720,100,8,4,3,1,0}.DecayedCumulativeWeightVectorInvariant— recomputes the full decayed-cumulative-weight vector (addr-weight + total-weight accumulators) over depth×64 × chain-length{8640,2880,720,4}× att/donation matrix, OLD literal expressions vs SSOT helpers, asserts equality at every depth + on the cumulative totals.mul128_shiftis reproduced verbatim (same on both arms → cancels).Scope
src/impl/dgb/only — no shared/bitcoin_family/core touch.share_tracker.hpp(rewire) +share_weight_decay_test.cpp(KAT) changed. No build.yml / CMakeLists churn (test + target pre-exist).Local verification (head d14d43c)
dgb_share_weight_decay_test: 8/8 PASS (incl. 2 new invariance KATs)dgb_share_test: 34/34 PASS (production TU consuming the rewired header compiles + passes)NO self-merge — consensus version/acceptance-adjacent surface: integrator value-diffs, then operator tap.