Repository navigation
fix(move): block opens into an already-rugged round — post-rug ride vault drain (v4.27) - #758
Merged
Merged
Conversation
…rain (v4.27) The rug is the ENTIRE house edge: the touch payout against ±barriers over a full round is player-positive WITHOUT it (touch ~79% vs ~57% break-even — −37.67% house edge no-rug per simulate_v4_house_edge.py). A round rugs at most once; after RugFiredV4 fires at segment R the round has ZERO remaining rug risk. But open_segment_ride_v4 had NO guard against opening into a rugged round, and decide_settlement routes only pre-rug rides (entry <= rugged_seg) to EXPIRED_LOSS — so a ride opened at entry > R settles on the rug-free path and keeps the full touch upside: positive player EV. An attacker watches the public RugFiredV4 event and opens max-stake post-rug (~45% of rounds qualify, ~+$1.50/ride), draining the vault. Breaks NO single-tx invariant (conservation/idempotency/double-pay all hold) — a probabilistic mispricing the correctness suite can't catch. Found by a fresh economic/MEV adversarial audit pass. Fix: assert !is_rugged(market) in open_segment_ride_v4, right after ensure_round_current (which clears the live rugged_at_segment on a round-roll, so opens resume next round). The round is HALTED after a rug; the frontend already refuses post-rug opens, so this closes the direct-MoveCall / modified-client bypass. + regression test open_into_an_already_rugged_round_aborts (real post-rug open → EMarketRugged). Reframed post_rug_open_keeps_its_win (was mislabeled an "honest" bet) to document it AS the exploit the guard prevents + decide_settlement boundary defense-in-depth. Suite 696/696. Awaits the v4.27 deploy (publisher keys) to go live, alongside #683/#694/#733. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
maxmoneycash
added a commit
that referenced
this pull request
Jun 24, 2026
…unt (#760) #758 added tests (post-rug open-block, v4.27) -> 696 #[test] in move/, but the docs still said 695, so check:doc-counts (the reality guard) was RED on main. Fixed with the one-command syncer: npm run sync:count rewrote README (badge + alt + body + layout + cmd), SAFETY, ADDRESSES, and the runbook together. Verified: check:doc-counts ✓ "696 (= 696 #[test] functions)"; check:meta ✓ 696. (sui move test independently confirmed 696/696 this session.) Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
maxmoneycash
added a commit
that referenced
this pull request
Jun 24, 2026
…gged) (#761) The doc-count reality guard (#738) caught the drift: a5's #758 (post-rug-open drain fix) added a Move test (count → 696) but the docs stayed at 695, so the cold-gate-enforced guard (#752) was failing. Ran 'npm run sync:count' to rewrite all four docs (README badge+body, move/SAFETY.md, deployments/ADDRESSES.md, the runbook) to 696. Verified: guard green — consistent across all docs AND matches the 696 #[test] functions in move/. This is the machinery working as designed (catch + one- command fix), unblocking the cold gate. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
maxmoneycash
added a commit
that referenced
this pull request
Jun 24, 2026
…ost-rug open-drain guard (#762) #758 added open_into_an_already_rugged_round_aborts + the source fix (open aborts into an already-rugged round) → reality-guard went RED on main (695 vs 696). Sync all docs to 696 (verified) — guard green — and map the open-side rug guard: a player can't bet INTO a known-doomed (already-rugged) round and drain against it (the open-side complement to the close/crank cross-round bounds, v4.27). Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
maxmoneycash
added a commit
that referenced
this pull request
Jun 24, 2026
… / v4.27) (#772) The runbook now drives the v4.27 upgrade (5 staged fixes + 2 procedure changes), but they were scattered across inline callouts. Add a consolidated summary table up front (the 4 loss-of-funds fixes #683/#694/#733/#758 + the #767 enable_rug gate) and the 2 procedure changes (settlementModel one-trigger #717, enable_rug cap arg). Retitle to v4.26 / v4.27. Docs-only — no count line touched. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This branch was successfully deployed
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.
CRITICAL economic exploit (loss-of-funds) — found by a fresh economic/MEV audit pass
The rug is the entire house edge. The touch payout against ±barriers over a full round is player-positive without it (touch ~79% vs ~57% break-even — −37.67% house edge no-rug per
simulate_v4_house_edge.py).A round rugs at most once. After
RugFiredV4fires at segment R, the round has zero remaining rug risk. But:open_segment_ride_v4had no guard against opening into a rugged round, anddecide_settlementroutes only pre-rug rides (entry <= rugged_seg) toEXPIRED_LOSS.So a ride opened at
entry > Rsettles on the rug-free path and keeps the full touch upside → positive player EV. An attacker watches the publicRugFiredV4event and opens max-stake post-rug (~45% of rounds qualify, ~+$1.50/ride), draining the vault.This breaks no single-tx invariant (conservation, idempotency, double-pay all hold) — a probabilistic mispricing the correctness suite can't catch. It's the orthogonal class to #683/#694/#733.
Fix
assert!(!is_rugged(market), EMarketRugged)inopen_segment_ride_v4, right afterensure_round_current(which clears the liverugged_at_segmenton a round-roll, so opens resume next round). The round is HALTED after a rug; the frontend already refuses post-rug opens — this closes the direct-MoveCall / modified-client bypass.Tests
open_into_an_already_rugged_round_aborts— real post-rug open →EMarketRugged.post_rug_open_keeps_its_win(was mislabeled an "honest" bet) to document it as the exploit the guard prevents +decide_settlementboundary defense-in-depth.Awaits the v4.27 deploy (publisher keys) to go live, alongside #683/#694/#733.
🤖 Generated with Claude Code