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

Gyro E-CLP #1055

Merged
merged 71 commits into from
Dec 17, 2024
Merged

Gyro E-CLP #1055

merged 71 commits into from
Dec 17, 2024

Conversation

joaobrunoah
Copy link
Contributor

Description

This PR adapts Gyro E-CLP to balancer v3.

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

Issue Resolution

Closes #705

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.

First pass done. Great start really, looks mostly cooked!

I just have very minor comments. The only part I'd consider changing is the parameter validation, where the use of if (!original_condition) revert makes it kinda harder to read.

I think this is a good reason to compile this package with 0.8.27 and just use requires, preserving the original redability. Other than that the rest looks correct.

I understand the tests can be expanded to test more ECLP settings, but that's totally out of scope of this PR. Let's open a ticket to track that down anyways.

Awesome job!

pkg/pool-gyro/contracts/GyroECLPPool.sol Outdated Show resolved Hide resolved
pkg/pool-gyro/contracts/GyroECLPPool.sol Show resolved Hide resolved
pkg/pool-gyro/contracts/GyroECLPPool.sol Outdated Show resolved Hide resolved
pkg/pool-gyro/contracts/GyroECLPPool.sol Show resolved Hide resolved
pkg/pool-gyro/contracts/GyroECLPPool.sol Outdated Show resolved Hide resolved
pkg/pool-gyro/contracts/lib/GyroECLPMath.sol Outdated Show resolved Hide resolved
pkg/pool-gyro/contracts/lib/GyroECLPMath.sol Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

I understand the only change here is revert reasons right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I didn't want to change the math to 0.8 because we were close to auditing.

pkg/pool-gyro/test/foundry/E2eBatchSwapECLP.t.sol Outdated Show resolved Hide resolved
@joaobrunoah joaobrunoah requested a review from jubeira December 13, 2024 17:37
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.

Thanks @joaobrunoah, but I think we need to polish the param validation a little bit. I made just a few comments but the pattern is repeated across the math file (not sure if elsewhere yet).

Let's try to write those requires exactly as they were in the original code, simply replacing _grequire with the standard requre and the gyro error with a custom error, preserving the semantics. Note that in most cases <= and >= are used instead of strict operators.

pkg/pool-gyro/contracts/lib/GyroECLPMath.sol Outdated Show resolved Hide resolved
pkg/pool-gyro/contracts/lib/GyroECLPMath.sol Outdated Show resolved Hide resolved
@elshan-eth
Copy link
Contributor

elshan-eth commented Dec 17, 2024

I watched it the first time, I think I'll need to watch it a few more times.

Copy link
Contributor

@elshan-eth elshan-eth left a comment

Choose a reason for hiding this comment

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

LGTM!

@elshan-eth
Copy link
Contributor

I have a small question. Why can't we take a ready math contract and reuse it? I assume that the problem is in dependencies, but it is still interesting to know WDYT

Juan Ignacio Ubeira added 2 commits December 17, 2024 12:34
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.

Just pushed last fixes and reviewed the latest changes. LGTM too!

Will merge after CI goes green.

@jubeira
Copy link
Contributor

jubeira commented Dec 17, 2024

I have a small question. Why can't we take a ready math contract and reuse it? I assume that the problem is in dependencies, but it is still interesting to know WDYT

You mean gyro math or signed math?

@elshan-eth
Copy link
Contributor

You mean gyro math or signed math?

I mean reusing GyroECLPMath from the original repo

@jubeira jubeira merged commit 2d6ae6a into main Dec 17, 2024
13 checks passed
@jubeira jubeira deleted the gyro-eclp-new branch December 17, 2024 20:50
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.

Port Gyro pools: ECLP
5 participants