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

Price improvement e2e test #2539

Merged
merged 19 commits into from
Mar 21, 2024
Merged

Price improvement e2e test #2539

merged 19 commits into from
Mar 21, 2024

Conversation

squadgazzz
Copy link
Contributor

@squadgazzz squadgazzz commented Mar 19, 2024

Fixes #2534

Those e2e tests are also required to be refactored and unified into a single test case. This will be done in a separate PR.

@squadgazzz squadgazzz changed the base branch from main to price-improvement-fee-api March 19, 2024 11:45
@squadgazzz squadgazzz marked this pull request as ready for review March 19, 2024 13:22
@squadgazzz squadgazzz requested a review from a team as a code owner March 19, 2024 13:22
@squadgazzz squadgazzz changed the title Price improvement e2e tests Price improvement e2e test Mar 19, 2024
Copy link
Contributor

@sunce86 sunce86 left a comment

Choose a reason for hiding this comment

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

Lg, although it's a bit unclear what actually happens under the hood, since we see only two random numbers in the test. Might be useful to add a comment similar to other tests (this can be recovered from existing logs and/or by adding temporary logs to observe execution)

@squadgazzz squadgazzz force-pushed the 2534/price-improvement-e2e-tests branch from 57da899 to 7efbc03 Compare March 19, 2024 16:44
@squadgazzz
Copy link
Contributor Author

Might be useful to add a comment similar to other tests (this can be recovered from existing logs and/or by adding temporary logs to observe execution)

Added a comment, but not sure how to properly reflect the price limit adjustments based on the quote.

Base automatically changed from price-improvement-fee-api to main March 20, 2024 15:49
@squadgazzz squadgazzz force-pushed the 2534/price-improvement-e2e-tests branch from ae53b07 to b499e19 Compare March 20, 2024 17:38
@squadgazzz squadgazzz force-pushed the 2534/price-improvement-e2e-tests branch from b499e19 to ece7143 Compare March 20, 2024 17:46
// Settlement contract balance after execution = 205312824093250 GNO =
// 205312824093250 GNO * 9871377667766744586 / (10000000000000000000 -
// 205312824093250) = 202676203868401 DAI
execute_test(
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this execute_test wrapper really necessary assuming we get rid of all the redundant surplus test cases and just keep 3 cases (surplus, price improvement and volume fee)? I think having three more verbose test cases would be better.

Maybe we could use more meaningful values (currently it seems like these were derived by running the test once and adjusting the values to what the test created) so it might not be that useful. But then, I also don't want us to go down the rabbit hole of redesigning the whole test infra like we did in the driver crate. Is it possible to use limit orders to ensure predictable match amounts?

Otherwise we can maybe do something like

  1. Seed a bit of liquidity on the AMM that serves the token pair
  2. Get a quote (which we use for placing the order)
  3. Inject more liquidity into the AMM (this should improve the price)
  4. Get another quote which we can do to do the math of how much the user should get in the end of the day.

This way it would be a bit easier to follow that these long digit series.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will be tackled in the #2468

@squadgazzz squadgazzz enabled auto-merge (squash) March 21, 2024 13:41
@squadgazzz squadgazzz merged commit 7680a1b into main Mar 21, 2024
9 checks passed
@squadgazzz squadgazzz deleted the 2534/price-improvement-e2e-tests branch March 21, 2024 15:50
@github-actions github-actions bot locked and limited conversation to collaborators Mar 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

chore:PriceImprovement policy fee e2e test
5 participants