-
Notifications
You must be signed in to change notification settings - Fork 607
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
x/gamm: Add check for correct input asset denoms to CalcJoinPoolShares #1931
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do think that the existing code base does have checks within the methods of CalcJoinPoolShares
already, but Im generally agreeing on this extra explicit sanity check!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
- Do we have a test case already testing this path? If not, we should definitely add one.
- We should get a changelog entry in.
I believe this test should cover it but happy to add another one with more assets/mixed assets if you think it would be useful:
Added in recent commit! |
Just making sure we don't miss anything - was that commit pushed? Not seeing a new test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This test was already there so it's not a part of this PR. The link I included was directly from main |
Closes: #1906
What is the purpose of the change
Our current implementation of CalcJoinPoolShares checks to make sure the number of denoms sent in for an all-asset join is correct, but has no check for whether those assets are actually the correct denoms. This makes it so that entirely invalid inputs (i.e. correct number of input tokens but incorrect denoms) successfully make it through the entire set of all-asset join calculations until they are incidentally caught in the single-asset join section due to a check in
updateIntermediaryPoolAssetsLiquidity
.osmosis/x/gamm/pool-models/balancer/amm.go
Lines 368 to 370 in 85529c7
This PR adds an additional check to the input tokens that makes sure they are of the correct denoms so that the function never assumes invalid inputs are correct for calculating all-asset joins.
Brief Changelog
DenomsSubsetOf
that makes sure that the input denoms are part of the pool being joined (Note: we cannot useDenomsSubsetOf
here because we have a denom->PoolAsset map instead of a set ofsdk.Coins
to represent pool liquidity)Testing and Verifying
This change is already covered by existing GAMM tests.
Documentation and Release Note
Unreleased
section inCHANGELOG.md
? (no)