Conversation
|
Caution Review failedPull request was closed or merged during review No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThis PR introduces Redis-backed caching infrastructure for on-chain data endpoints. It adds a new cache service module with async Redis operations (get, set, invalidate, prefix-invalidate), integrates caching into the existing escrow endpoint with cache invalidation on state changes, and creates a new on-chain API router with endpoints for reputation lookups, staking balances, treasury statistics, and webhook-based cache invalidation. The webhook endpoint verifies HMAC-SHA256 signatures and clears cached data across staking, reputation, and treasury namespaces. The new router is registered in the main FastAPI application, and comprehensive tests cover all endpoint behaviors including cache hit/miss scenarios. Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (1 warning, 2 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Description
Implements on-chain data REST API endpoints with Redis TTL caching (30 seconds) for live Solana state queries.
Closes #507
New endpoints (
/apiprefix):GET /reputation/{wallet}— Reputation summary for the contributor whose verified wallet matches the addressGET /staking/{wallet}— Native SOL + $FNDRY SPL token balances for any wallet via Solana RPCGET /treasury/stats— Treasury balance and aggregate payout stats (Redis cache + existing 60s in-memory layer)POST /webhooks/helius— Cache invalidation webhook for Helius/Shyft with optional HMAC-SHA256 signature verificationCache layer (
app/services/onchain_cache.py):cache_get/cache_set/cache_invalidate/cache_invalidate_prefixwith 30s TTLNoneso callers fall back to live RPCEscrow GET caching (
app/api/escrow.py):GET /api/escrow/{bounty_id}now caches the response in Redis for 30 secondsSolana Wallet for Payout
Wallet: 4QhseKvBuaCQhdkP248iXoUxohPzVC5m8pE9hAv4nMYw
Type of Change
Checklist
console.logor debugging code left behindTesting
backend/tests/test_onchain_api.py(5 test classes, 19 tests)TestReputationEndpoint— 404 on unknown wallet, cache miss/hit, cache write, paginationTestStakingEndpoint— RPC balances, cached response, cache write, 502 on RPC errorTestTreasuryStatsEndpoint— service hit, cache hit, 503 on failure, cache writeTestHeliusWebhook— account invalidation, treasury bust, signature missing/invalid/validTestEscrowCaching— GET writes cache on miss, serves from cache without DB hitAdditional Notes