From 0f3d20ff7378134df1e2d79ac792a8beef1820f1 Mon Sep 17 00:00:00 2001 From: Colin Axner Date: Thu, 1 Oct 2020 12:16:17 +0200 Subject: [PATCH 1/6] update connopeninit Update ConnOpenInit to reflect changes in https://github.com/cosmos/ics/pull/482. An additional version field is added to the connection handshake and connection open init message to take in an optional field. If this field is empty, then the default versions are used for connection handshake version negotiation. --- proto/ibc/connection/connection.proto | 3 +- x/ibc/03-connection/client/cli/tx.go | 32 +++- x/ibc/03-connection/handler.go | 2 +- x/ibc/03-connection/keeper/handshake.go | 8 +- x/ibc/03-connection/keeper/handshake_test.go | 8 +- x/ibc/03-connection/types/connection.pb.go | 181 ++++++++++++------- x/ibc/03-connection/types/msgs.go | 10 +- x/ibc/03-connection/types/msgs_test.go | 36 ++-- x/ibc/testing/chain.go | 7 +- 9 files changed, 189 insertions(+), 98 deletions(-) diff --git a/proto/ibc/connection/connection.proto b/proto/ibc/connection/connection.proto index 8c550f5c14f6..544a8e7bf1c8 100644 --- a/proto/ibc/connection/connection.proto +++ b/proto/ibc/connection/connection.proto @@ -14,7 +14,8 @@ message MsgConnectionOpenInit { string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; string connection_id = 2 [(gogoproto.moretags) = "yaml:\"connection_id\""]; Counterparty counterparty = 3 [(gogoproto.nullable) = false]; - bytes signer = 4 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; + string version = 4; + bytes signer = 5 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; } // MsgConnectionOpenTry defines a msg sent by a Relayer to try to open a diff --git a/x/ibc/03-connection/client/cli/tx.go b/x/ibc/03-connection/client/cli/tx.go index dba20ac1a4d4..5cb971bd239c 100644 --- a/x/ibc/03-connection/client/cli/tx.go +++ b/x/ibc/03-connection/client/cli/tx.go @@ -16,15 +16,22 @@ import ( host "github.com/cosmos/cosmos-sdk/x/ibc/24-host" ) +const ( + flagVersionIdentifier = "version-identifier" + flagVersionFeatures = "version-features" +) + // NewConnectionOpenInitCmd defines the command to initialize a connection on // chain A with a given counterparty chain B func NewConnectionOpenInitCmd() *cobra.Command { cmd := &cobra.Command{ Use: "open-init [connection-id] [client-id] [counterparty-connection-id] [counterparty-client-id] [path/to/counterparty_prefix.json]", Short: "Initialize connection on chain A", - Long: "Initialize a connection on chain A with a given counterparty chain B", + Long: `Initialize a connection on chain A with a given counterparty chain B. + - 'version-identifier' flag can be a single pre-selected version identifier to be used in the handshake. + - 'version-features' flag can be a list of features separated by commas to accompany the version identifier.`, Example: fmt.Sprintf( - "%s tx %s %s open-init [connection-id] [client-id] [counterparty-connection-id] [counterparty-client-id] [path/to/counterparty_prefix.json]", + "%s tx %s %s open-init [connection-id] [client-id] [counterparty-connection-id] [counterparty-client-id] [path/to/counterparty_prefix.json] --version-identifier=\"1.0\" --version-features=\"ORDER_UNORDERED\"", version.AppName, host.ModuleName, types.SubModuleName, ), Args: cobra.ExactArgs(5), @@ -45,9 +52,24 @@ func NewConnectionOpenInitCmd() *cobra.Command { return err } + var encodedVersion string + versionIdentifier, _ := cmd.Flags().GetString(flagVersionIdentifier) + + if versionIdentifier != "" { + var features []string + + versionFeatures, _ := cmd.Flags().GetString(flagVersionFeatures) + if versionFeatures != "" { + features = strings.Split(versionFeatures, ",") + } + + version := types.NewVersion(versionIdentifier, features) + encodedVersion, err = version.Encode() + } + msg := types.NewMsgConnectionOpenInit( connectionID, clientID, counterpartyConnectionID, counterpartyClientID, - counterpartyPrefix, clientCtx.GetFromAddress(), + counterpartyPrefix, encodedVersion, clientCtx.GetFromAddress(), ) if err := msg.ValidateBasic(); err != nil { @@ -58,6 +80,10 @@ func NewConnectionOpenInitCmd() *cobra.Command { }, } + // NOTE: we should use empty default values since the user may not want to select a version + // at this step in the handshake. + cmd.Flags().String(flagVersionIdentifier, "", "version identifier to be used in the connection handshake version negotiation") + cmd.Flags().String(flagVersionFeatures, "", "version features list separated by commas without spaces. The features must function with the version identifier.") flags.AddTxFlagsToCmd(cmd) return cmd diff --git a/x/ibc/03-connection/handler.go b/x/ibc/03-connection/handler.go index 4ce2932f1b92..8a7b86f8d5ba 100644 --- a/x/ibc/03-connection/handler.go +++ b/x/ibc/03-connection/handler.go @@ -11,7 +11,7 @@ import ( // HandleMsgConnectionOpenInit defines the sdk.Handler for MsgConnectionOpenInit func HandleMsgConnectionOpenInit(ctx sdk.Context, k keeper.Keeper, msg *types.MsgConnectionOpenInit) (*sdk.Result, error) { if err := k.ConnOpenInit( - ctx, msg.ConnectionId, msg.ClientId, msg.Counterparty, + ctx, msg.ConnectionId, msg.ClientId, msg.Counterparty, msg.Version, ); err != nil { return nil, sdkerrors.Wrap(err, "connection handshake open init failed") } diff --git a/x/ibc/03-connection/keeper/handshake.go b/x/ibc/03-connection/keeper/handshake.go index 12b874d36a15..e5e416176587 100644 --- a/x/ibc/03-connection/keeper/handshake.go +++ b/x/ibc/03-connection/keeper/handshake.go @@ -21,14 +21,20 @@ func (k Keeper) ConnOpenInit( connectionID, // identifier clientID string, counterparty types.Counterparty, // desiredCounterpartyConnectionIdentifier, counterpartyPrefix, counterpartyClientIdentifier + version string, ) error { _, found := k.GetConnection(ctx, connectionID) if found { return types.ErrConnectionExists } + versions := types.GetCompatibleEncodedVersions() + if version != "" { + versions = []string{version} + } + // connection defines chain A's ConnectionEnd - connection := types.NewConnectionEnd(types.INIT, clientID, counterparty, types.GetCompatibleEncodedVersions()) + connection := types.NewConnectionEnd(types.INIT, clientID, counterparty, versions) k.SetConnection(ctx, connectionID, connection) if err := k.addConnectionToClient(ctx, clientID, connectionID); err != nil { diff --git a/x/ibc/03-connection/keeper/handshake_test.go b/x/ibc/03-connection/keeper/handshake_test.go index d8eef8ef5509..87a547ac099e 100644 --- a/x/ibc/03-connection/keeper/handshake_test.go +++ b/x/ibc/03-connection/keeper/handshake_test.go @@ -17,6 +17,7 @@ func (suite *KeeperTestSuite) TestConnOpenInit() { var ( clientA string clientB string + version string ) testCases := []struct { @@ -27,6 +28,10 @@ func (suite *KeeperTestSuite) TestConnOpenInit() { {"success", func() { clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint) }, true}, + {"success with non empty version", func() { + clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint) + version = types.GetCompatibleEncodedVersions()[0] + }, true}, {"connection already exists", func() { clientA, clientB, _, _ = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint) }, false}, @@ -40,6 +45,7 @@ func (suite *KeeperTestSuite) TestConnOpenInit() { tc := tc suite.Run(tc.msg, func() { suite.SetupTest() // reset + version = "" // must be explicitly changed tc.malleate() @@ -47,7 +53,7 @@ func (suite *KeeperTestSuite) TestConnOpenInit() { connB := suite.chainB.GetFirstTestConnection(clientB, clientA) counterparty := types.NewCounterparty(clientB, connB.ID, suite.chainB.GetPrefix()) - err := suite.chainA.App.IBCKeeper.ConnectionKeeper.ConnOpenInit(suite.chainA.GetContext(), connA.ID, clientA, counterparty) + err := suite.chainA.App.IBCKeeper.ConnectionKeeper.ConnOpenInit(suite.chainA.GetContext(), connA.ID, clientA, counterparty, version) if tc.expPass { suite.Require().NoError(err) diff --git a/x/ibc/03-connection/types/connection.pb.go b/x/ibc/03-connection/types/connection.pb.go index 850dbce49638..e9cf2bfb4233 100644 --- a/x/ibc/03-connection/types/connection.pb.go +++ b/x/ibc/03-connection/types/connection.pb.go @@ -71,7 +71,8 @@ type MsgConnectionOpenInit struct { ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty" yaml:"client_id"` ConnectionId string `protobuf:"bytes,2,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty" yaml:"connection_id"` Counterparty Counterparty `protobuf:"bytes,3,opt,name=counterparty,proto3" json:"counterparty"` - Signer github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,4,opt,name=signer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"signer,omitempty"` + Version string `protobuf:"bytes,4,opt,name=version,proto3" json:"version,omitempty"` + Signer github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,5,opt,name=signer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"signer,omitempty"` } func (m *MsgConnectionOpenInit) Reset() { *m = MsgConnectionOpenInit{} } @@ -128,6 +129,13 @@ func (m *MsgConnectionOpenInit) GetCounterparty() Counterparty { return Counterparty{} } +func (m *MsgConnectionOpenInit) GetVersion() string { + if m != nil { + return m.Version + } + return "" +} + func (m *MsgConnectionOpenInit) GetSigner() github_com_cosmos_cosmos_sdk_types.AccAddress { if m != nil { return m.Signer @@ -752,71 +760,71 @@ func init() { func init() { proto.RegisterFile("ibc/connection/connection.proto", fileDescriptor_3bf62bacf5a27ee9) } var fileDescriptor_3bf62bacf5a27ee9 = []byte{ - // 1010 bytes of a gzipped FileDescriptorProto + // 1021 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0x4f, 0x6f, 0xe2, 0x46, - 0x14, 0xc7, 0xfc, 0xe7, 0x01, 0x09, 0xeb, 0x92, 0xc6, 0xa5, 0x5b, 0x8c, 0xdc, 0x4b, 0xd4, 0x2a, - 0xa6, 0xd9, 0xad, 0xf6, 0x10, 0xa9, 0x07, 0x60, 0x59, 0xd5, 0x6a, 0x37, 0x8b, 0x1c, 0x52, 0xa9, - 0x39, 0x14, 0x81, 0x3d, 0x90, 0x11, 0xc1, 0x46, 0xb6, 0xa9, 0x96, 0x6f, 0xb0, 0xca, 0xa9, 0xd7, - 0x4a, 0x8d, 0x54, 0xa9, 0xc7, 0x1e, 0xfa, 0x1d, 0x7a, 0xda, 0xe3, 0x1e, 0xdb, 0x8b, 0x55, 0x25, - 0xdf, 0x00, 0xf5, 0xd4, 0x4b, 0x2b, 0xcf, 0x8c, 0xff, 0x40, 0xb2, 0x95, 0x36, 0xb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0xff, 0x39, 0x00, 0x8d, 0x62, 0x03, 0x3b, 0x42, - 0x86, 0xc8, 0x63, 0x67, 0xe1, 0x8a, 0xf7, 0xa2, 0x48, 0x2f, 0x26, 0xa9, 0x39, 0xe2, 0x90, 0x56, - 0x38, 0xf4, 0x77, 0x42, 0x97, 0x15, 0xb2, 0x04, 0xb7, 0xbb, 0xba, 0x22, 0x8d, 0xfa, 0x2b, 0xb6, - 0x88, 0xc7, 0xb7, 0x60, 0x9b, 0x45, 0x4d, 0xc3, 0x46, 0x86, 0x3d, 0xb3, 0x85, 0x1c, 0x81, 0x57, - 0x16, 0xae, 0xf8, 0xfe, 0x12, 0xdc, 0x4f, 0x90, 0xd4, 0x2d, 0x3a, 0x83, 0x3f, 0xc0, 0x7f, 0x07, - 0xa5, 0x20, 0xea, 0xd3, 0x01, 0xaf, 0xa5, 0x43, 0x64, 0x74, 0xec, 0x06, 0xaa, 0x5a, 0x42, 0x4a, - 0xea, 0x76, 0x30, 0xc4, 0x68, 0x09, 0x3b, 0x26, 0xbf, 0x6e, 0xc7, 0xfc, 0x9d, 0xbc, 0xa5, 0x63, - 0x1a, 0xda, 0xf8, 0xa6, 0xfc, 0xb9, 0x37, 0x92, 0xbf, 0x00, 0x19, 0x26, 0x18, 0xda, 0x37, 0xaa, - 0xef, 0xbe, 0x85, 0xc6, 0x58, 0x55, 0x5e, 0x72, 0x03, 0xca, 0x3b, 0x00, 0x2a, 0xa8, 0x9e, 0x63, - 0xcd, 0x85, 0x14, 0x61, 0x39, 0x72, 0x60, 0x04, 0x21, 0x49, 0xcd, 0x12, 0xdb, 0x3b, 0x63, 0x56, - 0x65, 0x97, 0x5e, 0x4f, 0x76, 0x99, 0x8d, 0xc8, 0x2e, 0xfb, 0x56, 0x64, 0x97, 0x5b, 0x57, 0x76, - 0xbf, 0xc6, 0x41, 0xb8, 0x21, 0xbb, 0x96, 0x69, 0x0c, 0xb1, 0x35, 0x59, 0x57, 0x7a, 0xc1, 0xa7, - 0xeb, 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, 0x32, 0xe4, + 0xa9, 0xa5, 0xa3, 0x7d, 0xfb, 0xac, 0xdd, 0x3a, 0x2a, 0xf0, 0xa5, 0xec, 0xc5, 0x65, 0x25, 0xc5, + 0xd4, 0x30, 0x92, 0x18, 0xe3, 0x34, 0xd2, 0x93, 0x4b, 0xc2, 0x8b, 0x9f, 0xcb, 0xb1, 0x46, 0xfb, + 0xe5, 0x55, 0x99, 0x7b, 0x75, 0x55, 0xe6, 0xfe, 0xba, 0x2a, 0x73, 0x3f, 0x5c, 0x97, 0x63, 0xaf, + 0xae, 0xcb, 0xb1, 0x3f, 0xae, 0xcb, 0xb1, 0xd3, 0x47, 0xff, 0xdb, 0x5d, 0x9e, 0xd7, 0xbc, 0xdf, + 0x8d, 0xcf, 0x1e, 0xee, 0x47, 0x7e, 0x7a, 0x48, 0xc7, 0xe9, 0x27, 0xc9, 0x9d, 0xfb, 0xf0, 0xbf, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x15, 0x7b, 0x42, 0xe0, 0x13, 0x0d, 0x00, 0x00, } func (m *MsgConnectionOpenInit) Marshal() (dAtA []byte, err error) { @@ -844,6 +852,13 @@ func (m *MsgConnectionOpenInit) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.Signer) i = encodeVarintConnection(dAtA, i, uint64(len(m.Signer))) i-- + dAtA[i] = 0x2a + } + if len(m.Version) > 0 { + i -= len(m.Version) + copy(dAtA[i:], m.Version) + i = encodeVarintConnection(dAtA, i, uint64(len(m.Version))) + i-- dAtA[i] = 0x22 } { @@ -1439,6 +1454,10 @@ func (m *MsgConnectionOpenInit) Size() (n int) { } l = m.Counterparty.Size() n += 1 + l + sovConnection(uint64(l)) + l = len(m.Version) + if l > 0 { + n += 1 + l + sovConnection(uint64(l)) + } l = len(m.Signer) if l > 0 { n += 1 + l + sovConnection(uint64(l)) @@ -1816,6 +1835,38 @@ func (m *MsgConnectionOpenInit) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConnection + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthConnection + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthConnection + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Version = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) } diff --git a/x/ibc/03-connection/types/msgs.go b/x/ibc/03-connection/types/msgs.go index 9462678a7a50..77f9f11de41e 100644 --- a/x/ibc/03-connection/types/msgs.go +++ b/x/ibc/03-connection/types/msgs.go @@ -16,13 +16,14 @@ var _ sdk.Msg = &MsgConnectionOpenInit{} func NewMsgConnectionOpenInit( connectionID, clientID, counterpartyConnectionID, counterpartyClientID string, counterpartyPrefix commitmenttypes.MerklePrefix, - signer sdk.AccAddress, + version string, signer sdk.AccAddress, ) *MsgConnectionOpenInit { counterparty := NewCounterparty(counterpartyClientID, counterpartyConnectionID, counterpartyPrefix) return &MsgConnectionOpenInit{ ConnectionId: connectionID, ClientId: clientID, Counterparty: counterparty, + Version: version, Signer: signer, } } @@ -37,7 +38,7 @@ func (msg MsgConnectionOpenInit) Type() string { return "connection_open_init" } -// ValidateBasic implements sdk.Msg +// ValidateBasic implements sdk.Msg. func (msg MsgConnectionOpenInit) ValidateBasic() error { if err := host.ConnectionIdentifierValidator(msg.ConnectionId); err != nil { return sdkerrors.Wrap(err, "invalid connection ID") @@ -45,6 +46,11 @@ func (msg MsgConnectionOpenInit) ValidateBasic() error { if err := host.ClientIdentifierValidator(msg.ClientId); err != nil { return sdkerrors.Wrap(err, "invalid client ID") } + if msg.Version != "" { + if err := ValidateVersion(msg.Version); err != nil { + return sdkerrors.Wrap(err, "basic validation of the provided version failed") + } + } if msg.Signer.Empty() { return sdkerrors.ErrInvalidAddress } diff --git a/x/ibc/03-connection/types/msgs_test.go b/x/ibc/03-connection/types/msgs_test.go index 4f2951b131dc..334287625851 100644 --- a/x/ibc/03-connection/types/msgs_test.go +++ b/x/ibc/03-connection/types/msgs_test.go @@ -67,37 +67,31 @@ func TestMsgTestSuite(t *testing.T) { func (suite *MsgTestSuite) TestNewMsgConnectionOpenInit() { prefix := commitmenttypes.NewMerklePrefix([]byte("storePrefixKey")) signer, _ := sdk.AccAddressFromBech32("cosmos1ckgw5d7jfj7wwxjzs9fdrdev9vc8dzcw3n2lht") - - testMsgs := []*types.MsgConnectionOpenInit{ - types.NewMsgConnectionOpenInit("test/conn1", "clienttotesta", "connectiontotest", "clienttotest", prefix, signer), - types.NewMsgConnectionOpenInit("ibcconntest", "test/iris", "connectiontotest", "clienttotest", prefix, signer), - types.NewMsgConnectionOpenInit("ibcconntest", "clienttotest", "test/conn1", "clienttotest", prefix, signer), - types.NewMsgConnectionOpenInit("ibcconntest", "clienttotest", "connectiontotest", "test/conn1", prefix, signer), - types.NewMsgConnectionOpenInit("ibcconntest", "clienttotest", "connectiontotest", "clienttotest", emptyPrefix, signer), - types.NewMsgConnectionOpenInit("ibcconntest", "clienttotest", "connectiontotest", "clienttotest", prefix, nil), - types.NewMsgConnectionOpenInit("ibcconntest", "clienttotest", "connectiontotest", "clienttotest", prefix, signer), - } + // empty versions are considered valid, the default compatible versions + // will be used in protocol. + version := "" var testCases = []struct { + name string msg *types.MsgConnectionOpenInit expPass bool - errMsg string }{ - {testMsgs[0], false, "invalid connection ID"}, - {testMsgs[1], false, "invalid client ID"}, - {testMsgs[2], false, "invalid counterparty client ID"}, - {testMsgs[3], false, "invalid counterparty connection ID"}, - {testMsgs[4], false, "empty counterparty prefix"}, - {testMsgs[5], false, "empty singer"}, - {testMsgs[6], true, "success"}, + {"invalid connection ID", types.NewMsgConnectionOpenInit("test/conn1", "clienttotesta", "connectiontotest", "clienttotest", prefix, version, signer), false}, + {"invalid client ID", types.NewMsgConnectionOpenInit("ibcconntest", "test/iris", "connectiontotest", "clienttotest", prefix, version, signer), false}, + {"invalid counterparty client ID", types.NewMsgConnectionOpenInit("ibcconntest", "clienttotest", "test/conn1", "clienttotest", prefix, version, signer), false}, + {"invalid counterparty connection ID", types.NewMsgConnectionOpenInit("ibcconntest", "clienttotest", "connectiontotest", "test/conn1", prefix, version, signer), false}, + {"empty counterparty prefix", types.NewMsgConnectionOpenInit("ibcconntest", "clienttotest", "connectiontotest", "clienttotest", emptyPrefix, version, signer), false}, + {"supplied version fails basic validation", types.NewMsgConnectionOpenInit("ibcconntest", "clienttotest", "connectiontotest", "clienttotest", prefix, "bad version", signer), false}, + {"empty singer", types.NewMsgConnectionOpenInit("ibcconntest", "clienttotest", "connectiontotest", "clienttotest", prefix, version, nil), false}, + {"success", types.NewMsgConnectionOpenInit("ibcconntest", "clienttotest", "connectiontotest", "clienttotest", prefix, version, signer), true}, } - for i, tc := range testCases { + for _, tc := range testCases { err := tc.msg.ValidateBasic() if tc.expPass { - suite.Require().NoError(err, "Msg %d failed: %v", i, err) + suite.Require().NoError(err, tc.name) } else { - suite.Require().Error(err, "Invalid Msg %d passed: %s", i, tc.errMsg) + suite.Require().Error(err, tc.name) } } } diff --git a/x/ibc/testing/chain.go b/x/ibc/testing/chain.go index 5ec64cb8a1fd..2716f9a93c66 100644 --- a/x/ibc/testing/chain.go +++ b/x/ibc/testing/chain.go @@ -48,8 +48,9 @@ const ( UnbondingPeriod time.Duration = time.Hour * 24 * 7 * 3 MaxClockDrift time.Duration = time.Second * 10 - DefaultChannelVersion = ibctransfertypes.Version - InvalidID = "IDisInvalid" + DefaultChannelVersion = ibctransfertypes.Version + DefaultOpenInitVersion = "" + InvalidID = "IDisInvalid" ConnectionIDPrefix = "conn" ChannelIDPrefix = "chan" @@ -543,7 +544,7 @@ func (chain *TestChain) ConnectionOpenInit( msg := connectiontypes.NewMsgConnectionOpenInit( connection.ID, connection.ClientID, counterpartyConnection.ID, connection.CounterpartyClientID, - counterparty.GetPrefix(), + counterparty.GetPrefix(), DefaultOpenInitVersion, chain.SenderAccount.GetAddress(), ) return chain.sendMsgs(msg) From 0a8649fe15a00c292029741ada48e2770b0065f9 Mon Sep 17 00:00:00 2001 From: Colin Axner Date: Thu, 1 Oct 2020 12:29:48 +0200 Subject: [PATCH 2/6] add version compatibility check in open init --- x/ibc/03-connection/keeper/handshake.go | 4 ++++ x/ibc/03-connection/keeper/handshake_test.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/x/ibc/03-connection/keeper/handshake.go b/x/ibc/03-connection/keeper/handshake.go index e5e416176587..9cd3aca4e8f1 100644 --- a/x/ibc/03-connection/keeper/handshake.go +++ b/x/ibc/03-connection/keeper/handshake.go @@ -30,6 +30,10 @@ func (k Keeper) ConnOpenInit( versions := types.GetCompatibleEncodedVersions() if version != "" { + if !types.IsSupportedVersion(version) { + return sdkerrors.Wrap(types.ErrInvalidVersion, "version is not supported") + } + versions = []string{version} } diff --git a/x/ibc/03-connection/keeper/handshake_test.go b/x/ibc/03-connection/keeper/handshake_test.go index 87a547ac099e..ed4e71d8b3f9 100644 --- a/x/ibc/03-connection/keeper/handshake_test.go +++ b/x/ibc/03-connection/keeper/handshake_test.go @@ -35,6 +35,10 @@ func (suite *KeeperTestSuite) TestConnOpenInit() { {"connection already exists", func() { clientA, clientB, _, _ = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint) }, false}, + {"invalid version", func() { + clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint) + version = "bad version" + }, false}, {"couldn't add connection to client", func() { // swap client identifiers to result in client that does not exist clientB, clientA = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint) From 8e6d54b10369d29e5dba8ca0e3acc2972166e087 Mon Sep 17 00:00:00 2001 From: Colin Axner Date: Thu, 1 Oct 2020 17:16:17 +0200 Subject: [PATCH 3/6] update docs --- x/ibc/spec/01_concepts.md | 4 +++- x/ibc/spec/04_messages.md | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/x/ibc/spec/01_concepts.md b/x/ibc/spec/01_concepts.md index 5a6c8b380253..d520cec3fbc4 100644 --- a/x/ibc/spec/01_concepts.md +++ b/x/ibc/spec/01_concepts.md @@ -88,7 +88,9 @@ to support within their connection state. It is expected that this set of versions is from most preferred to least preferred. This is not a strict requirement for the SDK implementation of IBC because the party calling `ConnOpenTry` will greedily select the latest version it supports that the -counterparty supports as well. +counterparty supports as well. A specific version can optionally be passed +as `Version` to ensure that the handshake will either complete with that +version or fail. During `ConnOpenTry`, party B will select a version from the counterparty's supported versions. Priority will be placed on the latest supported version. diff --git a/x/ibc/spec/04_messages.md b/x/ibc/spec/04_messages.md index 6e68a11fac0c..7d4556acbaab 100644 --- a/x/ibc/spec/04_messages.md +++ b/x/ibc/spec/04_messages.md @@ -91,6 +91,7 @@ type MsgConnectionOpenInit struct { ClientId string ConnectionId string Counterparty Counterparty + Version string Signer sdk.AccAddress } ``` @@ -99,11 +100,12 @@ This message is expected to fail if: - `ClientId` is invalid (see naming requirements) - `ConnectionId` is invalid (see naming requirements) - `Counterparty` is empty +- 'Version' is not empty and invalid - `Signer` is empty - A Client hasn't been created for the given ID - A Connection for the given ID already exists -The message creates a connection for the given ID with an INIT state. +The message creates a connection for the given ID with an INIT state. ### MsgConnectionOpenTry From 85e1cd73d0c24160e99104bfd014c49ff0c5837f Mon Sep 17 00:00:00 2001 From: Colin Axner Date: Thu, 1 Oct 2020 17:20:27 +0200 Subject: [PATCH 4/6] make proto --- x/ibc/03-connection/types/connection.pb.go | 245 ++++++--------------- 1 file changed, 66 insertions(+), 179 deletions(-) diff --git a/x/ibc/03-connection/types/connection.pb.go b/x/ibc/03-connection/types/connection.pb.go index 909a7e114312..b56051da1bc1 100644 --- a/x/ibc/03-connection/types/connection.pb.go +++ b/x/ibc/03-connection/types/connection.pb.go @@ -67,18 +67,11 @@ func (State) EnumDescriptor() ([]byte, []int) { // MsgConnectionOpenInit defines the msg sent by an account on Chain A to // initialize a connection with Chain B. type MsgConnectionOpenInit struct { -<<<<<<< HEAD - ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty" yaml:"client_id"` - ConnectionId string `protobuf:"bytes,2,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty" yaml:"connection_id"` - Counterparty Counterparty `protobuf:"bytes,3,opt,name=counterparty,proto3" json:"counterparty"` - Version string `protobuf:"bytes,4,opt,name=version,proto3" json:"version,omitempty"` - Signer github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,5,opt,name=signer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"signer,omitempty"` -======= ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty" yaml:"client_id"` ConnectionId string `protobuf:"bytes,2,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty" yaml:"connection_id"` Counterparty Counterparty `protobuf:"bytes,3,opt,name=counterparty,proto3" json:"counterparty"` - Signer string `protobuf:"bytes,4,opt,name=signer,proto3" json:"signer,omitempty"` ->>>>>>> 72353902e2c8dc3ddaa4490d23693a14a720b804 + Version string `protobuf:"bytes,4,opt,name=version,proto3" json:"version,omitempty"` + Signer string `protobuf:"bytes,5,opt,name=signer,proto3" json:"signer,omitempty"` } func (m *MsgConnectionOpenInit) Reset() { *m = MsgConnectionOpenInit{} } @@ -114,44 +107,6 @@ func (m *MsgConnectionOpenInit) XXX_DiscardUnknown() { var xxx_messageInfo_MsgConnectionOpenInit proto.InternalMessageInfo -<<<<<<< HEAD -func (m *MsgConnectionOpenInit) GetClientId() string { - if m != nil { - return m.ClientId - } - return "" -} - -func (m *MsgConnectionOpenInit) GetConnectionId() string { - if m != nil { - return m.ConnectionId - } - return "" -} - -func (m *MsgConnectionOpenInit) GetCounterparty() Counterparty { - if m != nil { - return m.Counterparty - } - return Counterparty{} -} - -func (m *MsgConnectionOpenInit) GetVersion() string { - if m != nil { - return m.Version - } - return "" -} - -func (m *MsgConnectionOpenInit) GetSigner() github_com_cosmos_cosmos_sdk_types.AccAddress { - if m != nil { - return m.Signer - } - return nil -} - -======= ->>>>>>> 72353902e2c8dc3ddaa4490d23693a14a720b804 // MsgConnectionOpenTry defines a msg sent by a Relayer to try to open a // connection on Chain B. type MsgConnectionOpenTry struct { @@ -601,138 +556,70 @@ func init() { func init() { proto.RegisterFile("ibc/connection/connection.proto", fileDescriptor_3bf62bacf5a27ee9) } var fileDescriptor_3bf62bacf5a27ee9 = []byte{ -<<<<<<< HEAD - // 1021 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0x4f, 0x6f, 0xe2, 0x46, - 0x14, 0xc7, 0xc6, 0xfc, 0x7b, 0x40, 0xc2, 0xba, 0xa4, 0x71, 0xe9, 0x16, 0x23, 0xf7, 0x12, 0xb5, - 0x0a, 0x34, 0xbb, 0xd5, 0x1e, 0x22, 0xf5, 0x00, 0x2c, 0xab, 0x5a, 0xed, 0x66, 0x91, 0x43, 0x2a, - 0x35, 0x87, 0x22, 0x30, 0x03, 0x19, 0x11, 0x6c, 0x64, 0x9b, 0x6a, 0xf9, 0x06, 0xab, 0x9c, 0x7a, - 0xed, 0x21, 0x52, 0xa5, 0x1e, 0x7b, 0xe8, 0xad, 0x1f, 0xa0, 0xa7, 0x3d, 0xee, 0xb1, 0xbd, 0x58, - 0x55, 0xf2, 0x0d, 0x50, 0x4f, 0xbd, 0xb4, 0xf2, 0xcc, 0xf8, 0x0f, 0x24, 0x5b, 0x69, 0x03, 0xab, - 0x3d, 0xf9, 0xbd, 0x79, 0xef, 0xcd, 0xcc, 0xfb, 0xcd, 0xef, 0xbd, 0x19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x00, 0x00, -======= - // 995 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0x4b, 0x6f, 0x1a, 0x57, - 0x14, 0x66, 0x60, 0x78, 0x1d, 0xc0, 0x26, 0x53, 0x1c, 0x4f, 0x69, 0x3a, 0x83, 0xa6, 0x1b, 0xab, - 0x55, 0xa0, 0x49, 0xaa, 0x2c, 0x90, 0xba, 0x30, 0x84, 0xa8, 0xa3, 0x36, 0x0e, 0x1a, 0xe3, 0x4a, - 0xf5, 0xa2, 0x08, 0x86, 0x0b, 0xbe, 0xc2, 0xcc, 0xa0, 0x99, 0xa1, 0x0a, 0xdb, 0x2e, 0xaa, 0xc8, - 0xab, 0x6e, 0xbb, 0xb0, 0x14, 0xa9, 0xff, 0xa4, 0xab, 0x48, 0xdd, 0x64, 0xd9, 0x6e, 0x50, 0x65, - 0x6f, 0xba, 0xa6, 0x3f, 0xa0, 0xd5, 0x7d, 0xcc, 0x03, 0x6c, 0xab, 0x8a, 0xed, 0x28, 0x2b, 0xce, - 0xb9, 0xe7, 0x7c, 0x73, 0xef, 0x77, 0xce, 0x77, 0x1f, 0x80, 0x8a, 0xfb, 0x66, 0xcd, 0xb4, 0x2d, - 0x0b, 0x99, 0x1e, 0xb6, 0xad, 0x88, 0x59, 0x9d, 0x3a, 0xb6, 0x67, 0x4b, 0x1b, 0xb8, 0x6f, 0x56, - 0xc3, 0xd1, 0x72, 0x69, 0x64, 0x8f, 0x6c, 0x1a, 0xaa, 0x11, 0x8b, 0x65, 0x95, 0x3f, 0x1c, 0xd9, - 0xf6, 0xe8, 0x18, 0xd5, 0xa8, 0xd7, 0x9f, 0x0d, 0x6b, 0x3d, 0x6b, 0xce, 0x43, 0x7c, 0x86, 0xc9, - 0x04, 0x7b, 0x13, 0x64, 0x79, 0x11, 0x93, 0x27, 0x6c, 0xd3, 0x84, 0x63, 0x4c, 0x83, 0xf4, 0x87,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, 0x6e, 0x88, 0xa4, 0xc1, 0x04, 0x43, 0x12, 0xbb, 0x2c, - 0xbe, 0xfc, 0x55, 0x89, 0x35, 0xda, 0xaf, 0xcf, 0x14, 0xe1, 0xcd, 0x99, 0x22, 0xfc, 0x75, 0xa6, - 0x08, 0x3f, 0x9f, 0x2b, 0xb1, 0x37, 0xe7, 0x4a, 0xec, 0x8f, 0x73, 0x25, 0x76, 0xf8, 0x78, 0x84, - 0xbd, 0xa3, 0x59, 0x9f, 0xf4, 0xad, 0x66, 0xda, 0xee, 0xc4, 0x76, 0xf9, 0xcf, 0x7d, 0x77, 0x30, - 0xae, 0xbd, 0xa8, 0x91, 0x07, 0xfb, 0xe7, 0x8f, 0xee, 0x47, 0xfe, 0x36, 0x78, 0xf3, 0x29, 0x72, - 0xfb, 0x29, 0x7a, 0x43, 0x3e, 0xfa, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x86, 0xc8, 0x16, 0xfc, 0x55, - 0x0c, 0x00, 0x00, ->>>>>>> 72353902e2c8dc3ddaa4490d23693a14a720b804 + // 1004 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0xcd, 0x6f, 0x1a, 0x47, + 0x14, 0x67, 0x97, 0xe5, 0xeb, 0x01, 0x36, 0xd9, 0xe2, 0x78, 0x4b, 0x53, 0x16, 0x6d, 0x2f, 0x56, + 0xab, 0x40, 0x93, 0x54, 0x39, 0x20, 0xf5, 0x60, 0x08, 0x51, 0x57, 0x6d, 0x1c, 0xb4, 0xc6, 0x95, + 0xea, 0x43, 0x11, 0x1f, 0x03, 0x1e, 0x61, 0x76, 0xd1, 0xee, 0x52, 0x85, 0x6b, 0x0f, 0x55, 0x64, + 0xa9, 0x52, 0xaf, 0x3d, 0x58, 0x8a, 0xd4, 0xff, 0xa4, 0xa7, 0x48, 0xbd, 0xe4, 0xd8, 0x5e, 0x50, + 0x65, 0x5f, 0x7a, 0xe6, 0x1f, 0x68, 0x35, 0x1f, 0xfb, 0x01, 0x36, 0x87, 0xd8, 0x54, 0x3e, 0xf1, + 0xde, 0xfc, 0xde, 0x9b, 0x99, 0xf7, 0x9b, 0xdf, 0x9b, 0x1d, 0x40, 0xc5, 0xdd, 0x5e, 0xa5, 0x67, + 0x99, 0x26, 0xea, 0xb9, 0xd8, 0x32, 0x43, 0x66, 0x79, 0x62, 0x5b, 0xae, 0x25, 0x6f, 0xe1, 0x6e, + 0xaf, 0x1c, 0x8c, 0x16, 0xf2, 0x43, 0x6b, 0x68, 0x51, 0xa8, 0x42, 0x2c, 0x16, 0x55, 0xf8, 0x70, + 0x68, 0x59, 0xc3, 0x53, 0x54, 0xa1, 0x5e, 0x77, 0x3a, 0xa8, 0x74, 0xcc, 0x19, 0x87, 0xf8, 0x0a, + 0xe3, 0x31, 0x76, 0xc7, 0xc8, 0x74, 0x43, 0x26, 0x0f, 0xd8, 0xa5, 0x01, 0xa7, 0x98, 0x82, 0xf4, + 0x87, 0x01, 0xda, 0xcf, 0x22, 0xec, 0xbc, 0x70, 0x86, 0x75, 0x7f, 0xf1, 0x97, 0x13, 0x64, 0xea, + 0x26, 0x76, 0xe5, 0x47, 0x90, 0x62, 0x91, 0x6d, 0xdc, 0x57, 0x84, 0x92, 0xb0, 0x97, 0xaa, 0xe5, + 0x17, 0x73, 0x35, 0x37, 0xeb, 0x8c, 0x4f, 0xab, 0x9a, 0x0f, 0x69, 0x46, 0x92, 0xd9, 0x7a, 0x5f, + 0xfe, 0x12, 0xb2, 0x41, 0x15, 0x24, 0x4d, 0xa4, 0x69, 0xca, 0x62, 0xae, 0xe6, 0x79, 0x5a, 0x18, + 0xd6, 0x8c, 0x4c, 0xe0, 0xeb, 0x7d, 0xf9, 0x39, 0x64, 0x7a, 0xd6, 0xd4, 0x74, 0x91, 0x3d, 0xe9, + 0xd8, 0xee, 0x4c, 0x89, 0x96, 0x84, 0xbd, 0xf4, 0xe3, 0x07, 0xe5,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, 0x00, 0xff, 0xff, 0x10, 0x68, 0x4f, 0x5f, 0x6f, 0x0c, 0x00, 0x00, } func (m *MsgConnectionOpenInit) Marshal() (dAtA []byte, err error) { From c4266a5b1cf4afc49e773b7cf240ab303beca037 Mon Sep 17 00:00:00 2001 From: Colin Axner Date: Thu, 1 Oct 2020 17:26:43 +0200 Subject: [PATCH 5/6] fix formatting --- x/ibc/spec/04_messages.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/x/ibc/spec/04_messages.md b/x/ibc/spec/04_messages.md index 7d4556acbaab..30b0f5b96696 100644 --- a/x/ibc/spec/04_messages.md +++ b/x/ibc/spec/04_messages.md @@ -88,11 +88,11 @@ A connection is initialized on a light client using the `MsgConnectionOpenInit`. ```go type MsgConnectionOpenInit struct { - ClientId string - ConnectionId string - Counterparty Counterparty - Version string - Signer sdk.AccAddress + ClientId string + ConnectionId string + Counterparty Counterparty + Version string + Signer string } ``` From b4a44e3ac835d9a1dadca6fe2931e1f4deb33442 Mon Sep 17 00:00:00 2001 From: Colin Axner Date: Thu, 1 Oct 2020 17:28:53 +0200 Subject: [PATCH 6/6] fix lint --- x/ibc/03-connection/client/cli/tx.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/x/ibc/03-connection/client/cli/tx.go b/x/ibc/03-connection/client/cli/tx.go index 5cb971bd239c..88d26e782a3e 100644 --- a/x/ibc/03-connection/client/cli/tx.go +++ b/x/ibc/03-connection/client/cli/tx.go @@ -65,6 +65,9 @@ func NewConnectionOpenInitCmd() *cobra.Command { version := types.NewVersion(versionIdentifier, features) encodedVersion, err = version.Encode() + if err != nil { + return err + } } msg := types.NewMsgConnectionOpenInit(