Skip to content

[BCH] G2 ratchet gate-logic KAT — fenced rig-free SIM pinning the 60%-by-work version-switch accept gate - #577

Merged
frstrtr merged 1 commit into
masterfrom
bch/g2-ratchet-gate-kat
Jun 27, 2026
Merged

[BCH] G2 ratchet gate-logic KAT — fenced rig-free SIM pinning the 60%-by-work version-switch accept gate#577
frstrtr merged 1 commit into
masterfrom
bch/g2-ratchet-gate-kat

Conversation

@frstrtr

@frstrtr frstrtr commented Jun 27, 2026

Copy link
Copy Markdown
Owner

G2 ratchet gate-logic KAT (fenced, rig-free)

Adds a fenced, rig-free simulation KAT that pins the live 60%-by-WORK
version-switch accept gate. The test replicates the inline tail-guard at
src/impl/bch/share_check.hpp:1774 verbatim (non-circular — no lifted
SSOT) and exercises staged 1-by-1 miner migration over a synthetic
work-weighted vote distribution.

Scope

  • Test-only, bch-tree-local: pure int main() + assert over pack_types.hpp.
  • Zero shared-base / CMake-shared surface; no consensus-value change.
  • Wired into CMakeLists foreach + BOTH build.yml COIN_BCH test lists.

Verification

  • 15/15 PASS locally; build GREEN.
  • This PR exists so the whole gh rollup (Linux + ASan/UBSan + Windows +
    macOS + bch smoke + attribution-gate + drift-guard) runs on head 66d0730.

Branch: bch/g2-ratchet-gate-kat @ 66d0730

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.
@frstrtr
frstrtr merged commit 6bf6d29 into master Jun 27, 2026
19 of 21 checks passed
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