Skip to content

Comments

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

Draft
Alexangelj wants to merge 2 commits intomainfrom
fix/trading-function-boundary
Draft

fix(#439): updates trading function bound case v1.4.0-beta#441
Alexangelj wants to merge 2 commits intomainfrom
fix/trading-function-boundary

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