-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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 04-channel/keeper tests to ibc testing pkg #6400
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6400 +/- ##
==========================================
+ Coverage 56.68% 56.74% +0.06%
==========================================
Files 478 478
Lines 28777 28820 +43
==========================================
+ Hits 16313 16355 +42
- Misses 11306 11316 +10
+ Partials 1158 1149 -9 |
current issue here is somehow a helper func needs to be added to simapp to allow setting a valset at genesis |
I think the solution here is to add a |
…-remove-dup-channel
It seems like the current issue here is handling querying of proofs and submission of the correct proof height. When querying for a proof, we are returned the IAVL height of the proof, which actually corresponds to proofHeight + 1 of the tenderminet consensus. So if I want a proof at block height 6, in theory I should be able to query at IAVL height 5 and submit the proof along with the returned proofHeight + 1. This is quite confusing and it should be explored ways to remedy this as well as document this in the IBC specs. |
…-remove-dup-channel
…-remove-dup-channel
…mos-sdk into colin/5558-remove-dup-channel
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.
Awesome! thanks @colin-axner. Minor comments only
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.
Great work!! Have some suggested changes
) | ||
suite.Require().NoError(err, "could not create capability") | ||
// run test for all types of ordering | ||
for _, order := range []types.Order{types.UNORDERED, types.ORDERED} { |
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.
Nice touch!
// proof height + 1 is returned as the proof created corresponds to the height the proof | ||
// was created in the IAVL tree. Tendermint and subsequently the clients that rely on it | ||
// have heights 1 above the IAVL tree. Thus we return proof height + 1 | ||
return proof, uint64(res.Height) + 1 |
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 for reviewers @cwgoes @fedekunze : This is an issue that me and @jackzampolin repeatedly ran into when working with the relayer. We fixed the problem by incrementing the query height before passing into proof height.
We should consider whether we want to make this a requirement for relayers to handle correctly or if we want to deal with this peculiarity on the SDK side.
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 think we should open up an issue to discuss 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.
yeah let's create an issue 👍
x/ibc/testing/chain.go
Outdated
Time: chain.CurrentHeader.Time, | ||
Height: chain.App.LastBlockHeight() + 1, | ||
AppHash: chain.App.LastCommitID().Hash, | ||
Time: chain.CurrentHeader.Time, |
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 time not getting increased at all?
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.
Yeah I’d add 7 seconds
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.
it is, but in the coordinator. Increasing time here would cause updating clients to use headers from the future. I'll add a comment
} | ||
|
||
// NextTestChannel returns the next test channel to be created on this connection | ||
func (conn *TestConnection) NextTestChannel() TestChannel { |
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.
func (conn *TestConnection) NextTestChannel() TestChannel { | |
func (conn *TestConnection) NewTestChannel() TestChannel { |
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.
Hmm, so my issue with this naming is calling NewTestChannel
would result in the same test channel being returned
|
||
// FirstOrNextTestChannel returns the first test channel if it exists, otherwise it | ||
// returns the next test channel to be created. | ||
func (conn *TestConnection) FirstOrNextTestChannel() TestChannel { |
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.
func (conn *TestConnection) FirstOrNextTestChannel() TestChannel { | |
func (conn *TestConnection) GetTestChannel() TestChannel { |
Other options, GetOrCreateTestChannel
, FetchTestChannel
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.
A test channel isn't created. In fact just using this func or NextTestChannel
would result in referencing a channel that doesn't exist on the chain. I'll update the docs to be more clear with the intention of these funcs.
I like including First since this func is not meant to be used with the creation of multiple test channels on the same connection.
…-remove-dup-channel
Co-authored-by: Aditya <[email protected]> Co-authored-by: Federico Kunze <[email protected]>
…mos-sdk into colin/5558-remove-dup-channel
Co-authored-by: Aditya <[email protected]>
Co-authored-by: Aditya <[email protected]>
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.
ACK 👍
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.
Great work @colin-axner !
Still don't like NextTestChannel
and FirstOrNextTestChannel
. Maybe @fedekunze can be the tiebreaker here, but don't think it needs to block the entire PR. Approved 🎉
err := suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB) | ||
suite.Require().NoError(err) | ||
// set sequence to 2 | ||
packet = types.NewPacket(validPacketData, 2, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, timeoutHeight, disabledTimeoutTimestamp) |
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.
good way to test this!
* update testing pkg and first keeper test * fix version bug * add more helper testing funcs * move create header to testing pkg * fix connection state bug * add staking genesis state * update simapp with setting validator helper func * update simapp with valset helper * fix app hash issue * update to query from correct iavl proof height * first keeper test passing * second test passing 🎉 * fix build * update tests in all keeper_test * fix lint * begin refactoring querier test * update first querier test and update testing helpers * finish updating rest of querier tests * rename ChannelID in TestChannel to ID * remove usage of chain id for calling helper funcs * update openinit and opentry tests * finish opening channel handshake tests * finish handshake tests * general testing pkg cleanup * finish packetsend refactor * update recvpacket * packet executed refactored * finish packet test 🎉 * all tests passing * cleanup and increase code cov * remove todos in favor of opened issue #6509 * bump invalid id to meet validation requirements * bubble up proof height + 1 * Apply suggestions from code review Co-authored-by: Aditya <[email protected]> Co-authored-by: Federico Kunze <[email protected]> * fix uninit conn test * fix compile and address various pr review issues * Update x/ibc/04-channel/keeper/handshake_test.go Co-authored-by: Aditya <[email protected]> * Update x/ibc/04-channel/keeper/handshake_test.go Co-authored-by: Aditya <[email protected]> * address @AdityaSripal comments and increase cov Co-authored-by: Aditya <[email protected]> Co-authored-by: Federico Kunze <[email protected]>
Description
ref: #5558
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.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorer