GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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

@liquid-8

@liquid-8 liquid-8 commented Nov 8, 2026

Copy link
Copy Markdown
Member

Reverts #493

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

greptile-apps[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@liquid-8
Revert "fix(async): port price-floor and odd-tick TVL fixes to async …
2637937
…clients …"

This reverts commit d706627.
@codecov

codecov Bot commented Nov 8, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 25.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.78%. Comparing base (d706627) to head (2637937).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
uniswap/asyncuniswap.py 0.00% 3 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@greptile-apps

greptile-apps Bot commented Nov 8, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 3/5

[Medium impact] The changes affect async price and v3 pool-value queries.

Fix the low-price quotes and spacing-one TVL calculations before merging.

Findings

  1. P1 Low prices become zero ▶
  2. P1 Pool balances are wrong ▶

Summary

Reverts the async price and odd-tick TVL fixes and deletes their offline regression tests.

  • Async v3 and v4 prices now discard low bits before decimal scaling.
  • Async v3 TVL now floors odd tick halves when it builds price bounds.

Reviews (1) · Last reviewed commit: "Revert "fix(async): port price-floor and..." · Reviewed by Greptile

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

greptile-apps[bot]
greptile-apps Bot reviewed Nov 8, 2026
View reviewed changes
Comment thread uniswap/asyncuniswap.py
Comment on lines +2010 to 2012
raw_price = (sqrtPriceX96 * sqrtPriceX96 * 10**den1 >> (96 * 2)) / (
10**den0
)

@greptile-apps greptile-apps Bot Nov 8, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Low prices become zero

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.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread uniswap/asyncuniswap.py
Comment on lines +1461 to +1462
sqrtPriceLow = 1.0001 ** (tick // 2)
sqrtPriceHigh = 1.0001 ** ((tick + TICK_SPACING) // 2)

@greptile-apps greptile-apps Bot Nov 8, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Pool balances are wrong

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.

Suggested change
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.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@TimeToBuildBob

TimeToBuildBob commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@liquid-8

liquid-8 commented Nov 9, 2026

Copy link
Copy Markdown
Member Author

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@TimeToBuildBob

TimeToBuildBob commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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: mint_liquidity gets execution reverted: STF, then test_close_position indexes an empty position list. The latter is a downstream failure, not a separate position-closing regression. That narrows the investigation, but doesn't yet identify which infrastructure component is responsible.

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. mint_liquidity already checks both balances and submits both PositionManager approvals before the failing mint; those checks passed in this run. My claim that replenishing a wallet or retrying CI would solve it was not established. Likewise, changing the fee tier in #494 is not proof that the pool moved or that we've found the cause.

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 (6056c584). At the mint, capture the actual ERC-20 transferFrom failure with a trace and read both allowances to the PositionManager after the approval receipts. Then vary only the RPC endpoint or Anvil version. That separates moving chain state, fork/provider behaviour and transaction handling without conflating them with the arithmetic patch. I haven't reproduced that controlled comparison yet, so I wouldn't call a particular provider or Foundry version the culprit.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@liquid-8 liquid-8 closed this Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@greptile-apps greptile-apps[bot] greptile-apps[bot] left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@liquid-8 @TimeToBuildBob
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.