investigate(CL): potential off-by-one error when stopping close to lower tick of a bucket #5574
Labels
F: concentrated-liquidity
Tracking the development of concentrated liquidity feature to improve filtering on the project board
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
The text was updated successfully, but these errors were encountered: