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 Tau validations in ECLP Math #1185

Merged
merged 2 commits into from
Dec 20, 2024
Merged

Fix Tau validations in ECLP Math #1185

merged 2 commits into from
Dec 20, 2024

Conversation

joaobrunoah
Copy link
Contributor

Description

Certora found some validations were missing for ECLP pool:

  • tauAlpha.y > 0
  • tauBeta.y > 0
  • tauBeta.x > tauAlpha.x

Without these validations, the pool math may be very messed, like the example below:

int256 internal _tauBetaY = -92846388265400743995957747409218517601;

alice usdc 400000000000000000000
alice dai  400000000000000000000

addLiquidityProportional ==============
exactBptAmount 400000000000000000000
amountsIn[0] 100000000000000000000
amountsIn[1] 100000000000000000000

alice usdc 300000000000000000000
alice dai  300000000000000000000

removeLiquiditySingleTokenExactIn ==============
exactBptAmount 400000000000000000000
amountOut usdc 703546354221259914550023
alice usdc 703846354221259914550023
alice dai  300000000000000000000

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Dependency changes
  • Code refactor / cleanup
  • Optimization: [ ] gas / [ ] bytecode
  • Documentation or wording changes
  • Other

Checklist:

  • The diff is legible and has no extraneous changes
  • Complex code has been commented, including external interfaces
  • Tests have 100% code coverage
  • The base branch is either main, or there's a description of how to merge

@joaobrunoah joaobrunoah marked this pull request as draft December 18, 2024 14:29
@joaobrunoah joaobrunoah marked this pull request as ready for review December 19, 2024 14:38
Copy link
Contributor

@sschuldenzucker sschuldenzucker left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@jubeira jubeira left a comment

Choose a reason for hiding this comment

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

LGTM!

@joaobrunoah joaobrunoah merged commit 080bdd7 into main Dec 20, 2024
13 checks passed
@joaobrunoah joaobrunoah deleted the eclp-fix-tau branch December 20, 2024 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants