Fetch uncached V3 pools on demand so cold quotes find liquidity#4560
Fetch uncached V3 pools on demand so cold quotes find liquidity#4560AryanGodara wants to merge 1 commit into
Conversation
c628569 to
a1aa54b
Compare
ec454b8 to
1d243f4
Compare
There was a problem hiding this comment.
Code Review
This pull request implements on-demand fetching for Uniswap V3 pools that are missing from the warm cache, allowing them to be fetched at the indexer's current block instead of waiting for the next maintenance cycle. However, two high-severity issues were identified: first, if no pools exist for the requested token pairs, the checkpoint block number defaults to 0, which triggers a massive event replay from block 1 and can cause database overload or OOM; second, passing 0 as the target block to fetch current pools breaks the subgraph client backend by querying the genesis block. Both issues require immediate fixes to ensure stability and compatibility.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
1d243f4 to
5bcf94d
Compare
a1aa54b to
30abab7
Compare
5bcf94d to
5df6d08
Compare
30abab7 to
eb207c2
Compare
5df6d08 to
706dac6
Compare
eb207c2 to
ea474c9
Compare
706dac6 to
8bfe6c4
Compare
ea474c9 to
8b03564
Compare
8bfe6c4 to
cf905d5
Compare
Description
The driver's Uniswap V3 fetcher warm-caches the top
max-pools-to-initializepools ranked by rawliquidity. Raw liquidity isn't comparable across pools (it scales with token decimals and price range), so well-funded pools with a low raw value are excluded from the warm cache. When a quote requests such a pair,checkpoint.get()returns nothing andfetchreturns zero AMMs, failing the quote until a later maintenance tick happens to back-fill the pool.This change makes
fetchfetch the requested pairs' uncached pools on demand instead of deferring to maintenance, so the first quote for any pair finds liquidity.Changes
PoolsCheckpointHandler::getalso returns the ids of pools that exist for the requested pairs but aren't cached.fetchfetches those on demand (newfetch_pools) before building the result; on failure it serves whatever is cached.fetch_poolsskips pools whose conversion fails (e.g. ticks not yet available) instead of aborting the batch;update_missing_poolsreuses it, so periodic maintenance gains the same resilience.Stacked on #4559 (bootstrap split) and #4555 (migration isolation) so one image carries all three for combined staging validation.
How to test
Unit + e2e tests.
Did a local driver against an ink-seeded pool-indexer. it loads the previously-missing pools on the first quote.