-
Notifications
You must be signed in to change notification settings - Fork 83
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
Balancer Stable Math: calculate_invariant_v2 #368
Conversation
Another question is whether we want to keep supporting the old pools. In that case we'd need to duplicate the parts of the math that have changed. |
I think we would definitely want to support all balancer pools so we would need a much more elaborate solution than just updating the code. They do claim that the math hasn't changed and if that is the case then maybe no change is needed at all. Still waiting to hear if they have some edge cases/unit tests that were introduced in their contract update. |
Confirmed by balancer here, that the new implementation returns the same values as the only, it only has a wider convergence |
First part of #343: refactoring the calculate_invariant method so that we can support both versions of
StablePool
.There has been a change to the
calculateInvariant
method in Balancer's stable math. Previously they had a boolean indicator for rounding up or down on division and now they only support rounding up.The Balancer team have assured us that this computation will always return the same results as the previous implementation of the contract (also confirmed by out unit tests still agreeing), and that the only difference is better convergence. This means we can simply adjust the implementation and use it for all stable pools going forward.
Test Plan
Only one unit test needed to be updated (since this new implementation has a wider convergence ratio).
Release notes
Not yet determined. These changes may also need to be propagated to the quasi-modo solver (where stable math is also implemented) and we will also need to start indexing pools coming from their newly deployed factory.