fix(indexer): prefer on-chain pendingCred for claimable CRED #368 #539

Merged
PlasticDigits merged 1 commit from fix/368-claimable-cred-pending-onchain into main 2026-07-09 07:22:36 +00:00
PlasticDigits commented 2026-07-09 06:57:47 +00:00 (Migrated from gitlab.com)

Summary

  • Wallet stats claimable_cred / pending_cred_accrual prefer live TimeArena.pendingCred when RPC is configured (schema ≥ 2.26.0).
  • Stops zeroing claimable CRED solely because idx_play_cred_claim has a prior row for that epoch (residual after migrateLastBuyEpochToPodium).
  • Fixes play UI Claim CRED gate for wallets like 0xA5F4…f8bA that still have on-chain pending after an earlier claim + epoch migration (#368).

Test plan

  • cd indexer && cargo clippy --all-targets -- -D warnings
  • cd indexer && cargo test --lib arena_wallet_stats
  • Redeploy indexer.yieldomega.com and confirm wallet stats claimable_cred ≈ on-chain pendingCred(wallet, 0) for the reported wallet
  • Claim CRED button enables and succeeds for residual epoch-0 CRED

Closes #368

## Summary - Wallet stats `claimable_cred` / `pending_cred_accrual` prefer live `TimeArena.pendingCred` when RPC is configured (schema ≥ 2.26.0). - Stops zeroing claimable CRED solely because `idx_play_cred_claim` has a prior row for that epoch (residual after `migrateLastBuyEpochToPodium`). - Fixes play UI Claim CRED gate for wallets like `0xA5F4…f8bA` that still have on-chain pending after an earlier claim + epoch migration (#368). ## Test plan - [x] `cd indexer && cargo clippy --all-targets -- -D warnings` - [x] `cd indexer && cargo test --lib arena_wallet_stats` - [ ] Redeploy indexer.yieldomega.com and confirm wallet stats `claimable_cred` ≈ on-chain `pendingCred(wallet, 0)` for the reported wallet - [ ] Claim CRED button enables and succeeds for residual epoch-0 CRED Closes #368
project_80561744_bot_5118c68a88bff95eacb6ab1c47c19cae commented 2026-07-09 06:57:52 +00:00 (Migrated from gitlab.com)

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot) to get automatic reviews on future PRs.
PlasticDigits commented 2026-07-09 07:01:19 +00:00 (Migrated from gitlab.com)

Security review — MR !539

Commit reviewed: 0c44894e14620ff2cd5821ede826ada96dda333f

Scope: Indexer wallet-stats overlay — prefer live TimeArena.pendingCred(wallet, epoch) via configured RPC for claimable_cred / pending_cred_accrual; remove SQL idx_play_cred_claim existence gate that zeroed claimable after partial claims + epoch migration (#368).

Method: Traced attacker-controlled inputs (GET /v1/arena/wallet/{address}/stats path param) through valid_0x_address20 → ABI-encoded eth_call to operator-configured time_arena; compared on-chain pendingCred / claimCred semantics; checked RPC wiring, fallback paths, and frontend claim gating.

Outcome: FINDINGS: 0 medium+

Inline threads: none (no medium+ issues on this diff)

Notes (informational, below reporting threshold)

  • Wallet address is validated (valid_0x_address20, 400 on invalid) before RPC encoding; calldata uses fixed selector 0x0152f65f (pendingCred(address,uint256)) with padded address + epoch — no injection surface.
  • eth_call target and RPC URLs are operator-configured (address_registry, RPC_URL), not user-controlled — no SSRF from request parameters.
  • Mis-reported claimable_cred (RPC outage → SQL fallback, or dishonest RPC) can at worst enable a reverted claimCred tx; minting is enforced on-chain (claimCred zeroes weight/bonus, nonReentrant). No cross-wallet fund loss path identified.
  • Per-peer HTTP rate limiting (router_with_rate_limit / INDEXER_RATE_LIMIT_*) mitigates RPC amplification from wallet-stats polling; added load is two bounded eth_calls per stats request when RPC is configured.

Label: block:security not applied.

## Security review — MR !539 **Commit reviewed:** `0c44894e14620ff2cd5821ede826ada96dda333f` **Scope:** Indexer wallet-stats overlay — prefer live `TimeArena.pendingCred(wallet, epoch)` via configured RPC for `claimable_cred` / `pending_cred_accrual`; remove SQL `idx_play_cred_claim` existence gate that zeroed claimable after partial claims + epoch migration (#368). **Method:** Traced attacker-controlled inputs (`GET /v1/arena/wallet/{address}/stats` path param) through `valid_0x_address20` → ABI-encoded `eth_call` to operator-configured `time_arena`; compared on-chain `pendingCred` / `claimCred` semantics; checked RPC wiring, fallback paths, and frontend claim gating. **Outcome:** `FINDINGS: 0` medium+ **Inline threads:** none (no medium+ issues on this diff) ### Notes (informational, below reporting threshold) - Wallet address is validated (`valid_0x_address20`, 400 on invalid) before RPC encoding; calldata uses fixed selector `0x0152f65f` (`pendingCred(address,uint256)`) with padded address + epoch — no injection surface. - `eth_call` target and RPC URLs are operator-configured (`address_registry`, `RPC_URL`), not user-controlled — no SSRF from request parameters. - Mis-reported `claimable_cred` (RPC outage → SQL fallback, or dishonest RPC) can at worst enable a **reverted** `claimCred` tx; minting is enforced on-chain (`claimCred` zeroes weight/bonus, `nonReentrant`). No cross-wallet fund loss path identified. - Per-peer HTTP rate limiting (`router_with_rate_limit` / `INDEXER_RATE_LIMIT_*`) mitigates RPC amplification from wallet-stats polling; added load is two bounded `eth_call`s per stats request when RPC is configured. **Label:** `block:security` not applied.
PlasticDigits (Migrated from gitlab.com) merged commit 54fdfac458 into main 2026-07-09 07:22:37 +00:00
PlasticDigits commented 2026-07-09 07:22:38 +00:00 (Migrated from gitlab.com)

mentioned in commit 54fdfac458

mentioned in commit 54fdfac458a43d703eee7a053678fa6cda79b79c
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
code/yieldomega!539
No description provided.