Casino game kind, credits host functions, CtxFeatCredits (wire revision 7)#69
Merged
Conversation
…revision 7) Adds the platform-credits wagering surface for casino games: - GameMeta.Kind (game | casino) + MaxPayoutMultiplier as a new presence-guarded trailing meta section — absent reads as game, so every existing artifact keeps its meaning - credits_balance / credits_wager / credits_settle host functions: host-owned account-wide wallet, atomic escrow wagers, gross (stake-inclusive) settlement clamped to stake x the declared multiplier, typed refusals incl. economy-disabled (degrade, never trap); game-kind callers rejected host-side before any service call - CtxFeatCredits declaration bit; wire revision 6 -> 7 with ledger entry - Go SDK Services.Credits + kittest wallet double + native dev-runner and memsvc backends; Rust SDK mirrors (Meta fields, Room methods, CreditsError, CTX_FEAT_CREDITS) with regenerated cross-language goldens - ABI.md section 3/4.2 + GUIDE.md casino authoring section Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Review finding: the Settle double claimed production escrow semantics but omitted the MaxPayoutMultiplier clamp memsvc and the real host apply. Set Room.CreditsMaxPayoutMultiplier to your Meta declaration and unit tests exercise the same ceiling check/production enforce; 0 keeps the old unclamped behavior. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
BCook98
marked this pull request as ready for review
July 3, 2026 01:33
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
The wagering surface for casino games, as one additive minor (wire revision 6 → 7):
GameMeta.Kind(game|casino) +MaxPayoutMultiplier— a new presence-guarded trailing meta section. Absent ⇒game, so every existing artifact keeps its meaning; a casino game must declare a payout ceiling ≥ 1 that covers its largest configurable outcome (wire.ValidateGameKind, enforced at SDK encode time and refused at host load).credits_balance,credits_wager,credits_settle: a host-owned account-wide wallet. Wagers escrow atomically (a refused wager means the bet did not happen); settlement is gross (loss 0 · push = stake · win = stake + winnings) and clamped to stake × the declared multiplier; feature rounds (free spins, double-up ladders) ride the triggering stake and settle once. Typed refusals: insufficient, economy-disabled (degrade, never trap), denied, unavailable. Game-kind callers are rejected host-side before any service call.CtxFeatCredits(bit 2) — declaration-only bit marking an artifact that wagers.Services.Credits(+kit.ErrInsufficientCreditsetc.),kittestwallet double (Credits/CreditsStakes/CreditsDisabled), native dev-runner andmemsvcbackends (sogo run .,check, andplayall work today).Meta::kind/max_payout_multiplier,Room::credits_*,CreditsError,CTX_FEAT_CREDITS— wire revision bumped in lockstep, cross-language scalar goldens regenerated, hardcoded meta hexes updated.Testing
go test ./...green (incl. newwire.ValidateGameKind/round-trip/truncation vectors, gameabi kind-gating + status-code mapping tests, regeneratedscalars.txt)cargo testgreen inrust/andcrossverify/(revision crosscheck passes; byte-identity goldens updated from the Go reference encoder)Notes for review
CtxFeatCreditsis intentionally declaration-only: graceful degradation against hosts lacking the imports is impossible (instantiation fails before detection), so hosts at this revision always export the functions and signal economy state via the disabled status code.🤖 Generated with Claude Code