bch(share): canonical 60% work-weighted version-switch boundary (drop 95% flat-count punish) - #326
Merged
Conversation
… drop 95% flat-count punish Replace the non-canonical 95%-flat-count should_punish_version gate in share_check with the canonical 60% PPLNS-work-weighted boundary switch (p2pool data.py check() 1396-1414), matching the BTC F10/(b) port and the LTC/DGB removals. Add ShareTracker::get_desired_version_weights — per- desired-version WORK tally (idx->work), mirroring get_desired_version_counts (data.py:2651) — NOT a flat share count. A version BOUNDARY (share.version != parent.version) is valid only when the new version holds >= 60% of weighted desired-version support in the window [CHAIN_LENGTH*9/10, CHAIN_LENGTH] behind the parent; one-step downgrade is allowed (AutoRatchet deactivation), larger jumps rejected. Couples the accept gate to the work-weighted mint guard so an activated node cannot mint a boundary share its peers reject. BCH-fenced (src/impl/bch only); standalone SHA256d parent, no aux dimension. v36-native bucket-2 standardization.
frstrtr
added a commit
that referenced
this pull request
Jun 23, 2026
… drop 95% flat-count punish (#326) Replace the non-canonical 95%-flat-count should_punish_version gate in share_check with the canonical 60% PPLNS-work-weighted boundary switch (p2pool data.py check() 1396-1414), matching the BTC F10/(b) port and the LTC/DGB removals. Add ShareTracker::get_desired_version_weights — per- desired-version WORK tally (idx->work), mirroring get_desired_version_counts (data.py:2651) — NOT a flat share count. A version BOUNDARY (share.version != parent.version) is valid only when the new version holds >= 60% of weighted desired-version support in the window [CHAIN_LENGTH*9/10, CHAIN_LENGTH] behind the parent; one-step downgrade is allowed (AutoRatchet deactivation), larger jumps rejected. Couples the accept gate to the work-weighted mint guard so an activated node cannot mint a boundary share its peers reject. BCH-fenced (src/impl/bch only); standalone SHA256d parent, no aux dimension. v36-native bucket-2 standardization. Co-authored-by: frstrtr <frstrtr@users.noreply.github.com>
frstrtr
added a commit
that referenced
this pull request
Jun 27, 2026
…577) Fenced, additive, rig-free known-answer test for the BCH G2 staged 1-by-1 miner-migration gate. Pins the canonical 60%-by-WORK version-switch ACCEPT gate that bch::check_share enforces inline (src/impl/bch/share_check.hpp:1774): if (new_ver_weight * 100 < total_weight * 60) throw "switch without enough hash power upgraded"; via a verbatim replica of the live tail-guard (same non-circular localisation btc/DGB use; guard stays inline, no lifted SSOT). Arms the staged-migration rows without a SHA256d bitaxe rig. Properties pinned (15 asserts, all green): - 60%-by-WORK boundary at the exact crossing (59 hold / 60-100 pass / 0 hold) - mint-cannot-outrun-accept (#288): 95%-by-COUNT under heterogeneous hashrate can NOT outrun the 60%-by-work gate -> a minted V36 boundary share its peers would reject is prevented - work-weighted NOT flat-count (#290/#326 regression guard): gate diverges from a head-count in both directions; #326 dropped the 95%-flat-count punish - monotonic staged migration: 5 equal-work miners, tally advances monotone, accept gate crosses at stage 3/5 (60%) and stays on - downgrade asymmetry: V35-after-V36 (AutoRatchet deactivation) is un-gated Test-only, bch-tree-local: pure int main()+assert over <core/pack_types.hpp> uint288, no consensus / shared-base / CMake-shared surface. Registered in the bch test CMakeLists foreach and BOTH build.yml COIN_BCH --target allowlists. Co-authored-by: frstrtr <frstrtr@users.noreply.github.com>
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.
What
Ports the canonical AutoRatchet version-switch boundary rule into BCH share validation, replacing the non-canonical 95%-flat-count
should_punish_versiongate.get_desired_version_weights— per-desired-version WORK tally (idx->work = target_to_average_attempts), mirroring p2poolget_desired_version_counts(data.py:2651). NOT a flat count.Why
BCH still called the 95%-flat-count
should_punish_version(no BCH tracker even defined it — survived only as an uninstantiated dependent template expr). LTC/DGB removed it; BTC replaced it with the canonical 60% work-weighted switch (F10/(b), #290). This brings BCH to parity — v36-native bucket-2 standardization toward the v37 unified shape. Couples the accept gate to the work-weighted mint guard so an activated node cannot mint a boundary share its peers reject.Conformance
data.pycheck() 1396-1414 + get_desired_version_counts 2651. No v36 wire-surface change — same accept semantics as BTC/LTC/DGB.Verify
-fsyntax-onlyclean (rc=0).should_punish_versioncall remains (only the F10/(b) explanatory comment).GPG-signed. Merge operator-gated (I author/review; integrator merges on
push approved).