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

test(CL): multiple swaps over contiguous initialized ticks with tick spacing of 1 #5558

Closed
p0mvn opened this issue Jun 18, 2023 · 2 comments · Fixed by #5582
Closed

test(CL): multiple swaps over contiguous initialized ticks with tick spacing of 1 #5558

p0mvn opened this issue Jun 18, 2023 · 2 comments · Fixed by #5582
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 18, 2023

Background

This is a follow-up to:
#5526

We need to define tests that swap over adjacent contiguous initialized ticks with tick spacing of 1.

Suggested Design

General setup:

  1. Initialized 3 positions at each tick spacing increment around the current tick

The layout should look like the following:

                                                                        original_cur_tick
                                                                           /////////
                                                                       ////////////////
                                                                   //////////////////////
min tick                                                                                             max tick

Zero for one

  • swap to the middle tick to the left of the original current, then swap again to the leftmost tick
  • swap to the middle tick to the left of the original current, then swap again to the rightmost tick smaller than the original current
  • swap to the middle tick to the left of the original current and swap again but stay within the same initialized tick
  • swap to the middle tick to the left of the original current and then swap all the way back to the original current tick
  • swap beyond the leftmost tick and assert the error

One for zero

  • swap to the middle tick to the right of the original current, then swap again to the rightmost tick
  • swap to the middle tick to the right of the original current, then swap again to the leftmost tick greater than the original current
  • swap to the middle tick to the right of the original current and swap again but stay within the same initialized tick
  • swap to middle tick to the right of original current and swap again all the way back to the original current tick
  • swap beyond rightmost tick and assert error

Acceptance Criteria

  • test vectors added
@p0mvn p0mvn added the F: concentrated-liquidity Tracking the development of concentrated liquidity feature to improve filtering on the project board label Jun 18, 2023
@AlpinYukseloglu
Copy link
Contributor

These test vectors should fit quite cleanly into the tests introduced in #5476 (would just need to implement the swap vectors as additional optional test parameters).

Up to you whether building deeper context on those tests is a good time tradeoff but wanted to voice the option

@p0mvn
Copy link
Member Author

p0mvn commented Jun 19, 2023

Thanks. YeahI've looked at #5476 and while some of the setup logic could be reused, it felt more intuitive to me to continue plugging these vectors into the hand-picked "swap tick cross test suite" I added here: #5526

It does feel like a worthwhile addition as we have no tests covering that currently. I also suspect it let me uncover another critical bug. Will update once confirmed

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
None yet
2 participants