-
Notifications
You must be signed in to change notification settings - Fork 592
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
test(x/gamm): remove liquidity events #2186
Conversation
@@ -483,43 +490,50 @@ func (suite *KeeperTestSuite) TestExitPool() { | |||
} | |||
|
|||
for _, test := range tests { | |||
suite.SetupTest() | |||
suite.Run(test.name, func() { |
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.
Note to reviewers: the diff is large because of indentation change due to suite.Run
x/gamm/keeper/msg_server_test.go
Outdated
shareInAmount: sdk.NewInt(shareOut), | ||
tokenOutMins: sdk.NewCoins(), | ||
expectedRemoveLiquidityEvents: 1, | ||
expectedMessageEvents: 3, // 1 gamm + 2 tendermint. |
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.
just for my learning, why are there two TM messages emitted here?
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.
These are not TM, the comment is wrong, and I'm going to change this. This happens because other keeper methods emit these events. For example, bank send:
https://github.com/cosmos/cosmos-sdk/blob/71035879e4af4551b9bcf16f79bc52785793602e/x/bank/keeper/send.go#L213-L215
I think the bank send is wrong and should instead have its message emitted in the message server so that we don't triple-count it here.
Co-authored-by: Adam Tucker <adam@osmosis.team>
Co-authored-by: Adam Tucker <adam@osmosis.team>
Co-authored-by: Adam Tucker <adam@osmosis.team>
Planning on merging this once CI passes. All comments are addressed and no API or state-breaking changes |
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
* test(x/gamm): remove liquidity events * remove capacity pre-allocation * Update x/gamm/keeper/internal/events/emit_test.go Co-authored-by: Adam Tucker <adam@osmosis.team> * Update x/gamm/keeper/msg_server_test.go Co-authored-by: Adam Tucker <adam@osmosis.team> * Update x/gamm/keeper/pool_service_test.go Co-authored-by: Adam Tucker <adam@osmosis.team> * shareIn * update event comments * changelog * Update CHANGELOG.md Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com> * add docs Co-authored-by: Adam Tucker <adam@osmosis.team> Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com> (cherry picked from commit 40f19a3) # Conflicts: # CHANGELOG.md # x/gamm/keeper/pool_service_test.go # x/superfluid/keeper/unpool_test.go
Part of: #1942
What is the purpose of the change
Tests remove liquidity events that should be emitted when a pool is exited.
Similarly to #2141, I noticed that they were emitted twice:
I removed 1. while keeping 2.
No breaking changes.
Passthrough changes
AssertEventEmitted
test helper to be defined on the suite. It is also useful for testing events in other modulesctx
suite.Run()
to some table-driven testsTesting and Verifying
Documentation and Release Note
Unreleased
section inCHANGELOG.md
? no