dgb(phase-b): desired-version work/count tally SSOT + KAT - #429
Merged
Conversation
Lift the per-version accumulation core of ShareTracker::get_desired_version_weights (and its flat-count diagnostic sibling get_desired_version_counts) into coin/desired_version_tally.hpp as free functions over already-resolved (desired_version, work) pairs. The work-weighted map is the consensus input to the V36 60%-by-work switch rule (share_check step 2) and the #288 AutoRatchet activation tail guard; the flat-count map is diagnostics-only and never the gate. Oracle: p2pool-dgb-scrypt data.py:918-922 get_desired_version_counts, which is already work-weighted (res[dv] += target_to_average_attempts(share.target)). The per-share weight equals ShareIndex::work = chain::target_to_average_attempts( bits_to_target(m_bits)); the KAT anchors that equivalence non-circularly via ttaa over 2^k-1 targets (hand-derived 2^(256-k)). FENCED, additive, header-only: share_tracker.hpp is NOT rewired (byte-identity delegation is the follow-on). The chain-walk and lookbehind clamp stay in ShareTracker (clamp is the separate chain_walk_window SSOT). Consensus-neutral. Registered in both the dir CMakeLists.txt and the build.yml --target allowlist. KAT 6/6 green.
frstrtr
added a commit
that referenced
this pull request
Jun 24, 2026
…y SSOT Rewire ShareTracker::get_desired_version_weights() (the CONSENSUS 60%-by-work version-switch gate input) and its flat-count diagnostic sibling get_desired_version_counts() to delegate the per-version accumulation into the desired_version_tally SSOT introduced in #429 (accumulate_version_weights / accumulate_version_counts). The chain-walk and the lookbehind clamp stay inline in ShareTracker (the clamp is the separate chain_walk_window SSOT); only the map accumulation moves. Shares with an absent ShareIndex are skipped exactly as before, so the resulting map is byte-identical. Value-identity is proven NON-CIRCULARLY by a new KAT (DesiredVersionTallyDelegationByteIdentity) over chains of 2/4/8 shares whose expected maps are derived from first principles (production chain::target_to_average_attempts over the input bits, plus a hand-counted flat tally) rather than from the SSOT under test, plus a lookbehind-clamp check; and by the pre-existing real-chain weight tests (DesiredVersionWeightsByAttempts, WeightWalkValueInvarianceBattery, AutoRatchet*) which now route through the delegated accessor and remain green. Stacked on #429 (dgb/desired-version-tally-ssot).
frstrtr
added a commit
that referenced
this pull request
Jun 24, 2026
…y SSOT Rewire ShareTracker::get_desired_version_weights() (the CONSENSUS 60%-by-work version-switch gate input) and its flat-count diagnostic sibling get_desired_version_counts() to delegate the per-version accumulation into the desired_version_tally SSOT introduced in #429 (accumulate_version_weights / accumulate_version_counts). The chain-walk and the lookbehind clamp stay inline in ShareTracker (the clamp is the separate chain_walk_window SSOT); only the map accumulation moves. Shares with an absent ShareIndex are skipped exactly as before, so the resulting map is byte-identical. Value-identity is proven NON-CIRCULARLY by a new KAT (DesiredVersionTallyDelegationByteIdentity) over chains of 2/4/8 shares whose expected maps are derived from first principles (production chain::target_to_average_attempts over the input bits, plus a hand-counted flat tally) rather than from the SSOT under test, plus a lookbehind-clamp check; and by the pre-existing real-chain weight tests (DesiredVersionWeightsByAttempts, WeightWalkValueInvarianceBattery, AutoRatchet*) which now route through the delegated accessor and remain green. Stacked on #429 (dgb/desired-version-tally-ssot).
frstrtr
added a commit
that referenced
this pull request
Jun 25, 2026
dgb(phase-b): delegate get_desired_version_{weights,counts} into tally SSOT (#429 follow-on)
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.
FENCED, additive Phase-B SSOT pillar. Lifts the per-version accumulation core of ShareTracker::get_desired_version_weights (and the flat-count diagnostic sibling get_desired_version_counts) into coin/desired_version_tally.hpp as free functions over already-resolved (desired_version, work) pairs.
Why it matters: the work-weighted map is the CONSENSUS input to the V36 60%-by-work switch rule (share_check step 2) and the #288 AutoRatchet activation tail guard. The flat-count accumulator is diagnostics-only and never the gate.
Oracle: p2pool-dgb-scrypt data.py:918-922 get_desired_version_counts, which is already work-weighted: res[dv] += target_to_average_attempts(share.target). The per-share weight equals ShareIndex::work = chain::target_to_average_attempts(bits_to_target(m_bits)); the KAT anchors that equivalence NON-CIRCULARLY via ttaa over 2^k-1 targets (hand-derived 2^(256-k) = {2,4,8}).
Scope/fencing:
Tests: KAT 6/6 green (empty->empty, single bucket, same-version sum, multi-version buckets, non-circular oracle work anchor, flat-count-ignores-work divergence).