Bug
lib/ranking.ts calls get24hPriceChange() and getTokenTVL() for every candidate storyline (up to 50). Each function makes 2 on-chain reads, totaling ~200 RPC calls per discover page load. No caching layer exists.
Impact: Slow page loads, potential RPC rate limiting on Base Sepolia (and worse on mainnet with paid RPC).
Fix:
- Add
unstable_cache or revalidate (Next.js ISR) to the discover page server component
- Consider a reasonable revalidation window (e.g., 60-300 seconds)
- Alternatively, batch RPC calls using viem
multicall to reduce round trips
Context: Introduced in PR #86. Both getTrendingStorylines() and getRisingStorylines() in lib/ranking.ts have this issue.
Checklist:
Labels: bug, agent/T3
Bug
lib/ranking.tscallsget24hPriceChange()andgetTokenTVL()for every candidate storyline (up to 50). Each function makes 2 on-chain reads, totaling ~200 RPC calls per discover page load. No caching layer exists.Impact: Slow page loads, potential RPC rate limiting on Base Sepolia (and worse on mainnet with paid RPC).
Fix:
unstable_cacheorrevalidate(Next.js ISR) to the discover page server componentmulticallto reduce round tripsContext: Introduced in PR #86. Both
getTrendingStorylines()andgetRisingStorylines()inlib/ranking.tshave this issue.Checklist:
multicallfor batching on-chain readsnpm run lintandnpm run typecheckpassLabels:
bug,agent/T3