Skip to content

Commit 4bd5baf

Browse files
committed
dgb: standardize AutoRatchet mint gate to the work-weighted accept gate (contract)
Mirrors the intent of ltc 865fdd7 onto the DGB lane. ltc-doge root-caused the v35->v36 crossing wedge (#97): the AutoRatchet mint gate activated on a 95%-by-flat-COUNT desired-version tally, but the consensus accept gate (share_check step 2 / p2pool check() data.py:1399) admits a V36 boundary share only at the WORK-WEIGHTED 60% rule (canonical get_desired_version_counts, data.py:2651, weights each share by target_to_average_attempts). Under heterogeneous hashrate the flat count outran the work-weighted accept gate, so the minter produced boundary shares every peer rejected -> frozen crossing. DGB carries NO AutoRatchet minter yet (no src/impl/dgb/auto_ratchet.hpp; the minter lands in Phase B). The DGB accept gate (share_check.hpp version-switch rule) is ALREADY work-weighted/canonical via get_desired_version_weights, and that accessor is KAT-pinned (#249). The ONLY artifact of the unsafe F10 flat-count choice on this lane is the design-contract recorded in comments, which would seed the exact wedge into the future port. This corrects those comments so DGB's AutoRatchet is born work-weighted: its activation tail guard MUST read get_desired_version_weights over the same [9/10*CL, CL] window at the same 60% threshold the accept gate enforces, superseding F10. v36-native shared structure (consensus version-signaling), standardized cross-coin for a clean v37 migration. Comment-only; zero behavior change (no minter exists to alter). Per-coin isolation preserved: touches src/impl/dgb/ only.
1 parent 7f12a47 commit 4bd5baf

2 files changed

Lines changed: 19 additions & 7 deletions

File tree

src/impl/dgb/share_check.hpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1654,8 +1654,12 @@ bool share_check(const ShareT& share,
16541654
// The weight is target_to_average_attempts per share — get_desired_version_weights,
16551655
// matching canonical get_desired_version_counts (data.py:2651) — NOT a flat count.
16561656
// F10/(b): the prior non-canonical 95%-obsolescence punish is removed; the
1657-
// canonical 60% switch rule is now the ONLY version gate. AutoRatchet stays
1658-
// count-based and does not gate peer shares here.
1657+
// canonical 60% weighted switch rule is now the ONLY version gate, and it does
1658+
// not gate the local mint decision here. When the DGB AutoRatchet minter is
1659+
// ported (Phase B) its activation tail guard MUST be work-weighted to match
1660+
// this gate (get_desired_version_weights, share_tracker.hpp), superseding the
1661+
// F10 flat-count choice the LTC crossing soak proved unsafe — mirrors ltc
1662+
// 865fdd78.
16591663
{
16601664
auto chain_length = static_cast<int32_t>(params.chain_length);
16611665
if (!share.m_prev_hash.IsNull() && tracker.chain.contains(share.m_prev_hash))

src/impl/dgb/share_tracker.hpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2126,10 +2126,17 @@ class ShareTracker
21262126
// Canonical p2pool get_desired_version_counts (data.py:2651) weights each
21272127
// share by target_to_average_attempts(share.target) — NOT a flat count.
21282128
// The check()-phase 60% switch rule (share_check step 2) is a consensus gate
2129-
// and MUST use these weights to stay byte-identical with p2pool. AutoRatchet
2130-
// and its tail guard deliberately keep the FLAT-COUNT variant above
2131-
// (count-based per F10 finding #1 — weighting them would shift activation
2132-
// timing across the soak). Weight = ShareIndex::work (share.hpp).
2129+
// and MUST use these weights to stay byte-identical with p2pool. When the
2130+
// DGB AutoRatchet minter is ported (Phase B) its activation tail guard MUST
2131+
// ALSO read these work-weights over the SAME [9/10*CL, CL] window at the SAME
2132+
// 60% threshold the accept gate enforces (share_check step 2), so activation
2133+
// strictly implies the accept rule and a minted boundary share can never be
2134+
// rejected. This SUPERSEDES the earlier F10 keep-flat-count choice, which the
2135+
// LTC v35->v36 crossing soak (#97) proved unsafe: under heterogeneous hashrate
2136+
// a 95%-by-COUNT activation outruns the 60%-by-WORK accept gate and wedges the
2137+
// crossing. Cross-coin v36-native standardization (mirrors ltc 865fdd78). The
2138+
// flat-count accessor above stays for diagnostics/KAT only, never the gate.
2139+
// Weight = ShareIndex::work (share.hpp).
21332140
std::map<uint64_t, uint288> get_desired_version_weights(const uint256& share_hash, int32_t lookbehind)
21342141
{
21352142
std::map<uint64_t, uint288> weights;
@@ -2643,7 +2650,8 @@ class ShareTracker
26432650

26442651
// F10/(b): should_punish_version (the 95%-obsolescence punish) was removed.
26452652
// It was non-canonical — canonical p2pool check() has no 95% obsolescence
2646-
// rule; the count-based AutoRatchet plus the 60% weighted switch rule
2653+
// rule; the AutoRatchet (work-weighted at Phase-B port, per 865fdd78) plus the
2654+
// 60% weighted switch rule
26472655
// (share_check step 2) are the only version gates. Keeping it would
26482656
// punish/score-down shares canonical accepts, breaking the #81 zero-
26492657
// divergence gate. Head-scoring (Phase 4) now punishes only naughty heads.

0 commit comments

Comments
 (0)