balancer / balancer-v3-monorepo

GNU General Public License v3.0
37 stars 10 forks source link

Weighted math cleanup #811

Closed EndymionJkb closed 1 month ago

EndymionJkb commented 1 month ago

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:

Issue Resolution