feat(presets): adventurer objective entry validator (beast achievements Phase 2) - #32
feat(presets): adventurer objective entry validator (beast achievements Phase 2)#32starknetdev wants to merge 1 commit into
Conversation
Add `AdventurerValidator`, a thin `IEntryRequirementExtension` preset that gates tournament entry on a Death Mountain adventurer having completed a registered objective on the Adventurer Oracle (PR #31). It delegates to the oracle's `completed_objective(token_id, objective_id)` and stays game-agnostic by speaking only the `IMinigameObjectives` interface, so any conforming objectives provider works. Per `(context_owner, context_id)`: configured with an oracle address + a single objective id; the player supplies the adventurer NFT token_id as `qualification[0]`. Supports a per-player entry quota (`entry_limit`, 0 = unlimited) and an optional `bannable` flag that revokes an entry once the objective is no longer satisfied (objectives read live state). Modeled on `opus_troves_validator` (external-state delegation, current `EntryRequirementExtensionComponent` API). Adds 8 snforge tests mocking the oracle via `start_mock_call`. `scarb build` + `scarb fmt --check` clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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 ReviewConfirmed: no NFT ownership check. This is the core security finding. Let me write the review. Findings: [HIGH] No ownership binding between [MEDIUM] [LOW] Let me focus on the highest-signal finding plus a genuine correctness one. Let me double-check whether the same token used by same player with unlimited (entry_limit 0) matters — the key issue is different players reusing one qualifying token. Let me also verify Let me verify there isn't a missing Here's my review: [HIGH] packages/presets/src/entry_requirement/adventurer_validator.cairo:107-127 ( [LOW] packages/presets/src/entry_requirement/adventurer_validator.cairo:222-229 ( The high-severity ownership/quota-bypass finding is the key blocker. |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
Summary
Phase 2 of the Beast-Mode achievements build: a thin entry-requirement adapter on top of the Adventurer Oracle (#31). It lets Budokan gate tournament entry on "this adventurer completed objective N".
AdventurerValidatorimplements the metagameIEntryRequirementExtensionframework (currentEntryRequirementExtensionComponent, modeled onopus_troves_validator) and delegates the actual check to the oracle'scompleted_objective(token_id, objective_id). It stays game-agnostic — it only speaks theIMinigameObjectivesinterface (declared locally, no code dependency on the oracle crate), so any conforming objectives provider works.Behavior
(context_owner, context_id)is configured (add_config) with an oracle address + a single objective_id (config = [oracle, objective_id, bannable?]).token_idasqualification[0].oracle.completed_objective(token_id, objective_id)and the player is under their per-contextentry_limit(0 = unlimited).bannableflag revokes an existing entry once the objective is no longer satisfied (objectives read live state — e.g. a gold check can regress).Tests
8 snforge tests (mock the oracle via
start_mock_call): incomplete rejects, complete grants, unconfigured/empty-qualification reject, quota enforcement + free-on-remove, bannable ban-on-regress, non-bannable never bans, view getters.scarb build+scarb fmt --checkclean.Notes / follow-ups
(context, player_address), matching the merkle/opus presets.🤖 Generated with Claude Code