From 0d523006d0f453766ca5a44ef39ccdddeab8e3ad Mon Sep 17 00:00:00 2001 From: DimitrisJim Date: Mon, 15 Jan 2024 13:32:33 +0200 Subject: [PATCH 1/6] proto: Add Order to MsgRegisterInterchainAccount. --- .../controller/types/tx.pb.go | 127 +++++++++++------- .../controller/v1/tx.proto | 8 +- 2 files changed, 84 insertions(+), 51 deletions(-) diff --git a/modules/apps/27-interchain-accounts/controller/types/tx.pb.go b/modules/apps/27-interchain-accounts/controller/types/tx.pb.go index 4bb498300a7..f7e724b2e90 100644 --- a/modules/apps/27-interchain-accounts/controller/types/tx.pb.go +++ b/modules/apps/27-interchain-accounts/controller/types/tx.pb.go @@ -10,7 +10,8 @@ import ( _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" - types "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" + types1 "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" + types "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -32,9 +33,10 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // MsgRegisterInterchainAccount defines the payload for Msg/RegisterAccount type MsgRegisterInterchainAccount struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` - ConnectionId string `protobuf:"bytes,2,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty"` - Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + ConnectionId string `protobuf:"bytes,2,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty"` + Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` + Order types.Order `protobuf:"varint,4,opt,name=order,proto3,enum=ibc.core.channel.v1.Order" json:"order,omitempty"` } func (m *MsgRegisterInterchainAccount) Reset() { *m = MsgRegisterInterchainAccount{} } @@ -111,9 +113,9 @@ var xxx_messageInfo_MsgRegisterInterchainAccountResponse proto.InternalMessageIn // MsgSendTx defines the payload for Msg/SendTx type MsgSendTx struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` - ConnectionId string `protobuf:"bytes,2,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty"` - PacketData types.InterchainAccountPacketData `protobuf:"bytes,3,opt,name=packet_data,json=packetData,proto3" json:"packet_data"` + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + ConnectionId string `protobuf:"bytes,2,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty"` + PacketData types1.InterchainAccountPacketData `protobuf:"bytes,3,opt,name=packet_data,json=packetData,proto3" json:"packet_data"` // Relative timeout timestamp provided will be added to the current block time during transaction execution. // The timeout timestamp must be non-zero. RelativeTimeout uint64 `protobuf:"varint,4,opt,name=relative_timeout,json=relativeTimeout,proto3" json:"relative_timeout,omitempty"` @@ -284,47 +286,49 @@ func init() { } var fileDescriptor_7def041328c84a30 = []byte{ - // 626 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x4f, 0x4f, 0x13, 0x4f, - 0x18, 0xee, 0xfc, 0x58, 0xca, 0x8f, 0x01, 0x45, 0x37, 0x44, 0xca, 0x46, 0x17, 0x52, 0x3d, 0x20, - 0x09, 0x3b, 0x69, 0xd5, 0x68, 0x6a, 0x3c, 0x08, 0x78, 0x68, 0x4c, 0x93, 0x66, 0xc5, 0x84, 0x78, - 0x69, 0xa6, 0xb3, 0x93, 0x61, 0x64, 0x77, 0x66, 0xdd, 0x99, 0xae, 0x78, 0x33, 0x7a, 0x31, 0x1e, - 0x8c, 0x07, 0x3f, 0x00, 0x1f, 0x81, 0x6f, 0x21, 0x47, 0x8e, 0x9e, 0x8c, 0x81, 0x03, 0x37, 0x3f, - 0x83, 0xd9, 0x3f, 0xdd, 0xa2, 0x20, 0xc1, 0xc2, 0xad, 0xef, 0xfb, 0xf6, 0x79, 0xde, 0xe7, 0x79, - 0xe7, 0xdd, 0x17, 0x3e, 0xe4, 0x5d, 0x82, 0x70, 0x18, 0xfa, 0x9c, 0x60, 0xcd, 0xa5, 0x50, 0x88, - 0x0b, 0x4d, 0x23, 0xb2, 0x81, 0xb9, 0xe8, 0x60, 0x42, 0x64, 0x4f, 0x68, 0x85, 0x88, 0x14, 0x3a, - 0x92, 0xbe, 0x4f, 0x23, 0x14, 0xd7, 0x90, 0xde, 0x72, 0xc2, 0x48, 0x6a, 0x69, 0xd6, 0x79, 0x97, - 0x38, 0x47, 0xc1, 0xce, 0x09, 0x60, 0x67, 0x00, 0x76, 0xe2, 0x9a, 0x35, 0xcd, 0x24, 0x93, 0x29, - 0x1c, 0x25, 0xbf, 0x32, 0x26, 0xeb, 0xee, 0x99, 0x64, 0xc4, 0x35, 0x14, 0x62, 0xb2, 0x49, 0x75, - 0x8e, 0x5a, 0x19, 0x42, 0xfc, 0x11, 0x35, 0x19, 0xc9, 0x0c, 0x91, 0x2a, 0x90, 0x0a, 0x05, 0x8a, - 0x25, 0xf5, 0x40, 0xb1, 0xac, 0x50, 0x7d, 0x0f, 0xe0, 0xf5, 0x96, 0x62, 0x2e, 0x65, 0x5c, 0x69, - 0x1a, 0x35, 0x0b, 0xea, 0xc7, 0x19, 0xb3, 0x39, 0x0d, 0x47, 0xe5, 0x6b, 0x41, 0xa3, 0x0a, 0x98, - 0x07, 0x0b, 0xe3, 0x6e, 0x16, 0x98, 0x37, 0xe1, 0x25, 0x22, 0x85, 0xa0, 0x24, 0x51, 0xd4, 0xe1, - 0x5e, 0xe5, 0xbf, 0xb4, 0x3a, 0x39, 0x48, 0x36, 0x3d, 0xb3, 0x02, 0xc7, 0x62, 0x1a, 0x29, 0x2e, - 0x45, 0x65, 0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0, 0xb9, 0x62, 0x06, - 0x00, 0x00, + // 668 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x41, 0x4f, 0x13, 0x4f, + 0x14, 0xef, 0xfe, 0x29, 0xe5, 0xcf, 0x80, 0xa0, 0x1b, 0x22, 0x65, 0xa3, 0x05, 0xab, 0x07, 0x24, + 0x61, 0xc6, 0x56, 0x8d, 0xa6, 0xc6, 0x83, 0x80, 0x87, 0xc6, 0x34, 0x36, 0x2b, 0x26, 0xc4, 0x4b, + 0x33, 0x9d, 0x9d, 0x2c, 0x23, 0xdd, 0x99, 0x75, 0x66, 0xba, 0xe2, 0xcd, 0x78, 0x32, 0x1e, 0x8c, + 0x07, 0x3f, 0x00, 0x1f, 0x81, 0x8b, 0x9f, 0x41, 0x8e, 0x1c, 0x3d, 0x19, 0x03, 0x07, 0x6e, 0x7e, + 0x06, 0xb3, 0x3b, 0xdb, 0x2d, 0x0a, 0x12, 0x2c, 0xdc, 0xf6, 0xbd, 0x99, 0xf7, 0x7b, 0xbf, 0xdf, + 0x6f, 0xde, 0x3e, 0xf0, 0x80, 0xb5, 0x09, 0xc2, 0x61, 0xd8, 0x61, 0x04, 0x6b, 0x26, 0xb8, 0x42, + 0x8c, 0x6b, 0x2a, 0xc9, 0x3a, 0x66, 0xbc, 0x85, 0x09, 0x11, 0x5d, 0xae, 0x15, 0x22, 0x82, 0x6b, + 0x29, 0x3a, 0x1d, 0x2a, 0x51, 0x54, 0x41, 0x7a, 0x13, 0x86, 0x52, 0x68, 0x61, 0x57, 0x59, 0x9b, + 0xc0, 0xc3, 0xc5, 0xf0, 0x98, 0x62, 0xd8, 0x2f, 0x86, 0x51, 0xc5, 0x99, 0xf2, 0x85, 0x2f, 0x92, + 0x72, 0x14, 0x7f, 0x19, 0x24, 0xe7, 0xce, 0xa9, 0x68, 0x44, 0x15, 0x14, 0x62, 0xb2, 0x41, 0x75, + 0x5a, 0xb5, 0x3c, 0x00, 0xf9, 0x43, 0x6c, 0x0c, 0xc8, 0x34, 0x11, 0x2a, 0x10, 0x0a, 0x05, 0xca, + 0x8f, 0xcf, 0x03, 0xe5, 0xa7, 0x07, 0xd7, 0x62, 0x74, 0x22, 0x24, 0x45, 0x64, 0x1d, 0x73, 0x4e, + 0x3b, 0x49, 0xb9, 0xf9, 0x34, 0x57, 0xca, 0x5f, 0x2c, 0x70, 0xa5, 0xa1, 0x7c, 0x97, 0xfa, 0x4c, + 0x69, 0x2a, 0xeb, 0x59, 0xf7, 0x47, 0xa6, 0xb9, 0x3d, 0x05, 0x86, 0xc5, 0x6b, 0x4e, 0x65, 0xd1, + 0x9a, 0xb3, 0xe6, 0x47, 0x5d, 0x13, 0xd8, 0xd7, 0xc1, 0x05, 0x22, 0x38, 0xa7, 0x24, 0x26, 0xdd, + 0x62, 0x5e, 0xf1, 0xbf, 0xe4, 0x74, 0xbc, 0x9f, 0xac, 0x7b, 0x76, 0x11, 0x8c, 0x44, 0x54, 0x2a, + 0x26, 0x78, 0x71, 0x28, 0x39, 0xee, 0x85, 0xf6, 0x2d, 0x30, 0x2c, 0xa4, 0x47, 0x65, 0x31, 0x3f, + 0x67, 0xcd, 0x4f, 0x54, 0x1d, 0x18, 0x3f, 0x43, 0x4c, 0x14, 0xf6, 0xd8, 0x45, 0x15, 0xf8, 0x34, + 0xbe, 0xe1, 0x9a, 0x8b, 0xb5, 0x89, 0xf7, 0x5b, 0xb3, 0xb9, 0x77, 0x07, 0xdb, 0x0b, 0x86, 0x40, + 0xd9, 0x03, 0x37, 0x4e, 0xa2, 0xed, 0x52, 0x15, 0x0a, 0xae, 0xa8, 0x7d, 0x15, 0x80, 0x14, 0x32, + 0x66, 0x69, 0x34, 0x8c, 0xa6, 0x99, 0xba, 0x67, 0x4f, 0x83, 0x91, 0x50, 0x48, 0xdd, 0x57, 0x50, + 0x88, 0xc3, 0xba, 0x57, 0xcb, 0xc7, 0xfd, 0xca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, 0xe9, 0xa3, 0x05, + 0x0a, 0xe9, 0xa0, 0x3e, 0x1c, 0xb0, 0x89, 0x29, 0x77, 0x1e, 0x9f, 0xa9, 0x3c, 0x23, 0xb4, 0x65, + 0x81, 0xf1, 0xdf, 0x26, 0x62, 0x79, 0x40, 0xdc, 0xc3, 0x20, 0xce, 0x93, 0x73, 0x00, 0xe9, 0x51, + 0x74, 0x86, 0xdf, 0x1e, 0x6c, 0x2f, 0x58, 0x4b, 0x2f, 0x77, 0xf6, 0x4a, 0xd6, 0xee, 0x5e, 0xc9, + 0xfa, 0xb1, 0x57, 0xb2, 0x3e, 0xed, 0x97, 0x72, 0xbb, 0xfb, 0xa5, 0xdc, 0xb7, 0xfd, 0x52, 0xee, + 0x45, 0xd3, 0x67, 0x7a, 0xbd, 0xdb, 0x86, 0x44, 0x04, 0x28, 0xdd, 0xb2, 0xac, 0x4d, 0x16, 0x7d, + 0x81, 0xa2, 0xfb, 0x28, 0x10, 0x5e, 0xb7, 0x43, 0x55, 0xbc, 0xbf, 0x15, 0xaa, 0xde, 0x5b, 0xec, + 0xf3, 0x58, 0x3c, 0x6e, 0x75, 0xeb, 0x37, 0x21, 0x55, 0xed, 0x42, 0xb2, 0x77, 0x6f, 0xff, 0x0a, + 0x00, 0x00, 0xff, 0xff, 0x5c, 0x9c, 0xca, 0xe1, 0xb7, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -505,6 +509,11 @@ func (m *MsgRegisterInterchainAccount) MarshalToSizedBuffer(dAtA []byte) (int, e _ = i var l int _ = l + if m.Order != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Order)) + i-- + dAtA[i] = 0x20 + } if len(m.Version) > 0 { i -= len(m.Version) copy(dAtA[i:], m.Version) @@ -738,6 +747,9 @@ func (m *MsgRegisterInterchainAccount) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } + if m.Order != 0 { + n += 1 + sovTx(uint64(m.Order)) + } return n } @@ -947,6 +959,25 @@ func (m *MsgRegisterInterchainAccount) Unmarshal(dAtA []byte) error { } m.Version = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Order", wireType) + } + m.Order = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Order |= types.Order(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) diff --git a/proto/ibc/applications/interchain_accounts/controller/v1/tx.proto b/proto/ibc/applications/interchain_accounts/controller/v1/tx.proto index 1287cfa2d37..db0c7b77e39 100644 --- a/proto/ibc/applications/interchain_accounts/controller/v1/tx.proto +++ b/proto/ibc/applications/interchain_accounts/controller/v1/tx.proto @@ -8,6 +8,7 @@ import "gogoproto/gogo.proto"; import "ibc/applications/interchain_accounts/v1/packet.proto"; import "ibc/applications/interchain_accounts/controller/v1/controller.proto"; import "cosmos/msg/v1/msg.proto"; +import "ibc/core/channel/v1/channel.proto"; // Msg defines the 27-interchain-accounts/controller Msg service. service Msg { @@ -27,9 +28,10 @@ message MsgRegisterInterchainAccount { option (gogoproto.goproto_getters) = false; - string owner = 1; - string connection_id = 2; - string version = 3; + string owner = 1; + string connection_id = 2; + string version = 3; + ibc.core.channel.v1.Order order = 4; } // MsgRegisterInterchainAccountResponse defines the response for Msg/RegisterAccount From ce7bf38b8208854800635e4e06fe2ebf84d99b77 Mon Sep 17 00:00:00 2001 From: DimitrisJim Date: Mon, 15 Jan 2024 13:33:00 +0200 Subject: [PATCH 2/6] chore: apply proto changes to go files. --- e2e/tests/interchain_accounts/base_test.go | 8 ++++---- e2e/tests/interchain_accounts/gov_test.go | 3 ++- e2e/tests/interchain_accounts/groups_test.go | 3 ++- e2e/tests/interchain_accounts/incentivized_test.go | 5 +++-- e2e/tests/interchain_accounts/localhost_test.go | 6 +++--- e2e/tests/interchain_accounts/params_test.go | 3 ++- e2e/tests/upgrades/genesis_test.go | 3 ++- .../27-interchain-accounts/controller/client/cli/tx.go | 4 +++- .../controller/ibc_middleware_test.go | 6 +++--- .../27-interchain-accounts/controller/keeper/account.go | 6 +++--- .../controller/keeper/msg_server.go | 2 +- .../controller/keeper/msg_server_test.go | 2 +- .../apps/27-interchain-accounts/controller/types/msgs.go | 4 +++- .../27-interchain-accounts/controller/types/msgs_test.go | 4 +++- modules/apps/callbacks/callbacks_test.go | 3 ++- 15 files changed, 37 insertions(+), 25 deletions(-) diff --git a/e2e/tests/interchain_accounts/base_test.go b/e2e/tests/interchain_accounts/base_test.go index 1425e512787..e345b0a781a 100644 --- a/e2e/tests/interchain_accounts/base_test.go +++ b/e2e/tests/interchain_accounts/base_test.go @@ -59,7 +59,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) + msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAddress, version, channeltypes.ORDERED) txResp := s.BroadcastMessages(ctx, chainA, controllerAccount, msgRegisterAccount) s.AssertTxSuccess(txResp) @@ -155,7 +155,7 @@ func (s *InterchainAccountsTestSuite) TestMsgSendTx_FailedTransfer_InsufficientF 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) + msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAddress, version, channeltypes.ORDERED) txResp := s.BroadcastMessages(ctx, chainA, controllerAccount, msgRegisterAccount) s.AssertTxSuccess(txResp) @@ -253,7 +253,7 @@ func (s *InterchainAccountsTestSuite) TestMsgSendTx_SuccessfulTransfer_AfterReop var err error // explicitly set the version string because we don't want to use incentivized channels. version := icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID) - msgRegisterInterchainAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAddress, version) + msgRegisterInterchainAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAddress, version, channeltypes.ORDERED) s.RegisterInterchainAccount(ctx, chainA, controllerAccount, msgRegisterInterchainAccount) portID, err = icatypes.NewControllerPortID(controllerAddress) s.Require().NoError(err) @@ -351,7 +351,7 @@ func (s *InterchainAccountsTestSuite) TestMsgSendTx_SuccessfulTransfer_AfterReop t.Run("register interchain account", 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) - msgRegisterInterchainAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAddress, version) + msgRegisterInterchainAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAddress, version, channeltypes.ORDERED) s.RegisterInterchainAccount(ctx, chainA, controllerAccount, msgRegisterInterchainAccount) s.Require().NoError(test.WaitForBlocks(ctx, 10, chainA, chainB)) diff --git a/e2e/tests/interchain_accounts/gov_test.go b/e2e/tests/interchain_accounts/gov_test.go index 3505fcd559d..212b5d173f4 100644 --- a/e2e/tests/interchain_accounts/gov_test.go +++ b/e2e/tests/interchain_accounts/gov_test.go @@ -23,6 +23,7 @@ import ( "github.com/cosmos/ibc-go/e2e/testvalues" controllertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" ibctesting "github.com/cosmos/ibc-go/v8/testing" ) @@ -53,7 +54,7 @@ func (s *InterchainAccountsGovTestSuite) TestInterchainAccountsGovIntegration() t.Run("execute proposal for MsgRegisterInterchainAccount", func(t *testing.T) { version := icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID) - msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, govModuleAddress.String(), version) + msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, govModuleAddress.String(), version, channeltypes.ORDERED) s.ExecuteAndPassGovV1Proposal(ctx, msgRegisterAccount, chainA, controllerAccount) }) diff --git a/e2e/tests/interchain_accounts/groups_test.go b/e2e/tests/interchain_accounts/groups_test.go index 6fe99fe533b..43faca17a3f 100644 --- a/e2e/tests/interchain_accounts/groups_test.go +++ b/e2e/tests/interchain_accounts/groups_test.go @@ -23,6 +23,7 @@ import ( "github.com/cosmos/ibc-go/e2e/testvalues" controllertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" ibctesting "github.com/cosmos/ibc-go/v8/testing" ) @@ -114,7 +115,7 @@ func (s *InterchainAccountsGroupsTestSuite) TestInterchainAccountsGroupsIntegrat t.Run("submit proposal for MsgRegisterInterchainAccount", func(t *testing.T) { groupPolicyAddr = s.QueryGroupPolicyAddress(ctx, chainA) - msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, groupPolicyAddr, icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID)) + msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, groupPolicyAddr, icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID), channeltypes.ORDERED) msgSubmitProposal, err := grouptypes.NewMsgSubmitProposal(groupPolicyAddr, []string{chainAAddress}, []sdk.Msg{msgRegisterAccount}, DefaultMetadata, grouptypes.Exec_EXEC_UNSPECIFIED, "e2e groups proposal: for MsgRegisterInterchainAccount", "e2e groups proposal: for MsgRegisterInterchainAccount") s.Require().NoError(err) diff --git a/e2e/tests/interchain_accounts/incentivized_test.go b/e2e/tests/interchain_accounts/incentivized_test.go index 00f0ae464b0..309a8e92b8f 100644 --- a/e2e/tests/interchain_accounts/incentivized_test.go +++ b/e2e/tests/interchain_accounts/incentivized_test.go @@ -23,6 +23,7 @@ import ( controllertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" feetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" ibctesting "github.com/cosmos/ibc-go/v8/testing" ) @@ -71,7 +72,7 @@ func (s *IncentivizedInterchainAccountsTestSuite) TestMsgSendTx_SuccessfulBankSe t.Run("broadcast MsgRegisterInterchainAccount", func(t *testing.T) { version := "" // allow version to be specified by the controller chain since both chains should support incentivized channels - msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAccount.FormattedAddress(), version) + msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAccount.FormattedAddress(), version, channeltypes.ORDERED) txResp := s.BroadcastMessages(ctx, chainA, controllerAccount, msgRegisterAccount) s.AssertTxSuccess(txResp) @@ -249,7 +250,7 @@ func (s *IncentivizedInterchainAccountsTestSuite) TestMsgSendTx_FailedBankSend_I t.Run("broadcast MsgRegisterInterchainAccount", func(t *testing.T) { version := "" // allow version to be specified by the controller chain since both chains should support incentivized channels - msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAccount.FormattedAddress(), version) + msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAccount.FormattedAddress(), version, channeltypes.ORDERED) txResp := s.BroadcastMessages(ctx, chainA, controllerAccount, msgRegisterAccount) s.AssertTxSuccess(txResp) diff --git a/e2e/tests/interchain_accounts/localhost_test.go b/e2e/tests/interchain_accounts/localhost_test.go index 99dbc591eb1..d486041de2e 100644 --- a/e2e/tests/interchain_accounts/localhost_test.go +++ b/e2e/tests/interchain_accounts/localhost_test.go @@ -64,7 +64,7 @@ func (s *LocalhostInterchainAccountsTestSuite) TestInterchainAccounts_Localhost( s.Require().NoError(err) t.Run("channel open init localhost - broadcast MsgRegisterInterchainAccount", func(t *testing.T) { - msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(exported.LocalhostConnectionID, userAWallet.FormattedAddress(), version) + msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(exported.LocalhostConnectionID, userAWallet.FormattedAddress(), version, channeltypes.ORDERED) txResp := s.BroadcastMessages(ctx, chainA, userAWallet, msgRegisterAccount) s.AssertTxSuccess(txResp) @@ -219,7 +219,7 @@ func (s *LocalhostInterchainAccountsTestSuite) TestInterchainAccounts_ReopenChan s.Require().NoError(err) t.Run("channel open init localhost - broadcast MsgRegisterInterchainAccount", func(t *testing.T) { - msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(exported.LocalhostConnectionID, userAWallet.FormattedAddress(), version) + msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(exported.LocalhostConnectionID, userAWallet.FormattedAddress(), version, channeltypes.ORDERED) txResp := s.BroadcastMessages(ctx, chainA, userAWallet, msgRegisterAccount) s.AssertTxSuccess(txResp) @@ -347,7 +347,7 @@ func (s *LocalhostInterchainAccountsTestSuite) TestInterchainAccounts_ReopenChan }) t.Run("channel open init localhost: create new channel for existing account", func(t *testing.T) { - msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(exported.LocalhostConnectionID, userAWallet.FormattedAddress(), version) + msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(exported.LocalhostConnectionID, userAWallet.FormattedAddress(), version, channeltypes.ORDERED) txResp := s.BroadcastMessages(ctx, chainA, userAWallet, msgRegisterAccount) s.AssertTxSuccess(txResp) diff --git a/e2e/tests/interchain_accounts/params_test.go b/e2e/tests/interchain_accounts/params_test.go index 5e8e0e10102..4cdc64fa371 100644 --- a/e2e/tests/interchain_accounts/params_test.go +++ b/e2e/tests/interchain_accounts/params_test.go @@ -17,6 +17,7 @@ import ( controllertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" hosttypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types" icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" ibctesting "github.com/cosmos/ibc-go/v8/testing" ) @@ -95,7 +96,7 @@ func (s *InterchainAccountsParamsTestSuite) TestControllerEnabledParam() { t.Run("ensure that broadcasting a MsgRegisterInterchainAccount fails", 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) + msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAddress, version, channeltypes.ORDERED) txResp := s.BroadcastMessages(ctx, chainA, controllerAccount, msgRegisterAccount) s.AssertTxFailure(txResp, controllertypes.ErrControllerSubModuleDisabled) diff --git a/e2e/tests/upgrades/genesis_test.go b/e2e/tests/upgrades/genesis_test.go index 95cba42dcf9..4b387bb128b 100644 --- a/e2e/tests/upgrades/genesis_test.go +++ b/e2e/tests/upgrades/genesis_test.go @@ -24,6 +24,7 @@ import ( "github.com/cosmos/ibc-go/e2e/testvalues" controllertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" ibctesting "github.com/cosmos/ibc-go/v8/testing" ) @@ -89,7 +90,7 @@ func (s *GenesisTestSuite) TestIBCGenesis() { t.Run("ics27: 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) + msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAddress, version, channeltypes.ORDERED) txResp := s.BroadcastMessages(ctx, chainA, controllerAccount, msgRegisterAccount) s.AssertTxSuccess(txResp) diff --git a/modules/apps/27-interchain-accounts/controller/client/cli/tx.go b/modules/apps/27-interchain-accounts/controller/client/cli/tx.go index 39f46d22533..216b868d3ed 100644 --- a/modules/apps/27-interchain-accounts/controller/client/cli/tx.go +++ b/modules/apps/27-interchain-accounts/controller/client/cli/tx.go @@ -14,6 +14,7 @@ import ( "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" ) const ( @@ -46,13 +47,14 @@ the associated capability.`), return err } - msg := types.NewMsgRegisterInterchainAccount(connectionID, owner, version) + msg := types.NewMsgRegisterInterchainAccount(connectionID, owner, version, channeltypes.ORDERED) return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } cmd.Flags().String(flagVersion, "", "Controller chain channel version") + flags.AddTxFlagsToCmd(cmd) return cmd diff --git a/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go b/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go index b55598fa44e..ebcca260cbc 100644 --- a/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go +++ b/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go @@ -1183,7 +1183,7 @@ func (suite *InterchainAccountsTestSuite) TestInFlightHandshakeRespectsGoAPICall // attempt to start a second handshake via the controller msg server msgServer := controllerkeeper.NewMsgServerImpl(&suite.chainA.GetSimApp().ICAControllerKeeper) - msgRegisterInterchainAccount := types.NewMsgRegisterInterchainAccount(path.EndpointA.ConnectionID, suite.chainA.SenderAccount.GetAddress().String(), TestVersion) + msgRegisterInterchainAccount := types.NewMsgRegisterInterchainAccount(path.EndpointA.ConnectionID, suite.chainA.SenderAccount.GetAddress().String(), TestVersion, channeltypes.ORDERED) res, err := msgServer.RegisterInterchainAccount(suite.chainA.GetContext(), msgRegisterInterchainAccount) suite.Require().Error(err) @@ -1196,7 +1196,7 @@ func (suite *InterchainAccountsTestSuite) TestInFlightHandshakeRespectsMsgServer // initiate a channel handshake such that channel.State == INIT msgServer := controllerkeeper.NewMsgServerImpl(&suite.chainA.GetSimApp().ICAControllerKeeper) - msgRegisterInterchainAccount := types.NewMsgRegisterInterchainAccount(path.EndpointA.ConnectionID, suite.chainA.SenderAccount.GetAddress().String(), TestVersion) + msgRegisterInterchainAccount := types.NewMsgRegisterInterchainAccount(path.EndpointA.ConnectionID, suite.chainA.SenderAccount.GetAddress().String(), TestVersion, channeltypes.ORDERED) res, err := msgServer.RegisterInterchainAccount(suite.chainA.GetContext(), msgRegisterInterchainAccount) suite.Require().NotNil(res) @@ -1229,7 +1229,7 @@ func (suite *InterchainAccountsTestSuite) TestClosedChannelReopensWithMsgServer( // route a new MsgRegisterInterchainAccount in order to reopen the msgServer := controllerkeeper.NewMsgServerImpl(&suite.chainA.GetSimApp().ICAControllerKeeper) - msgRegisterInterchainAccount := types.NewMsgRegisterInterchainAccount(path.EndpointA.ConnectionID, suite.chainA.SenderAccount.GetAddress().String(), path.EndpointA.ChannelConfig.Version) + msgRegisterInterchainAccount := types.NewMsgRegisterInterchainAccount(path.EndpointA.ConnectionID, suite.chainA.SenderAccount.GetAddress().String(), path.EndpointA.ChannelConfig.Version, channeltypes.ORDERED) res, err := msgServer.RegisterInterchainAccount(suite.chainA.GetContext(), msgRegisterInterchainAccount) suite.Require().NoError(err) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/account.go b/modules/apps/27-interchain-accounts/controller/keeper/account.go index 42d4c879d8f..cae378f5c91 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/account.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/account.go @@ -41,7 +41,7 @@ func (k Keeper) RegisterInterchainAccount(ctx sdk.Context, connectionID, owner, k.SetMiddlewareEnabled(ctx, portID, connectionID) - _, err = k.registerInterchainAccount(ctx, connectionID, portID, version) + _, err = k.registerInterchainAccount(ctx, connectionID, portID, version, channeltypes.ORDERED) if err != nil { return err } @@ -51,7 +51,7 @@ func (k Keeper) RegisterInterchainAccount(ctx sdk.Context, connectionID, owner, // registerInterchainAccount registers an interchain account, returning the channel id of the MsgChannelOpenInitResponse // and an error if one occurred. -func (k Keeper) registerInterchainAccount(ctx sdk.Context, connectionID, portID, version string) (string, error) { +func (k Keeper) registerInterchainAccount(ctx sdk.Context, connectionID, portID, version string, order channeltypes.Order) (string, error) { // if there is an active channel for this portID / connectionID return an error activeChannelID, found := k.GetOpenActiveChannel(ctx, connectionID, portID) if found { @@ -69,7 +69,7 @@ func (k Keeper) registerInterchainAccount(ctx sdk.Context, connectionID, portID, } } - msg := channeltypes.NewMsgChannelOpenInit(portID, version, channeltypes.ORDERED, []string{connectionID}, icatypes.HostPortID, authtypes.NewModuleAddress(icatypes.ModuleName).String()) + msg := channeltypes.NewMsgChannelOpenInit(portID, version, order, []string{connectionID}, icatypes.HostPortID, authtypes.NewModuleAddress(icatypes.ModuleName).String()) handler := k.msgRouter.Handler(msg) res, err := handler(ctx, msg) if err != nil { diff --git a/modules/apps/27-interchain-accounts/controller/keeper/msg_server.go b/modules/apps/27-interchain-accounts/controller/keeper/msg_server.go index 86355cac4f9..b76d2eb28f3 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/msg_server.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/msg_server.go @@ -39,7 +39,7 @@ func (s msgServer) RegisterInterchainAccount(goCtx context.Context, msg *types.M s.SetMiddlewareDisabled(ctx, portID, msg.ConnectionId) - channelID, err := s.registerInterchainAccount(ctx, msg.ConnectionId, portID, msg.Version) + channelID, err := s.registerInterchainAccount(ctx, msg.ConnectionId, portID, msg.Version, msg.Order) if err != nil { s.Logger(ctx).Error("error registering interchain account", "error", err.Error()) return nil, err diff --git a/modules/apps/27-interchain-accounts/controller/keeper/msg_server_test.go b/modules/apps/27-interchain-accounts/controller/keeper/msg_server_test.go index 4518a4c3825..f9040f231a0 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/msg_server_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/msg_server_test.go @@ -75,7 +75,7 @@ func (suite *KeeperTestSuite) TestRegisterInterchainAccount_MsgServer() { path := NewICAPath(suite.chainA, suite.chainB) suite.coordinator.SetupConnections(path) - msg = types.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, ibctesting.TestAccAddress, "") + msg = types.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, ibctesting.TestAccAddress, "", channeltypes.ORDERED) tc.malleate() diff --git a/modules/apps/27-interchain-accounts/controller/types/msgs.go b/modules/apps/27-interchain-accounts/controller/types/msgs.go index 1afa45929cb..74db1303244 100644 --- a/modules/apps/27-interchain-accounts/controller/types/msgs.go +++ b/modules/apps/27-interchain-accounts/controller/types/msgs.go @@ -8,6 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" host "github.com/cosmos/ibc-go/v8/modules/core/24-host" ibcerrors "github.com/cosmos/ibc-go/v8/modules/core/errors" ) @@ -25,11 +26,12 @@ var ( ) // NewMsgRegisterInterchainAccount creates a new instance of MsgRegisterInterchainAccount -func NewMsgRegisterInterchainAccount(connectionID, owner, version string) *MsgRegisterInterchainAccount { +func NewMsgRegisterInterchainAccount(connectionID, owner, version string, order channeltypes.Order) *MsgRegisterInterchainAccount { return &MsgRegisterInterchainAccount{ ConnectionId: connectionID, Owner: owner, Version: version, + Order: order, } } diff --git a/modules/apps/27-interchain-accounts/controller/types/msgs_test.go b/modules/apps/27-interchain-accounts/controller/types/msgs_test.go index 17bf0d98e0c..a282937e8bd 100644 --- a/modules/apps/27-interchain-accounts/controller/types/msgs_test.go +++ b/modules/apps/27-interchain-accounts/controller/types/msgs_test.go @@ -14,6 +14,7 @@ import ( "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" feetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" ibctesting "github.com/cosmos/ibc-go/v8/testing" ) @@ -80,6 +81,7 @@ func TestMsgRegisterInterchainAccountValidateBasic(t *testing.T) { ibctesting.FirstConnectionID, ibctesting.TestAccAddress, icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID), + channeltypes.ORDERED, ) tc.malleate() @@ -97,7 +99,7 @@ func TestMsgRegisterInterchainAccountGetSigners(t *testing.T) { expSigner, err := sdk.AccAddressFromBech32(ibctesting.TestAccAddress) require.NoError(t, err) - msg := types.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, ibctesting.TestAccAddress, "") + msg := types.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, ibctesting.TestAccAddress, "", channeltypes.ORDERED) encodingCfg := moduletestutil.MakeTestEncodingConfig(ica.AppModuleBasic{}) signers, _, err := encodingCfg.Codec.GetMsgV1Signers(msg) require.NoError(t, err) diff --git a/modules/apps/callbacks/callbacks_test.go b/modules/apps/callbacks/callbacks_test.go index 9796913cef6..cc65cf6a2f0 100644 --- a/modules/apps/callbacks/callbacks_test.go +++ b/modules/apps/callbacks/callbacks_test.go @@ -24,6 +24,7 @@ import ( icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" feetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" ibctesting "github.com/cosmos/ibc-go/v8/testing" ibcmock "github.com/cosmos/ibc-go/v8/testing/mock" @@ -153,7 +154,7 @@ func (s *CallbacksTestSuite) SetupICATest() string { // RegisterInterchainAccount submits a MsgRegisterInterchainAccount and updates the controller endpoint with the // channel created. func (s *CallbacksTestSuite) RegisterInterchainAccount(owner string) { - msgRegister := icacontrollertypes.NewMsgRegisterInterchainAccount(s.path.EndpointA.ConnectionID, owner, s.path.EndpointA.ChannelConfig.Version) + msgRegister := icacontrollertypes.NewMsgRegisterInterchainAccount(s.path.EndpointA.ConnectionID, owner, s.path.EndpointA.ChannelConfig.Version, channeltypes.ORDERED) res, err := s.chainA.SendMsgs(msgRegister) s.Require().NotEmpty(res) From 9e80438f6d8950fcbdd6300defdb14a78dd6bb3a Mon Sep 17 00:00:00 2001 From: DimitrisJim Date: Mon, 15 Jan 2024 15:31:18 +0200 Subject: [PATCH 3/6] Add ordering to cli tx for Register. --- .../controller/client/cli/tx.go | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/modules/apps/27-interchain-accounts/controller/client/cli/tx.go b/modules/apps/27-interchain-accounts/controller/client/cli/tx.go index 216b868d3ed..acb849272ac 100644 --- a/modules/apps/27-interchain-accounts/controller/client/cli/tx.go +++ b/modules/apps/27-interchain-accounts/controller/client/cli/tx.go @@ -19,7 +19,9 @@ import ( const ( // The controller chain channel version - flagVersion = "version" + flagVersion = "version" + // The channel ordering + flagOrdering = "ordering" flagRelativePacketTimeout = "relative-packet-timeout" ) @@ -47,14 +49,23 @@ the associated capability.`), return err } - msg := types.NewMsgRegisterInterchainAccount(connectionID, owner, version, channeltypes.ORDERED) + orderString, err := cmd.Flags().GetString(flagOrdering) + if err != nil { + return err + } + order, err := getOrder(orderString) + if err != nil { + return err + } + + msg := types.NewMsgRegisterInterchainAccount(connectionID, owner, version, order) return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } cmd.Flags().String(flagVersion, "", "Controller chain channel version") - + cmd.Flags().String(flagOrdering, "ORDER_ORDERED", "Channel ordering") flags.AddTxFlagsToCmd(cmd) return cmd @@ -109,3 +120,12 @@ appropriate relative timeoutTimestamp must be provided with flag {relative-packe return cmd } + +// getOrder returns the channel ordering from the provided string +func getOrder(orderString string) (channeltypes.Order, error) { + order, found := channeltypes.Order_value[strings.ToUpper(orderString)] + if !found { + return channeltypes.NONE, fmt.Errorf("invalid channel ordering: %s", orderString) + } + return channeltypes.Order(order), nil +} From 7a36ca26cbdeead0a35132388a228b2374ecf186 Mon Sep 17 00:00:00 2001 From: DimitrisJim Date: Mon, 15 Jan 2024 15:37:41 +0200 Subject: [PATCH 4/6] Add documentation line for tx now accepting ordering. --- .../apps/27-interchain-accounts/controller/client/cli/tx.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/apps/27-interchain-accounts/controller/client/cli/tx.go b/modules/apps/27-interchain-accounts/controller/client/cli/tx.go index acb849272ac..419c22474aa 100644 --- a/modules/apps/27-interchain-accounts/controller/client/cli/tx.go +++ b/modules/apps/27-interchain-accounts/controller/client/cli/tx.go @@ -32,8 +32,8 @@ func newRegisterInterchainAccountCmd() *cobra.Command { Long: strings.TrimSpace(`Register an account on the counterparty chain via the connection id from the source chain. Connection identifier should be for the source chain and the interchain account will be created on the counterparty chain. Callers are expected to -provide the appropriate application version string via {version} flag. Generates a new -port identifier using the provided owner string, binds to the port identifier and claims +provide the appropriate application version string via {version} flag and the desired ordering +via the {ordering} flag. Generates a new port identifier using the provided owner string, binds to the port identifier and claims the associated capability.`), Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { From 9e9aae69efe4cff51a1a538a8c447e82ec1a1b8c Mon Sep 17 00:00:00 2001 From: DimitrisJim Date: Tue, 16 Jan 2024 09:48:07 +0200 Subject: [PATCH 5/6] Address feedback review. Co-authored-by: Carlos Rodriguez --- .../27-interchain-accounts/controller/client/cli/tx.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/apps/27-interchain-accounts/controller/client/cli/tx.go b/modules/apps/27-interchain-accounts/controller/client/cli/tx.go index 419c22474aa..cbef4d26864 100644 --- a/modules/apps/27-interchain-accounts/controller/client/cli/tx.go +++ b/modules/apps/27-interchain-accounts/controller/client/cli/tx.go @@ -14,6 +14,7 @@ import ( "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" + connectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" ) @@ -53,7 +54,7 @@ the associated capability.`), if err != nil { return err } - order, err := getOrder(orderString) + order, err := parseOrder(orderString) if err != nil { return err } @@ -65,7 +66,7 @@ the associated capability.`), } cmd.Flags().String(flagVersion, "", "Controller chain channel version") - cmd.Flags().String(flagOrdering, "ORDER_ORDERED", "Channel ordering") + cmd.Flags().String(flagOrdering, "ORDER_ORDERED", fmt.Sprintf("Channel ordering, can be one of: %s", strings.Join(connectiontypes.SupportedOrderings, ", "))) flags.AddTxFlagsToCmd(cmd) return cmd @@ -121,8 +122,8 @@ appropriate relative timeoutTimestamp must be provided with flag {relative-packe return cmd } -// getOrder returns the channel ordering from the provided string -func getOrder(orderString string) (channeltypes.Order, error) { +// parseOrder returns the channel ordering from the provided string +func parseOrder(orderString string) (channeltypes.Order, error) { order, found := channeltypes.Order_value[strings.ToUpper(orderString)] if !found { return channeltypes.NONE, fmt.Errorf("invalid channel ordering: %s", orderString) From 12d5b8daf8ba5c5aa71c17bdc7eb25b2c794b796 Mon Sep 17 00:00:00 2001 From: DimitrisJim Date: Tue, 16 Jan 2024 12:30:31 +0200 Subject: [PATCH 6/6] Address Cian's feedback; spacing. --- .../controller/client/cli/tx.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/modules/apps/27-interchain-accounts/controller/client/cli/tx.go b/modules/apps/27-interchain-accounts/controller/client/cli/tx.go index cbef4d26864..356b7a8fc30 100644 --- a/modules/apps/27-interchain-accounts/controller/client/cli/tx.go +++ b/modules/apps/27-interchain-accounts/controller/client/cli/tx.go @@ -50,11 +50,7 @@ the associated capability.`), return err } - orderString, err := cmd.Flags().GetString(flagOrdering) - if err != nil { - return err - } - order, err := parseOrder(orderString) + order, err := parseOrder(cmd) if err != nil { return err } @@ -66,7 +62,7 @@ the associated capability.`), } cmd.Flags().String(flagVersion, "", "Controller chain channel version") - cmd.Flags().String(flagOrdering, "ORDER_ORDERED", fmt.Sprintf("Channel ordering, can be one of: %s", strings.Join(connectiontypes.SupportedOrderings, ", "))) + cmd.Flags().String(flagOrdering, channeltypes.ORDERED.String(), fmt.Sprintf("Channel ordering, can be one of: %s", strings.Join(connectiontypes.SupportedOrderings, ", "))) flags.AddTxFlagsToCmd(cmd) return cmd @@ -122,11 +118,17 @@ appropriate relative timeoutTimestamp must be provided with flag {relative-packe return cmd } -// parseOrder returns the channel ordering from the provided string -func parseOrder(orderString string) (channeltypes.Order, error) { +// parseOrder gets the channel ordering from the flags. +func parseOrder(cmd *cobra.Command) (channeltypes.Order, error) { + orderString, err := cmd.Flags().GetString(flagOrdering) + if err != nil { + return channeltypes.NONE, err + } + order, found := channeltypes.Order_value[strings.ToUpper(orderString)] if !found { return channeltypes.NONE, fmt.Errorf("invalid channel ordering: %s", orderString) } + return channeltypes.Order(order), nil }