Skip to content
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: e2e test for timeout of ics20 packet #1992

Merged
merged 5 commits into from
Aug 16, 2022

Conversation

seantking
Copy link
Contributor

Description

closes: #1975


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.

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes

@seantking seantking changed the title Sean/issue#1975 timeout ibc transfer test: e2e test for timeout of ics20 packet Aug 11, 2022
}

t.Run("IBC transfer packet timesout", func(t *testing.T) {
tx, err := chainA.SendIBCTransfer(ctx, channelA.ChannelID, chainAWallet.KeyName, chainBWalletAmount, testvalues.ImmediatelyTimeout())
Copy link
Contributor Author

@seantking seantking Aug 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@colin-axner I tried to use your helper function for broadcasting the message instead of using the built-in library fn but for some reason the packet never timesout. Everything works as expected when using the built in transfer helper.

Not sure if this is a golang relayer issue or if the message doesn't get broadcast correctly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we create an issue to investigate this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, I'd like to understand why this is the case?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is that the cli takes in a relative timeout. So the in this instance, 1 is being passed for the timeout timestamp which is added to the latest known consensus state timestamp (which passes for sending a packet). In the function I added, you have to pass the absolute timeout

@codecov-commenter
Copy link

Codecov Report

Merging #1992 (d7d515a) into main (2bd397b) will increase coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1992      +/-   ##
==========================================
+ Coverage   80.09%   80.10%   +0.01%     
==========================================
  Files         167      167              
  Lines       11773    11771       -2     
==========================================
  Hits         9429     9429              
+ Misses       1929     1927       -2     
  Partials      415      415              
Impacted Files Coverage Δ
...dules/light-clients/06-solomachine/client_state.go 87.59% <0.00%> (+1.26%) ⬆️

Copy link
Contributor

@colin-axner colin-axner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, will drop an approval after merge conflicts are fixed

e2e/transfer_test.go Outdated Show resolved Hide resolved
}

t.Run("IBC transfer packet timesout", func(t *testing.T) {
tx, err := chainA.SendIBCTransfer(ctx, channelA.ChannelID, chainAWallet.KeyName, chainBWalletAmount, testvalues.ImmediatelyTimeout())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, I'd like to understand why this is the case?

Copy link
Member

@damiannolan damiannolan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, left some minor nits. Otherwise lgtm! 🚀

@@ -12,6 +12,7 @@ on:
options:
- TestTransferTestSuite
- TestFeeMiddlewareTestSuite
- TestTransferTestSuite
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be duplicated? I guess we can remove, must be from merging main.

Amount: testvalues.IBCTransferAmount,
}

t.Run("IBC transfer packet timesout", func(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should we make "IBC transfer packet timeout" or "IBC transfer packet times out"

tx, err := chainA.SendIBCTransfer(ctx, channelA.ChannelID, chainAWallet.KeyName, chainBWalletAmount, testvalues.ImmediatelyTimeout())
s.Require().NoError(err)
s.Require().NoError(tx.Validate(), "source ibc transfer tx is invalid")
time.Sleep(time.Nanosecond * 1) // want it to timeout immediately
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same difference I think

Suggested change
time.Sleep(time.Nanosecond * 1) // want it to timeout immediately
time.Sleep(time.Nanosecond) // want it to timeout immediately

Copy link
Contributor

@colin-axner colin-axner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK nice work. I'm fine leaving the SendIBCTransfer usage, but it would be nice if the message was broadcasted, especially since we rely on the timeout creation by the cli

@seantking seantking enabled auto-merge (squash) August 16, 2022 09:47
@seantking seantking merged commit 0a887e4 into main Aug 16, 2022
@seantking seantking deleted the sean/issue#1975-timeout-ibc-transfer branch August 16, 2022 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

E2E: Timeout IBC transfer
5 participants