GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Revert "fix(async): port price-floor and odd-tick TVL fixes to async clients" by liquid-8 · Pull Request #495 · uniswap-python/uniswap-python Conversation
Member
Reverts #493
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
…clients …" This reverts commit d706627.
|
There was an error while loading. Please reload this page.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@ ## master #495 +/- ## ========================================== - Coverage 62.08% 60.78% -1.31% ========================================== Files 14 14 Lines 4302 4302 ========================================== - Hits 2671 2615 -56 - Misses 1631 1687 +56 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
[Medium impact] The changes affect async price and v3 pool-value queries. Fix the low-price quotes and spacing-one TVL calculations before merging. FindingsSummaryReverts the async price and odd-tick TVL fixes and deletes their offline regression tests.
Reviews (1) · Last reviewed commit: "Revert "fix(async): port price-floor and..." · Reviewed by Greptile |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| raw_price = (sqrtPriceX96 * sqrtPriceX96 * 10**den1 >> (96 * 2)) / ( | ||
| 10**den0 | ||
| ) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The right shift drops price precision before decimal scaling in both get_raw_price and AsyncUniswap4.get_token_token_spot_price. With 18-decimal tokens and a valid price near 1e-24, the shifted numerator becomes zero. The forward call returns 0.0, and the reverse call raises ZeroDivisionError. Less extreme prices also lose precision.
Keep the numerator intact and divide by (1 << 192) * 10**den0 here, with the matching denominator in the V4 method.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| sqrtPriceLow = 1.0001 ** (tick // 2) | ||
| sqrtPriceHigh = 1.0001 ** ((tick + TICK_SPACING) // 2) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Using // 2 gives the wrong price bounds for spacing-one pools, which are supported at fee 100. For the interval from tick 0 to tick 1, both bounds become 1, so both token contributions become zero despite positive liquidity. Odd starting ticks instead get a wider interval.
Restore / 2 for both bounds so get_tvl_in_pool counts liquidity at its actual prices.
| sqrtPriceLow = 1.0001 ** (tick // 2) | |
| sqrtPriceHigh = 1.0001 ** ((tick + TICK_SPACING) // 2) | |
| sqrtPriceLow = 1.0001 ** (tick / 2) | |
| sqrtPriceHigh = 1.0001 ** ((tick + TICK_SPACING) / 2) |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Greptile's review correctly flags two P1 bugs this revert would re-introduce: low prices returning zero and wrong pool TVL balances in the async clients. Those are the exact bugs #493 fixed, and the offline regression tests it added would be deleted. The failing v3 CI tests that prompted this (DAI-USDC pool params changed on mainnet) are addressed separately in #494 and are not related to the async price/TVL fixes. Could you clarify what specific problem you're trying to solve with this revert? If there's a new regression from #493 I'm not seeing, happy to fix it directly rather than lose the price-floor and odd-tick TVL corrections. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
It's not that I'm gonna roll back, rather opposite I'm trying to localize a very specific issue Quick breakdown: codebase was unaffected since the last major PR, everything was green. Then you found that arithmetic problem and made a sync PR, still green (which make sense). Erik merged that, still green after the merge. Then you pushed an async PR for the very same reason, still green. I checked, everything was fine, I merged as well. And that merge broke tests for both sync and async versions, which is insane At the moment I'm sure: this is infra issue, not ours. Still pondering though what part of infra is broken |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Got it — you're using the revert as a diagnostic control, not proposing to drop the fixes. I misread that intent. The useful result is that the revert's v3 run still fails in both clients: I also need to correct my earlier advice on #493: these tests start local Anvil forks, so do not fund or approve anything on mainnet. The next isolating experiment I'd use is the last-green revision versus the failing revision with the same fork block, Anvil binary and RPC endpoint, each on a fresh fork. The fixture currently leaves the fork block unpinned, and this failing run installed Anvil 1.9.0 ( |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.