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

E2E test where unordered channel is used with ICA #5566

Merged
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion e2e/tests/interchain_accounts/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ import (
ibctesting "github.com/cosmos/ibc-go/v8/testing"
)

// orderMapping is a mapping from channel ordering to the string representation of the ordering.
// the representation can be different depending on the relayer implmentation.
Copy link
Contributor

Choose a reason for hiding this comment

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

bummer 😅

Copy link
Member

Choose a reason for hiding this comment

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

this must be something to do with how the enum value is serialized with JSON or something maybe?

So channeltypes.UNORDERED evaluates to ORDER_UNORDERED in normal go code but here one of the relayers returns it as Unordered? is it hermes?

crodriguezvega marked this conversation as resolved.
Show resolved Hide resolved
var orderMapping = map[channeltypes.Order][]string{
channeltypes.ORDERED: {channeltypes.ORDERED.String(), "Ordered"},
channeltypes.UNORDERED: {channeltypes.UNORDERED.String(), "Unordered"},
}

func TestInterchainAccountsTestSuite(t *testing.T) {
testifysuite.Run(t, new(InterchainAccountsTestSuite))
}
Expand All @@ -41,6 +48,14 @@ func (s *InterchainAccountsTestSuite) RegisterInterchainAccount(ctx context.Cont
}

func (s *InterchainAccountsTestSuite) TestMsgSendTx_SuccessfulTransfer() {
s.testMsgSendTxSuccessfulTransfer(channeltypes.ORDERED)
}

func (s *InterchainAccountsTestSuite) TestMsgSendTx_SuccessfulTransfer_UnorderedChannel() {
s.testMsgSendTxSuccessfulTransfer(channeltypes.UNORDERED)
}

func (s *InterchainAccountsTestSuite) testMsgSendTxSuccessfulTransfer(order channeltypes.Order) {
t := s.T()
ctx := context.TODO()

Expand All @@ -59,7 +74,7 @@ func (s *InterchainAccountsTestSuite) TestMsgSendTx_SuccessfulTransfer() {
t.Run("broadcast MsgRegisterInterchainAccount", func(t *testing.T) {
// explicitly set the version string because we don't want to use incentivized channels.
version := icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID)
msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAddress, version, channeltypes.ORDERED)
msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAddress, version, order)

txResp := s.BroadcastMessages(ctx, chainA, controllerAccount, msgRegisterAccount)
s.AssertTxSuccess(txResp)
Expand All @@ -78,6 +93,8 @@ func (s *InterchainAccountsTestSuite) TestMsgSendTx_SuccessfulTransfer() {
channels, err := relayer.GetChannels(ctx, s.GetRelayerExecReporter(), chainA.Config().ChainID)
s.Require().NoError(err)
s.Require().Equal(len(channels), 2)
icaChannel := channels[0]
s.Require().Contains(orderMapping[order], icaChannel.Ordering)
})

t.Run("interchain account executes a bank transfer on behalf of the corresponding owner account", func(t *testing.T) {
Expand Down
Loading