feat(token_lite): single-game gas-optimized token component (denshokan lite) - #123
feat(token_lite): single-game gas-optimized token component (denshokan lite)#123starknetdev wants to merge 2 commits into
Conversation
…hokan lite) Adds a CoreTokenLiteComponent for single-game deployments (e.g. super-death-mountain) that never used the multi-game registry, objectives, context, skills, per-token renderers, or enumerable, and that keep game-over/objective authority in the game contract: - No mutable token state: no update_game, no metagame callbacks, no game_over latch. is_playable/assert_is_playable check the lifecycle window only — zero storage reads (pure unpack of the packed token id). - New assert_owner_and_playable merges the per-action owner_of + assert_is_playable pair into one external call. - Mint does no SRC5 probe, no registry lookup, no settings/objective validation; keeps the exact IMinigameToken::mint ABI and rejects unsupported params loudly. 251-bit pack_token_id layout is unchanged. - Registers IMINIGAME_TOKEN_LITE_ID plus the legacy IMINIGAME_TOKEN_ID and exposes a zero game_registry_address() so MinigameComponent::initializer accepts a lite token unchanged. Includes IMinigameTokenLite in the interfaces package, a wiring example contract, 30 tests, CI matrix + codecov updates (18 modules), and doc refreshes (root AGENTS.md matrix table was stale). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 13 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (17)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
GPT Code ReviewReview execution failed (exit code 1). The Codex CLI log was not posted because it can contain the full review prompt. |
GPT Code ReviewReview execution failed (exit code 1). The Codex CLI log was not posted because it can contain the full review prompt. |
Claude Code ReviewAll the numbers reconcile: main-ci matrix = 18 modules, pr-ci add lines = 18, codecov Minor wording inconsistencies (codecov.yml:4 says "package count" but the check counts modules; AGENTS.md:131 example still shows The scoped changes are internally consistent and correct. lgtm |
Claude Code ReviewThis reveals two divergences from the full token:
Both are consistent with the full token's design. No regression. I've now thoroughly reviewed the component, interface, tests, example wiring, packing parity, lifecycle math (bit-identical to full token), the compat shim (only mint/assert_is_playable/player_name are called by minigame consumers — all present), soulbound guard, and SRC5 registration. The one item worth flagging as a low-severity finding: the interface ID constant is hardcoded and no test independently verifies it against Let me double-check the No actionable, in-scope findings backed by concrete regressions or bugs. lgtm |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Baseline/op-x10 test pairs measuring warm mint, per-action ownership+ playability guard, and post-action sync on the lite component against FullTokenContract in its deployed-denshokan configuration (registry-backed multi-game, all extensions). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Summary
Adds a
token_litemodule toembeddable_game_standard: a single-game, storage-minimal replacement for the full minigame token, designed for deployments like super-death-mountain that never used the multi-game registry, objectives, context, skills, per-token renderers, client urls, or enumerable — and that keep game-over / objective-completion authority in the game contract itself.Design
game_id_from_addresson mint, no SRC5 probes anywhereupdate_game, no metagame callbacks, no game_over latch;is_playable= lifecycle window only, zero storage reads (pure unpack of the packed token id)assert_owner_and_playable(token_id, expected_owner)owner_of+assert_is_playablepair into one external call (one storage read total)mintkeeps the exactIMinigameToken::mintABIminigame::minthelper work unchanged; unsupported params are rejected loudly, never silently ignoredpack_token_idlayout unchangedsettings_id/minted_by/lifecycle from the id, and indexers, keep working; unused fields are written as zeroIMINIGAME_TOKEN_LITE_ID+ legacyIMINIGAME_TOKEN_ID, exposes zerogame_registry_address()MinigameComponent::initializeraccepts a lite token without modificationContext: super-death-mountain's own gas bench measures
update_gameas a ~6.73M L2 gas subtree, dominated by the twogame_over()/score()callbacks (~1.56M each). With no mutable state there is nothing to sync — games gate dead runs themselves and callrefresh_metadata(ERC-4906) after actions.Changes
packages/interfaces/src/token/lite.cairo—IMinigameTokenLite+IMINIGAME_TOKEN_LITE_ID(derived viasrc5_rs, excludingrefresh_metadata*per convention)packages/embeddable_game_standard/src/token_lite/—CoreTokenLiteComponent, module AGENTS.md, wiring example contract, 30 testscodecov.ymlbumped to 18 modules; root AGENTS.md matrix table refreshed (was stale at 16, missingmerkledrop)Test plan
scarb build --workspacesnforge test -p game_components_embeddable_game_standard "::token_lite::"— 30/30 passing (packing fields, lifecycle windows/clamping, all rejected params, soulbound transfer guard, combined owner+playable guard, minter map, ERC-4906 events, SRC5 registration)scarb fmt --check🤖 Generated with Claude Code