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

Add version to base pools and refactor pool constructors #2080

Closed
wants to merge 5 commits into from

Conversation

jubeira
Copy link
Contributor

@jubeira jubeira commented Nov 30, 2022

Description

This PR moves the version to the base pool layer (both BasePool and NewBasePool), and refactors the constructors for every pool to reduce the stack pressure and arrange the arguments in a way that makes more sense and is more consistent.

The idea behind the change is the following:

  • We are passing around many parameters that are always the same regardless the pool type. Those are bundled in this PR as BasePoolParams, and every pool has them. There are two benefits here: as a user you know that you'll need at least those in any pool, and also the parameters are routed all the way down to the base layer directly. The version is actually one of those.
  • Besides the base params, every pool type has its own required params. Those are generally bundled in NewPoolParams structs, which are basically the current ones in master when extracting the base ones.
    • One exception to this rule is LinearPool, since every linear pool type has its own nuances and generalizing the 'non-base' params doesn't add up that much.
  • I've also bundled the pool registration params. I was on the fence with this one, but in the end this also reduces stack pressure, and the structs are only bundled / unbundled in the constructors, so it shouldn't add much overhead.

This PR is expected to compile, but tests have not been refactored yet.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Dependency changes
  • Code refactor / cleanup
  • Documentation or wording changes
  • Other

Checklist:

  • The diff is legible and has no extraneous changes
  • Complex code has been commented, including external interfaces
  • Tests are included for all code paths
  • The base branch is either master, or there's a description of how to merge

Issue Resolution

Closes #2026, supersedes #2075.
Alternative to #2078.

Copy link
Contributor

@nventuro nventuro left a comment

Choose a reason for hiding this comment

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

This is definitely an interesting approach, and we may end up choosing this direction or a similar one in the future. However, as-is this changeset is exceedingly large (and doesn't include the corresponding changes in the tests and helpers, which are far from trivial).

I'd go with #2078 for now to address the immediate situation, and then consider a route like this one in the future.

@jubeira
Copy link
Contributor Author

jubeira commented Nov 30, 2022

Sounds good. I'll reopen when the time comes.

Note that the large changeset is hard to avoid: the moment you touch base pools, half of the codebase goes upside down.

@jubeira jubeira closed this Nov 30, 2022
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.

Add Etherscan-visible versioning to pools
2 participants