After introducing the liquidity approximation (allowing the Vault to handle unbalanced liquidity operations itself, vs. delegating to the pools), the WeightedMath functions supporting those operations became unused.
These functions contained various limits (e.g., invariant change limits) that were enforced at the math level in v2: but were now no longer being used. The continued presence of these functions obscures this, so they're best removed.
I don't think the minimum weight really belongs in the math, so I moved that to the pool. (EDIT: per discussion, the limits do arise from the math, so maybe the final state should have some parameters in the math.) I also removed the invariant limits from the math, as they're currently unused. We will need to reintroduce them when we apply the limits in the existing code.
Apologies to Elshan for tossing all those Rounding tests :)
Type of change
[ ] Bug fix
[ ] New feature
[ ] Breaking change
[ ] Dependency changes
[X] Code refactor / cleanup
[ ] Optimization: [ ] gas / [ ] bytecode
[ ] Documentation or wording changes
[ ] Other
Checklist:
[X] The diff is legible and has no extraneous changes
[N/A] Complex code has been commented, including external interfaces
[ ] Tests have 100% code coverage
[X] The base branch is either main, or there's a description of how to merge
Description
After introducing the liquidity approximation (allowing the Vault to handle unbalanced liquidity operations itself, vs. delegating to the pools), the WeightedMath functions supporting those operations became unused.
These functions contained various limits (e.g., invariant change limits) that were enforced at the math level in v2: but were now no longer being used. The continued presence of these functions obscures this, so they're best removed.
I don't think the minimum weight really belongs in the math, so I moved that to the pool. (EDIT: per discussion, the limits do arise from the math, so maybe the final state should have some parameters in the math.) I also removed the invariant limits from the math, as they're currently unused. We will need to reintroduce them when we apply the limits in the existing code.
Apologies to Elshan for tossing all those Rounding tests :)
Type of change
Checklist:
main
, or there's a description of how to mergeIssue Resolution