Uniswap / routing-api

GNU General Public License v3.0
150 stars 185 forks source link

fix: sepolia cached routes filter blocks to live to unblock v4 swap bug bash on sepolia #873

Closed jsy1218 closed 3 weeks ago

jsy1218 commented 3 weeks ago

I found out why cached routes cache invalidation doesn't work. Because we forgot to filter cached routes based on the blocks to live https://github.com/Uniswap/routing-api/blob/main/lib/handlers/router-entities/route-caching/dynamo-route-caching-provider.ts#L478.

I was first debugging against prod trading-api public endpoint https://app.warp.dev/block/ghxWNHwhcCy4P0n7qpqexD, on why it keeps returning a v4 pool, that returns a pool that doesn't even exist on the re-deployed v4 sepolia PoolManager[0xE8E23e97Fa135823143d6b9Cba9c699040D51F70]. Then I realized, the pool id 0xb793c6019fbdb95575103e55874d923da9386f689076f64659f1fff6bd3ac31f belongs to the previously deployed v4 sepolia PoolManager. Then I realized, this is prob another cached routes becoming stale case.

then I was able to repro on my local endpoint https://app.warp.dev/block/U6GvrgSvHrAfl9tESL2ZgE, with the pool id 0xb793c6019fbdb95575103e55874d923da9386f689076f64659f1fff6bd3ac31f that also doesn't exist on PoolManager[0xE8E23e97Fa135823143d6b9Cba9c699040D51F70]. After this fix, I can finally get the pool I want to go through in https://app.warp.dev/block/hWUIoJFIDXoFOrsKt1W27R. Those are the 1 ETH / 2160 USDC pools with hardcoded hook address 0x0000000000000000000000000000000000000020 that was LP'ed today against v4 position manager. Hence this gives me confidence the fix can also work on prod routing-api.

We need this quick fix to unblock the native ETH -> USDC v4 swap bug bash tomorrow. We need to properly fix the cached routes cache invalidation in a separate PR.

jsy1218 commented 3 weeks ago

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @jsy1218 and the rest of your teammates on Graphite Graphite

graphite-app[bot] commented 3 weeks ago

Graphite Automations

"Request reviewers once CI passes on routing-api repo" took an action on this PR • (10/16/24)

4 reviewers were added and 1 assignee was added to this PR based on 's automation.

jsy1218 commented 3 weeks ago

Merge activity