Extend arena activity API with state transition events #345
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:open_issues
agents
agent:security_audit
agent:verify
area
timecurve
arena
arena-v2
audit
block:feature_review
block:security
bug
contracts
design
devops
docs
documentation
enhancement
epic
feature
frontend
indexer
low priority
megaeth
operations
ops
performance
QA
qa checklist
referrals
removal
security
smart-contracts
tech-debt
testing
time-arena
timecurve
visual-qa
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
code/yieldomega#345
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent
Transition Gap Analysis (#342) — P0 #3. Bundles H-I2.
Current codebase
GET /v1/arena/activity(api_arena.rs,ACTIVITY_UNION_SQL) unions onlybuy,steal,guard,revengefrom indexed tables.LevelUp,CredClaimed,PodiumEpochRolled,FeatureUnlocked,LastBuyEpochStartedindecoder.rs/persist.rs— but they are not exposed on the activity feed.Why needed
Frontend cannot indexer-first drive celebration/toast stacks for non-buy transitions (level-up, CRED claim, podium roll, epoch start, feature unlock) without a unified feed.
Constraints / guardrails
BlockLogCursorpattern.kinddiscriminator per event type./v1/arena/activityover a parallel endpoint unless union SQL becomes unmaintainable.Relevant files
indexer/src/api_arena.rs(ACTIVITY_UNION_SQL,arena_activity)indexer/src/persist.rsindexer/src/decoder.rsidx_arena_*for level_up, cred_claimed, podium_epoch_rolled, etc.frontend/src/lib/indexerApi.tsRecommended direction
ACTIVITY_UNION_SQLwithUNION ALLbranches for:level_up(idx_arena_level_upor equivalent)cred_claim(idx_arena_cred_claimed)podium_epoch(idx_arena_podium_epoch_rolled)epoch_started(idx_arena_last_buy_epoch_started)feature_unlocked(idx_arena_feature_unlocked)Acceptance criteria
kindvalues.Test plan
cd indexer && cargo clippy --all-targets -- -D warnings && cargo testintegration_stage2.rs— seed events, query/v1/arena/activitybash scripts/verify-wallet-profile-anvil.sh(level history baseline)Attack / abuse test plan
Verification criteria
curl /v1/arena/activityafter scripted level-up / roll / claim shows corresponding kinds.mentioned in issue #342
mentioned in merge request !516
mentioned in commit
5507efc596Verification — #345 Extend arena activity API with state transition events
Result: PASS (no repo changes; implementation already on
main)Acceptance criteria
integration_stage2.rs::api_arena_activity_smokeassertslevel_up,cred_claim,podium_epoch,epoch_started,feature_unlocked(plus buy/steal/guard/revenge) and per-kind field mapping (bp_delta,amount_doub_wad,target, etc.)integration_stage2.rs::api_activity_cursor_smoke— page-1/page-2 no duplicate(tx_hash, log_index)keys; mixed kinds on first page; invalid cursor → 400kindvaluesINV-INDEXER-345-ACTIVITY-TRANSITIONSindocs/testing/invariants-and-business-logic.md;docs/indexer/design.md#arena-activity-http-gitlab-292per-kind semantics;indexer/README.md§ Arena activity;frontend/src/lib/indexerApi.tsArenaActivityKindunionapi_arena.rsarena_activity:ACTIVITY_UNION_SQLis static; cursor/limit/offset bound via$1/$2/$3(BlockLogCursordecode +sqlx::query().bind(...))Test plan
cd indexer && cargo clippy --all-targets -- -D warningsYIELDOMEGA_PG_TEST_URL=… cargo test(7integration_stage2tests incl.postgres_stage2_persist_all_events_and_rollback_after)bash scripts/verify-cloud-postgres.shbash scripts/verify-wallet-profile-anvil.shintegration_stage2)Verification criteria (issue body)
GET /v1/arena/activityshows transition kinds after seeded eventsapi_arena_activity_smoke(HTTP router oneshot ≡ curl against running indexer)Attack / abuse test plan
kind,actor,target, amounts/deltas, tx identity,block_timestamp— no key materialapi_activity_cursor_smokeImplementation spot-check
indexer/src/api_arena.rs—ACTIVITY_UNION_SQLunions nine branches (4 WarBow + buy + 5 transition tables).indexerApi.ts; docs cross-linked from arena-views and frontend-content-audit.Follow-ups
mentioned in issue #364