diff --git a/proto/ibc/connection/connection.proto b/proto/ibc/connection/connection.proto index 339d919f7..64cd418eb 100644 --- a/proto/ibc/connection/connection.proto +++ b/proto/ibc/connection/connection.proto @@ -34,9 +34,8 @@ message MsgConnectionOpenTry { (gogoproto.moretags) = "yaml:\"connection_id\"" ]; Counterparty counterparty = 3 [(gogoproto.nullable) = false]; - repeated string counterparty_versions = 4 [ - (gogoproto.moretags) = "yaml:\"counterparty_versions\"" - ]; + repeated string counterparty_versions = 4 + [(gogoproto.moretags) = "yaml:\"counterparty_versions\""]; // proof of the initialization the connection on Chain A: `UNITIALIZED -> // INIT` bytes proof_init = 5 [(gogoproto.moretags) = "yaml:\"proof_init\""]; @@ -90,6 +89,24 @@ message MsgConnectionOpenConfirm { // separate one. NOTE: there must only be 2 defined ConnectionEnds to establish // a connection between two chains. message ConnectionEnd { + option (gogoproto.goproto_getters) = false; + // client associated with this connection. + string client_id = 1 [ + (gogoproto.customname) = "ClientID", + (gogoproto.moretags) = "yaml:\"client_id\"" + ]; + // IBC version which can be utilised to determine encodings or protocols for + // channels or packets utilising this connection + repeated string versions = 2; + // current state of the connection end. + State state = 3; + // counterparty chain associated with this connection. + Counterparty counterparty = 4 [(gogoproto.nullable) = false]; +} + +// IdentifiedConnection defines a connection with additional connection +// identifier field. +message IdentifiedConnection { option (gogoproto.goproto_getters) = false; // connection identifier. string id = 1 diff --git a/proto/ibc/connection/query.proto b/proto/ibc/connection/query.proto index 0ed5bf8f7..073170992 100644 --- a/proto/ibc/connection/query.proto +++ b/proto/ibc/connection/query.proto @@ -47,7 +47,7 @@ message QueryConnectionsRequest { // QueryConnectionsResponse is the response type for the Query/Connections RPC method. message QueryConnectionsResponse { // list of stored connections of the chain. - repeated ibc.connection.ConnectionEnd connections = 1; + repeated ibc.connection.IdentifiedConnection connections = 1; // pagination response cosmos.query.PageResponse pagination = 2; // query block height @@ -72,4 +72,4 @@ message QueryClientConnectionsResponse { string proof_path = 3; // height at which the proof was generated uint64 proof_height = 4; -} \ No newline at end of file +} diff --git a/x/ibc/03-connection/client/utils/utils.go b/x/ibc/03-connection/client/utils/utils.go index fbcd1b730..81fc8e22d 100644 --- a/x/ibc/03-connection/client/utils/utils.go +++ b/x/ibc/03-connection/client/utils/utils.go @@ -56,7 +56,7 @@ func queryConnectionABCI(clientCtx client.Context, connectionID string) (*types. return nil, err } - return types.NewQueryConnectionResponse(connection, proofBz, res.Height), nil + return types.NewQueryConnectionResponse(connectionID, connection, proofBz, res.Height), nil } // QueryClientConnections queries the connection paths registered for a particular client. diff --git a/x/ibc/03-connection/exported/exported.go b/x/ibc/03-connection/exported/exported.go index c4746239a..cb525aa22 100644 --- a/x/ibc/03-connection/exported/exported.go +++ b/x/ibc/03-connection/exported/exported.go @@ -6,7 +6,6 @@ import ( // ConnectionI describes the required methods for a connection. type ConnectionI interface { - GetID() string GetClientID() string GetState() int32 GetCounterparty() CounterpartyI diff --git a/x/ibc/03-connection/genesis.go b/x/ibc/03-connection/genesis.go index 7eb34bb46..cdecadbff 100644 --- a/x/ibc/03-connection/genesis.go +++ b/x/ibc/03-connection/genesis.go @@ -10,7 +10,8 @@ import ( // state. func InitGenesis(ctx sdk.Context, k keeper.Keeper, gs types.GenesisState) { for _, connection := range gs.Connections { - k.SetConnection(ctx, connection.ID, connection) + conn := types.NewConnectionEnd(connection.State, connection.ClientID, connection.Counterparty, connection.Versions) + k.SetConnection(ctx, connection.ID, conn) } for _, connPaths := range gs.ClientConnectionPaths { k.SetClientConnectionPaths(ctx, connPaths.ClientID, connPaths.Paths) diff --git a/x/ibc/03-connection/keeper/grpc_query.go b/x/ibc/03-connection/keeper/grpc_query.go index cbfd4586c..017672086 100644 --- a/x/ibc/03-connection/keeper/grpc_query.go +++ b/x/ibc/03-connection/keeper/grpc_query.go @@ -49,16 +49,22 @@ func (q Keeper) Connections(c context.Context, req *types.QueryConnectionsReques ctx := sdk.UnwrapSDKContext(c) - connections := []*types.ConnectionEnd{} + connections := []*types.IdentifiedConnection{} store := prefix.NewStore(ctx.KVStore(q.storeKey), host.KeyConnectionPrefix) - pageRes, err := query.Paginate(store, req.Pagination, func(_, value []byte) error { + pageRes, err := query.Paginate(store, req.Pagination, func(key, value []byte) error { var result types.ConnectionEnd if err := q.cdc.UnmarshalBinaryBare(value, &result); err != nil { return err } - connections = append(connections, &result) + connectionID, err := host.ParseConnectionPath(string(key)) + if err != nil { + return err + } + + identifiedConnection := types.NewIdentifiedConnection(connectionID, result) + connections = append(connections, &identifiedConnection) return nil }) diff --git a/x/ibc/03-connection/keeper/grpc_query_test.go b/x/ibc/03-connection/keeper/grpc_query_test.go index 79bf61817..8a7b70c8a 100644 --- a/x/ibc/03-connection/keeper/grpc_query_test.go +++ b/x/ibc/03-connection/keeper/grpc_query_test.go @@ -50,7 +50,7 @@ func (suite *KeeperTestSuite) TestQueryConnection() { connB := suite.chainB.GetFirstTestConnection(clientB, clientA) counterparty := types.NewCounterparty(clientB, connB.ID, suite.chainB.GetPrefix()) - expConnection = types.NewConnectionEnd(types.INIT, connA.ID, clientA, counterparty, types.GetCompatibleEncodedVersions()) + expConnection = types.NewConnectionEnd(types.INIT, clientA, counterparty, types.GetCompatibleEncodedVersions()) suite.chainA.App.IBCKeeper.ConnectionKeeper.SetConnection(suite.chainA.GetContext(), connA.ID, expConnection) req = &types.QueryConnectionRequest{ @@ -84,7 +84,7 @@ func (suite *KeeperTestSuite) TestQueryConnection() { func (suite *KeeperTestSuite) TestQueryConnections() { var ( req *types.QueryConnectionsRequest - expConnections = []*types.ConnectionEnd{} + expConnections = []*types.IdentifiedConnection{} ) testCases := []struct { @@ -119,11 +119,15 @@ func (suite *KeeperTestSuite) TestQueryConnections() { counterparty2 := types.NewCounterparty(clientB, connB1.ID, suite.chainB.GetPrefix()) counterparty3 := types.NewCounterparty(clientB1, connB2.ID, suite.chainB.GetPrefix()) - conn1 := types.NewConnectionEnd(types.OPEN, connA0.ID, clientA, counterparty1, types.GetCompatibleEncodedVersions()) - conn2 := types.NewConnectionEnd(types.INIT, connA1.ID, clientA, counterparty2, types.GetCompatibleEncodedVersions()) - conn3 := types.NewConnectionEnd(types.OPEN, connA2.ID, clientA1, counterparty3, types.GetCompatibleEncodedVersions()) + conn1 := types.NewConnectionEnd(types.OPEN, clientA, counterparty1, types.GetCompatibleEncodedVersions()) + conn2 := types.NewConnectionEnd(types.INIT, clientA, counterparty2, types.GetCompatibleEncodedVersions()) + conn3 := types.NewConnectionEnd(types.OPEN, clientA1, counterparty3, types.GetCompatibleEncodedVersions()) - expConnections = []*types.ConnectionEnd{&conn1, &conn2, &conn3} + iconn1 := types.NewIdentifiedConnection(connA0.ID, conn1) + iconn2 := types.NewIdentifiedConnection(connA1.ID, conn2) + iconn3 := types.NewIdentifiedConnection(connA2.ID, conn3) + + expConnections = []*types.IdentifiedConnection{&iconn1, &iconn2, &iconn3} req = &types.QueryConnectionsRequest{ Pagination: &query.PageRequest{ diff --git a/x/ibc/03-connection/keeper/handshake.go b/x/ibc/03-connection/keeper/handshake.go index 49c7c31dc..2b71e5c8f 100644 --- a/x/ibc/03-connection/keeper/handshake.go +++ b/x/ibc/03-connection/keeper/handshake.go @@ -26,7 +26,7 @@ func (k Keeper) ConnOpenInit( } // connection defines chain A's ConnectionEnd - connection := types.NewConnectionEnd(types.INIT, connectionID, clientID, counterparty, types.GetCompatibleEncodedVersions()) + connection := types.NewConnectionEnd(types.INIT, clientID, counterparty, types.GetCompatibleEncodedVersions()) k.SetConnection(ctx, connectionID, connection) if err := k.addConnectionToClient(ctx, clientID, connectionID); err != nil { @@ -70,7 +70,7 @@ func (k Keeper) ConnOpenTry( // NOTE: chain A's counterparty is chain B (i.e where this code is executed) prefix := k.GetCommitmentPrefix() expectedCounterparty := types.NewCounterparty(clientID, connectionID, commitmenttypes.NewMerklePrefix(prefix.Bytes())) - expectedConnection := types.NewConnectionEnd(types.INIT, counterparty.ConnectionID, counterparty.ClientID, expectedCounterparty, counterpartyVersions) + expectedConnection := types.NewConnectionEnd(types.INIT, counterparty.ClientID, expectedCounterparty, counterpartyVersions) // chain B picks a version from Chain A's available versions that is compatible // with the supported IBC versions @@ -80,7 +80,7 @@ func (k Keeper) ConnOpenTry( } // connection defines chain B's ConnectionEnd - connection := types.NewConnectionEnd(types.UNINITIALIZED, connectionID, clientID, counterparty, []string{version}) + connection := types.NewConnectionEnd(types.UNINITIALIZED, clientID, counterparty, []string{version}) // Check that ChainA committed expectedConnectionEnd to its state if err := k.VerifyConnectionState( @@ -183,7 +183,7 @@ func (k Keeper) ConnOpenAck( prefix := k.GetCommitmentPrefix() expectedCounterparty := types.NewCounterparty(connection.ClientID, connectionID, commitmenttypes.NewMerklePrefix(prefix.Bytes())) - expectedConnection := types.NewConnectionEnd(types.TRYOPEN, connection.Counterparty.ConnectionID, connection.Counterparty.ClientID, expectedCounterparty, []string{encodedVersion}) + expectedConnection := types.NewConnectionEnd(types.TRYOPEN, connection.Counterparty.ClientID, expectedCounterparty, []string{encodedVersion}) // Ensure that ChainB stored expected connectionEnd in its state during ConnOpenTry if err := k.VerifyConnectionState( @@ -235,7 +235,7 @@ func (k Keeper) ConnOpenConfirm( prefix := k.GetCommitmentPrefix() expectedCounterparty := types.NewCounterparty(connection.ClientID, connectionID, commitmenttypes.NewMerklePrefix(prefix.Bytes())) - expectedConnection := types.NewConnectionEnd(types.OPEN, connection.Counterparty.ConnectionID, connection.Counterparty.ClientID, expectedCounterparty, connection.Versions) + expectedConnection := types.NewConnectionEnd(types.OPEN, connection.Counterparty.ClientID, expectedCounterparty, connection.Versions) // Check that connection on ChainA is open if err := k.VerifyConnectionState( diff --git a/x/ibc/03-connection/keeper/keeper.go b/x/ibc/03-connection/keeper/keeper.go index a8373a97f..796139990 100644 --- a/x/ibc/03-connection/keeper/keeper.go +++ b/x/ibc/03-connection/keeper/keeper.go @@ -130,7 +130,7 @@ func (k Keeper) GetAllClientConnectionPaths(ctx sdk.Context) []types.ConnectionP // IterateConnections provides an iterator over all ConnectionEnd objects. // For each ConnectionEnd, cb will be called. If the cb returns true, the // iterator will close and stop. -func (k Keeper) IterateConnections(ctx sdk.Context, cb func(types.ConnectionEnd) bool) { +func (k Keeper) IterateConnections(ctx sdk.Context, cb func(types.IdentifiedConnection) bool) { store := ctx.KVStore(k.storeKey) iterator := sdk.KVStorePrefixIterator(store, host.KeyConnectionPrefix) @@ -139,15 +139,17 @@ func (k Keeper) IterateConnections(ctx sdk.Context, cb func(types.ConnectionEnd) var connection types.ConnectionEnd k.cdc.MustUnmarshalBinaryBare(iterator.Value(), &connection) - if cb(connection) { + connectionID := host.MustParseConnectionPath(string(iterator.Key())) + identifiedConnection := types.NewIdentifiedConnection(connectionID, connection) + if cb(identifiedConnection) { break } } } // GetAllConnections returns all stored ConnectionEnd objects. -func (k Keeper) GetAllConnections(ctx sdk.Context) (connections []types.ConnectionEnd) { - k.IterateConnections(ctx, func(connection types.ConnectionEnd) bool { +func (k Keeper) GetAllConnections(ctx sdk.Context) (connections []types.IdentifiedConnection) { + k.IterateConnections(ctx, func(connection types.IdentifiedConnection) bool { connections = append(connections, connection) return false }) diff --git a/x/ibc/03-connection/keeper/keeper_test.go b/x/ibc/03-connection/keeper/keeper_test.go index 7d4a4b2a1..a2735c1cc 100644 --- a/x/ibc/03-connection/keeper/keeper_test.go +++ b/x/ibc/03-connection/keeper/keeper_test.go @@ -61,9 +61,13 @@ func (suite KeeperTestSuite) TestGetAllConnections() { counterpartyB0 := types.NewCounterparty(clientB, connB0.ID, suite.chainB.GetPrefix()) // connection B0 counterpartyB1 := types.NewCounterparty(clientB, connB1.ID, suite.chainB.GetPrefix()) // connection B1 - conn1 := types.NewConnectionEnd(types.OPEN, connA0.ID, clientA, counterpartyB0, types.GetCompatibleEncodedVersions()) // A0 - B0 - conn2 := types.NewConnectionEnd(types.OPEN, connA1.ID, clientA, counterpartyB1, types.GetCompatibleEncodedVersions()) // A1 - B1 - expConnections := []types.ConnectionEnd{conn1, conn2} + conn1 := types.NewConnectionEnd(types.OPEN, clientA, counterpartyB0, types.GetCompatibleEncodedVersions()) // A0 - B0 + conn2 := types.NewConnectionEnd(types.OPEN, clientA, counterpartyB1, types.GetCompatibleEncodedVersions()) // A1 - B1 + + iconn1 := types.NewIdentifiedConnection(connA0.ID, conn1) + iconn2 := types.NewIdentifiedConnection(connA1.ID, conn2) + + expConnections := []types.IdentifiedConnection{iconn1, iconn2} connections := suite.chainA.App.IBCKeeper.ConnectionKeeper.GetAllConnections(suite.chainA.GetContext()) suite.Require().Len(connections, len(expConnections)) diff --git a/x/ibc/03-connection/simulation/decoder_test.go b/x/ibc/03-connection/simulation/decoder_test.go index 2abe8d628..dc75f12ab 100644 --- a/x/ibc/03-connection/simulation/decoder_test.go +++ b/x/ibc/03-connection/simulation/decoder_test.go @@ -17,14 +17,15 @@ func TestDecodeStore(t *testing.T) { app := simapp.Setup(false) cdc := app.AppCodec() + connectionID := "connectionidone" + connection := types.ConnectionEnd{ - ID: "connectionidone", ClientID: "clientidone", Versions: []string{"1.0"}, } paths := types.ClientPaths{ - Paths: []string{connection.ID}, + Paths: []string{connectionID}, } kvPairs := tmkv.Pairs{ @@ -33,7 +34,7 @@ func TestDecodeStore(t *testing.T) { Value: cdc.MustMarshalBinaryBare(&paths), }, tmkv.Pair{ - Key: host.KeyConnection(connection.ID), + Key: host.KeyConnection(connectionID), Value: cdc.MustMarshalBinaryBare(&connection), }, tmkv.Pair{ diff --git a/x/ibc/03-connection/types/connection.go b/x/ibc/03-connection/types/connection.go index b8350f8fa..608082937 100644 --- a/x/ibc/03-connection/types/connection.go +++ b/x/ibc/03-connection/types/connection.go @@ -11,9 +11,8 @@ import ( var _ exported.ConnectionI = (*ConnectionEnd)(nil) // NewConnectionEnd creates a new ConnectionEnd instance. -func NewConnectionEnd(state State, connectionID, clientID string, counterparty Counterparty, versions []string) ConnectionEnd { +func NewConnectionEnd(state State, clientID string, counterparty Counterparty, versions []string) ConnectionEnd { return ConnectionEnd{ - ID: connectionID, ClientID: clientID, Versions: versions, State: state, @@ -26,11 +25,6 @@ func (c ConnectionEnd) GetState() int32 { return int32(c.State) } -// GetID implements the Connection interface -func (c ConnectionEnd) GetID() string { - return c.ID -} - // GetClientID implements the Connection interface func (c ConnectionEnd) GetClientID() string { return c.ClientID @@ -50,9 +44,6 @@ func (c ConnectionEnd) GetVersions() []string { // NOTE: the protocol supports that the connection and client IDs match the // counterparty's. func (c ConnectionEnd) ValidateBasic() error { - if err := host.ConnectionIdentifierValidator(c.ID); err != nil { - return sdkerrors.Wrap(err, "invalid connection ID") - } if err := host.ClientIdentifierValidator(c.ClientID); err != nil { return sdkerrors.Wrap(err, "invalid client ID") } @@ -106,3 +97,23 @@ func (c Counterparty) ValidateBasic() error { } return nil } + +// NewIdentifiedConnection creates a new IdentifiedConnection instance +func NewIdentifiedConnection(connectionID string, conn ConnectionEnd) IdentifiedConnection { + return IdentifiedConnection{ + ID: connectionID, + ClientID: conn.ClientID, + Versions: conn.Versions, + State: conn.State, + Counterparty: conn.Counterparty, + } +} + +// ValidateBasic performs a basic validation of the connection identifier and connection fields. +func (ic IdentifiedConnection) ValidateBasic() error { + if err := host.ConnectionIdentifierValidator(ic.ID); err != nil { + return sdkerrors.Wrap(err, "invalid connection ID") + } + connection := NewConnectionEnd(ic.State, ic.ClientID, ic.Counterparty, ic.Versions) + return connection.ValidateBasic() +} diff --git a/x/ibc/03-connection/types/connection.pb.go b/x/ibc/03-connection/types/connection.pb.go index 617953fd5..61399616e 100644 --- a/x/ibc/03-connection/types/connection.pb.go +++ b/x/ibc/03-connection/types/connection.pb.go @@ -418,8 +418,6 @@ func (m *MsgConnectionOpenConfirm) GetSigner() github_com_cosmos_cosmos_sdk_type // separate one. NOTE: there must only be 2 defined ConnectionEnds to establish // a connection between two chains. type ConnectionEnd struct { - // connection identifier. - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" yaml:"id"` // client associated with this connection. ClientID string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty" yaml:"client_id"` // IBC version which can be utilised to determine encodings or protocols for @@ -464,6 +462,55 @@ func (m *ConnectionEnd) XXX_DiscardUnknown() { var xxx_messageInfo_ConnectionEnd proto.InternalMessageInfo +// IdentifiedConnection defines a connection with additional connection +// identifier field. +type IdentifiedConnection struct { + // connection identifier. + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" yaml:"id"` + // client associated with this connection. + ClientID string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty" yaml:"client_id"` + // IBC version which can be utilised to determine encodings or protocols for + // channels or packets utilising this connection + Versions []string `protobuf:"bytes,3,rep,name=versions,proto3" json:"versions,omitempty"` + // current state of the connection end. + State State `protobuf:"varint,4,opt,name=state,proto3,enum=ibc.connection.State" json:"state,omitempty"` + // counterparty chain associated with this connection. + Counterparty Counterparty `protobuf:"bytes,5,opt,name=counterparty,proto3" json:"counterparty"` +} + +func (m *IdentifiedConnection) Reset() { *m = IdentifiedConnection{} } +func (m *IdentifiedConnection) String() string { return proto.CompactTextString(m) } +func (*IdentifiedConnection) ProtoMessage() {} +func (*IdentifiedConnection) Descriptor() ([]byte, []int) { + return fileDescriptor_3bf62bacf5a27ee9, []int{5} +} +func (m *IdentifiedConnection) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *IdentifiedConnection) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_IdentifiedConnection.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *IdentifiedConnection) XXX_Merge(src proto.Message) { + xxx_messageInfo_IdentifiedConnection.Merge(m, src) +} +func (m *IdentifiedConnection) XXX_Size() int { + return m.Size() +} +func (m *IdentifiedConnection) XXX_DiscardUnknown() { + xxx_messageInfo_IdentifiedConnection.DiscardUnknown(m) +} + +var xxx_messageInfo_IdentifiedConnection proto.InternalMessageInfo + // Counterparty defines the counterparty chain associated with a connection end. type Counterparty struct { // identifies the client on the counterparty chain associated with a given @@ -480,7 +527,7 @@ func (m *Counterparty) Reset() { *m = Counterparty{} } func (m *Counterparty) String() string { return proto.CompactTextString(m) } func (*Counterparty) ProtoMessage() {} func (*Counterparty) Descriptor() ([]byte, []int) { - return fileDescriptor_3bf62bacf5a27ee9, []int{5} + return fileDescriptor_3bf62bacf5a27ee9, []int{6} } func (m *Counterparty) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -519,7 +566,7 @@ func (m *ClientPaths) Reset() { *m = ClientPaths{} } func (m *ClientPaths) String() string { return proto.CompactTextString(m) } func (*ClientPaths) ProtoMessage() {} func (*ClientPaths) Descriptor() ([]byte, []int) { - return fileDescriptor_3bf62bacf5a27ee9, []int{6} + return fileDescriptor_3bf62bacf5a27ee9, []int{7} } func (m *ClientPaths) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -567,7 +614,7 @@ func (m *ConnectionPaths) Reset() { *m = ConnectionPaths{} } func (m *ConnectionPaths) String() string { return proto.CompactTextString(m) } func (*ConnectionPaths) ProtoMessage() {} func (*ConnectionPaths) Descriptor() ([]byte, []int) { - return fileDescriptor_3bf62bacf5a27ee9, []int{7} + return fileDescriptor_3bf62bacf5a27ee9, []int{8} } func (m *ConnectionPaths) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -623,7 +670,7 @@ func (m *Version) Reset() { *m = Version{} } func (m *Version) String() string { return proto.CompactTextString(m) } func (*Version) ProtoMessage() {} func (*Version) Descriptor() ([]byte, []int) { - return fileDescriptor_3bf62bacf5a27ee9, []int{8} + return fileDescriptor_3bf62bacf5a27ee9, []int{9} } func (m *Version) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -659,6 +706,7 @@ func init() { proto.RegisterType((*MsgConnectionOpenAck)(nil), "ibc.connection.MsgConnectionOpenAck") proto.RegisterType((*MsgConnectionOpenConfirm)(nil), "ibc.connection.MsgConnectionOpenConfirm") proto.RegisterType((*ConnectionEnd)(nil), "ibc.connection.ConnectionEnd") + proto.RegisterType((*IdentifiedConnection)(nil), "ibc.connection.IdentifiedConnection") proto.RegisterType((*Counterparty)(nil), "ibc.connection.Counterparty") proto.RegisterType((*ClientPaths)(nil), "ibc.connection.ClientPaths") proto.RegisterType((*ConnectionPaths)(nil), "ibc.connection.ConnectionPaths") @@ -668,65 +716,65 @@ func init() { func init() { proto.RegisterFile("ibc/connection/connection.proto", fileDescriptor_3bf62bacf5a27ee9) } var fileDescriptor_3bf62bacf5a27ee9 = []byte{ - // 914 bytes of a gzipped FileDescriptorProto + // 926 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x56, 0xcd, 0x6e, 0xdb, 0x46, - 0x10, 0x16, 0x29, 0xea, 0x6f, 0x2c, 0xdb, 0x0a, 0x23, 0x37, 0x04, 0x1b, 0x90, 0x2c, 0x73, 0x11, + 0x10, 0x16, 0x29, 0xea, 0x6f, 0x2c, 0xdb, 0x0a, 0x23, 0x37, 0x84, 0x1a, 0x90, 0x2c, 0x73, 0x11, 0x5a, 0x58, 0x6a, 0x92, 0x22, 0x07, 0x03, 0x3d, 0x48, 0xb2, 0x8c, 0x12, 0xad, 0x1d, 0x81, 0x96, 0x0b, 0x34, 0x17, 0x41, 0x26, 0x57, 0xf2, 0x42, 0x16, 0x29, 0x90, 0xeb, 0x22, 0x7e, 0x83, 0xc0, - 0xa7, 0x5e, 0x7b, 0x30, 0x50, 0x20, 0x2f, 0xd1, 0x27, 0x28, 0x72, 0xcc, 0xb1, 0x27, 0xa2, 0x90, - 0xdf, 0x40, 0xe8, 0xa9, 0xa7, 0x82, 0xbb, 0x14, 0x49, 0x59, 0x46, 0x8b, 0x54, 0x3e, 0x14, 0x39, - 0x71, 0x7e, 0xbe, 0x9d, 0xdd, 0x99, 0x6f, 0x38, 0xbb, 0xa0, 0xe2, 0x53, 0xab, 0x61, 0xb9, 0x8e, - 0x83, 0x2c, 0x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, 0xa9, 0x77, 0x39, 0xdd, 0x5b, 0xc7, 0x79, 0xfa, 0x98, 0x7e, 0xfe, + 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x2c, 0xb0, 0xb2, 0x80, 0xb6, 0x0b, 0x00, 0x00, } func (m *MsgConnectionOpenInit) Marshal() (dAtA []byte, err error) { @@ -1003,6 +1051,60 @@ func (m *ConnectionEnd) MarshalTo(dAtA []byte) (int, error) { } func (m *ConnectionEnd) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Counterparty.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintConnection(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if m.State != 0 { + i = encodeVarintConnection(dAtA, i, uint64(m.State)) + i-- + dAtA[i] = 0x20 + } + if len(m.Versions) > 0 { + for iNdEx := len(m.Versions) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Versions[iNdEx]) + copy(dAtA[i:], m.Versions[iNdEx]) + i = encodeVarintConnection(dAtA, i, uint64(len(m.Versions[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if len(m.ClientID) > 0 { + i -= len(m.ClientID) + copy(dAtA[i:], m.ClientID) + i = encodeVarintConnection(dAtA, i, uint64(len(m.ClientID))) + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} + +func (m *IdentifiedConnection) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *IdentifiedConnection) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *IdentifiedConnection) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1342,6 +1444,30 @@ func (m *MsgConnectionOpenConfirm) Size() (n int) { } func (m *ConnectionEnd) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ClientID) + if l > 0 { + n += 1 + l + sovConnection(uint64(l)) + } + if len(m.Versions) > 0 { + for _, s := range m.Versions { + l = len(s) + n += 1 + l + sovConnection(uint64(l)) + } + } + if m.State != 0 { + n += 1 + sovConnection(uint64(m.State)) + } + l = m.Counterparty.Size() + n += 1 + l + sovConnection(uint64(l)) + return n +} + +func (m *IdentifiedConnection) Size() (n int) { if m == nil { return 0 } @@ -2411,6 +2537,175 @@ func (m *ConnectionEnd) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: ConnectionEnd: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClientID", 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.ClientID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Versions", 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.Versions = append(m.Versions, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) + } + m.State = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConnection + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.State |= State(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Counterparty", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConnection + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthConnection + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthConnection + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Counterparty.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipConnection(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthConnection + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthConnection + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *IdentifiedConnection) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConnection + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: IdentifiedConnection: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: IdentifiedConnection: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) diff --git a/x/ibc/03-connection/types/connection_test.go b/x/ibc/03-connection/types/connection_test.go index 53251c782..b05eaba7a 100644 --- a/x/ibc/03-connection/types/connection_test.go +++ b/x/ibc/03-connection/types/connection_test.go @@ -25,32 +25,27 @@ func TestConnectionValidateBasic(t *testing.T) { }{ { "valid connection", - types.ConnectionEnd{connectionID, clientID, []string{ibctesting.ConnectionVersion}, types.INIT, types.Counterparty{clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))}}, + types.ConnectionEnd{clientID, []string{ibctesting.ConnectionVersion}, types.INIT, types.Counterparty{clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))}}, true, }, - { - "invalid connection id", - types.ConnectionEnd{"(connectionIDONE)", clientID, []string{ibctesting.ConnectionVersion}, types.INIT, types.Counterparty{clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))}}, - false, - }, { "invalid client id", - types.ConnectionEnd{connectionID, "(clientID1)", []string{ibctesting.ConnectionVersion}, types.INIT, types.Counterparty{clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))}}, + types.ConnectionEnd{"(clientID1)", []string{ibctesting.ConnectionVersion}, types.INIT, types.Counterparty{clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))}}, false, }, { "empty versions", - types.ConnectionEnd{connectionID, clientID, nil, types.INIT, types.Counterparty{clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))}}, + types.ConnectionEnd{clientID, nil, types.INIT, types.Counterparty{clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))}}, false, }, { "invalid version", - types.ConnectionEnd{connectionID, clientID, []string{"1.0.0"}, types.INIT, types.Counterparty{clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))}}, + types.ConnectionEnd{clientID, []string{"1.0.0"}, types.INIT, types.Counterparty{clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))}}, false, }, { "invalid counterparty", - types.ConnectionEnd{connectionID, clientID, []string{ibctesting.ConnectionVersion}, types.INIT, types.Counterparty{clientID2, connectionID2, emptyPrefix}}, + types.ConnectionEnd{clientID, []string{ibctesting.ConnectionVersion}, types.INIT, types.Counterparty{clientID2, connectionID2, emptyPrefix}}, false, }, } @@ -90,3 +85,33 @@ func TestCounterpartyValidateBasic(t *testing.T) { } } } + +func TestIdentifiedConnectionValidateBasic(t *testing.T) { + testCases := []struct { + name string + connection types.IdentifiedConnection + expPass bool + }{ + { + "valid connection", + types.NewIdentifiedConnection(clientID, types.ConnectionEnd{clientID, []string{ibctesting.ConnectionVersion}, types.INIT, types.Counterparty{clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))}}), + true, + }, + { + "invalid connection id", + types.NewIdentifiedConnection("(connectionIDONE)", types.ConnectionEnd{clientID, []string{ibctesting.ConnectionVersion}, types.INIT, types.Counterparty{clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))}}), + false, + }, + } + + for i, tc := range testCases { + tc := tc + + err := tc.connection.ValidateBasic() + if tc.expPass { + require.NoError(t, err, "valid test case %d failed: %s", i, tc.name) + } else { + require.Error(t, err, "invalid test case %d passed: %s", i, tc.name) + } + } +} diff --git a/x/ibc/03-connection/types/genesis.go b/x/ibc/03-connection/types/genesis.go index 31d881a62..7a1a010e7 100644 --- a/x/ibc/03-connection/types/genesis.go +++ b/x/ibc/03-connection/types/genesis.go @@ -16,13 +16,13 @@ func NewConnectionPaths(id string, paths []string) ConnectionPaths { // GenesisState defines the ibc connection submodule's genesis state. type GenesisState struct { - Connections []ConnectionEnd `json:"connections" yaml:"connections"` - ClientConnectionPaths []ConnectionPaths `json:"client_connection_paths" yaml:"client_connection_paths"` + Connections []IdentifiedConnection `json:"connections" yaml:"connections"` + ClientConnectionPaths []ConnectionPaths `json:"client_connection_paths" yaml:"client_connection_paths"` } // NewGenesisState creates a GenesisState instance. func NewGenesisState( - connections []ConnectionEnd, connPaths []ConnectionPaths, + connections []IdentifiedConnection, connPaths []ConnectionPaths, ) GenesisState { return GenesisState{ Connections: connections, @@ -33,7 +33,7 @@ func NewGenesisState( // DefaultGenesisState returns the ibc connection submodule's default genesis state. func DefaultGenesisState() GenesisState { return GenesisState{ - Connections: []ConnectionEnd{}, + Connections: []IdentifiedConnection{}, ClientConnectionPaths: []ConnectionPaths{}, } } diff --git a/x/ibc/03-connection/types/genesis_test.go b/x/ibc/03-connection/types/genesis_test.go index ee1a02c62..6ed5feff7 100644 --- a/x/ibc/03-connection/types/genesis_test.go +++ b/x/ibc/03-connection/types/genesis_test.go @@ -26,8 +26,8 @@ func TestValidateGenesis(t *testing.T) { { name: "valid genesis", genState: types.NewGenesisState( - []types.ConnectionEnd{ - types.NewConnectionEnd(types.INIT, connectionID, clientID, types.Counterparty{clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))}, []string{ibctesting.ConnectionVersion}), + []types.IdentifiedConnection{ + types.NewIdentifiedConnection(connectionID, types.NewConnectionEnd(types.INIT, clientID, types.Counterparty{clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))}, []string{ibctesting.ConnectionVersion})), }, []types.ConnectionPaths{ {clientID, []string{host.ConnectionPath(connectionID)}}, @@ -38,8 +38,8 @@ func TestValidateGenesis(t *testing.T) { { name: "invalid connection", genState: types.NewGenesisState( - []types.ConnectionEnd{ - types.NewConnectionEnd(types.INIT, connectionID, "(CLIENTIDONE)", types.Counterparty{clientID, connectionID, commitmenttypes.NewMerklePrefix([]byte("prefix"))}, []string{ibctesting.ConnectionVersion}), + []types.IdentifiedConnection{ + types.NewIdentifiedConnection(connectionID, types.NewConnectionEnd(types.INIT, "(CLIENTIDONE)", types.Counterparty{clientID, connectionID, commitmenttypes.NewMerklePrefix([]byte("prefix"))}, []string{ibctesting.ConnectionVersion})), }, []types.ConnectionPaths{ {clientID, []string{host.ConnectionPath(connectionID)}}, @@ -50,8 +50,8 @@ func TestValidateGenesis(t *testing.T) { { name: "invalid client id", genState: types.NewGenesisState( - []types.ConnectionEnd{ - types.NewConnectionEnd(types.INIT, connectionID, clientID, types.Counterparty{clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))}, []string{ibctesting.ConnectionVersion}), + []types.IdentifiedConnection{ + types.NewIdentifiedConnection(connectionID, types.NewConnectionEnd(types.INIT, clientID, types.Counterparty{clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))}, []string{ibctesting.ConnectionVersion})), }, []types.ConnectionPaths{ {"(CLIENTIDONE)", []string{host.ConnectionPath(connectionID)}}, @@ -62,8 +62,8 @@ func TestValidateGenesis(t *testing.T) { { name: "invalid path", genState: types.NewGenesisState( - []types.ConnectionEnd{ - types.NewConnectionEnd(types.INIT, connectionID, clientID, types.Counterparty{clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))}, []string{ibctesting.ConnectionVersion}), + []types.IdentifiedConnection{ + types.NewIdentifiedConnection(connectionID, types.NewConnectionEnd(types.INIT, clientID, types.Counterparty{clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))}, []string{ibctesting.ConnectionVersion})), }, []types.ConnectionPaths{ {clientID, []string{connectionID}}, diff --git a/x/ibc/03-connection/types/querier.go b/x/ibc/03-connection/types/querier.go index 9f5218b70..9d9a01cd2 100644 --- a/x/ibc/03-connection/types/querier.go +++ b/x/ibc/03-connection/types/querier.go @@ -9,9 +9,9 @@ import ( // NewQueryConnectionResponse creates a new QueryConnectionResponse instance func NewQueryConnectionResponse( - connection ConnectionEnd, proof []byte, height int64, + connectionID string, connection ConnectionEnd, proof []byte, height int64, ) *QueryConnectionResponse { - path := commitmenttypes.NewMerklePath(strings.Split(host.ConnectionPath(connection.ID), "/")) + path := commitmenttypes.NewMerklePath(strings.Split(host.ConnectionPath(connectionID), "/")) return &QueryConnectionResponse{ Connection: &connection, Proof: proof, diff --git a/x/ibc/03-connection/types/query.pb.go b/x/ibc/03-connection/types/query.pb.go index d49e6baac..14a201fe0 100644 --- a/x/ibc/03-connection/types/query.pb.go +++ b/x/ibc/03-connection/types/query.pb.go @@ -198,7 +198,7 @@ func (m *QueryConnectionsRequest) GetPagination() *query.PageRequest { // QueryConnectionsResponse is the response type for the Query/Connections RPC method. type QueryConnectionsResponse struct { // list of stored connections of the chain. - Connections []*ConnectionEnd `protobuf:"bytes,1,rep,name=connections,proto3" json:"connections,omitempty"` + Connections []*IdentifiedConnection `protobuf:"bytes,1,rep,name=connections,proto3" json:"connections,omitempty"` // pagination response Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` // query block height @@ -238,7 +238,7 @@ func (m *QueryConnectionsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryConnectionsResponse proto.InternalMessageInfo -func (m *QueryConnectionsResponse) GetConnections() []*ConnectionEnd { +func (m *QueryConnectionsResponse) GetConnections() []*IdentifiedConnection { if m != nil { return m.Connections } @@ -392,41 +392,41 @@ func init() { func init() { proto.RegisterFile("ibc/connection/query.proto", fileDescriptor_5ee60d8b08ce3606) } var fileDescriptor_5ee60d8b08ce3606 = []byte{ - // 529 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0xcf, 0x6e, 0xd3, 0x4e, - 0x10, 0xce, 0x26, 0x6d, 0xd5, 0x4c, 0xfc, 0xfb, 0x51, 0x56, 0x55, 0x31, 0x96, 0xe2, 0x04, 0x1f, - 0x20, 0x3d, 0xc4, 0x46, 0xad, 0x40, 0x02, 0x09, 0x21, 0x95, 0x22, 0x11, 0x2e, 0x84, 0x15, 0x27, - 0x2e, 0x91, 0xff, 0x2c, 0xb6, 0x05, 0xf5, 0xba, 0xd9, 0x8d, 0x44, 0xdf, 0x82, 0x77, 0xe0, 0x01, - 0xe0, 0x19, 0x38, 0x71, 0xec, 0x91, 0x53, 0x85, 0x9c, 0x17, 0x41, 0xde, 0x75, 0xba, 0x6e, 0x93, - 0x2a, 0x5c, 0x38, 0x65, 0x3d, 0xf3, 0x7d, 0x33, 0xdf, 0x7e, 0xb3, 0x19, 0xb0, 0xd2, 0x20, 0xf4, - 0x42, 0x96, 0x65, 0x34, 0x14, 0x29, 0xcb, 0xbc, 0xd3, 0x19, 0x9d, 0x9e, 0xb9, 0xf9, 0x94, 0x09, - 0x86, 0xff, 0x4f, 0x83, 0xd0, 0xd5, 0x39, 0x6b, 0x37, 0x66, 0x31, 0x93, 0x29, 0xaf, 0x3c, 0x29, - 0x94, 0xd5, 0x0d, 0x19, 0x3f, 0x61, 0x5c, 0x31, 0xbd, 0xdc, 0x8f, 0xd3, 0xcc, 0x2f, 0xe1, 0x55, - 0xba, 0x77, 0xad, 0x81, 0x3e, 0x2a, 0x80, 0xf3, 0x06, 0xf6, 0xde, 0x96, 0xd4, 0x17, 0x97, 0x09, - 0x42, 0x4f, 0x67, 0x94, 0x0b, 0xfc, 0x08, 0xfe, 0xd3, 0xe8, 0x49, 0x1a, 0x99, 0xa8, 0x8f, 0x06, - 0xed, 0xa3, 0x9d, 0xe2, 0xa2, 0x67, 0x68, 0xf4, 0xe8, 0x98, 0x18, 0x1a, 0x36, 0x8a, 0x9c, 0xef, - 0x08, 0xee, 0x2c, 0x55, 0xe4, 0x39, 0xcb, 0x38, 0xc5, 0xcf, 0x00, 0x34, 0x56, 0xd6, 0xeb, 0x1c, - 0x74, 0xdd, 0xab, 0xf7, 0x74, 0x35, 0xef, 0x65, 0x16, 0x91, 0x1a, 0x01, 0xef, 0xc2, 0x66, 0x3e, - 0x65, 0xec, 0x83, 0xd9, 0xec, 0xa3, 0x81, 0x41, 0xd4, 0x07, 0xee, 0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x83, 0xb5, 0x38, 0x75, 0x57, 0xa7, 0x81, 0x03, 0xe8, 0xd4, 0x4c, 0xc0, 0xeb, 0x98, 0x0b, - 0xcf, 0xad, 0xc1, 0x7a, 0xe0, 0x65, 0x0f, 0x01, 0xb7, 0x97, 0xec, 0xc6, 0xc3, 0xd5, 0x05, 0x6e, - 0x98, 0xb1, 0xe5, 0xfe, 0x2d, 0x7c, 0xd1, 0xf5, 0x68, 0xfc, 0xb3, 0xb0, 0xd1, 0x79, 0x61, 0xa3, - 0xdf, 0x85, 0x8d, 0xbe, 0xcc, 0xed, 0xc6, 0xf9, 0xdc, 0x6e, 0xfc, 0x9a, 0xdb, 0x8d, 0xf7, 0x8f, - 0xe3, 0x54, 0x24, 0xb3, 0xc0, 0x0d, 0xd9, 0x89, 0x57, 0xed, 0x29, 0xf5, 0x33, 0xe4, 0xd1, 0x47, - 0xef, 0xb3, 0x57, 0x2e, 0xa7, 0x87, 0x87, 0xc3, 0xda, 0x7e, 0x12, 0x67, 0x39, 0xe5, 0xc1, 0x96, - 0xdc, 0x4d, 0x87, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xed, 0x4b, 0x0d, 0x29, 0x1f, 0x05, 0x00, - 0x00, + // 542 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0xc1, 0x6e, 0xd3, 0x40, + 0x10, 0xcd, 0x26, 0x6d, 0xd5, 0x4c, 0x02, 0x94, 0x55, 0x55, 0x8c, 0xa5, 0x38, 0xc1, 0x42, 0x90, + 0x1e, 0x62, 0xa3, 0x54, 0x20, 0x81, 0xc4, 0xa5, 0x14, 0x44, 0xb8, 0x10, 0x56, 0x9c, 0xb8, 0x44, + 0x89, 0xbd, 0x75, 0x56, 0x50, 0xaf, 0x9b, 0xdd, 0x48, 0xf4, 0x2f, 0xf8, 0x07, 0x7e, 0x80, 0x13, + 0x1f, 0xc0, 0x89, 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 0xc5, + 0xe9, 0xbb, 0xba, 0x25, 0x3c, 0x82, 0x5a, 0xc1, 0x04, 0xbc, 0x8e, 0x39, 0xf7, 0xdc, 0x6e, 0xaf, + 0x07, 0x5e, 0xf6, 0x90, 0x70, 0x77, 0xc9, 0x6e, 0xdc, 0x59, 0x5d, 0xe0, 0x9a, 0x19, 0xdb, 0xde, + 0xff, 0xc2, 0xe7, 0x5d, 0x0f, 0xfb, 0xbf, 0x53, 0x07, 0x9d, 0xa7, 0x0e, 0xfa, 0x9b, 0x3a, 0xe8, + 0xdb, 0xcc, 0x29, 0x9d, 0xcf, 0x9c, 0xd2, 0x9f, 0x99, 0x53, 0xfa, 0xf4, 0x2c, 0x62, 0x72, 0x3c, + 0x1d, 0x79, 0x01, 0x3f, 0xf1, 0xf3, 0x75, 0xa5, 0x7f, 0x3a, 0x22, 0xfc, 0xec, 0x7f, 0xf5, 0xb3, + 0x1d, 0xf5, 0xe4, 0xa0, 0x53, 0x58, 0x53, 0xf2, 0x2c, 0xa1, 0x62, 0xb4, 0xa5, 0x56, 0xd4, 0xc1, + 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3a, 0x7c, 0xa2, 0x33, 0x26, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1375,7 +1375,7 @@ func (m *QueryConnectionsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Connections = append(m.Connections, &ConnectionEnd{}) + m.Connections = append(m.Connections, &IdentifiedConnection{}) if err := m.Connections[len(m.Connections)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/x/ibc/04-channel/keeper/handshake_test.go b/x/ibc/04-channel/keeper/handshake_test.go index 7bac18edf..c55bf7dd5 100644 --- a/x/ibc/04-channel/keeper/handshake_test.go +++ b/x/ibc/04-channel/keeper/handshake_test.go @@ -51,7 +51,7 @@ func (suite *KeeperTestSuite) TestChanOpenInit() { // set connection as UNINITIALIZED counterparty := connectiontypes.NewCounterparty(clientIDB, connIDA, suite.chainB.GetPrefix()) - connection := connectiontypes.NewConnectionEnd(connectiontypes.UNINITIALIZED, clientIDA, connIDA, counterparty, []string{ibctesting.ConnectionVersion}) + connection := connectiontypes.NewConnectionEnd(connectiontypes.UNINITIALIZED, clientIDA, counterparty, []string{ibctesting.ConnectionVersion}) suite.chainA.App.IBCKeeper.ConnectionKeeper.SetConnection(suite.chainA.GetContext(), connA.ID, connection) portCap = nil diff --git a/x/ibc/04-channel/keeper/packet_test.go b/x/ibc/04-channel/keeper/packet_test.go index aaa30ad46..e9821d7cb 100644 --- a/x/ibc/04-channel/keeper/packet_test.go +++ b/x/ibc/04-channel/keeper/packet_test.go @@ -105,7 +105,7 @@ func (suite *KeeperTestSuite) TestSendPacket() { {"connection is UNINITIALIZED", func() { // set connection as UNINITIALIZED counterparty := connectiontypes.NewCounterparty(clientIDB, connIDA, suite.chainB.GetPrefix()) - connection := connectiontypes.NewConnectionEnd(connectiontypes.UNINITIALIZED, clientIDA, connIDA, counterparty, []string{ibctesting.ConnectionVersion}) + connection := connectiontypes.NewConnectionEnd(connectiontypes.UNINITIALIZED, clientIDA, counterparty, []string{ibctesting.ConnectionVersion}) suite.chainA.App.IBCKeeper.ConnectionKeeper.SetConnection(suite.chainA.GetContext(), connIDA, connection) channelA := ibctesting.TestChannel{PortID: portID, ID: channelIDA} diff --git a/x/ibc/07-tendermint/types/client_state_test.go b/x/ibc/07-tendermint/types/client_state_test.go index bf887af27..e17ef89b7 100644 --- a/x/ibc/07-tendermint/types/client_state_test.go +++ b/x/ibc/07-tendermint/types/client_state_test.go @@ -164,7 +164,7 @@ func (suite *TendermintTestSuite) TestVerifyClientConsensusState() { func (suite *TendermintTestSuite) TestVerifyConnectionState() { counterparty := connectiontypes.NewCounterparty("clientB", testConnectionID, commitmenttypes.NewMerklePrefix([]byte("ibc"))) - conn := connectiontypes.NewConnectionEnd(connectiontypes.OPEN, testConnectionID, "clientA", counterparty, []string{"1.0.0"}) + conn := connectiontypes.NewConnectionEnd(connectiontypes.OPEN, "clientA", counterparty, []string{"1.0.0"}) testCases := []struct { name string diff --git a/x/ibc/09-localhost/types/client_state_test.go b/x/ibc/09-localhost/types/client_state_test.go index c02562496..beb57982d 100644 --- a/x/ibc/09-localhost/types/client_state_test.go +++ b/x/ibc/09-localhost/types/client_state_test.go @@ -87,7 +87,7 @@ func (suite *LocalhostTestSuite) TestVerifyClientConsensusState() { func (suite *LocalhostTestSuite) TestVerifyConnectionState() { counterparty := connectiontypes.NewCounterparty("clientB", testConnectionID, commitmenttypes.NewMerklePrefix([]byte("ibc"))) - conn := connectiontypes.NewConnectionEnd(connectiontypes.OPEN, testConnectionID, "clientA", counterparty, []string{"1.0.0"}) + conn := connectiontypes.NewConnectionEnd(connectiontypes.OPEN, "clientA", counterparty, []string{"1.0.0"}) testCases := []struct { name string diff --git a/x/ibc/24-host/keys.go b/x/ibc/24-host/keys.go index 99299053b..5a7ae915d 100644 --- a/x/ibc/24-host/keys.go +++ b/x/ibc/24-host/keys.go @@ -93,7 +93,7 @@ func ClientConnectionsPath(clientID string) string { // ConnectionPath defines the path under which connection paths are stored func ConnectionPath(connectionID string) string { - return fmt.Sprintf("connections/%s", connectionID) + return fmt.Sprintf("%s/%s", KeyConnectionPrefix, connectionID) } // KeyClientConnections returns the store key for the connectios of a given client diff --git a/x/ibc/24-host/utils.go b/x/ibc/24-host/parse.go similarity index 64% rename from x/ibc/24-host/utils.go rename to x/ibc/24-host/parse.go index b0d06c972..ef1c0707f 100644 --- a/x/ibc/24-host/utils.go +++ b/x/ibc/24-host/parse.go @@ -16,6 +16,17 @@ func RemovePath(paths []string, path string) ([]string, bool) { return paths, false } +// ParseConnectionPath returns the connection ID from a full path. It returns +// an error if the provided path is invalid, +func ParseConnectionPath(path string) (string, error) { + split := strings.Split(path, "/") + if len(split) != 2 { + return "", sdkerrors.Wrapf(ErrInvalidPath, "cannot parse connection path %s", path) + } + + return split[1], nil +} + // ParseChannelPath returns the port and channel ID from a full path. It returns // an error if the provided path is invalid, func ParseChannelPath(path string) (string, string, error) { @@ -31,6 +42,16 @@ func ParseChannelPath(path string) (string, string, error) { return split[2], split[4], nil } +// MustParseConnectionPath returns the connection ID from a full path. Panics +// if the provided path is invalid +func MustParseConnectionPath(path string) string { + connectionID, err := ParseConnectionPath(path) + if err != nil { + panic(err) + } + return connectionID +} + // MustParseChannelPath returns the port and channel ID from a full path. Panics // if the provided path is invalid func MustParseChannelPath(path string) (string, string) { diff --git a/x/ibc/genesis_test.go b/x/ibc/genesis_test.go index 5a3f32142..381488442 100644 --- a/x/ibc/genesis_test.go +++ b/x/ibc/genesis_test.go @@ -47,8 +47,8 @@ func (suite *IBCTestSuite) TestValidateGenesis() { true, ), ConnectionGenesis: connectiontypes.NewGenesisState( - []connectiontypes.ConnectionEnd{ - connectiontypes.NewConnectionEnd(connectiontypes.INIT, connectionID, clientID, connectiontypes.NewCounterparty(clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))), []string{ibctesting.ConnectionVersion}), + []connectiontypes.IdentifiedConnection{ + connectiontypes.NewIdentifiedConnection(connectionID, connectiontypes.NewConnectionEnd(connectiontypes.INIT, clientID, connectiontypes.NewCounterparty(clientID2, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))), []string{ibctesting.ConnectionVersion})), }, []connectiontypes.ConnectionPaths{ connectiontypes.NewConnectionPaths(clientID, []string{host.ConnectionPath(connectionID)}), @@ -102,8 +102,8 @@ func (suite *IBCTestSuite) TestValidateGenesis() { genState: types.GenesisState{ ClientGenesis: clienttypes.DefaultGenesisState(), ConnectionGenesis: connectiontypes.NewGenesisState( - []connectiontypes.ConnectionEnd{ - connectiontypes.NewConnectionEnd(connectiontypes.INIT, connectionID, "(CLIENTIDONE)", connectiontypes.NewCounterparty(clientID, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))), []string{"1.0.0"}), + []connectiontypes.IdentifiedConnection{ + connectiontypes.NewIdentifiedConnection(connectionID, connectiontypes.NewConnectionEnd(connectiontypes.INIT, "(CLIENTIDONE)", connectiontypes.NewCounterparty(clientID, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))), []string{"1.0.0"})), }, []connectiontypes.ConnectionPaths{ connectiontypes.NewConnectionPaths(clientID, []string{host.ConnectionPath(connectionID)}), diff --git a/x/ibc/simulation/decoder_test.go b/x/ibc/simulation/decoder_test.go index 27b801fa3..0dc926d14 100644 --- a/x/ibc/simulation/decoder_test.go +++ b/x/ibc/simulation/decoder_test.go @@ -23,6 +23,7 @@ func TestDecodeStore(t *testing.T) { dec := simulation.NewDecodeStore(app.IBCKeeper.Codecs()) clientID := "clientidone" + connectionID := "connectionidone" channelID := "channelidone" portID := "portidone" @@ -31,7 +32,6 @@ func TestDecodeStore(t *testing.T) { FrozenHeight: 10, } connection := connectiontypes.ConnectionEnd{ - ID: clientID, ClientID: "clientidone", Versions: []string{"1.0"}, } @@ -46,7 +46,7 @@ func TestDecodeStore(t *testing.T) { Value: aminoCdc.MustMarshalBinaryBare(clientState), }, tmkv.Pair{ - Key: host.KeyConnection(connection.ID), + Key: host.KeyConnection(connectionID), Value: cdc.MustMarshalBinaryBare(&connection), }, tmkv.Pair{