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

fix(#439): updates trading function bound case v1.4.0-beta #441

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Alexangelj
Copy link
Contributor

Changes

Updates the NormalStrategyLib.tradingFunction to explicitly handle the boundary case.

  • Adds four new custom errors that are used when one reserve is at the bound but the other reserve is not at the opposite bound.
  • Adds two branches of code in trading function:
      1. If x >= WAD || y <= 0, then checks if the other reserve is at the opposite bound, if not it reverts, else it returns σ√τ
      1. If x <= 0 || y >= WAD, then checks if other reserve is at the opposite bound, if not it reverts, else it returns σ√τ
      1. Else, computes the trading function regularly

There needs to be some updates to the test suite to test these boundary cases better. Right now, there are fuzz tests that fuzz a broad space of parameters and reserves, but these should be more concentrated on fuzzing the reserve changes against a few specific parameter profiles.

@Alexangelj Alexangelj changed the title fix(#439): updates trading function bound case fix(#439): updates trading function bound case v1.4.0-beta Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant