Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

investigate(CL): potential off-by-one error when stopping close to lower tick of a bucket #5574

Closed
p0mvn opened this issue Jun 19, 2023 · 0 comments
Assignees
Labels
F: concentrated-liquidity Tracking the development of concentrated liquidity feature to improve filtering on the project board

Comments

@p0mvn
Copy link
Member

p0mvn commented Jun 19, 2023

Background

Upon merging #5526 and #5541 together, there were some test failures stemming from one by one final ticks when stopping within a bucket.

More context: https://osmosis-network.slack.com/archives/C047MFF0U1X/p1687195103842209?thread_ts=1687190034.518519&cid=C047MFF0U1X

There might be an edge case that is not covered by our suite. Assume I swap zero for one, close to the tick boundary and end up on a lower tick right before crossing it here. Assume that our new CalculateSqrtPriceToTick bumps me down by one tick so that I'm now in another bucket without having crossed the tick.

We do have such test cases constructed but I'm wondering if the math just works out for them. As a result, it does not choose the tMin1 value inCalculateSqrtPriceToTick and this particular construction passes

Suggested Design

Try to break our swaps by constructing a test case that stops within a bucket but close to a lower edge so that tick rounding pushes the lower tick in another bucket without crossing it

Acceptance Criteria

  • see if it breaks
  • if breaks, come up with direction
  • if cannot break, document finding and explain why this is safe
@p0mvn p0mvn added the F: concentrated-liquidity Tracking the development of concentrated liquidity feature to improve filtering on the project board label Jun 19, 2023
@github-project-automation github-project-automation bot moved this to Needs Triage 🔍 in Osmosis Chain Development Jun 19, 2023
@p0mvn p0mvn self-assigned this Jun 19, 2023
@p0mvn p0mvn closed this as completed Jun 22, 2023
@github-project-automation github-project-automation bot moved this from Needs Triage 🔍 to Done ✅ in Osmosis Chain Development Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F: concentrated-liquidity Tracking the development of concentrated liquidity feature to improve filtering on the project board
Projects
Archived in project
Development

No branches or pull requests

1 participant