Skip to content

dgb(phase-b): desired-version work/count tally SSOT + KAT - #429

Merged
frstrtr merged 1 commit into
masterfrom
dgb/desired-version-tally-ssot
Jun 24, 2026
Merged

dgb(phase-b): desired-version work/count tally SSOT + KAT#429
frstrtr merged 1 commit into
masterfrom
dgb/desired-version-tally-ssot

Conversation

@frstrtr

@frstrtr frstrtr commented Jun 24, 2026

Copy link
Copy Markdown
Owner

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).

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
frstrtr merged commit 47ed9d0 into master Jun 24, 2026
32 checks passed
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)
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