Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Refactor: Change Pool API to have separate methods for
JoinPool
andJoinPoolNoSwap
#2133Refactor: Change Pool API to have separate methods for
JoinPool
andJoinPoolNoSwap
#2133Changes from 19 commits
9f86b96
3cb4b3b
654fdf4
019e3e5
1fdf342
5633945
f1a00eb
08d2b8e
eebb7cc
43772e7
79e4232
82ff209
a251f7c
a370c6e
dcbb25a
d9fe736
8806506
1a1509c
20f068e
4797f8f
eda585c
0e5f5fa
1eae187
8b6f485
6147129
0e55e9d
005ae6a
096d5b2
2f53651
d91e0b5
0ef8a99
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
So now this method is basically not called in the codebase anywhere, right?
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.
CalcJoinPoolShares
? Do you mean calls outside of the module? Otherwise it's called inJoinPool
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.
But JoinPool is no longer called in the state machien right?
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 might be missing your point here but I believe
JoinPool
is still called inJoinSwapExactAmountIn
:osmosis/x/gamm/keeper/pool_service.go
Line 272 in 16e3e4b
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.
Context:
CalcJoinPoolNoSwapShares
includes this calculation and returns the resultingtokensJoined
aboveThere 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'm just going to point out which branches are not covered by tests.
@AlpinYukseloglu do you mind confirming please if it is possible to introduce test cases to cover these
This is the first branch
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.
This one should actually not be possible as it only fails when there are duplicate assets in a pool and it's not possible to have duplicate denoms in a valid coin set. The error check is just here as a best practice.
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.
Is it due to using a balancer pool constructor in
TestCalcJoinPoolNoSwapShares
where the constructor performs this validation?What if we avoid it using it to trigger an invalid state and achieve full coverage?
We should be able to:
Now, we can force duplicate pool assets
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.
Please see the most recent case I added. It is still technically a trivial test case because duplicate pool assets are caught in multiple places throughout this function and ultimately end up in a division by zero even if you comment out all of them, but it should be covered now.