-
Notifications
You must be signed in to change notification settings - Fork 628
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
e2e: transfer memo tests #2306
e2e: transfer memo tests #2306
Conversation
Hi @nicolaslara thanks for the contribution! Regarding CI, currently, the smallest unit of exclusion/inclusion is a test suite. Since we don't want to run this on PRs (just during compatibility testing as @colin-axner suggested) I recommend the following steps.
The compatibility tests are currently a WIP, so we can add your test to them once it is fully up and running! |
…data-integration-and-tests
@chatton @colin-axner I started modifying the tests the way you suggested, but after merging main I noticed that it got updated to v6 while the e2e tests are still on v5. Should I keep this PR on v5? or should I update the e2e tests to v6 (which probably should be done in a separate PR)? |
I believe we need to update the ibc-go version used in the ibctest repository first. See strangelove-ventures/interchaintest#315. I'll be bumping this in a separate pr, you are welcome to use the commit in the linked pr in the meantime to get tests passing |
…data-integration-and-tests
…etadata-integration-and-tests
…etadata-integration-and-tests
…b.com:nicolaslara/ibc-go into nicolas/packet-metadata-integration-and-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.
Really nice work, thanks @colin-axner & @nicolaslara ❤️
e2e/tests/transfer/base_test.go
Outdated
var memoFeatureRelease = testsuite.FeatureReleases{ | ||
MajorVersion: "v6", | ||
MinorVersions: []string{"v2.5, v3.4, v4.2, v5.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.
👍
e2e/tests/transfer/base_test.go
Outdated
s.Require().NoError(err) | ||
|
||
if !memoFeatureRelease.IsSupported(chainAVersion) { | ||
s.Require().Equal(transferTxResp.Code, uint32(2)) |
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.
[nit] we should have arguments in the order of expected
/ actual
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.
yup, nice catch
e2e/tests/transfer/base_test.go
Outdated
|
||
chainBIBCToken := testsuite.GetIBCToken(chainADenom, channelA.Counterparty.PortID, channelA.Counterparty.ChannelID) | ||
|
||
t.Run("packets relayed?", func(t *testing.T) { |
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.
[nit] this punctuation is a bit strange in test names, is this intentional?
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.
don't think so
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! just a nit on replacing with local ibc-go version
@@ -214,4 +214,4 @@ replace ( | |||
) | |||
|
|||
// uncomment to use the local version of ibc-go, you will need to run `go mod tidy` in e2e directory. | |||
// replace github.com/cosmos/ibc-go/v6 => ../ | |||
replace github.com/cosmos/ibc-go/v6 => ../ |
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.
should we recomment 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.
we want this commented out as this comment is simply here for convenience to allow for testing against local ibc-go changes.
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.
ibc-go doesn't have a release with the memo changes yet so the constructors would break otherwise
@@ -304,9 +304,9 @@ func (s *E2ETestSuite) RecoverRelayerWallets(ctx context.Context, relayer ibc.Re | |||
|
|||
// Transfer broadcasts a MsgTransfer message. | |||
func (s *E2ETestSuite) Transfer(ctx context.Context, chain *cosmos.CosmosChain, user *ibc.Wallet, | |||
portID, channelID string, token sdk.Coin, sender, receiver string, timeoutHeight clienttypes.Height, timeoutTimestamp uint64, | |||
portID, channelID string, token sdk.Coin, sender, receiver string, timeoutHeight clienttypes.Height, timeoutTimestamp uint64, memo string, |
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.
decided to make this default behaviour going forward. In the future we should add a type to send default ibc transfers to cut down on args here. Think you could have something like endpoint.SendIBCTransfer(receiver)
// If the chains contain a version of FungibleTokenPacketData with memo, both send and receive should succeed. | ||
// If one of the chains contains a version of FungibleTokenPacketData without memo, then receiving a packet with | ||
// memo should fail in that chain | ||
func (s *TransferTestSuite) TestMsgTransfer_WithMemo() { |
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.
moved into base_test.go
since this should work for any version of ibc-go
e2e/tests/transfer/base_test.go
Outdated
s.Require().NoError(err) | ||
|
||
if !memoFeatureRelease.IsSupported(chainAVersion) { | ||
s.Require().Equal(transferTxResp.Code, uint32(2)) |
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.
yup, nice catch
e2e/tests/transfer/base_test.go
Outdated
|
||
chainBIBCToken := testsuite.GetIBCToken(chainADenom, channelA.Counterparty.PortID, channelA.Counterparty.ChannelID) | ||
|
||
t.Run("packets relayed?", func(t *testing.T) { |
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.
don't think so
@@ -214,4 +214,4 @@ replace ( | |||
) | |||
|
|||
// uncomment to use the local version of ibc-go, you will need to run `go mod tidy` in e2e directory. | |||
// replace github.com/cosmos/ibc-go/v6 => ../ | |||
replace github.com/cosmos/ibc-go/v6 => ../ |
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.
ibc-go doesn't have a release with the memo changes yet so the constructors would break otherwise
@colin-axner the |
e2e/tests/transfer/base_test.go
Outdated
if !memoFeatureRelease.IsSupported(chainAVersion) { | ||
// transfer not sent, end test | ||
return |
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.
since the checks are run in t.Run()
, we need a check here to properly return. I left the code as is because I think it is nice doing assertions in t.Run()
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.
Looks good to me! Thanks a lot @nicolaslara and @colin-axner 🚀
e2e/tests/transfer/base_test.go
Outdated
chainAVersion := chainA.Config().Images[0].Version | ||
chainBVersion := chainB.Config().Images[0].Version | ||
|
||
t.Logf("Running memo tests versions chainA: %s, chainB: %s", chainAVersion, chainBVersion) |
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.
Should we also remove? :D
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.
sure!
e2e/tests/transfer/base_test.go
Outdated
// memoFeatureReleases represents the releases the memo field was released in. | ||
var memoFeatureRelease = testsuite.FeatureReleases{ |
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.
mega nit: should the var be the same as in the godoc or vice versa?
Description
adds e2e tests for the transfer memo addition
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 explorerCodecov Report
in the comment section below once CI passes