Skip to content

fix(move): block opens into an already-rugged round — post-rug ride vault drain (v4.27) - #758

Merged
maxmoneycash merged 1 commit into
mainfrom
agent5/fix-post-rug-open-drain-1782174678
Jun 23, 2026
Merged

maxmoneycash merged 1 commit into
mainfrom
agent5/fix-post-rug-open-drain-1782174678

Conversation

@maxmoneycash

Copy link
Copy Markdown
Member

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

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) 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 — this closes the direct-MoveCall / modified-client bypass.

Tests

  • New 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.

🤖 Generated with Claude Code

…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>
@maxmoneycash
maxmoneycash merged commit 8a2b164 into main Jun 23, 2026
2 checks passed
@vercel

vercel Bot commented Jun 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
wick-markets Ready Ready Preview, Comment Jun 23, 2026 4:22pm

Request Review

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

1 active deployment
Preview — f4e17265 Deployed Jun 23, 2026 by vercel[bot]
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