-
Notifications
You must be signed in to change notification settings - Fork 626
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: add unit tests for channel upgrade event emission #5475
test: add unit tests for channel upgrade event emission #5475
Conversation
…here are no packet commitments left (#3964)
* Add ChanUpgradeOpen core handler. * Tests tests tests. * Update upgrade open handler based on feedback. * Reformat testing approach. * Move counterpartyhops assignment inline. * Check err of SetChannelState. * Address feedback. * Remove uneeded modification of version.
* chore: adding check for in flight packets in WriteUpgradeAckChannel * added test for TestWriteUpgradeAckChannel * linter * add client update to UpgradeAckChannel test * mv test * merge * fix post-merge * fix merge issues * review comment --------- Co-authored-by: Charly <charly@interchain.berlin> Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
…3895) * Add implementation for message server handling of ChanUpgradeOpen. * Add tests for msg_server. * Address review feedback. * Remove setting of flush status. * Apply suggestions from code review Co-authored-by: Damian Nolan <damiannolan@gmail.com> * Address rest of review comments. --------- Co-authored-by: Damian Nolan <damiannolan@gmail.com>
* chore: update abort upgrade function to panic on error * apply review suggestions --------- Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
* Amend Ack packet to keep acknowledging if we're in the process of flushing pre-upgrade packets. * Use handshake to reach correct state before mutating any fields. * Add test to verify post-ack channel state after last in-flight packet. * Remove unecessary modifications of version for non initializing channel end. * Test both cases: final in-flight packet and non-final one. * Apply suggestions from code review Co-authored-by: Carlos Rodriguez <carlos@interchain.io> * Remove manual setting of flush status. * Update test name, pass mock version to both channels. --------- Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
* Amend timeout to handle in-flight packets. * Update timeout handler per spec. * Update tests to test for toggling of flush status. * Fix small typos in docstring. --------- Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
…UpgradeOpen. (#4052) * Pass in counterparty portid, channelid. * use direct check on err. * Force distinct channel identifiers when testing UpgradeOpen.
…4019) * WIP: adding fee upgrade cbs and testing * imp: allow failure expectations when using chain.SendMsgs * fixing import errors from cherry-pick * updating tests and rm try code * rm diff onChanUpgradeTry * Update modules/apps/29-fee/ibc_middleware.go * adding MetadataFromVersion func to pkg types * addressing pr feedback, disable fees on err, rename args, adding testcase * Update modules/apps/29-fee/ibc_middleware_test.go Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com> * abstract out expIsFeeEnabled check in tests * adding additional error context to MetadataFromVersion --------- Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
…4023) * WIP: adding fee upgrade cbs and testing * imp: allow failure expectations when using chain.SendMsgs * fixing import errors from cherry-pick * updating tests and rm try code * rm diff onChanUpgradeTry * Update modules/apps/29-fee/ibc_middleware.go * adding OnChanUpgradeTry implementation for 29-fee, adding tests * rm CR in test expectation * remove goconst linter as discussed async * adding MetadataFromVersion func to pkg types * addressing pr feedback, disable fees on err, rename args, adding testcase * Update modules/apps/29-fee/ibc_middleware_test.go Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com> * abstract out expIsFeeEnabled check in tests * adding additional error context to MetadataFromVersion * propagate changes from onChanUpgradeInit PR * addressing test assertion feedback --------- Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
…4028) * WIP: adding fee upgrade cbs and testing * imp: allow failure expectations when using chain.SendMsgs * fixing import errors from cherry-pick * updating tests and rm try code * rm diff onChanUpgradeTry * Update modules/apps/29-fee/ibc_middleware.go * adding OnChanUpgradeTry implementation for 29-fee, adding tests * rm CR in test expectation * remove goconst linter as discussed async * adding onChanUpgradeAck implementation to 29-fee, adding tests * adding MetadataFromVersion func to pkg types * addressing pr feedback, disable fees on err, rename args, adding testcase * Update modules/apps/29-fee/ibc_middleware_test.go Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com> * abstract out expIsFeeEnabled check in tests * adding additional error context to MetadataFromVersion * propagate changes from onChanUpgradeInit PR * addressing test assertion feedback * updating to use types.MetadataFromVersion in OnChanUpgradeAck * updating tests to add additional checks --------- Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
* use counterparty conn hops. * Clean up tests. * Amend inline comment slightly. * Address nits --------- Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
…gradeAck. (#4075) * Move channel to OPEN if all in-flight packets have been flushed in UpgradeAck. * Add comment noting that counterparty flush status has been verified before usage. * Fix failing tests.
* adding transfer checks in upgrade cbs * adding tests and reduce diff by moving code out * add additional assertion on upgrade stored in state * lint: single var declaration instead of block * rename version -> upgradeVersion * Update modules/apps/transfer/ibc_module_test.go * rename sequence -> upgradeSequence * updating to use NewTranferPath in test func * address pr comment - reformat error msg
…-upgrade-event-emission
…-upgrade-event-emission
…-upgrade-event-emission
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.
Excellent work, @charleenfei!
…-upgrade-event-emission
…ent-emission' of github.com:cosmos/ibc-go into charly/issue#3497-add-unit-tests-for-channel-upgrade-event-emission
…-upgrade-event-emission
…-upgrade-event-emission
…-upgrade-event-emission
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! ✨ One event I'm noticing isn't checked is the one emitted when writting error receipt. Home for this check could be in msg_server_test and/or in core? Maybe we could move expected events in the malleate for Try
(which emits it).
Fine if this is done in follow up or you wanna push it here.
sdk.AttributeKeyModule: channeltypes.AttributeValueCategory, | ||
}, | ||
} | ||
ibctesting.AssertEventsLegacy(&suite.Suite, expEvents, events) |
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.
guess this can be follow up at some point but this and AssertEvents
are sorta confusing as options and their docustring aren't as helpful, it seems like we should have one way to ideally check for events in tests.
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.
Any ideas on the difference between the two so I don't have to check the code?
It seems also odd to have to pass the Suite
as an argument. An instance of testing.T
could be passed, or an error return should be fine too.
In any case, I think these event testing functions has been around for a while. We can give them some attention in a follow up as you suggested! :)
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.
the EventsLegacy
function handles sdk.Events, whereas Events
handles ABCI events (typed array), we can double check these later agreed
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'll add a follow up PR for error receipt events @DimitrisJim to make reviewing easier! thanks <3
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.
AssertEvents
was added when we were upgrading to SDK v0.50 to be able to assert the events in this test, if I remember correctly. Now that we are in SDK v0.50 I think we move to AssertEvents
and remove AssertEventsLegacy
and also the EventsMap
type alias.
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.
thanks for context @crodriguezvega! I'll open an issue to keep track of this.
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.
Thanks @charleenfei!
I can push a commit to remove the upgrade found
check.
sdk.AttributeKeyModule: channeltypes.AttributeValueCategory, | ||
}, | ||
} | ||
ibctesting.AssertEventsLegacy(&suite.Suite, expEvents, events) |
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.
Any ideas on the difference between the two so I don't have to check the code?
It seems also odd to have to pass the Suite
as an argument. An instance of testing.T
could be passed, or an error return should be fine too.
In any case, I think these event testing functions has been around for a while. We can give them some attention in a follow up as you suggested! :)
(cherry picked from commit dc99ee4)
Description
closes: #3497
Commit Message / Changelog Entry
see the guidelines for commit messages. (view raw markdown for examples)
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
).godoc
comments.Files changed
in the Github PR explorer.Codecov Report
in the comment section below once CI passes.