-
Notifications
You must be signed in to change notification settings - Fork 586
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(upgrades): crossing hello test #5535
Merged
crodriguezvega
merged 8 commits into
main
from
carlos/5393-successful-test-with-crossing-hello-scenario
Jan 30, 2024
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4a75874
upgrades crossing hello test
crodriguezvega cbe1255
Merge branch 'main' into carlos/5393-successful-test-with-crossing-he…
crodriguezvega 70387dd
Merge branch 'main' into carlos/5393-successful-test-with-crossing-he…
crodriguezvega 5cfbd4a
start relayer before executing the proposals
crodriguezvega f8a4d50
Merge branch 'main' into carlos/5393-successful-test-with-crossing-he…
crodriguezvega 39fd1d5
change text
crodriguezvega e9db4ca
Merge branch 'main' into carlos/5393-successful-test-with-crossing-he…
crodriguezvega 2d0838a
review comment
crodriguezvega File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -4,6 +4,7 @@ package channel | |||||
|
||||||
import ( | ||||||
"context" | ||||||
"sync" | ||||||
"testing" | ||||||
|
||||||
"github.com/strangelove-ventures/interchaintest/v8/ibc" | ||||||
|
@@ -235,6 +236,95 @@ func (s *ChannelTestSuite) TestChannelUpgrade_WithFeeMiddleware_Succeeds() { | |||||
}) | ||||||
} | ||||||
|
||||||
// TestChannelUpgrade_WithFeeMiddleware_CrossingHello_Succeeds tests upgrading a transfer channel to wire up fee middleware under crossing hello | ||||||
func (s *ChannelTestSuite) TestChannelUpgrade_WithFeeMiddleware_CrossingHello_Succeeds() { | ||||||
t := s.T() | ||||||
ctx := context.TODO() | ||||||
|
||||||
relayer, channelA := s.SetupChainsRelayerAndChannel(ctx, s.TransferChannelOptions()) | ||||||
channelB := channelA.Counterparty | ||||||
chainA, chainB := s.GetChains() | ||||||
|
||||||
chainADenom := chainA.Config().Denom | ||||||
|
||||||
chainAWallet := s.CreateUserOnChainA(ctx, testvalues.StartingTokenAmount) | ||||||
chainAAddress := chainAWallet.FormattedAddress() | ||||||
|
||||||
chainBWallet := s.CreateUserOnChainB(ctx, testvalues.StartingTokenAmount) | ||||||
chainBAddress := chainBWallet.FormattedAddress() | ||||||
|
||||||
s.Require().NoError(test.WaitForBlocks(ctx, 1, chainA, chainB), "failed to wait for blocks") | ||||||
|
||||||
// trying to create some inflight packets, although they might get relayed before the upgrade starts | ||||||
t.Run("create inflight transfer packets between chain A and chain B", func(t *testing.T) { | ||||||
transferTxResp := s.Transfer(ctx, chainA, chainAWallet, channelA.PortID, channelA.ChannelID, testvalues.DefaultTransferAmount(chainADenom), chainAAddress, chainBAddress, s.GetTimeoutHeight(ctx, chainB), 0, "") | ||||||
s.AssertTxSuccess(transferTxResp) | ||||||
}) | ||||||
|
||||||
t.Run("start relayer", func(t *testing.T) { | ||||||
s.StartRelayer(relayer) | ||||||
}) | ||||||
|
||||||
t.Run("execute gov proposals to initiate channel upgrade on chain A and chain B", func(t *testing.T) { | ||||||
var wg sync.WaitGroup | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Love me a WaitGroup <3 |
||||||
|
||||||
wg.Add(1) | ||||||
go func() { | ||||||
defer wg.Done() | ||||||
chA, err := s.QueryChannel(ctx, chainA, channelA.PortID, channelA.ChannelID) | ||||||
s.Require().NoError(err) | ||||||
s.initiateChannelUpgrade(ctx, chainA, chainAWallet, channelA.PortID, channelA.ChannelID, s.createUpgradeFields(chA)) | ||||||
}() | ||||||
|
||||||
wg.Add(1) | ||||||
go func() { | ||||||
defer wg.Done() | ||||||
chB, err := s.QueryChannel(ctx, chainB, channelB.PortID, channelB.ChannelID) | ||||||
s.Require().NoError(err) | ||||||
s.initiateChannelUpgrade(ctx, chainB, chainBWallet, channelB.PortID, channelB.ChannelID, s.createUpgradeFields(chB)) | ||||||
}() | ||||||
|
||||||
wg.Wait() | ||||||
}) | ||||||
|
||||||
s.Require().NoError(test.WaitForBlocks(ctx, 10, chainA, chainB), "failed to wait for blocks") | ||||||
|
||||||
t.Run("packets are relayed between chain A and chain B", func(t *testing.T) { | ||||||
// packet from chain A to chain B | ||||||
s.AssertPacketRelayed(ctx, chainA, channelA.PortID, channelA.ChannelID, 1) | ||||||
}) | ||||||
|
||||||
t.Run("verify channel A upgraded and is fee enabled", func(t *testing.T) { | ||||||
channel, err := s.QueryChannel(ctx, chainA, channelA.PortID, channelA.ChannelID) | ||||||
s.Require().NoError(err) | ||||||
|
||||||
// check the channel version include the fee version | ||||||
version, err := feetypes.MetadataFromVersion(channel.Version) | ||||||
s.Require().NoError(err) | ||||||
s.Require().Equal(feetypes.Version, version.FeeVersion, "the channel version did not include ics29") | ||||||
|
||||||
// extra check | ||||||
feeEnabled, err := s.QueryFeeEnabledChannel(ctx, chainA, channelA.PortID, channelA.ChannelID) | ||||||
s.Require().NoError(err) | ||||||
s.Require().Equal(true, feeEnabled) | ||||||
}) | ||||||
|
||||||
t.Run("verify channel A upgraded and is fee enabled", func(t *testing.T) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
channel, err := s.QueryChannel(ctx, chainB, channelB.PortID, channelB.ChannelID) | ||||||
s.Require().NoError(err) | ||||||
|
||||||
// check the channel version include the fee version | ||||||
version, err := feetypes.MetadataFromVersion(channel.Version) | ||||||
s.Require().NoError(err) | ||||||
s.Require().Equal(feetypes.Version, version.FeeVersion, "the channel version did not include ics29") | ||||||
|
||||||
// extra check | ||||||
feeEnabled, err := s.QueryFeeEnabledChannel(ctx, chainB, channelB.PortID, channelB.ChannelID) | ||||||
s.Require().NoError(err) | ||||||
s.Require().Equal(true, feeEnabled) | ||||||
}) | ||||||
} | ||||||
|
||||||
// TestChannelUpgrade_WithFeeMiddleware_FailsWithTimeoutOnAck tests upgrading a transfer channel to wire up fee middleware but fails on ACK because of timeout | ||||||
func (s *ChannelTestSuite) TestChannelUpgrade_WithFeeMiddleware_FailsWithTimeoutOnAck() { | ||||||
t := s.T() | ||||||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 this be after initializing upgrades on each end? Wondering if the relayer will pickup the first upgrade attempt and try on the counterparty before the counterparty submits its upgrade attempt
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.
that makes sense to me
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 will leave it for now like this (just want to finally merge this PR), but I will look if it makes any difference starting the relayer afterwards.