diff --git a/modules/apps/transfer/v2/keeper/msg_server_test.go b/modules/apps/transfer/v2/keeper/msg_server_test.go index e12cdf43cb5..b4ab8e61016 100644 --- a/modules/apps/transfer/v2/keeper/msg_server_test.go +++ b/modules/apps/transfer/v2/keeper/msg_server_test.go @@ -265,20 +265,20 @@ func (suite *KeeperTestSuite) TestMsgRecvPacketTransfer() { nil, }, { - "failure: invalid destination channel on received packet", + "failure: invalid destination client on received packet", func() {}, func() { - packet.DestinationChannel = ibctesting.InvalidID + packet.DestinationClient = ibctesting.InvalidID }, - channeltypesv2.ErrChannelNotFound, + clienttypes.ErrCounterpartyNotFound, }, { - "failure: counter party channel does not match source channel", + "failure: counter party client does not match source client", func() {}, func() { - packet.SourceChannel = ibctesting.InvalidID + packet.SourceClient = ibctesting.InvalidID }, - channeltypes.ErrInvalidChannelIdentifier, + clienttypes.ErrInvalidCounterparty, }, { "failure: receive is disabled", @@ -335,7 +335,7 @@ func (suite *KeeperTestSuite) TestMsgRecvPacketTransfer() { if expPass { suite.Require().NoError(err) - actualAckHash := suite.chainB.GetSimApp().IBCKeeper.ChannelKeeperV2.GetPacketAcknowledgement(suite.chainB.GetContext(), packet.DestinationChannel, packet.Sequence) + actualAckHash := suite.chainB.GetSimApp().IBCKeeper.ChannelKeeperV2.GetPacketAcknowledgement(suite.chainB.GetContext(), packet.DestinationClient, packet.Sequence) expectedHash := channeltypesv2.CommitAcknowledgement(expectedAck) suite.Require().Equal(expectedHash, actualAckHash) @@ -343,7 +343,7 @@ func (suite *KeeperTestSuite) TestMsgRecvPacketTransfer() { denom := transfertypes.Denom{ Base: sdk.DefaultBondDenom, Trace: []transfertypes.Hop{ - transfertypes.NewHop(sendPayload.DestinationPort, packet.DestinationChannel), + transfertypes.NewHop(sendPayload.DestinationPort, packet.DestinationClient), }, } @@ -593,7 +593,7 @@ func (suite *KeeperTestSuite) TestV2RetainsFungibility() { denomBtoC := transfertypes.Denom{ Base: sdk.DefaultBondDenom, Trace: []transfertypes.Hop{ - transfertypes.NewHop(transfertypes.ModuleName, pathv2.EndpointB.ChannelID), + transfertypes.NewHop(transfertypes.ModuleName, pathv2.EndpointB.ClientID), transfertypes.NewHop(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID), }, } diff --git a/modules/core/02-client/keeper/keeper.go b/modules/core/02-client/keeper/keeper.go index 4275ae4048b..e618a54913f 100644 --- a/modules/core/02-client/keeper/keeper.go +++ b/modules/core/02-client/keeper/keeper.go @@ -115,6 +115,47 @@ func (k *Keeper) SetClientState(ctx context.Context, clientID string, clientStat store.Set(host.ClientStateKey(), types.MustMarshalClientState(k.cdc, clientState)) } +// GetClientCreator returns the creator of a client +func (k *Keeper) GetClientCreator(ctx context.Context, clientID string) sdk.AccAddress { + store := k.ClientStore(ctx, clientID) + bz := store.Get(types.CreatorKey()) + if len(bz) == 0 { + return nil + } + return sdk.AccAddress(bz) +} + +// SetClientCreator sets the creator of a client +func (k *Keeper) SetClientCreator(ctx context.Context, clientID string, creator sdk.AccAddress) { + store := k.ClientStore(ctx, clientID) + store.Set(types.CreatorKey(), creator.Bytes()) +} + +// DeleteClientCreator deletes the creator of a client +func (k *Keeper) DeleteClientCreator(ctx context.Context, clientID string) { + store := k.ClientStore(ctx, clientID) + store.Delete(types.CreatorKey()) +} + +// SetClientCounterparty sets counterpartyInfo for a given clientID +func (k *Keeper) SetClientCounterparty(ctx context.Context, clientID string, counterparty types.CounterpartyInfo) { + store := k.ClientStore(ctx, clientID) + store.Set(types.CounterpartyKey(), k.cdc.MustMarshal(&counterparty)) +} + +// GetClientCounterparty gets counterpartyInfo for a given clientID +func (k *Keeper) GetClientCounterparty(ctx context.Context, clientID string) (types.CounterpartyInfo, bool) { + store := k.ClientStore(ctx, clientID) + bz := store.Get(types.CounterpartyKey()) + if len(bz) == 0 { + return types.CounterpartyInfo{}, false + } + + var counterparty types.CounterpartyInfo + k.cdc.MustUnmarshal(bz, &counterparty) + return counterparty, true +} + // GetClientConsensusState gets the stored consensus state from a client at a given height. func (k *Keeper) GetClientConsensusState(ctx context.Context, clientID string, height exported.Height) (exported.ConsensusState, bool) { store := k.ClientStore(ctx, clientID) diff --git a/modules/core/02-client/keeper/keeper_test.go b/modules/core/02-client/keeper/keeper_test.go index 2e9dbe09fbc..4d9e025e990 100644 --- a/modules/core/02-client/keeper/keeper_test.go +++ b/modules/core/02-client/keeper/keeper_test.go @@ -127,6 +127,25 @@ func (suite *KeeperTestSuite) TestSetClientState() { suite.Require().Equal(clientState, retrievedState, "Client states are not equal") } +func (suite *KeeperTestSuite) TestSetClientCreator() { + creator := suite.chainA.SenderAccount.GetAddress() + suite.keeper.SetClientCreator(suite.ctx, testClientID, creator) + getCreator := suite.keeper.GetClientCreator(suite.ctx, testClientID) + suite.Require().Equal(creator, getCreator) + suite.keeper.DeleteClientCreator(suite.ctx, testClientID) + getCreator = suite.keeper.GetClientCreator(suite.ctx, testClientID) + suite.Require().Equal(sdk.AccAddress(nil), getCreator) +} + +func (suite *KeeperTestSuite) TestSetClientCounterparty() { + counterparty := types.NewCounterpartyInfo([][]byte{[]byte("ibc"), []byte("channel-7")}, testClientID2) + suite.keeper.SetClientCounterparty(suite.ctx, testClientID, counterparty) + + retrievedCounterparty, found := suite.keeper.GetClientCounterparty(suite.ctx, testClientID) + suite.Require().True(found, "GetCounterparty failed") + suite.Require().Equal(counterparty, retrievedCounterparty, "Counterparties are not equal") +} + func (suite *KeeperTestSuite) TestSetClientConsensusState() { suite.keeper.SetClientConsensusState(suite.ctx, testClientID, testClientHeight, suite.consensusState) diff --git a/modules/core/02-client/types/codec.go b/modules/core/02-client/types/codec.go index b39023a3bba..48a1b782f7c 100644 --- a/modules/core/02-client/types/codec.go +++ b/modules/core/02-client/types/codec.go @@ -47,6 +47,7 @@ func RegisterInterfaces(registry coreregistry.InterfaceRegistrar) { &MsgRecoverClient{}, &MsgIBCSoftwareUpgrade{}, &MsgUpdateParams{}, + &MsgRegisterCounterparty{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/modules/core/02-client/types/counterparty.go b/modules/core/02-client/types/counterparty.go new file mode 100644 index 00000000000..b057a590002 --- /dev/null +++ b/modules/core/02-client/types/counterparty.go @@ -0,0 +1,9 @@ +package types + +// NewCounterpartyInfo creates a new counterparty info instance from merlePrefix and clientID +func NewCounterpartyInfo(merklePrefix [][]byte, clientID string) CounterpartyInfo { + return CounterpartyInfo{ + MerklePrefix: merklePrefix, + ClientId: clientID, + } +} diff --git a/modules/core/02-client/types/counterparty.pb.go b/modules/core/02-client/types/counterparty.pb.go new file mode 100644 index 00000000000..f20ce5e466e --- /dev/null +++ b/modules/core/02-client/types/counterparty.pb.go @@ -0,0 +1,902 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: ibc/core/client/v2/counterparty.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// CounterpartyInfo defines the key that the counterparty will use to message our client +type CounterpartyInfo struct { + // merkle prefix key is the prefix that ics provable keys are stored under + MerklePrefix [][]byte `protobuf:"bytes,1,rep,name=merkle_prefix,json=merklePrefix,proto3" json:"merkle_prefix,omitempty"` + // client identifier is the identifier used to send packet messages to our client + ClientId string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` +} + +func (m *CounterpartyInfo) Reset() { *m = CounterpartyInfo{} } +func (m *CounterpartyInfo) String() string { return proto.CompactTextString(m) } +func (*CounterpartyInfo) ProtoMessage() {} +func (*CounterpartyInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_bc4a81c3d2196cf1, []int{0} +} +func (m *CounterpartyInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CounterpartyInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CounterpartyInfo.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 *CounterpartyInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_CounterpartyInfo.Merge(m, src) +} +func (m *CounterpartyInfo) XXX_Size() int { + return m.Size() +} +func (m *CounterpartyInfo) XXX_DiscardUnknown() { + xxx_messageInfo_CounterpartyInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_CounterpartyInfo proto.InternalMessageInfo + +func (m *CounterpartyInfo) GetMerklePrefix() [][]byte { + if m != nil { + return m.MerklePrefix + } + return nil +} + +func (m *CounterpartyInfo) GetClientId() string { + if m != nil { + return m.ClientId + } + return "" +} + +// MsgRegisterCounterparty defines a message to register a counterparty on a client +type MsgRegisterCounterparty struct { + // client identifier + ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` + // counterparty merkle prefix + CounterpartyMerklePrefix [][]byte `protobuf:"bytes,2,rep,name=counterparty_merkle_prefix,json=counterpartyMerklePrefix,proto3" json:"counterparty_merkle_prefix,omitempty"` + // counterparty client identifier + CounterpartyClientId string `protobuf:"bytes,3,opt,name=counterparty_client_id,json=counterpartyClientId,proto3" json:"counterparty_client_id,omitempty"` + // signer address + Signer string `protobuf:"bytes,4,opt,name=signer,proto3" json:"signer,omitempty"` +} + +func (m *MsgRegisterCounterparty) Reset() { *m = MsgRegisterCounterparty{} } +func (m *MsgRegisterCounterparty) String() string { return proto.CompactTextString(m) } +func (*MsgRegisterCounterparty) ProtoMessage() {} +func (*MsgRegisterCounterparty) Descriptor() ([]byte, []int) { + return fileDescriptor_bc4a81c3d2196cf1, []int{1} +} +func (m *MsgRegisterCounterparty) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRegisterCounterparty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRegisterCounterparty.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 *MsgRegisterCounterparty) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRegisterCounterparty.Merge(m, src) +} +func (m *MsgRegisterCounterparty) XXX_Size() int { + return m.Size() +} +func (m *MsgRegisterCounterparty) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRegisterCounterparty.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRegisterCounterparty proto.InternalMessageInfo + +// MsgRegisterCounterpartyResponse defines the Msg/RegisterCounterparty response type. +type MsgRegisterCounterpartyResponse struct { +} + +func (m *MsgRegisterCounterpartyResponse) Reset() { *m = MsgRegisterCounterpartyResponse{} } +func (m *MsgRegisterCounterpartyResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRegisterCounterpartyResponse) ProtoMessage() {} +func (*MsgRegisterCounterpartyResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_bc4a81c3d2196cf1, []int{2} +} +func (m *MsgRegisterCounterpartyResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRegisterCounterpartyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRegisterCounterpartyResponse.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 *MsgRegisterCounterpartyResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRegisterCounterpartyResponse.Merge(m, src) +} +func (m *MsgRegisterCounterpartyResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRegisterCounterpartyResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRegisterCounterpartyResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRegisterCounterpartyResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*CounterpartyInfo)(nil), "ibc.core.client.v2.CounterpartyInfo") + proto.RegisterType((*MsgRegisterCounterparty)(nil), "ibc.core.client.v2.MsgRegisterCounterparty") + proto.RegisterType((*MsgRegisterCounterpartyResponse)(nil), "ibc.core.client.v2.MsgRegisterCounterpartyResponse") +} + +func init() { + proto.RegisterFile("ibc/core/client/v2/counterparty.proto", fileDescriptor_bc4a81c3d2196cf1) +} + +var fileDescriptor_bc4a81c3d2196cf1 = []byte{ + // 388 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xcd, 0x4c, 0x4a, 0xd6, + 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x4f, 0xce, 0xc9, 0x4c, 0xcd, 0x2b, 0xd1, 0x2f, 0x33, 0xd2, 0x4f, + 0xce, 0x2f, 0xcd, 0x2b, 0x49, 0x2d, 0x2a, 0x48, 0x2c, 0x2a, 0xa9, 0xd4, 0x2b, 0x28, 0xca, 0x2f, + 0xc9, 0x17, 0x12, 0xca, 0x4c, 0x4a, 0xd6, 0x03, 0x29, 0xd3, 0x83, 0x28, 0xd3, 0x2b, 0x33, 0x92, + 0x12, 0x4f, 0xce, 0x2f, 0xce, 0xcd, 0x2f, 0xd6, 0xcf, 0x2d, 0x4e, 0xd7, 0x2f, 0x33, 0x04, 0x51, + 0x10, 0xc5, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0xa6, 0x3e, 0x88, 0x05, 0x11, 0x55, 0x0a, + 0xe1, 0x12, 0x70, 0x46, 0x32, 0xd8, 0x33, 0x2f, 0x2d, 0x5f, 0x48, 0x99, 0x8b, 0x37, 0x37, 0xb5, + 0x28, 0x3b, 0x27, 0x35, 0xbe, 0xa0, 0x28, 0x35, 0x2d, 0xb3, 0x42, 0x82, 0x51, 0x81, 0x59, 0x83, + 0x27, 0x88, 0x07, 0x22, 0x18, 0x00, 0x16, 0x13, 0x92, 0xe6, 0xe2, 0x84, 0x58, 0x1a, 0x9f, 0x99, + 0x22, 0xc1, 0xa4, 0xc0, 0xa8, 0xc1, 0x19, 0xc4, 0x01, 0x11, 0xf0, 0x4c, 0x51, 0xba, 0xcc, 0xc8, + 0x25, 0xee, 0x5b, 0x9c, 0x1e, 0x94, 0x9a, 0x9e, 0x59, 0x5c, 0x92, 0x5a, 0x84, 0x6c, 0x03, 0xaa, + 0x46, 0x46, 0x54, 0x8d, 0x42, 0x36, 0x5c, 0x52, 0xc8, 0xfe, 0x8c, 0x47, 0x75, 0x07, 0x13, 0xd8, + 0x1d, 0x12, 0xc8, 0x2a, 0x7c, 0x91, 0xdd, 0x64, 0xc2, 0x25, 0x86, 0xa2, 0x1b, 0x61, 0x0f, 0x33, + 0xd8, 0x1e, 0x11, 0x64, 0x59, 0x67, 0x98, 0x9d, 0x62, 0x5c, 0x6c, 0xc5, 0x99, 0xe9, 0x79, 0xa9, + 0x45, 0x12, 0x2c, 0x60, 0x55, 0x50, 0x9e, 0x15, 0x7f, 0xc7, 0x02, 0x79, 0x86, 0xa6, 0xe7, 0x1b, + 0xb4, 0xa0, 0x02, 0x4a, 0x8a, 0x5c, 0xf2, 0x38, 0x3c, 0x15, 0x94, 0x5a, 0x5c, 0x90, 0x9f, 0x57, + 0x9c, 0x6a, 0x34, 0x89, 0x91, 0x8b, 0x1f, 0x59, 0xc2, 0xb7, 0x38, 0x5d, 0xa8, 0x82, 0x4b, 0x04, + 0x6b, 0x40, 0x68, 0xeb, 0x61, 0x46, 0x9f, 0x1e, 0x0e, 0x0b, 0xa4, 0x8c, 0x49, 0x50, 0x0c, 0x73, + 0x8d, 0x14, 0x6b, 0xc3, 0xf3, 0x0d, 0x5a, 0x8c, 0x4e, 0x41, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, + 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, + 0x78, 0x2c, 0xc7, 0x10, 0x65, 0x91, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, + 0x0f, 0x4d, 0x37, 0x99, 0x49, 0xc9, 0xba, 0xe9, 0xf9, 0xfa, 0x65, 0x96, 0xfa, 0xb9, 0xf9, 0x29, + 0xa5, 0x39, 0xa9, 0xc5, 0x90, 0x74, 0x68, 0x60, 0xa4, 0x0b, 0x4d, 0x8a, 0x25, 0x95, 0x05, 0xa9, + 0xc5, 0x49, 0x6c, 0xe0, 0xe4, 0x63, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xda, 0x00, 0x13, 0xe2, + 0xaa, 0x02, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// CounterpartyMsgClient is the client API for CounterpartyMsg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type CounterpartyMsgClient interface { + // RegisterCounterparty defines a rpc handler method for MsgRegisterCounterparty. + RegisterCounterparty(ctx context.Context, in *MsgRegisterCounterparty, opts ...grpc.CallOption) (*MsgRegisterCounterpartyResponse, error) +} + +type counterpartyMsgClient struct { + cc grpc1.ClientConn +} + +func NewCounterpartyMsgClient(cc grpc1.ClientConn) CounterpartyMsgClient { + return &counterpartyMsgClient{cc} +} + +func (c *counterpartyMsgClient) RegisterCounterparty(ctx context.Context, in *MsgRegisterCounterparty, opts ...grpc.CallOption) (*MsgRegisterCounterpartyResponse, error) { + out := new(MsgRegisterCounterpartyResponse) + err := c.cc.Invoke(ctx, "/ibc.core.client.v2.CounterpartyMsg/RegisterCounterparty", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// CounterpartyMsgServer is the server API for CounterpartyMsg service. +type CounterpartyMsgServer interface { + // RegisterCounterparty defines a rpc handler method for MsgRegisterCounterparty. + RegisterCounterparty(context.Context, *MsgRegisterCounterparty) (*MsgRegisterCounterpartyResponse, error) +} + +// UnimplementedCounterpartyMsgServer can be embedded to have forward compatible implementations. +type UnimplementedCounterpartyMsgServer struct { +} + +func (*UnimplementedCounterpartyMsgServer) RegisterCounterparty(ctx context.Context, req *MsgRegisterCounterparty) (*MsgRegisterCounterpartyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RegisterCounterparty not implemented") +} + +func RegisterCounterpartyMsgServer(s grpc1.Server, srv CounterpartyMsgServer) { + s.RegisterService(&_CounterpartyMsg_serviceDesc, srv) +} + +func _CounterpartyMsg_RegisterCounterparty_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRegisterCounterparty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CounterpartyMsgServer).RegisterCounterparty(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ibc.core.client.v2.CounterpartyMsg/RegisterCounterparty", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CounterpartyMsgServer).RegisterCounterparty(ctx, req.(*MsgRegisterCounterparty)) + } + return interceptor(ctx, in, info, handler) +} + +var _CounterpartyMsg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "ibc.core.client.v2.CounterpartyMsg", + HandlerType: (*CounterpartyMsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "RegisterCounterparty", + Handler: _CounterpartyMsg_RegisterCounterparty_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "ibc/core/client/v2/counterparty.proto", +} + +func (m *CounterpartyInfo) 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 *CounterpartyInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CounterpartyInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ClientId) > 0 { + i -= len(m.ClientId) + copy(dAtA[i:], m.ClientId) + i = encodeVarintCounterparty(dAtA, i, uint64(len(m.ClientId))) + i-- + dAtA[i] = 0x12 + } + if len(m.MerklePrefix) > 0 { + for iNdEx := len(m.MerklePrefix) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.MerklePrefix[iNdEx]) + copy(dAtA[i:], m.MerklePrefix[iNdEx]) + i = encodeVarintCounterparty(dAtA, i, uint64(len(m.MerklePrefix[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *MsgRegisterCounterparty) 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 *MsgRegisterCounterparty) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRegisterCounterparty) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintCounterparty(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x22 + } + if len(m.CounterpartyClientId) > 0 { + i -= len(m.CounterpartyClientId) + copy(dAtA[i:], m.CounterpartyClientId) + i = encodeVarintCounterparty(dAtA, i, uint64(len(m.CounterpartyClientId))) + i-- + dAtA[i] = 0x1a + } + if len(m.CounterpartyMerklePrefix) > 0 { + for iNdEx := len(m.CounterpartyMerklePrefix) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.CounterpartyMerklePrefix[iNdEx]) + copy(dAtA[i:], m.CounterpartyMerklePrefix[iNdEx]) + i = encodeVarintCounterparty(dAtA, i, uint64(len(m.CounterpartyMerklePrefix[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.ClientId) > 0 { + i -= len(m.ClientId) + copy(dAtA[i:], m.ClientId) + i = encodeVarintCounterparty(dAtA, i, uint64(len(m.ClientId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRegisterCounterpartyResponse) 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 *MsgRegisterCounterpartyResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRegisterCounterpartyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintCounterparty(dAtA []byte, offset int, v uint64) int { + offset -= sovCounterparty(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *CounterpartyInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.MerklePrefix) > 0 { + for _, b := range m.MerklePrefix { + l = len(b) + n += 1 + l + sovCounterparty(uint64(l)) + } + } + l = len(m.ClientId) + if l > 0 { + n += 1 + l + sovCounterparty(uint64(l)) + } + return n +} + +func (m *MsgRegisterCounterparty) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ClientId) + if l > 0 { + n += 1 + l + sovCounterparty(uint64(l)) + } + if len(m.CounterpartyMerklePrefix) > 0 { + for _, b := range m.CounterpartyMerklePrefix { + l = len(b) + n += 1 + l + sovCounterparty(uint64(l)) + } + } + l = len(m.CounterpartyClientId) + if l > 0 { + n += 1 + l + sovCounterparty(uint64(l)) + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovCounterparty(uint64(l)) + } + return n +} + +func (m *MsgRegisterCounterpartyResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovCounterparty(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozCounterparty(x uint64) (n int) { + return sovCounterparty(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *CounterpartyInfo) 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 ErrIntOverflowCounterparty + } + 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: CounterpartyInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CounterpartyInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MerklePrefix", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCounterparty + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthCounterparty + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthCounterparty + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MerklePrefix = append(m.MerklePrefix, make([]byte, postIndex-iNdEx)) + copy(m.MerklePrefix[len(m.MerklePrefix)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + 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 ErrIntOverflowCounterparty + } + 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 ErrInvalidLengthCounterparty + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCounterparty + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClientId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCounterparty(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCounterparty + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRegisterCounterparty) 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 ErrIntOverflowCounterparty + } + 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: MsgRegisterCounterparty: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRegisterCounterparty: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowCounterparty + } + 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 ErrInvalidLengthCounterparty + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCounterparty + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClientId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CounterpartyMerklePrefix", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCounterparty + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthCounterparty + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthCounterparty + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CounterpartyMerklePrefix = append(m.CounterpartyMerklePrefix, make([]byte, postIndex-iNdEx)) + copy(m.CounterpartyMerklePrefix[len(m.CounterpartyMerklePrefix)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CounterpartyClientId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCounterparty + } + 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 ErrInvalidLengthCounterparty + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCounterparty + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CounterpartyClientId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCounterparty + } + 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 ErrInvalidLengthCounterparty + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCounterparty + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCounterparty(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCounterparty + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRegisterCounterpartyResponse) 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 ErrIntOverflowCounterparty + } + 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: MsgRegisterCounterpartyResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRegisterCounterpartyResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipCounterparty(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCounterparty + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipCounterparty(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowCounterparty + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowCounterparty + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowCounterparty + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthCounterparty + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupCounterparty + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthCounterparty + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthCounterparty = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowCounterparty = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupCounterparty = fmt.Errorf("proto: unexpected end of group") +) diff --git a/modules/core/02-client/types/errors.go b/modules/core/02-client/types/errors.go index 62d906bc40c..f663019ab0f 100644 --- a/modules/core/02-client/types/errors.go +++ b/modules/core/02-client/types/errors.go @@ -38,4 +38,6 @@ var ( ErrFailedNonMembershipVerification = errorsmod.Register(SubModuleName, 31, "non-membership verification failed") ErrRouteNotFound = errorsmod.Register(SubModuleName, 32, "light client module route not found") ErrClientTypeNotSupported = errorsmod.Register(SubModuleName, 33, "client type not supported") + ErrInvalidCounterparty = errorsmod.Register(SubModuleName, 34, "invalid counterparty") + ErrCounterpartyNotFound = errorsmod.Register(SubModuleName, 35, "counterparty not found") ) diff --git a/modules/core/02-client/types/keys.go b/modules/core/02-client/types/keys.go index 76ce77f08c7..d0ea7ca9c7f 100644 --- a/modules/core/02-client/types/keys.go +++ b/modules/core/02-client/types/keys.go @@ -29,6 +29,12 @@ const ( // ParamsKey is the store key for the IBC client parameters ParamsKey = "clientParams" + // KeyCreator is the key for the creator in the client-specific store + KeyCreator = "creator" + + // KeyCounterparty is the key for the counterpartyInfo in the client-specific store + KeyCounterparty = "counterparty" + // AllowAllClients is the value that if set in AllowedClients param // would allow any wired up light client modules to be allowed AllowAllClients = "*" @@ -91,3 +97,13 @@ func MustParseClientIdentifier(clientID string) string { return clientType } + +// CreatorKey returns the key under which the client creator is stored in the client store +func CreatorKey() []byte { + return []byte(KeyCreator) +} + +// CounterpartyKey returns the key under which the counterparty is stored in the client store +func CounterpartyKey() []byte { + return []byte(KeyCounterparty) +} diff --git a/modules/core/02-client/types/msgs.go b/modules/core/02-client/types/msgs.go index a520a46ab7c..81fd0c21cac 100644 --- a/modules/core/02-client/types/msgs.go +++ b/modules/core/02-client/types/msgs.go @@ -22,6 +22,8 @@ var ( _ sdk.Msg = (*MsgIBCSoftwareUpgrade)(nil) _ sdk.Msg = (*MsgRecoverClient)(nil) + _ sdk.Msg = (*MsgRegisterCounterparty)(nil) + _ sdk.HasValidateBasic = (*MsgCreateClient)(nil) _ sdk.HasValidateBasic = (*MsgUpdateClient)(nil) _ sdk.HasValidateBasic = (*MsgSubmitMisbehaviour)(nil) @@ -29,6 +31,7 @@ var ( _ sdk.HasValidateBasic = (*MsgUpdateParams)(nil) _ sdk.HasValidateBasic = (*MsgIBCSoftwareUpgrade)(nil) _ sdk.HasValidateBasic = (*MsgRecoverClient)(nil) + _ sdk.HasValidateBasic = (*MsgRegisterCounterparty)(nil) _ gogoprotoany.UnpackInterfacesMessage = (*MsgCreateClient)(nil) _ gogoprotoany.UnpackInterfacesMessage = (*MsgUpdateClient)(nil) @@ -320,3 +323,27 @@ func (msg *MsgUpdateParams) ValidateBasic() error { } return msg.Params.Validate() } + +// NewMsgRegisterCounterparty creates a new instance of MsgRegisterCounterparty. +func NewMsgRegisterCounterparty(clientID string, merklePrefix [][]byte, counterpartyClientID string, signer string) *MsgRegisterCounterparty { + return &MsgRegisterCounterparty{ + ClientId: clientID, + CounterpartyMerklePrefix: merklePrefix, + CounterpartyClientId: counterpartyClientID, + Signer: signer, + } +} + +// ValidateBasic performs basic checks on a MsgRegisterCounterparty. +func (msg *MsgRegisterCounterparty) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Signer); err != nil { + return errorsmod.Wrapf(ibcerrors.ErrInvalidAddress, "string could not be parsed as address: %v", err) + } + if len(msg.CounterpartyMerklePrefix) == 0 { + return errorsmod.Wrap(ErrInvalidCounterparty, "counterparty messaging key cannot be empty") + } + if err := host.ClientIdentifierValidator(msg.ClientId); err != nil { + return err + } + return host.ClientIdentifierValidator(msg.CounterpartyClientId) +} diff --git a/modules/core/02-client/types/msgs_test.go b/modules/core/02-client/types/msgs_test.go index 112b7beb211..ca51a240f37 100644 --- a/modules/core/02-client/types/msgs_test.go +++ b/modules/core/02-client/types/msgs_test.go @@ -981,3 +981,74 @@ func TestMsgUpdateParamsGetSigners(t *testing.T) { } } } + +func TestMsgRegisterCounterpartyValidateBasic(t *testing.T) { + signer := ibctesting.TestAccAddress + testCases := []struct { + name string + msg *types.MsgRegisterCounterparty + expError error + }{ + { + "success", + types.NewMsgRegisterCounterparty( + "testclientid", + [][]byte{[]byte("ibc"), []byte("channel-9")}, + "testclientid3", + signer, + ), + nil, + }, + { + "failure: empty client id", + types.NewMsgRegisterCounterparty( + "", + [][]byte{[]byte("ibc"), []byte("channel-9")}, + "testclientid3", + signer, + ), + host.ErrInvalidID, + }, + { + "failure: empty counterparty client id", + types.NewMsgRegisterCounterparty( + "testclientid", + [][]byte{[]byte("ibc"), []byte("channel-9")}, + "", + signer, + ), + host.ErrInvalidID, + }, + { + "failure: empty counterparty messaging key", + types.NewMsgRegisterCounterparty( + "testclientid", + [][]byte{}, + "testclientid3", + signer, + ), + types.ErrInvalidCounterparty, + }, + { + "failure: empty signer", + types.NewMsgRegisterCounterparty( + "testclientid", + [][]byte{[]byte("ibc"), []byte("channel-9")}, + "testclientid3", + "badsigner", + ), + ibcerrors.ErrInvalidAddress, + }, + } + for _, tc := range testCases { + tc := tc + t.Run(tc.name, func(t *testing.T) { + err := tc.msg.ValidateBasic() + if tc.expError == nil { + require.NoError(t, err) + } else { + require.ErrorIs(t, err, tc.expError) + } + }) + } +} diff --git a/modules/core/04-channel/v2/client/cli/cli.go b/modules/core/04-channel/v2/client/cli/cli.go index 5fdde6a87dc..cf8f883f46d 100644 --- a/modules/core/04-channel/v2/client/cli/cli.go +++ b/modules/core/04-channel/v2/client/cli/cli.go @@ -19,8 +19,6 @@ func GetQueryCmd() *cobra.Command { } queryCmd.AddCommand( - getCmdQueryChannel(), - getCmdQueryChannelClientState(), getCmdQueryNextSequenceSend(), getCmdQueryPacketCommitment(), getCmdQueryPacketCommitments(), @@ -43,10 +41,8 @@ func NewTxCmd() *cobra.Command { RunE: client.ValidateCmd, } - txCmd.AddCommand( - newCreateChannelTxCmd(), - newRegisterCounterpartyTxCmd(), - ) + // TODO: Add v2 packet commands: https://github.com/cosmos/ibc-go/issues/7853 + txCmd.AddCommand() return txCmd } diff --git a/modules/core/04-channel/v2/client/cli/query.go b/modules/core/04-channel/v2/client/cli/query.go index 04f9f91e5c7..0f7949d3504 100644 --- a/modules/core/04-channel/v2/client/cli/query.go +++ b/modules/core/04-channel/v2/client/cli/query.go @@ -18,76 +18,14 @@ const ( flagSequences = "sequences" ) -// getCmdQueryChannel defines the command to query the channel information (creator and channel) for the given channel ID. -func getCmdQueryChannel() *cobra.Command { - cmd := &cobra.Command{ - Use: "channel [channel-id]", - Short: "Query the information of a channel.", - Long: "Query the channel information for the provided channel ID.", - Example: fmt.Sprintf("%s query %s %s channel [channel-id]", version.AppName, exported.ModuleName, types.SubModuleName), - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - channelID := args[0] - - queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.Channel(cmd.Context(), types.NewQueryChannelRequest(channelID)) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -// getCmdQueryChannelClientState defines the command to query the channel client state for the given channel ID. -func getCmdQueryChannelClientState() *cobra.Command { - cmd := &cobra.Command{ - Use: "client-state [channel-id]", - Short: "Query the client state associated with a channel.", - Long: "Query the client state associated with a channel for the provided channel ID.", - Example: fmt.Sprintf("%s query %s %s client-state [channel-id]", version.AppName, exported.ModuleName, types.SubModuleName), - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - channelID := args[0] - queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.ChannelClientState(cmd.Context(), types.NewQueryChannelClientStateRequest(channelID)) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -// getCmdQueryNextSequenceSend defines the command to query a next send sequence for a given channel +// getCmdQueryNextSequenceSend defines the command to query a next send sequence for a given client func getCmdQueryNextSequenceSend() *cobra.Command { cmd := &cobra.Command{ - Use: "next-sequence-send [channel-id]", + Use: "next-sequence-send [client-id]", Short: "Query a next send sequence", - Long: "Query the next sequence send for a given channel", + Long: "Query the next sequence send for a given client", Example: fmt.Sprintf( - "%s query %s %s next-sequence-send [channel-id]", version.AppName, exported.ModuleName, types.SubModuleName, + "%s query %s %s next-sequence-send [client-id]", version.AppName, exported.ModuleName, types.SubModuleName, ), Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { @@ -95,14 +33,14 @@ func getCmdQueryNextSequenceSend() *cobra.Command { if err != nil { return err } - channelID := args[0] + clientID := args[0] prove, err := cmd.Flags().GetBool(flags.FlagProve) if err != nil { return err } if prove { - res, err := queryNextSequenceSendABCI(clientCtx, channelID) + res, err := queryNextSequenceSendABCI(clientCtx, clientID) if err != nil { return err } @@ -111,7 +49,7 @@ func getCmdQueryNextSequenceSend() *cobra.Command { } queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.NextSequenceSend(cmd.Context(), types.NewQueryNextSequenceSendRequest(channelID)) + res, err := queryClient.NextSequenceSend(cmd.Context(), types.NewQueryNextSequenceSendRequest(clientID)) if err != nil { return err } @@ -128,11 +66,11 @@ func getCmdQueryNextSequenceSend() *cobra.Command { func getCmdQueryPacketCommitment() *cobra.Command { cmd := &cobra.Command{ - Use: "packet-commitment [channel-id] [sequence]", + Use: "packet-commitment [client-id] [sequence]", Short: "Query a channel/v2 packet commitment", - Long: "Query a channel/v2 packet commitment by channel-id and sequence", + Long: "Query a channel/v2 packet commitment by client-id and sequence", Example: fmt.Sprintf( - "%s query %s %s packet-commitment [channel-id] [sequence]", version.AppName, exported.ModuleName, types.SubModuleName, + "%s query %s %s packet-commitment [client-id] [sequence]", version.AppName, exported.ModuleName, types.SubModuleName, ), Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { @@ -141,7 +79,7 @@ func getCmdQueryPacketCommitment() *cobra.Command { return err } - channelID := args[0] + clientID := args[0] seq, err := strconv.ParseUint(args[1], 10, 64) if err != nil { return err @@ -153,7 +91,7 @@ func getCmdQueryPacketCommitment() *cobra.Command { } if prove { - res, err := queryPacketCommitmentABCI(clientCtx, channelID, seq) + res, err := queryPacketCommitmentABCI(clientCtx, clientID, seq) if err != nil { return err } @@ -162,7 +100,7 @@ func getCmdQueryPacketCommitment() *cobra.Command { } queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.PacketCommitment(cmd.Context(), types.NewQueryPacketCommitmentRequest(channelID, seq)) + res, err := queryClient.PacketCommitment(cmd.Context(), types.NewQueryPacketCommitmentRequest(clientID, seq)) if err != nil { return err } @@ -179,10 +117,10 @@ func getCmdQueryPacketCommitment() *cobra.Command { func getCmdQueryPacketCommitments() *cobra.Command { cmd := &cobra.Command{ - Use: "packet-commitments [channel-id]", - Short: "Query all packet commitments associated with a channel", - Long: "Query all packet commitments associated with a channel", - Example: fmt.Sprintf("%s query %s %s packet-commitments [channel-id]", version.AppName, exported.ModuleName, types.SubModuleName), + Use: "packet-commitments [client-id]", + Short: "Query all packet commitments associated with a client", + Long: "Query all packet commitments associated with a client", + Example: fmt.Sprintf("%s query %s %s packet-commitments [client-id]", version.AppName, exported.ModuleName, types.SubModuleName), Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) @@ -197,7 +135,7 @@ func getCmdQueryPacketCommitments() *cobra.Command { } req := &types.QueryPacketCommitmentsRequest{ - ChannelId: args[0], + ClientId: args[0], Pagination: pageReq, } @@ -211,18 +149,18 @@ func getCmdQueryPacketCommitments() *cobra.Command { } flags.AddQueryFlagsToCmd(cmd) - flags.AddPaginationFlagsToCmd(cmd, "packet commitments associated with a channel") + flags.AddPaginationFlagsToCmd(cmd, "packet commitments associated with a client") return cmd } func getCmdQueryPacketAcknowledgement() *cobra.Command { cmd := &cobra.Command{ - Use: "packet-acknowledgement [channel-id] [sequence]", + Use: "packet-acknowledgement [client-id] [sequence]", Short: "Query a channel/v2 packet acknowledgement", - Long: "Query a channel/v2 packet acknowledgement by channel-id and sequence", + Long: "Query a channel/v2 packet acknowledgement by client-id and sequence", Example: fmt.Sprintf( - "%s query %s %s packet-acknowledgement [channel-id] [sequence]", version.AppName, exported.ModuleName, types.SubModuleName, + "%s query %s %s packet-acknowledgement [client-id] [sequence]", version.AppName, exported.ModuleName, types.SubModuleName, ), Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { @@ -231,7 +169,7 @@ func getCmdQueryPacketAcknowledgement() *cobra.Command { return err } - channelID := args[0] + clientID := args[0] seq, err := strconv.ParseUint(args[1], 10, 64) if err != nil { return err @@ -243,7 +181,7 @@ func getCmdQueryPacketAcknowledgement() *cobra.Command { } if prove { - res, err := queryPacketAcknowledgementABCI(clientCtx, channelID, seq) + res, err := queryPacketAcknowledgementABCI(clientCtx, clientID, seq) if err != nil { return err } @@ -252,7 +190,7 @@ func getCmdQueryPacketAcknowledgement() *cobra.Command { } queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.PacketAcknowledgement(cmd.Context(), types.NewQueryPacketAcknowledgementRequest(channelID, seq)) + res, err := queryClient.PacketAcknowledgement(cmd.Context(), types.NewQueryPacketAcknowledgementRequest(clientID, seq)) if err != nil { return err } @@ -269,11 +207,11 @@ func getCmdQueryPacketAcknowledgement() *cobra.Command { func getCmdQueryPacketReceipt() *cobra.Command { cmd := &cobra.Command{ - Use: "packet-receipt [channel-id] [sequence]", + Use: "packet-receipt [client-id] [sequence]", Short: "Query a channel/v2 packet receipt", - Long: "Query a channel/v2 packet receipt by channel-id and sequence", + Long: "Query a channel/v2 packet receipt by client-id and sequence", Example: fmt.Sprintf( - "%s query %s %s packet-receipt [channel-id] [sequence]", version.AppName, exported.ModuleName, types.SubModuleName, + "%s query %s %s packet-receipt [client-id] [sequence]", version.AppName, exported.ModuleName, types.SubModuleName, ), Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { @@ -282,7 +220,7 @@ func getCmdQueryPacketReceipt() *cobra.Command { return err } - channelID := args[0] + clientID := args[0] seq, err := strconv.ParseUint(args[1], 10, 64) if err != nil { return err @@ -294,7 +232,7 @@ func getCmdQueryPacketReceipt() *cobra.Command { } if prove { - res, err := queryPacketReceiptABCI(clientCtx, channelID, seq) + res, err := queryPacketReceiptABCI(clientCtx, clientID, seq) if err != nil { return err } @@ -303,7 +241,7 @@ func getCmdQueryPacketReceipt() *cobra.Command { } queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.PacketReceipt(cmd.Context(), types.NewQueryPacketReceiptRequest(channelID, seq)) + res, err := queryClient.PacketReceipt(cmd.Context(), types.NewQueryPacketReceiptRequest(clientID, seq)) if err != nil { return err } @@ -322,11 +260,11 @@ func getCmdQueryPacketReceipt() *cobra.Command { // packets on the receiving chain func getCmdQueryUnreceivedPackets() *cobra.Command { cmd := &cobra.Command{ - Use: "unreceived-packets [channel-id]", + Use: "unreceived-packets [client-id]", Short: "Query a channel/v2 unreceived-packets", - Long: "Query a channel/v2 unreceived-packets by channel-id and sequences", + Long: "Query a channel/v2 unreceived-packets by client-id and sequences", Example: fmt.Sprintf( - "%s query %s %s unreceived-packet [channel-id] --sequences=1,2,3", version.AppName, exported.ModuleName, types.SubModuleName, + "%s query %s %s unreceived-packet [client-id] --sequences=1,2,3", version.AppName, exported.ModuleName, types.SubModuleName, ), Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { @@ -335,7 +273,7 @@ func getCmdQueryUnreceivedPackets() *cobra.Command { return err } - channelID := args[0] + clientID := args[0] seqSlice, err := cmd.Flags().GetInt64Slice(flagSequences) if err != nil { return err @@ -347,7 +285,7 @@ func getCmdQueryUnreceivedPackets() *cobra.Command { } queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.UnreceivedPackets(cmd.Context(), types.NewQueryUnreceivedPacketsRequest(channelID, seqs)) + res, err := queryClient.UnreceivedPackets(cmd.Context(), types.NewQueryUnreceivedPacketsRequest(clientID, seqs)) if err != nil { return err } @@ -365,14 +303,14 @@ func getCmdQueryUnreceivedPackets() *cobra.Command { // getCmdQueryUnreceivedAcks defines the command to query all the unreceived acks on the original sending chain func getCmdQueryUnreceivedAcks() *cobra.Command { cmd := &cobra.Command{ - Use: "unreceived-acks [channel-id]", - Short: "Query all the unreceived acks associated with a channel", + Use: "unreceived-acks [client-id]", + Short: "Query all the unreceived acks associated with a client", Long: `Given a list of acknowledgement sequences from counterparty, determine if an ack on the counterparty chain has been received on the executing chain. The return value represents: - Unreceived packet acknowledgement: packet commitment exists on original sending (executing) chain and ack exists on receiving chain. `, - Example: fmt.Sprintf("%s query %s %s unreceived-acks [channel-id] --sequences=1,2,3", version.AppName, exported.ModuleName, types.SubModuleName), + Example: fmt.Sprintf("%s query %s %s unreceived-acks [client-id] --sequences=1,2,3", version.AppName, exported.ModuleName, types.SubModuleName), Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) @@ -392,7 +330,7 @@ The return value represents: } req := &types.QueryUnreceivedAcksRequest{ - ChannelId: args[0], + ClientId: args[0], PacketAckSequences: seqs, } diff --git a/modules/core/04-channel/v2/client/cli/tx.go b/modules/core/04-channel/v2/client/cli/tx.go deleted file mode 100644 index 6849a1476a9..00000000000 --- a/modules/core/04-channel/v2/client/cli/tx.go +++ /dev/null @@ -1,93 +0,0 @@ -package cli - -import ( - "encoding/hex" - "fmt" - "strings" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/cosmos/cosmos-sdk/version" - - "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types" - commitmenttypesv2 "github.com/cosmos/ibc-go/v9/modules/core/23-commitment/types/v2" - "github.com/cosmos/ibc-go/v9/modules/core/exported" -) - -// newCreateChannelTxCmd defines the command to create an IBC channel/v2. -func newCreateChannelTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "create-channel [client-identifier] [merkle-path-prefix]", - Args: cobra.ExactArgs(2), - Short: "create an IBC channel/v2", - Long: `Creates an IBC channel/v2 using the client identifier representing the counterparty chain and the hex-encoded merkle path prefix under which the counterparty stores packet flow information.`, - Example: fmt.Sprintf("%s tx %s %s create-channel 07-tendermint-0 696263,657572656b61", version.AppName, exported.ModuleName, types.SubModuleName), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - clientID := args[0] - merklePathPrefix, err := parseMerklePathPrefix(args[2]) - if err != nil { - return err - } - - msg := types.NewMsgCreateChannel(clientID, merklePathPrefix, clientCtx.GetFromAddress().String()) - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - return cmd -} - -// newRegisterCounterpartyCmd defines the command to provide the counterparty channel identifier to an IBC channel. -func newRegisterCounterpartyTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "register-counterparty [channel-identifier] [counterparty-channel-identifier]", - Args: cobra.ExactArgs(2), - Short: "Register the counterparty channel identifier for an IBC channel", - Long: `Register the counterparty channel identifier for an IBC channel specified by its channel ID.`, - Example: fmt.Sprintf("%s tx %s %s register-counterparty channel-0 channel-1", version.AppName, exported.ModuleName, types.SubModuleName), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - channelID := args[0] - counterpartyChannelID := args[1] - - msg := types.MsgRegisterCounterparty{ - ChannelId: channelID, - CounterpartyChannelId: counterpartyChannelID, - Signer: clientCtx.GetFromAddress().String(), - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - return cmd -} - -// parseMerklePathPrefix parses a comma-separated list of hex-encoded strings into a MerklePath. -func parseMerklePathPrefix(merklePathPrefixString string) (commitmenttypesv2.MerklePath, error) { - var keyPath [][]byte - hexPrefixes := strings.Split(merklePathPrefixString, ",") - for _, hexPrefix := range hexPrefixes { - prefix, err := hex.DecodeString(hexPrefix) - if err != nil { - return commitmenttypesv2.MerklePath{}, fmt.Errorf("invalid hex merkle path prefix: %w", err) - } - keyPath = append(keyPath, prefix) - } - - return commitmenttypesv2.MerklePath{KeyPath: keyPath}, nil -} diff --git a/modules/core/04-channel/v2/keeper/events.go b/modules/core/04-channel/v2/keeper/events.go index eb1a71b5481..33b3f3bc275 100644 --- a/modules/core/04-channel/v2/keeper/events.go +++ b/modules/core/04-channel/v2/keeper/events.go @@ -24,8 +24,8 @@ func emitSendPacketEvents(ctx context.Context, packet types.Packet) { sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeSendPacket, - sdk.NewAttribute(types.AttributeKeySrcChannel, packet.SourceChannel), - sdk.NewAttribute(types.AttributeKeyDstChannel, packet.DestinationChannel), + sdk.NewAttribute(types.AttributeKeySrcChannel, packet.SourceClient), + sdk.NewAttribute(types.AttributeKeyDstChannel, packet.DestinationClient), sdk.NewAttribute(types.AttributeKeySequence, fmt.Sprintf("%d", packet.Sequence)), sdk.NewAttribute(types.AttributeKeyTimeoutTimestamp, fmt.Sprintf("%d", packet.TimeoutTimestamp)), sdk.NewAttribute(types.AttributeKeyEncodedPacketHex, hex.EncodeToString(encodedPacket)), @@ -49,8 +49,8 @@ func emitRecvPacketEvents(ctx context.Context, packet types.Packet) { sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeRecvPacket, - sdk.NewAttribute(types.AttributeKeySrcChannel, packet.SourceChannel), - sdk.NewAttribute(types.AttributeKeyDstChannel, packet.DestinationChannel), + sdk.NewAttribute(types.AttributeKeySrcChannel, packet.SourceClient), + sdk.NewAttribute(types.AttributeKeyDstChannel, packet.DestinationClient), sdk.NewAttribute(types.AttributeKeySequence, fmt.Sprintf("%d", packet.Sequence)), sdk.NewAttribute(types.AttributeKeyTimeoutTimestamp, fmt.Sprintf("%d", packet.TimeoutTimestamp)), sdk.NewAttribute(types.AttributeKeyEncodedPacketHex, hex.EncodeToString(encodedPacket)), @@ -79,8 +79,8 @@ func emitWriteAcknowledgementEvents(ctx context.Context, packet types.Packet, ac sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeWriteAck, - sdk.NewAttribute(types.AttributeKeySrcChannel, packet.SourceChannel), - sdk.NewAttribute(types.AttributeKeyDstChannel, packet.DestinationChannel), + sdk.NewAttribute(types.AttributeKeySrcChannel, packet.SourceClient), + sdk.NewAttribute(types.AttributeKeyDstChannel, packet.DestinationClient), sdk.NewAttribute(types.AttributeKeySequence, fmt.Sprintf("%d", packet.Sequence)), sdk.NewAttribute(types.AttributeKeyTimeoutTimestamp, fmt.Sprintf("%d", packet.TimeoutTimestamp)), sdk.NewAttribute(types.AttributeKeyEncodedPacketHex, hex.EncodeToString(encodedPacket)), @@ -105,8 +105,8 @@ func emitAcknowledgePacketEvents(ctx context.Context, packet types.Packet) { sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeAcknowledgePacket, - sdk.NewAttribute(types.AttributeKeySrcChannel, packet.SourceChannel), - sdk.NewAttribute(types.AttributeKeyDstChannel, packet.DestinationChannel), + sdk.NewAttribute(types.AttributeKeySrcChannel, packet.SourceClient), + sdk.NewAttribute(types.AttributeKeyDstChannel, packet.DestinationClient), sdk.NewAttribute(types.AttributeKeySequence, fmt.Sprintf("%d", packet.Sequence)), sdk.NewAttribute(types.AttributeKeyTimeoutTimestamp, fmt.Sprintf("%d", packet.TimeoutTimestamp)), sdk.NewAttribute(types.AttributeKeyEncodedPacketHex, hex.EncodeToString(encodedPacket)), @@ -130,8 +130,8 @@ func emitTimeoutPacketEvents(ctx context.Context, packet types.Packet) { sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeTimeoutPacket, - sdk.NewAttribute(types.AttributeKeySrcChannel, packet.SourceChannel), - sdk.NewAttribute(types.AttributeKeyDstChannel, packet.DestinationChannel), + sdk.NewAttribute(types.AttributeKeySrcChannel, packet.SourceClient), + sdk.NewAttribute(types.AttributeKeyDstChannel, packet.DestinationClient), sdk.NewAttribute(types.AttributeKeySequence, fmt.Sprintf("%d", packet.Sequence)), sdk.NewAttribute(types.AttributeKeyTimeoutTimestamp, fmt.Sprintf("%d", packet.TimeoutTimestamp)), sdk.NewAttribute(types.AttributeKeyEncodedPacketHex, hex.EncodeToString(encodedPacket)), @@ -142,38 +142,3 @@ func emitTimeoutPacketEvents(ctx context.Context, packet types.Packet) { ), }) } - -// emitCreateChannelEvent emits a channel create event. -func (*Keeper) emitCreateChannelEvent(ctx context.Context, channelID, clientID string) { - sdkCtx := sdk.UnwrapSDKContext(ctx) - - sdkCtx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypeCreateChannel, - sdk.NewAttribute(types.AttributeKeyChannelID, channelID), - sdk.NewAttribute(types.AttributeKeyClientID, clientID), - ), - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - ), - }) -} - -// emitRegisterCounterpartyEvent emits a register counterparty event. -func (*Keeper) emitRegisterCounterpartyEvent(ctx context.Context, channelID string, channel types.Channel) { - sdkCtx := sdk.UnwrapSDKContext(ctx) - - sdkCtx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypeRegisterCounterparty, - sdk.NewAttribute(types.AttributeKeyChannelID, channelID), - sdk.NewAttribute(types.AttributeKeyClientID, channel.ClientId), - sdk.NewAttribute(types.AttributeKeyCounterpartyChannelID, channel.CounterpartyChannelId), - ), - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - ), - }) -} diff --git a/modules/core/04-channel/v2/keeper/export_test.go b/modules/core/04-channel/v2/keeper/export_test.go index 002bc6d8d41..aae6048ed2a 100644 --- a/modules/core/04-channel/v2/keeper/export_test.go +++ b/modules/core/04-channel/v2/keeper/export_test.go @@ -7,17 +7,10 @@ package keeper import ( "context" - storetypes "cosmossdk.io/store/types" - "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types" "github.com/cosmos/ibc-go/v9/modules/core/exported" ) -// ChannelStore is a wrapper around channelStore to allow its usage during testing. -func (k Keeper) ChannelStore(ctx context.Context) storetypes.KVStore { - return k.channelStore(ctx) -} - func (k *Keeper) SendPacketTest( ctx context.Context, sourceChannel string, @@ -75,8 +68,3 @@ func (k *Keeper) TimeoutPacketTest( proofHeight, ) } - -// AliasV1Channel is a wrapper around aliasV1Channel to allow its usage in tests. -func (k *Keeper) AliasV1Channel(ctx context.Context, portID, channelID string) (types.Channel, bool) { - return k.aliasV1Channel(ctx, portID, channelID) -} diff --git a/modules/core/04-channel/v2/keeper/grpc_query.go b/modules/core/04-channel/v2/keeper/grpc_query.go index 709781e4a4d..0eea059e9ca 100644 --- a/modules/core/04-channel/v2/keeper/grpc_query.go +++ b/modules/core/04-channel/v2/keeper/grpc_query.go @@ -34,97 +34,21 @@ func NewQueryServer(k *Keeper) types.QueryServer { } } -// Channel implements the Query/Channel gRPC method -func (q *queryServer) Channel(ctx context.Context, req *types.QueryChannelRequest) (*types.QueryChannelResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "empty request") - } - - if err := host.ChannelIdentifierValidator(req.ChannelId); err != nil { - return nil, status.Error(codes.InvalidArgument, err.Error()) - } - - channel, found := q.GetChannel(ctx, req.ChannelId) - if !found { - return nil, status.Error(codes.NotFound, errorsmod.Wrapf(types.ErrChannelNotFound, "channel-id: %s", req.ChannelId).Error()) - } - - return types.NewQueryChannelResponse(channel), nil -} - -// ChannelClientState implements the Query/ChannelClientState gRPC method -func (q *queryServer) ChannelClientState(ctx context.Context, req *types.QueryChannelClientStateRequest) (*types.QueryChannelClientStateResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "empty request") - } - - if err := host.ChannelIdentifierValidator(req.ChannelId); err != nil { - return nil, status.Error(codes.InvalidArgument, err.Error()) - } - - channel, found := q.GetChannel(ctx, req.ChannelId) - if !found { - return nil, status.Error(codes.NotFound, errorsmod.Wrapf(types.ErrChannelNotFound, "channel-id: %s", req.ChannelId).Error()) - } - - clientState, found := q.ClientKeeper.GetClientState(ctx, channel.ClientId) - if !found { - return nil, status.Error(codes.NotFound, errorsmod.Wrapf(clienttypes.ErrClientNotFound, "client-id: %s", channel.ClientId).Error()) - } - - identifiedClientState := clienttypes.NewIdentifiedClientState(channel.ClientId, clientState) - res := types.NewQueryChannelClientStateResponse(identifiedClientState, nil, clienttypes.GetSelfHeight(ctx)) - - return res, nil -} - -// ChannelConsensusState implements the Query/ChannelConsensusState gRPC method -func (q *queryServer) ChannelConsensusState(ctx context.Context, req *types.QueryChannelConsensusStateRequest) (*types.QueryChannelConsensusStateResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "empty request") - } - - if err := host.ChannelIdentifierValidator(req.ChannelId); err != nil { - return nil, status.Error(codes.InvalidArgument, err.Error()) - } - - channel, found := q.GetChannel(ctx, req.ChannelId) - if !found { - return nil, status.Error(codes.NotFound, errorsmod.Wrapf(types.ErrChannelNotFound, "channel-id: %s", req.ChannelId).Error()) - } - - consHeight := clienttypes.NewHeight(req.RevisionNumber, req.RevisionHeight) - consensusState, found := q.ClientKeeper.GetClientConsensusState(ctx, channel.ClientId, consHeight) - if !found { - return nil, status.Error( - codes.NotFound, - errorsmod.Wrapf(clienttypes.ErrConsensusStateNotFound, "client-id: %s", channel.ClientId).Error(), - ) - } - - anyConsensusState, err := clienttypes.PackConsensusState(consensusState) - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - - return types.NewQueryChannelConsensusStateResponse(channel.ClientId, anyConsensusState, nil, clienttypes.GetSelfHeight(ctx)), nil -} - // NextSequenceSend implements the Query/NextSequenceSend gRPC method func (q *queryServer) NextSequenceSend(ctx context.Context, req *types.QueryNextSequenceSendRequest) (*types.QueryNextSequenceSendResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } - if err := host.ChannelIdentifierValidator(req.ChannelId); err != nil { + if err := host.ClientIdentifierValidator(req.ClientId); err != nil { return nil, status.Error(codes.InvalidArgument, err.Error()) } - sequence, found := q.GetNextSequenceSend(ctx, req.ChannelId) + sequence, found := q.GetNextSequenceSend(ctx, req.ClientId) if !found { return nil, status.Error( codes.NotFound, - errorsmod.Wrapf(types.ErrSequenceSendNotFound, "channel-id %s", req.ChannelId).Error(), + errorsmod.Wrapf(types.ErrSequenceSendNotFound, "client-id %s", req.ClientId).Error(), ) } return types.NewQueryNextSequenceSendResponse(sequence, nil, clienttypes.GetSelfHeight(ctx)), nil @@ -136,7 +60,7 @@ func (q *queryServer) PacketCommitment(ctx context.Context, req *types.QueryPack return nil, status.Error(codes.InvalidArgument, "empty request") } - if err := host.ChannelIdentifierValidator(req.ChannelId); err != nil { + if err := host.ClientIdentifierValidator(req.ClientId); err != nil { return nil, status.Error(codes.InvalidArgument, err.Error()) } @@ -144,11 +68,7 @@ func (q *queryServer) PacketCommitment(ctx context.Context, req *types.QueryPack return nil, status.Error(codes.InvalidArgument, "packet sequence cannot be 0") } - if !q.HasChannel(ctx, req.ChannelId) { - return nil, status.Error(codes.NotFound, errorsmod.Wrap(types.ErrChannelNotFound, req.ChannelId).Error()) - } - - commitment := q.GetPacketCommitment(ctx, req.ChannelId, req.Sequence) + commitment := q.GetPacketCommitment(ctx, req.ClientId, req.Sequence) if len(commitment) == 0 { return nil, status.Error(codes.NotFound, "packet commitment hash not found") } @@ -162,16 +82,12 @@ func (q *queryServer) PacketCommitments(ctx context.Context, req *types.QueryPac return nil, status.Error(codes.InvalidArgument, "empty request") } - if err := host.ChannelIdentifierValidator(req.ChannelId); err != nil { + if err := host.ClientIdentifierValidator(req.ClientId); err != nil { return nil, status.Error(codes.InvalidArgument, err.Error()) } - if !q.HasChannel(ctx, req.ChannelId) { - return nil, status.Error(codes.NotFound, errorsmod.Wrap(types.ErrChannelNotFound, req.ChannelId).Error()) - } - var commitments []*types.PacketState - store := prefix.NewStore(runtime.KVStoreAdapter(q.KVStoreService.OpenKVStore(ctx)), hostv2.PacketCommitmentPrefixKey(req.ChannelId)) + store := prefix.NewStore(runtime.KVStoreAdapter(q.KVStoreService.OpenKVStore(ctx)), hostv2.PacketCommitmentPrefixKey(req.ClientId)) pageRes, err := query.Paginate(store, req.Pagination, func(key, value []byte) error { keySplit := strings.Split(string(key), "/") @@ -181,7 +97,7 @@ func (q *queryServer) PacketCommitments(ctx context.Context, req *types.QueryPac return types.ErrInvalidPacket } - commitment := types.NewPacketState(req.ChannelId, sequence, value) + commitment := types.NewPacketState(req.ClientId, sequence, value) commitments = append(commitments, &commitment) return nil }) @@ -203,7 +119,7 @@ func (q *queryServer) PacketAcknowledgement(ctx context.Context, req *types.Quer return nil, status.Error(codes.InvalidArgument, "empty request") } - if err := host.ChannelIdentifierValidator(req.ChannelId); err != nil { + if err := host.ClientIdentifierValidator(req.ClientId); err != nil { return nil, status.Error(codes.InvalidArgument, err.Error()) } @@ -211,11 +127,7 @@ func (q *queryServer) PacketAcknowledgement(ctx context.Context, req *types.Quer return nil, status.Error(codes.InvalidArgument, "packet sequence cannot be 0") } - if !q.HasChannel(ctx, req.ChannelId) { - return nil, status.Error(codes.NotFound, errorsmod.Wrap(types.ErrChannelNotFound, req.ChannelId).Error()) - } - - acknowledgement := q.GetPacketAcknowledgement(ctx, req.ChannelId, req.Sequence) + acknowledgement := q.GetPacketAcknowledgement(ctx, req.ClientId, req.Sequence) if len(acknowledgement) == 0 { return nil, status.Error(codes.NotFound, "packet acknowledgement hash not found") } @@ -229,26 +141,22 @@ func (q *queryServer) PacketAcknowledgements(ctx context.Context, req *types.Que return nil, status.Error(codes.InvalidArgument, "empty request") } - if err := host.ChannelIdentifierValidator(req.ChannelId); err != nil { + if err := host.ClientIdentifierValidator(req.ClientId); err != nil { return nil, status.Error(codes.InvalidArgument, err.Error()) } - if !q.HasChannel(ctx, req.ChannelId) { - return nil, status.Error(codes.NotFound, errorsmod.Wrap(types.ErrChannelNotFound, req.ChannelId).Error()) - } - var acks []*types.PacketState - store := prefix.NewStore(runtime.KVStoreAdapter(q.KVStoreService.OpenKVStore(ctx)), hostv2.PacketAcknowledgementPrefixKey(req.ChannelId)) + store := prefix.NewStore(runtime.KVStoreAdapter(q.KVStoreService.OpenKVStore(ctx)), hostv2.PacketAcknowledgementPrefixKey(req.ClientId)) // if a list of packet sequences is provided then query for each specific ack and return a list <= len(req.PacketCommitmentSequences) // otherwise, maintain previous behaviour and perform paginated query for _, seq := range req.PacketCommitmentSequences { - acknowledgement := q.GetPacketAcknowledgement(ctx, req.ChannelId, seq) + acknowledgement := q.GetPacketAcknowledgement(ctx, req.ClientId, seq) if len(acknowledgement) == 0 { continue } - ack := types.NewPacketState(req.ChannelId, seq, acknowledgement) + ack := types.NewPacketState(req.ClientId, seq, acknowledgement) acks = append(acks, &ack) } @@ -269,7 +177,7 @@ func (q *queryServer) PacketAcknowledgements(ctx context.Context, req *types.Que return types.ErrInvalidPacket } - ack := types.NewPacketState(req.ChannelId, sequence, value) + ack := types.NewPacketState(req.ClientId, sequence, value) acks = append(acks, &ack) return nil @@ -291,7 +199,7 @@ func (q *queryServer) PacketReceipt(ctx context.Context, req *types.QueryPacketR return nil, status.Error(codes.InvalidArgument, "empty request") } - if err := host.ChannelIdentifierValidator(req.ChannelId); err != nil { + if err := host.ClientIdentifierValidator(req.ClientId); err != nil { return nil, status.Error(codes.InvalidArgument, err.Error()) } @@ -299,11 +207,7 @@ func (q *queryServer) PacketReceipt(ctx context.Context, req *types.QueryPacketR return nil, status.Error(codes.InvalidArgument, "packet sequence cannot be 0") } - if !q.HasChannel(ctx, req.ChannelId) { - return nil, status.Error(codes.NotFound, errorsmod.Wrap(types.ErrChannelNotFound, req.ChannelId).Error()) - } - - hasReceipt := q.HasPacketReceipt(ctx, req.ChannelId, req.Sequence) + hasReceipt := q.HasPacketReceipt(ctx, req.ClientId, req.Sequence) return types.NewQueryPacketReceiptResponse(hasReceipt, nil, clienttypes.GetSelfHeight(ctx)), nil } @@ -329,14 +233,10 @@ func (q *queryServer) UnreceivedPackets(ctx context.Context, req *types.QueryUnr return nil, status.Error(codes.InvalidArgument, "empty request") } - if err := host.ChannelIdentifierValidator(req.ChannelId); err != nil { + if err := host.ClientIdentifierValidator(req.ClientId); err != nil { return nil, status.Error(codes.InvalidArgument, err.Error()) } - if !q.HasChannel(ctx, req.ChannelId) { - return nil, status.Error(codes.NotFound, errorsmod.Wrap(types.ErrChannelNotFound, req.ChannelId).Error()) - } - var unreceivedSequences []uint64 for i, seq := range req.Sequences { // filter for invalid sequences to ensure they are not included in the response value. @@ -345,7 +245,7 @@ func (q *queryServer) UnreceivedPackets(ctx context.Context, req *types.QueryUnr } // if the packet receipt does not exist, then it is unreceived - if !q.HasPacketReceipt(ctx, req.ChannelId, seq) { + if !q.HasPacketReceipt(ctx, req.ClientId, seq) { unreceivedSequences = append(unreceivedSequences, seq) } } @@ -379,14 +279,10 @@ func (q *queryServer) UnreceivedAcks(ctx context.Context, req *types.QueryUnrece return nil, status.Error(codes.InvalidArgument, "empty request") } - if err := host.ChannelIdentifierValidator(req.ChannelId); err != nil { + if err := host.ClientIdentifierValidator(req.ClientId); err != nil { return nil, status.Error(codes.InvalidArgument, err.Error()) } - if !q.HasChannel(ctx, req.ChannelId) { - return nil, status.Error(codes.NotFound, errorsmod.Wrap(types.ErrChannelNotFound, req.ChannelId).Error()) - } - var unreceivedSequences []uint64 for _, seq := range req.PacketAckSequences { @@ -396,7 +292,7 @@ func (q *queryServer) UnreceivedAcks(ctx context.Context, req *types.QueryUnrece // if packet commitment still exists on the original sending chain, then packet ack has not been received // since processing the ack will delete the packet commitment - if commitment := q.GetPacketCommitment(ctx, req.ChannelId, seq); len(commitment) != 0 { + if commitment := q.GetPacketCommitment(ctx, req.ClientId, seq); len(commitment) != 0 { unreceivedSequences = append(unreceivedSequences, seq) } diff --git a/modules/core/04-channel/v2/keeper/grpc_query_test.go b/modules/core/04-channel/v2/keeper/grpc_query_test.go index 4af5b3414b5..8d8a07d73ac 100644 --- a/modules/core/04-channel/v2/keeper/grpc_query_test.go +++ b/modules/core/04-channel/v2/keeper/grpc_query_test.go @@ -8,296 +8,11 @@ import ( "github.com/cosmos/cosmos-sdk/types/query" - clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/keeper" "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types" - commitmenttypes "github.com/cosmos/ibc-go/v9/modules/core/23-commitment/types" - "github.com/cosmos/ibc-go/v9/modules/core/exported" ibctesting "github.com/cosmos/ibc-go/v9/testing" ) -func (suite *KeeperTestSuite) TestQueryChannel() { - var ( - req *types.QueryChannelRequest - expChannel types.Channel - ) - - testCases := []struct { - msg string - malleate func() - expError error - }{ - { - "success", - func() { - ctx := suite.chainA.GetContext() - suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetChannel(ctx, ibctesting.FirstChannelID, expChannel) - - req = &types.QueryChannelRequest{ - ChannelId: ibctesting.FirstChannelID, - } - }, - nil, - }, - { - "req is nil", - func() { - req = nil - }, - status.Error(codes.InvalidArgument, "empty request"), - }, - { - "invalid channelID", - func() { - req = &types.QueryChannelRequest{} - }, - status.Error(codes.InvalidArgument, "identifier cannot be blank: invalid identifier"), - }, - { - "channel not found", - func() { - req = &types.QueryChannelRequest{ - ChannelId: ibctesting.FirstChannelID, - } - }, - status.Error(codes.NotFound, fmt.Sprintf("channel-id: %s: channel not found", ibctesting.FirstChannelID)), - }, - } - - for _, tc := range testCases { - tc := tc - - suite.Run(fmt.Sprintf("Case %s", tc.msg), func() { - suite.SetupTest() // reset - - merklePathPrefix := commitmenttypes.NewMerklePath([]byte("prefix")) - expChannel = types.Channel{ClientId: ibctesting.SecondClientID, CounterpartyChannelId: ibctesting.SecondChannelID, MerklePathPrefix: merklePathPrefix} - - tc.malleate() - - queryServer := keeper.NewQueryServer(suite.chainA.GetSimApp().IBCKeeper.ChannelKeeperV2) - res, err := queryServer.Channel(suite.chainA.GetContext(), req) - - expPass := tc.expError == nil - if expPass { - suite.Require().NoError(err) - suite.Require().NotNil(res) - suite.Require().Equal(expChannel, res.Channel) - } else { - suite.Require().ErrorIs(err, tc.expError) - suite.Require().Nil(res) - } - }) - } -} - -func (suite *KeeperTestSuite) TestQueryChannelClientState() { - var ( - req *types.QueryChannelClientStateRequest - expIdentifiedClientState clienttypes.IdentifiedClientState - ) - - testCases := []struct { - msg string - malleate func() - expError error - }{ - { - "success", - func() { - path := ibctesting.NewPath(suite.chainA, suite.chainB) - path.SetupV2() - - expClientState := suite.chainA.GetClientState(path.EndpointA.ClientID) - expIdentifiedClientState = clienttypes.NewIdentifiedClientState(path.EndpointA.ClientID, expClientState) - - req = &types.QueryChannelClientStateRequest{ - ChannelId: path.EndpointA.ChannelID, - } - }, - nil, - }, - { - "empty request", - func() { - req = nil - }, - status.Error(codes.InvalidArgument, "empty request"), - }, - { - "invalid channel ID", - func() { - req = &types.QueryChannelClientStateRequest{ - ChannelId: "", - } - }, - status.Error(codes.InvalidArgument, "identifier cannot be blank: invalid identifier"), - }, - { - "channel not found", - func() { - req = &types.QueryChannelClientStateRequest{ - ChannelId: "test-channel-id", - } - }, - status.Error(codes.NotFound, fmt.Sprintf("channel-id: %s: channel not found", "test-channel-id")), - }, - { - "client state not found", - func() { - path := ibctesting.NewPath(suite.chainA, suite.chainB) - path.SetupV2() - - channel, found := path.EndpointA.Chain.App.GetIBCKeeper().ChannelKeeperV2.GetChannel(suite.chainA.GetContext(), path.EndpointA.ChannelID) - suite.Require().True(found) - channel.ClientId = ibctesting.SecondClientID - - path.EndpointA.Chain.App.GetIBCKeeper().ChannelKeeperV2.SetChannel(suite.chainA.GetContext(), path.EndpointA.ChannelID, channel) - - req = &types.QueryChannelClientStateRequest{ - ChannelId: path.EndpointA.ChannelID, - } - }, - status.Error(codes.NotFound, fmt.Sprintf("client-id: %s: light client not found", ibctesting.SecondClientID)), - }, - } - - for _, tc := range testCases { - tc := tc - - suite.Run(fmt.Sprintf("Case %s", tc.msg), func() { - suite.SetupTest() // reset - - tc.malleate() - ctx := suite.chainA.GetContext() - - queryServer := keeper.NewQueryServer(suite.chainA.App.GetIBCKeeper().ChannelKeeperV2) - res, err := queryServer.ChannelClientState(ctx, req) - - expPass := tc.expError == nil - if expPass { - suite.Require().NoError(err) - suite.Require().NotNil(res) - suite.Require().Equal(&expIdentifiedClientState, res.IdentifiedClientState) - - // ensure UnpackInterfaces is defined - cachedValue := res.IdentifiedClientState.ClientState.GetCachedValue() - suite.Require().NotNil(cachedValue) - } else { - suite.Require().ErrorIs(err, tc.expError) - suite.Require().Nil(res) - } - }) - } -} - -func (suite *KeeperTestSuite) TestQueryChannelConsensusState() { - var ( - req *types.QueryChannelConsensusStateRequest - expConsensusState exported.ConsensusState - expClientID string - ) - - testCases := []struct { - msg string - malleate func() - expError error - }{ - { - "success", - func() { - path := ibctesting.NewPath(suite.chainA, suite.chainB) - path.SetupV2() - - expConsensusState, _ = suite.chainA.GetConsensusState(path.EndpointA.ClientID, path.EndpointA.GetClientLatestHeight()) - suite.Require().NotNil(expConsensusState) - expClientID = path.EndpointA.ClientID - - req = &types.QueryChannelConsensusStateRequest{ - ChannelId: path.EndpointA.ChannelID, - RevisionNumber: path.EndpointA.GetClientLatestHeight().GetRevisionNumber(), - RevisionHeight: path.EndpointA.GetClientLatestHeight().GetRevisionHeight(), - } - }, - nil, - }, - { - "empty request", - func() { - req = nil - }, - status.Error(codes.InvalidArgument, "empty request"), - }, - { - "invalid channel ID", - func() { - req = &types.QueryChannelConsensusStateRequest{ - ChannelId: "", - RevisionNumber: 0, - RevisionHeight: 1, - } - }, - status.Error(codes.InvalidArgument, "identifier cannot be blank: invalid identifier"), - }, - { - "channel not found", - func() { - req = &types.QueryChannelConsensusStateRequest{ - ChannelId: "test-channel-id", - RevisionNumber: 0, - RevisionHeight: 1, - } - }, - status.Error(codes.NotFound, fmt.Sprintf("channel-id: %s: channel not found", "test-channel-id")), - }, - { - "consensus state for channel's connection not found", - func() { - path := ibctesting.NewPath(suite.chainA, suite.chainB) - path.SetupV2() - - req = &types.QueryChannelConsensusStateRequest{ - ChannelId: path.EndpointA.ChannelID, - RevisionNumber: 0, - RevisionHeight: uint64(suite.chainA.GetContext().BlockHeight()), // use current height - } - }, - status.Error(codes.NotFound, fmt.Sprintf("client-id: %s: consensus state not found", "07-tendermint-0")), - }, - } - - for _, tc := range testCases { - tc := tc - - suite.Run(fmt.Sprintf("Case %s", tc.msg), func() { - suite.SetupTest() // reset - - tc.malleate() - ctx := suite.chainA.GetContext() - - queryServer := keeper.NewQueryServer(suite.chainA.App.GetIBCKeeper().ChannelKeeperV2) - res, err := queryServer.ChannelConsensusState(ctx, req) - - expPass := tc.expError == nil - if expPass { - suite.Require().NoError(err) - suite.Require().NotNil(res) - consensusState, err := clienttypes.UnpackConsensusState(res.ConsensusState) - suite.Require().NoError(err) - suite.Require().Equal(expConsensusState, consensusState) - suite.Require().Equal(expClientID, res.ClientId) - - // ensure UnpackInterfaces is defined - cachedValue := res.ConsensusState.GetCachedValue() - suite.Require().NotNil(cachedValue) - } else { - suite.Require().ErrorIs(err, tc.expError) - suite.Require().Nil(res) - } - }) - } -} - func (suite *KeeperTestSuite) TestQueryPacketCommitment() { var ( expCommitment []byte @@ -317,11 +32,11 @@ func (suite *KeeperTestSuite) TestQueryPacketCommitment() { path.SetupV2() expCommitment = []byte("commitmentHash") - suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetPacketCommitment(suite.chainA.GetContext(), path.EndpointA.ChannelID, 1, expCommitment) + suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetPacketCommitment(suite.chainA.GetContext(), path.EndpointA.ClientID, 1, expCommitment) req = &types.QueryPacketCommitmentRequest{ - ChannelId: path.EndpointA.ChannelID, - Sequence: 1, + ClientId: path.EndpointA.ClientID, + Sequence: 1, } }, nil, @@ -337,8 +52,8 @@ func (suite *KeeperTestSuite) TestQueryPacketCommitment() { "invalid channel ID", func() { req = &types.QueryPacketCommitmentRequest{ - ChannelId: "", - Sequence: 1, + ClientId: "", + Sequence: 1, } }, status.Error(codes.InvalidArgument, "identifier cannot be blank: invalid identifier"), @@ -347,22 +62,12 @@ func (suite *KeeperTestSuite) TestQueryPacketCommitment() { "invalid sequence", func() { req = &types.QueryPacketCommitmentRequest{ - ChannelId: ibctesting.FirstChannelID, - Sequence: 0, + ClientId: ibctesting.FirstClientID, + Sequence: 0, } }, status.Error(codes.InvalidArgument, "packet sequence cannot be 0"), }, - { - "channel not found", - func() { - req = &types.QueryPacketCommitmentRequest{ - ChannelId: "channel-141", - Sequence: 1, - } - }, - status.Error(codes.NotFound, fmt.Sprintf("%s: channel not found", "channel-141")), - }, { "commitment not found", func() { @@ -370,8 +75,8 @@ func (suite *KeeperTestSuite) TestQueryPacketCommitment() { path.SetupV2() req = &types.QueryPacketCommitmentRequest{ - ChannelId: path.EndpointA.ChannelID, - Sequence: 1, + ClientId: path.EndpointA.ClientID, + Sequence: 1, } }, status.Error(codes.NotFound, "packet commitment hash not found"), @@ -421,13 +126,13 @@ func (suite *KeeperTestSuite) TestQueryPacketCommitments() { expCommitments = make([]*types.PacketState, 0, 10) // reset expected commitments for i := uint64(1); i <= 10; i++ { - pktStateCommitment := types.NewPacketState(path.EndpointA.ChannelID, i, []byte(fmt.Sprintf("hash_%d", i))) - suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetPacketCommitment(suite.chainA.GetContext(), pktStateCommitment.ChannelId, pktStateCommitment.Sequence, pktStateCommitment.Data) + pktStateCommitment := types.NewPacketState(path.EndpointA.ClientID, i, []byte(fmt.Sprintf("hash_%d", i))) + suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetPacketCommitment(suite.chainA.GetContext(), pktStateCommitment.ClientId, pktStateCommitment.Sequence, pktStateCommitment.Data) expCommitments = append(expCommitments, &pktStateCommitment) } req = &types.QueryPacketCommitmentsRequest{ - ChannelId: path.EndpointA.ChannelID, + ClientId: path.EndpointA.ClientID, Pagination: &query.PageRequest{ Key: nil, Limit: 11, @@ -445,8 +150,8 @@ func (suite *KeeperTestSuite) TestQueryPacketCommitments() { expCommitments = make([]*types.PacketState, 0, 10) // reset expected commitments for i := uint64(1); i <= 10; i++ { - pktStateCommitment := types.NewPacketState(path.EndpointA.ChannelID, i, []byte(fmt.Sprintf("hash_%d", i))) - suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetPacketCommitment(suite.chainA.GetContext(), pktStateCommitment.ChannelId, pktStateCommitment.Sequence, pktStateCommitment.Data) + pktStateCommitment := types.NewPacketState(path.EndpointA.ClientID, i, []byte(fmt.Sprintf("hash_%d", i))) + suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetPacketCommitment(suite.chainA.GetContext(), pktStateCommitment.ClientId, pktStateCommitment.Sequence, pktStateCommitment.Data) expCommitments = append(expCommitments, &pktStateCommitment) } @@ -454,7 +159,7 @@ func (suite *KeeperTestSuite) TestQueryPacketCommitments() { expCommitments = expCommitments[:limit] req = &types.QueryPacketCommitmentsRequest{ - ChannelId: path.EndpointA.ChannelID, + ClientId: path.EndpointA.ClientID, Pagination: &query.PageRequest{ Key: nil, Limit: limit, @@ -472,23 +177,14 @@ func (suite *KeeperTestSuite) TestQueryPacketCommitments() { status.Error(codes.InvalidArgument, "empty request"), }, { - "invalid channel ID", + "invalid client ID", func() { req = &types.QueryPacketCommitmentsRequest{ - ChannelId: "", + ClientId: "", } }, status.Error(codes.InvalidArgument, "identifier cannot be blank: invalid identifier"), }, - { - "channel not found", - func() { - req = &types.QueryPacketCommitmentsRequest{ - ChannelId: "channel-141", - } - }, - status.Error(codes.NotFound, fmt.Sprintf("%s: channel not found", "channel-141")), - }, } for _, tc := range testCases { @@ -534,11 +230,11 @@ func (suite *KeeperTestSuite) TestQueryPacketAcknowledgement() { path.SetupV2() expAcknowledgement = []byte("acknowledgementHash") - suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetPacketAcknowledgement(suite.chainA.GetContext(), path.EndpointA.ChannelID, 1, expAcknowledgement) + suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetPacketAcknowledgement(suite.chainA.GetContext(), path.EndpointA.ClientID, 1, expAcknowledgement) req = &types.QueryPacketAcknowledgementRequest{ - ChannelId: path.EndpointA.ChannelID, - Sequence: 1, + ClientId: path.EndpointA.ClientID, + Sequence: 1, } }, nil, @@ -551,11 +247,11 @@ func (suite *KeeperTestSuite) TestQueryPacketAcknowledgement() { status.Error(codes.InvalidArgument, "empty request"), }, { - "invalid channel ID", + "invalid client ID", func() { req = &types.QueryPacketAcknowledgementRequest{ - ChannelId: "", - Sequence: 1, + ClientId: "", + Sequence: 1, } }, status.Error(codes.InvalidArgument, "identifier cannot be blank: invalid identifier"), @@ -564,22 +260,12 @@ func (suite *KeeperTestSuite) TestQueryPacketAcknowledgement() { "invalid sequence", func() { req = &types.QueryPacketAcknowledgementRequest{ - ChannelId: ibctesting.FirstChannelID, - Sequence: 0, + ClientId: ibctesting.FirstClientID, + Sequence: 0, } }, status.Error(codes.InvalidArgument, "packet sequence cannot be 0"), }, - { - "channel not found", - func() { - req = &types.QueryPacketAcknowledgementRequest{ - ChannelId: "channel-141", - Sequence: 1, - } - }, - status.Error(codes.NotFound, fmt.Sprintf("%s: channel not found", "channel-141")), - }, { "acknowledgement not found", func() { @@ -587,8 +273,8 @@ func (suite *KeeperTestSuite) TestQueryPacketAcknowledgement() { path.SetupV2() req = &types.QueryPacketAcknowledgementRequest{ - ChannelId: path.EndpointA.ChannelID, - Sequence: 1, + ClientId: path.EndpointA.ClientID, + Sequence: 1, } }, status.Error(codes.NotFound, "packet acknowledgement hash not found"), @@ -639,8 +325,8 @@ func (suite *KeeperTestSuite) TestQueryPacketAcknowledgements() { var commitments []uint64 for i := uint64(0); i < 100; i++ { - ack := types.NewPacketState(path.EndpointA.ChannelID, i, []byte(fmt.Sprintf("hash_%d", i))) - suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetPacketAcknowledgement(suite.chainA.GetContext(), ack.ChannelId, ack.Sequence, ack.Data) + ack := types.NewPacketState(path.EndpointA.ClientID, i, []byte(fmt.Sprintf("hash_%d", i))) + suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetPacketAcknowledgement(suite.chainA.GetContext(), ack.ClientId, ack.Sequence, ack.Data) if i < 10 { // populate the store with 100 and query for 10 specific acks expAcknowledgements = append(expAcknowledgements, &ack) @@ -649,7 +335,7 @@ func (suite *KeeperTestSuite) TestQueryPacketAcknowledgements() { } req = &types.QueryPacketAcknowledgementsRequest{ - ChannelId: path.EndpointA.ChannelID, + ClientId: path.EndpointA.ClientID, PacketCommitmentSequences: commitments, Pagination: nil, } @@ -665,13 +351,13 @@ func (suite *KeeperTestSuite) TestQueryPacketAcknowledgements() { expAcknowledgements = make([]*types.PacketState, 0, 10) for i := uint64(1); i <= 10; i++ { - ack := types.NewPacketState(path.EndpointA.ChannelID, i, []byte(fmt.Sprintf("hash_%d", i))) - suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetPacketAcknowledgement(suite.chainA.GetContext(), ack.ChannelId, ack.Sequence, ack.Data) + ack := types.NewPacketState(path.EndpointA.ClientID, i, []byte(fmt.Sprintf("hash_%d", i))) + suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetPacketAcknowledgement(suite.chainA.GetContext(), ack.ClientId, ack.Sequence, ack.Data) expAcknowledgements = append(expAcknowledgements, &ack) } req = &types.QueryPacketAcknowledgementsRequest{ - ChannelId: path.EndpointA.ChannelID, + ClientId: path.EndpointA.ClientID, Pagination: &query.PageRequest{ Key: nil, Limit: 11, @@ -692,20 +378,11 @@ func (suite *KeeperTestSuite) TestQueryPacketAcknowledgements() { "invalid ID", func() { req = &types.QueryPacketAcknowledgementsRequest{ - ChannelId: "", + ClientId: "", } }, status.Error(codes.InvalidArgument, "identifier cannot be blank: invalid identifier"), }, - { - "channel not found", - func() { - req = &types.QueryPacketAcknowledgementsRequest{ - ChannelId: "test-channel-id", - } - }, - status.Error(codes.NotFound, fmt.Sprintf("%s: channel not found", "test-channel-id")), - }, } for _, tc := range testCases { @@ -750,12 +427,12 @@ func (suite *KeeperTestSuite) TestQueryPacketReceipt() { path = ibctesting.NewPath(suite.chainA, suite.chainB) path.SetupV2() - suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetPacketReceipt(suite.chainA.GetContext(), path.EndpointA.ChannelID, 1) + suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetPacketReceipt(suite.chainA.GetContext(), path.EndpointA.ClientID, 1) expReceipt = true req = &types.QueryPacketReceiptRequest{ - ChannelId: path.EndpointA.ChannelID, - Sequence: 1, + ClientId: path.EndpointA.ClientID, + Sequence: 1, } }, nil, @@ -768,8 +445,8 @@ func (suite *KeeperTestSuite) TestQueryPacketReceipt() { expReceipt = false req = &types.QueryPacketReceiptRequest{ - ChannelId: path.EndpointA.ChannelID, - Sequence: 1, + ClientId: path.EndpointA.ClientID, + Sequence: 1, } }, nil, @@ -782,11 +459,11 @@ func (suite *KeeperTestSuite) TestQueryPacketReceipt() { status.Error(codes.InvalidArgument, "empty request"), }, { - "invalid channel ID", + "invalid client ID", func() { req = &types.QueryPacketReceiptRequest{ - ChannelId: "", - Sequence: 1, + ClientId: "", + Sequence: 1, } }, status.Error(codes.InvalidArgument, "identifier cannot be blank: invalid identifier"), @@ -795,22 +472,12 @@ func (suite *KeeperTestSuite) TestQueryPacketReceipt() { "invalid sequence", func() { req = &types.QueryPacketReceiptRequest{ - ChannelId: ibctesting.FirstChannelID, - Sequence: 0, + ClientId: ibctesting.FirstClientID, + Sequence: 0, } }, status.Error(codes.InvalidArgument, "packet sequence cannot be 0"), }, - { - "channel not found", - func() { - req = &types.QueryPacketReceiptRequest{ - ChannelId: "channel-141", - Sequence: 1, - } - }, - status.Error(codes.NotFound, fmt.Sprintf("%s: channel not found", "channel-141")), - }, } for _, tc := range testCases { @@ -856,8 +523,8 @@ func (suite *KeeperTestSuite) TestQueryNextSequenceSend() { expSeq = 42 seq := uint64(42) - suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetNextSequenceSend(suite.chainA.GetContext(), path.EndpointA.ChannelID, seq) - req = types.NewQueryNextSequenceSendRequest(path.EndpointA.ChannelID) + suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetNextSequenceSend(suite.chainA.GetContext(), path.EndpointA.ClientID, seq) + req = types.NewQueryNextSequenceSendRequest(path.EndpointA.ClientID) }, nil, }, @@ -869,7 +536,7 @@ func (suite *KeeperTestSuite) TestQueryNextSequenceSend() { status.Error(codes.InvalidArgument, "empty request"), }, { - "invalid channel ID", + "invalid client ID", func() { req = types.NewQueryNextSequenceSendRequest("") }, @@ -878,9 +545,9 @@ func (suite *KeeperTestSuite) TestQueryNextSequenceSend() { { "sequence send not found", func() { - req = types.NewQueryNextSequenceSendRequest(ibctesting.FirstChannelID) + req = types.NewQueryNextSequenceSendRequest(ibctesting.FirstClientID) }, - status.Error(codes.NotFound, fmt.Sprintf("channel-id %s: sequence send not found", ibctesting.FirstChannelID)), + status.Error(codes.NotFound, fmt.Sprintf("client-id %s: sequence send not found", ibctesting.FirstClientID)), }, } @@ -929,10 +596,10 @@ func (suite *KeeperTestSuite) TestQueryUnreceivedPackets() { status.Error(codes.InvalidArgument, "empty request"), }, { - "invalid channel ID", + "invalid client ID", func() { req = &types.QueryUnreceivedPacketsRequest{ - ChannelId: "", + ClientId: "", } }, status.Error(codes.InvalidArgument, "identifier cannot be blank: invalid identifier"), @@ -944,21 +611,12 @@ func (suite *KeeperTestSuite) TestQueryUnreceivedPackets() { path.SetupV2() req = &types.QueryUnreceivedPacketsRequest{ - ChannelId: path.EndpointA.ChannelID, + ClientId: path.EndpointA.ClientID, Sequences: []uint64{0}, } }, status.Error(codes.InvalidArgument, "packet sequence 0 cannot be 0"), }, - { - "channel not found", - func() { - req = &types.QueryUnreceivedPacketsRequest{ - ChannelId: "invalid-channel-id", - } - }, - status.Error(codes.NotFound, fmt.Sprintf("%s: channel not found", "invalid-channel-id")), - }, { "basic success empty packet commitments", func() { @@ -967,7 +625,7 @@ func (suite *KeeperTestSuite) TestQueryUnreceivedPackets() { expSeq = []uint64(nil) req = &types.QueryUnreceivedPacketsRequest{ - ChannelId: path.EndpointA.ChannelID, + ClientId: path.EndpointA.ClientID, Sequences: []uint64{}, } }, @@ -983,7 +641,7 @@ func (suite *KeeperTestSuite) TestQueryUnreceivedPackets() { expSeq = []uint64{1} req = &types.QueryUnreceivedPacketsRequest{ - ChannelId: path.EndpointA.ChannelID, + ClientId: path.EndpointA.ClientID, Sequences: []uint64{1}, } }, @@ -995,11 +653,11 @@ func (suite *KeeperTestSuite) TestQueryUnreceivedPackets() { path = ibctesting.NewPath(suite.chainA, suite.chainB) path.SetupV2() - suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetPacketReceipt(suite.chainA.GetContext(), path.EndpointA.ChannelID, 1) + suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetPacketReceipt(suite.chainA.GetContext(), path.EndpointA.ClientID, 1) expSeq = []uint64(nil) req = &types.QueryUnreceivedPacketsRequest{ - ChannelId: path.EndpointA.ChannelID, + ClientId: path.EndpointA.ClientID, Sequences: []uint64{1}, } }, @@ -1018,14 +676,14 @@ func (suite *KeeperTestSuite) TestQueryUnreceivedPackets() { packetCommitments = append(packetCommitments, seq) if seq%2 == 0 { - suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetPacketReceipt(suite.chainA.GetContext(), path.EndpointA.ChannelID, seq) + suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetPacketReceipt(suite.chainA.GetContext(), path.EndpointA.ClientID, seq) } else { expSeq = append(expSeq, seq) } } req = &types.QueryUnreceivedPacketsRequest{ - ChannelId: path.EndpointA.ChannelID, + ClientId: path.EndpointA.ClientID, Sequences: packetCommitments, } }, @@ -1075,7 +733,7 @@ func (suite *KeeperTestSuite) TestQueryUnreceivedAcks() { func() { expSeq = []uint64(nil) req = &types.QueryUnreceivedAcksRequest{ - ChannelId: path.EndpointA.ChannelID, + ClientId: path.EndpointA.ClientID, PacketAckSequences: []uint64{1}, } }, @@ -1084,11 +742,11 @@ func (suite *KeeperTestSuite) TestQueryUnreceivedAcks() { { "success: single unreceived packet ack", func() { - suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetPacketCommitment(suite.chainA.GetContext(), path.EndpointA.ChannelID, 1, []byte("commitment")) + suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetPacketCommitment(suite.chainA.GetContext(), path.EndpointA.ClientID, 1, []byte("commitment")) expSeq = []uint64{1} req = &types.QueryUnreceivedAcksRequest{ - ChannelId: path.EndpointA.ChannelID, + ClientId: path.EndpointA.ClientID, PacketAckSequences: []uint64{1}, } }, @@ -1105,13 +763,13 @@ func (suite *KeeperTestSuite) TestQueryUnreceivedAcks() { packetAcks = append(packetAcks, seq) if seq%2 == 0 { - suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetPacketCommitment(suite.chainA.GetContext(), path.EndpointA.ChannelID, seq, []byte("commitement")) + suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetPacketCommitment(suite.chainA.GetContext(), path.EndpointA.ClientID, seq, []byte("commitement")) expSeq = append(expSeq, seq) } } req = &types.QueryUnreceivedAcksRequest{ - ChannelId: path.EndpointA.ChannelID, + ClientId: path.EndpointA.ClientID, PacketAckSequences: packetAcks, } }, @@ -1125,28 +783,19 @@ func (suite *KeeperTestSuite) TestQueryUnreceivedAcks() { status.Error(codes.InvalidArgument, "empty request"), }, { - "invalid channel ID", + "invalid client ID", func() { req = &types.QueryUnreceivedAcksRequest{ - ChannelId: "", + ClientId: "", } }, status.Error(codes.InvalidArgument, "identifier cannot be blank: invalid identifier"), }, - { - "channel not found", - func() { - req = &types.QueryUnreceivedAcksRequest{ - ChannelId: "test-channel-id", - } - }, - status.Error(codes.NotFound, fmt.Sprintf("%s: channel not found", "test-channel-id")), - }, { "invalid seq", func() { req = &types.QueryUnreceivedAcksRequest{ - ChannelId: path.EndpointA.ChannelID, + ClientId: path.EndpointA.ClientID, PacketAckSequences: []uint64{0}, } }, diff --git a/modules/core/04-channel/v2/keeper/keeper.go b/modules/core/04-channel/v2/keeper/keeper.go index e9843f71bb3..a63e644f83e 100644 --- a/modules/core/04-channel/v2/keeper/keeper.go +++ b/modules/core/04-channel/v2/keeper/keeper.go @@ -2,22 +2,16 @@ package keeper import ( "context" - "fmt" "cosmossdk.io/core/appmodule" "cosmossdk.io/log" - "cosmossdk.io/store/prefix" - storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" connectionkeeper "github.com/cosmos/ibc-go/v9/modules/core/03-connection/keeper" channelkeeperv1 "github.com/cosmos/ibc-go/v9/modules/core/04-channel/keeper" - channeltypesv1 "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types" - commitmentv2types "github.com/cosmos/ibc-go/v9/modules/core/23-commitment/types/v2" hostv2 "github.com/cosmos/ibc-go/v9/modules/core/24-host/v2" "github.com/cosmos/ibc-go/v9/modules/core/api" "github.com/cosmos/ibc-go/v9/modules/core/exported" @@ -61,67 +55,10 @@ func (Keeper) Logger(ctx context.Context) log.Logger { return sdkCtx.Logger().With("module", "x/"+exported.ModuleName+"/"+types.SubModuleName) } -// channelStore returns the KV store under which channels are stored. -func (k Keeper) channelStore(ctx context.Context) storetypes.KVStore { - channelPrefix := []byte(fmt.Sprintf("%s/", types.ChannelPrefix)) - return prefix.NewStore(runtime.KVStoreAdapter(k.KVStoreService.OpenKVStore(ctx)), channelPrefix) -} - -// creatorStore returns the KV store under which creators are stored. -func (k Keeper) creatorStore(ctx context.Context) storetypes.KVStore { - creatorPrefix := []byte(fmt.Sprintf("%s/", types.CreatorPrefix)) - return prefix.NewStore(runtime.KVStoreAdapter(k.KVStoreService.OpenKVStore(ctx)), creatorPrefix) -} - -// SetChannel sets the Channel for a given channel identifier. -func (k *Keeper) SetChannel(ctx context.Context, channelID string, channel types.Channel) { - bz := k.cdc.MustMarshal(&channel) - k.channelStore(ctx).Set([]byte(channelID), bz) -} - -// GetChannel gets the Channel for a given channel identifier. -func (k *Keeper) GetChannel(ctx context.Context, channelID string) (types.Channel, bool) { - store := k.channelStore(ctx) - bz := store.Get([]byte(channelID)) - if len(bz) == 0 { - return types.Channel{}, false - } - - var channel types.Channel - k.cdc.MustUnmarshal(bz, &channel) - return channel, true -} - -// HasChannel returns true if a Channel exists for a given channel identifier, otherwise false. -func (k *Keeper) HasChannel(ctx context.Context, channelID string) bool { - store := k.channelStore(ctx) - return store.Has([]byte(channelID)) -} - -// GetCreator returns the creator of the channel. -func (k *Keeper) GetCreator(ctx context.Context, channelID string) (string, bool) { - bz := k.creatorStore(ctx).Get([]byte(channelID)) - if len(bz) == 0 { - return "", false - } - - return string(bz), true -} - -// SetCreator sets the creator of the channel. -func (k *Keeper) SetCreator(ctx context.Context, channelID, creator string) { - k.creatorStore(ctx).Set([]byte(channelID), []byte(creator)) -} - -// DeleteCreator deletes the creator associated with the channel. -func (k *Keeper) DeleteCreator(ctx context.Context, channelID string) { - k.creatorStore(ctx).Delete([]byte(channelID)) -} - -// GetPacketReceipt returns the packet receipt from the packet receipt path based on the channelID and sequence. -func (k *Keeper) GetPacketReceipt(ctx context.Context, channelID string, sequence uint64) ([]byte, bool) { +// GetPacketReceipt returns the packet receipt from the packet receipt path based on the clientID and sequence. +func (k *Keeper) GetPacketReceipt(ctx context.Context, clientID string, sequence uint64) ([]byte, bool) { store := k.KVStoreService.OpenKVStore(ctx) - bz, err := store.Get(hostv2.PacketReceiptKey(channelID, sequence)) + bz, err := store.Get(hostv2.PacketReceiptKey(clientID, sequence)) if err != nil { panic(err) } @@ -132,9 +69,9 @@ func (k *Keeper) GetPacketReceipt(ctx context.Context, channelID string, sequenc } // HasPacketReceipt returns true if the packet receipt exists, otherwise false. -func (k *Keeper) HasPacketReceipt(ctx context.Context, channelID string, sequence uint64) bool { +func (k *Keeper) HasPacketReceipt(ctx context.Context, clientID string, sequence uint64) bool { store := k.KVStoreService.OpenKVStore(ctx) - has, err := store.Has(hostv2.PacketReceiptKey(channelID, sequence)) + has, err := store.Has(hostv2.PacketReceiptKey(clientID, sequence)) if err != nil { panic(err) } @@ -144,17 +81,17 @@ func (k *Keeper) HasPacketReceipt(ctx context.Context, channelID string, sequenc // SetPacketReceipt writes the packet receipt under the receipt path // This is a public path that is standardized by the IBC V2 specification. -func (k *Keeper) SetPacketReceipt(ctx context.Context, channelID string, sequence uint64) { +func (k *Keeper) SetPacketReceipt(ctx context.Context, clientID string, sequence uint64) { store := k.KVStoreService.OpenKVStore(ctx) - if err := store.Set(hostv2.PacketReceiptKey(channelID, sequence), []byte{byte(2)}); err != nil { + if err := store.Set(hostv2.PacketReceiptKey(clientID, sequence), []byte{byte(2)}); err != nil { panic(err) } } // GetPacketAcknowledgement fetches the packet acknowledgement from the store. -func (k *Keeper) GetPacketAcknowledgement(ctx context.Context, channelID string, sequence uint64) []byte { +func (k *Keeper) GetPacketAcknowledgement(ctx context.Context, clientID string, sequence uint64) []byte { store := k.KVStoreService.OpenKVStore(ctx) - bz, err := store.Get(hostv2.PacketAcknowledgementKey(channelID, sequence)) + bz, err := store.Get(hostv2.PacketAcknowledgementKey(clientID, sequence)) if err != nil { panic(err) } @@ -163,22 +100,22 @@ func (k *Keeper) GetPacketAcknowledgement(ctx context.Context, channelID string, // SetPacketAcknowledgement writes the acknowledgement hash under the acknowledgement path // This is a public path that is standardized by the IBC V2 specification. -func (k *Keeper) SetPacketAcknowledgement(ctx context.Context, channelID string, sequence uint64, ackHash []byte) { +func (k *Keeper) SetPacketAcknowledgement(ctx context.Context, clientID string, sequence uint64, ackHash []byte) { store := k.KVStoreService.OpenKVStore(ctx) - if err := store.Set(hostv2.PacketAcknowledgementKey(channelID, sequence), ackHash); err != nil { + if err := store.Set(hostv2.PacketAcknowledgementKey(clientID, sequence), ackHash); err != nil { panic(err) } } // HasPacketAcknowledgement checks if the packet ack hash is already on the store. -func (k *Keeper) HasPacketAcknowledgement(ctx context.Context, channelID string, sequence uint64) bool { - return len(k.GetPacketAcknowledgement(ctx, channelID, sequence)) > 0 +func (k *Keeper) HasPacketAcknowledgement(ctx context.Context, clientID string, sequence uint64) bool { + return len(k.GetPacketAcknowledgement(ctx, clientID, sequence)) > 0 } // GetPacketCommitment returns the packet commitment hash under the commitment path. -func (k *Keeper) GetPacketCommitment(ctx context.Context, channelID string, sequence uint64) []byte { +func (k *Keeper) GetPacketCommitment(ctx context.Context, clientID string, sequence uint64) []byte { store := k.KVStoreService.OpenKVStore(ctx) - bz, err := store.Get(hostv2.PacketCommitmentKey(channelID, sequence)) + bz, err := store.Get(hostv2.PacketCommitmentKey(clientID, sequence)) if err != nil { panic(err) } @@ -189,25 +126,25 @@ func (k *Keeper) GetPacketCommitment(ctx context.Context, channelID string, sequ } // SetPacketCommitment writes the commitment hash under the commitment path. -func (k *Keeper) SetPacketCommitment(ctx context.Context, channelID string, sequence uint64, commitment []byte) { +func (k *Keeper) SetPacketCommitment(ctx context.Context, clientID string, sequence uint64, commitment []byte) { store := k.KVStoreService.OpenKVStore(ctx) - if err := store.Set(hostv2.PacketCommitmentKey(channelID, sequence), commitment); err != nil { + if err := store.Set(hostv2.PacketCommitmentKey(clientID, sequence), commitment); err != nil { panic(err) } } // DeletePacketCommitment deletes the packet commitment hash under the commitment path. -func (k *Keeper) DeletePacketCommitment(ctx context.Context, channelID string, sequence uint64) { +func (k *Keeper) DeletePacketCommitment(ctx context.Context, clientID string, sequence uint64) { store := k.KVStoreService.OpenKVStore(ctx) - if err := store.Delete(hostv2.PacketCommitmentKey(channelID, sequence)); err != nil { + if err := store.Delete(hostv2.PacketCommitmentKey(clientID, sequence)); err != nil { panic(err) } } // GetNextSequenceSend returns the next send sequence from the sequence path -func (k *Keeper) GetNextSequenceSend(ctx context.Context, channelID string) (uint64, bool) { +func (k *Keeper) GetNextSequenceSend(ctx context.Context, clientID string) (uint64, bool) { store := k.KVStoreService.OpenKVStore(ctx) - bz, err := store.Get(hostv2.NextSequenceSendKey(channelID)) + bz, err := store.Get(hostv2.NextSequenceSendKey(clientID)) if err != nil { panic(err) } @@ -218,48 +155,10 @@ func (k *Keeper) GetNextSequenceSend(ctx context.Context, channelID string) (uin } // SetNextSequenceSend writes the next send sequence under the sequence path -func (k *Keeper) SetNextSequenceSend(ctx context.Context, channelID string, sequence uint64) { +func (k *Keeper) SetNextSequenceSend(ctx context.Context, clientID string, sequence uint64) { store := k.KVStoreService.OpenKVStore(ctx) bigEndianBz := sdk.Uint64ToBigEndian(sequence) - if err := store.Set(hostv2.NextSequenceSendKey(channelID), bigEndianBz); err != nil { + if err := store.Set(hostv2.NextSequenceSendKey(clientID), bigEndianBz); err != nil { panic(err) } } - -// aliasV1Channel returns a version 2 channel for the given port and channel ID -// by converting the channel into a version 2 channel. -func (k *Keeper) aliasV1Channel(ctx context.Context, portID, channelID string) (types.Channel, bool) { - channel, ok := k.channelKeeperV1.GetChannel(ctx, portID, channelID) - if !ok { - return types.Channel{}, false - } - // Do not allow channel to be converted into a version 2 channel - // if the channel is not OPEN or if it is not UNORDERED - if channel.State != channeltypesv1.OPEN || channel.Ordering != channeltypesv1.UNORDERED { - return types.Channel{}, false - } - connection, ok := k.connectionKeeper.GetConnection(ctx, channel.ConnectionHops[0]) - if !ok { - return types.Channel{}, false - } - merklePathPrefix := commitmentv2types.NewMerklePath(connection.Counterparty.Prefix.KeyPrefix, []byte("")) - - channelv2 := types.Channel{ - CounterpartyChannelId: channel.Counterparty.ChannelId, - ClientId: connection.ClientId, - MerklePathPrefix: merklePathPrefix, - } - return channelv2, true -} - -// convertV1Channel attempts to retrieve a v1 channel from the channel keeper if it exists, then converts it -// to a v2 counterparty and stores it in the v2 channel keeper for future use -func (k *Keeper) convertV1Channel(ctx context.Context, port, id string) (types.Channel, bool) { - if channel, ok := k.aliasV1Channel(ctx, port, id); ok { - // we can key on just the channel here since channel ids are globally unique - k.SetChannel(ctx, id, channel) - return channel, true - } - - return types.Channel{}, false -} diff --git a/modules/core/04-channel/v2/keeper/keeper_test.go b/modules/core/04-channel/v2/keeper/keeper_test.go index 3521e3c789f..5da9af68bda 100644 --- a/modules/core/04-channel/v2/keeper/keeper_test.go +++ b/modules/core/04-channel/v2/keeper/keeper_test.go @@ -5,10 +5,6 @@ import ( testifysuite "github.com/stretchr/testify/suite" - "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" - channeltypes2 "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types" - commitmenttypes "github.com/cosmos/ibc-go/v9/modules/core/23-commitment/types" - commitmentv2types "github.com/cosmos/ibc-go/v9/modules/core/23-commitment/types/v2" ibctesting "github.com/cosmos/ibc-go/v9/testing" ) @@ -33,121 +29,3 @@ func (suite *KeeperTestSuite) SetupTest() { suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(2)) suite.chainC = suite.coordinator.GetChain(ibctesting.GetChainID(3)) } - -func (suite *KeeperTestSuite) TestAliasV1Channel() { - var path *ibctesting.Path - - testCases := []struct { - name string - malleate func() - expPass bool - }{ - { - "success", - func() {}, - true, - }, - { - "failure: channel not found", - func() { - path.EndpointA.ChannelID = "" - }, - false, - }, - { - "failure: channel not OPEN", - func() { - path.EndpointA.UpdateChannel(func(channel *types.Channel) { channel.State = types.TRYOPEN }) - }, - false, - }, - { - "failure: channel is ORDERED", - func() { - path.EndpointA.UpdateChannel(func(channel *types.Channel) { channel.Ordering = types.ORDERED }) - }, - false, - }, - { - "failure: connection not found", - func() { - path.EndpointA.UpdateChannel(func(channel *types.Channel) { channel.ConnectionHops = []string{ibctesting.InvalidID} }) - }, - false, - }, - } - - for _, tc := range testCases { - tc := tc - - suite.Run(tc.name, func() { - suite.SetupTest() // reset - - // create a previously existing path on chainA to change the identifiers - // between the path between chainA and chainB - path1 := ibctesting.NewPath(suite.chainA, suite.chainC) - path1.Setup() - - path = ibctesting.NewPath(suite.chainA, suite.chainB) - path.Setup() - - tc.malleate() - - channel, found := suite.chainA.GetSimApp().IBCKeeper.ChannelKeeperV2.AliasV1Channel(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - - if tc.expPass { - suite.Require().True(found) - - merklePath := commitmentv2types.NewMerklePath([]byte("ibc"), []byte("")) - expChannel := channeltypes2.NewChannel(path.EndpointA.ClientID, path.EndpointB.ChannelID, merklePath) - suite.Require().Equal(channel, expChannel) - } else { - suite.Require().False(found) - suite.Require().Equal(channel, channeltypes2.Channel{}) - } - }) - } -} - -func (suite *KeeperTestSuite) TestSetChannel() { - merklePathPrefix := commitmenttypes.NewMerklePath([]byte("ibc"), []byte("")) - channel := channeltypes2.Channel{ - ClientId: ibctesting.FirstClientID, - MerklePathPrefix: merklePathPrefix, - } - suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetChannel(suite.chainA.GetContext(), ibctesting.FirstChannelID, channel) - - retrievedChannel, found := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.GetChannel(suite.chainA.GetContext(), ibctesting.FirstChannelID) - suite.Require().True(found, "GetChannel does not return channel") - suite.Require().Equal(channel, retrievedChannel, "Channel retrieved not equal") - - // No channel stored under other channel identifier. - retrievedChannel, found = suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.GetChannel(suite.chainA.GetContext(), ibctesting.SecondChannelID) - suite.Require().False(found, "GetChannel unexpectedly returned a channel") - suite.Require().Equal(channeltypes2.Channel{}, retrievedChannel, "Channel retrieved not empty") -} - -func (suite *KeeperTestSuite) TestSetCreator() { - expectedCreator := "test-creator" - - // Set the creator for the client - suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetCreator(suite.chainA.GetContext(), ibctesting.FirstChannelID, expectedCreator) - - // Retrieve the creator from the store - retrievedCreator, found := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.GetCreator(suite.chainA.GetContext(), ibctesting.FirstChannelID) - - // Verify that the retrieved creator matches the expected creator - suite.Require().True(found, "GetCreator did not return stored creator") - suite.Require().Equal(expectedCreator, retrievedCreator, "Creator is not retrieved correctly") - - // Verify that the creator is deleted from the store - suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.DeleteCreator(suite.chainA.GetContext(), ibctesting.FirstChannelID) - retrievedCreator, found = suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.GetCreator(suite.chainA.GetContext(), ibctesting.FirstChannelID) - suite.Require().False(found, "GetCreator unexpectedly returned a creator") - suite.Require().Empty(retrievedCreator, "Creator is not empty") - - // Verify non stored creator is not found - retrievedCreator, found = suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.GetCreator(suite.chainA.GetContext(), ibctesting.SecondChannelID) - suite.Require().False(found, "GetCreator unexpectedly returned a creator") - suite.Require().Empty(retrievedCreator, "Creator is not empty") -} diff --git a/modules/core/04-channel/v2/keeper/msg_server.go b/modules/core/04-channel/v2/keeper/msg_server.go index 179e44fd93f..aaadfc8fc80 100644 --- a/modules/core/04-channel/v2/keeper/msg_server.go +++ b/modules/core/04-channel/v2/keeper/msg_server.go @@ -9,58 +9,12 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types" - ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors" internalerrors "github.com/cosmos/ibc-go/v9/modules/core/internal/errors" "github.com/cosmos/ibc-go/v9/modules/core/internal/v2/telemetry" ) var _ types.MsgServer = &Keeper{} -// CreateChannel defines a rpc handler method for MsgCreateChannel. -func (k *Keeper) CreateChannel(goCtx context.Context, msg *types.MsgCreateChannel) (*types.MsgCreateChannelResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - channelID := k.channelKeeperV1.GenerateChannelIdentifier(ctx) - - // Initialize channel with empty counterparty channel identifier. - channel := types.NewChannel(msg.ClientId, "", msg.MerklePathPrefix) - k.SetChannel(ctx, channelID, channel) - k.SetCreator(ctx, channelID, msg.Signer) - k.SetNextSequenceSend(ctx, channelID, 1) - - k.emitCreateChannelEvent(goCtx, channelID, msg.ClientId) - - return &types.MsgCreateChannelResponse{ChannelId: channelID}, nil -} - -// RegisterCounterparty defines a rpc handler method for MsgRegisterCounterparty. -func (k *Keeper) RegisterCounterparty(goCtx context.Context, msg *types.MsgRegisterCounterparty) (*types.MsgRegisterCounterpartyResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - channel, ok := k.GetChannel(ctx, msg.ChannelId) - if !ok { - return nil, errorsmod.Wrapf(types.ErrChannelNotFound, "channel must exist for channel id %s", msg.ChannelId) - } - - creator, found := k.GetCreator(ctx, msg.ChannelId) - if !found { - return nil, errorsmod.Wrap(ibcerrors.ErrUnauthorized, "channel creator must be set") - } - - if creator != msg.Signer { - return nil, errorsmod.Wrapf(ibcerrors.ErrUnauthorized, "channel creator (%s) must match signer (%s)", creator, msg.Signer) - } - - channel.CounterpartyChannelId = msg.CounterpartyChannelId - k.SetChannel(ctx, msg.ChannelId, channel) - // Delete client creator from state as it is not needed after this point. - k.DeleteCreator(ctx, msg.ChannelId) - - k.emitRegisterCounterpartyEvent(goCtx, msg.ChannelId, channel) - - return &types.MsgRegisterCounterpartyResponse{}, nil -} - // SendPacket implements the PacketMsgServer SendPacket method. func (k *Keeper) SendPacket(ctx context.Context, msg *types.MsgSendPacket) (*types.MsgSendPacketResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) @@ -83,15 +37,15 @@ func (k *Keeper) SendPacket(ctx context.Context, msg *types.MsgSendPacket) (*typ return nil, errorsmod.Wrap(err, "invalid address for msg Signer") } - sequence, destChannel, err := k.sendPacket(ctx, msg.SourceChannel, msg.TimeoutTimestamp, msg.Payloads) + sequence, destChannel, err := k.sendPacket(ctx, msg.SourceClient, msg.TimeoutTimestamp, msg.Payloads) if err != nil { - sdkCtx.Logger().Error("send packet failed", "source-channel", msg.SourceChannel, "error", errorsmod.Wrap(err, "send packet failed")) - return nil, errorsmod.Wrapf(err, "send packet failed for source id: %s", msg.SourceChannel) + sdkCtx.Logger().Error("send packet failed", "source-client", msg.SourceClient, "error", errorsmod.Wrap(err, "send packet failed")) + return nil, errorsmod.Wrapf(err, "send packet failed for source id: %s", msg.SourceClient) } for _, pd := range msg.Payloads { cbs := k.Router.Route(pd.SourcePort) - err := cbs.OnSendPacket(ctx, msg.SourceChannel, destChannel, sequence, pd, signer) + err := cbs.OnSendPacket(ctx, msg.SourceClient, destChannel, sequence, pd, signer) if err != nil { return nil, err } @@ -122,10 +76,10 @@ func (k *Keeper) RecvPacket(ctx context.Context, msg *types.MsgRecvPacket) (*typ writeFn() case types.ErrNoOpMsg: // no-ops do not need event emission as they will be ignored - sdkCtx.Logger().Debug("no-op on redundant relay", "source-channel", msg.Packet.SourceChannel) + sdkCtx.Logger().Debug("no-op on redundant relay", "source-client", msg.Packet.SourceClient) return &types.MsgRecvPacketResponse{Result: types.NOOP}, nil default: - sdkCtx.Logger().Error("receive packet failed", "source-channel", msg.Packet.SourceChannel, "error", errorsmod.Wrap(err, "receive packet verification failed")) + sdkCtx.Logger().Error("receive packet failed", "source-client", msg.Packet.SourceClient, "error", errorsmod.Wrap(err, "receive packet verification failed")) return nil, errorsmod.Wrap(err, "receive packet verification failed") } @@ -139,7 +93,7 @@ func (k *Keeper) RecvPacket(ctx context.Context, msg *types.MsgRecvPacket) (*typ // Cache context so that we may discard state changes from callback if the acknowledgement is unsuccessful. cacheCtx, writeFn = sdkCtx.CacheContext() cb := k.Router.Route(pd.DestinationPort) - res := cb.OnRecvPacket(cacheCtx, msg.Packet.SourceChannel, msg.Packet.DestinationChannel, msg.Packet.Sequence, pd, signer) + res := cb.OnRecvPacket(cacheCtx, msg.Packet.SourceClient, msg.Packet.DestinationClient, msg.Packet.Sequence, pd, signer) if res.Status != types.PacketStatus_Failure { // write application state changes for asynchronous and successful acknowledgements @@ -169,8 +123,8 @@ func (k *Keeper) RecvPacket(ctx context.Context, msg *types.MsgRecvPacket) (*typ // note this should never happen as the payload would have had to be empty. if len(ack.AppAcknowledgements) == 0 { - sdkCtx.Logger().Error("receive packet failed", "source-channel", msg.Packet.SourceChannel, "error", errorsmod.Wrap(err, "invalid acknowledgement results")) - return &types.MsgRecvPacketResponse{Result: types.FAILURE}, errorsmod.Wrapf(err, "receive packet failed source-channel %s invalid acknowledgement results", msg.Packet.SourceChannel) + sdkCtx.Logger().Error("receive packet failed", "source-client", msg.Packet.SourceClient, "error", errorsmod.Wrap(err, "invalid acknowledgement results")) + return &types.MsgRecvPacketResponse{Result: types.FAILURE}, errorsmod.Wrapf(err, "receive packet failed source-client %s invalid acknowledgement results", msg.Packet.SourceClient) } if !isAsync { @@ -189,7 +143,7 @@ func (k *Keeper) RecvPacket(ctx context.Context, msg *types.MsgRecvPacket) (*typ // TODO: store the packet for async applications to access if required. defer telemetry.ReportRecvPacket(msg.Packet) - sdkCtx.Logger().Info("receive packet callback succeeded", "source-channel", msg.Packet.SourceChannel, "dest-channel", msg.Packet.DestinationChannel, "result", types.SUCCESS.String()) + sdkCtx.Logger().Info("receive packet callback succeeded", "source-client", msg.Packet.SourceClient, "dest-client", msg.Packet.DestinationClient, "result", types.SUCCESS.String()) return &types.MsgRecvPacketResponse{Result: types.SUCCESS}, nil } @@ -209,19 +163,19 @@ func (k *Keeper) Acknowledgement(ctx context.Context, msg *types.MsgAcknowledgem case nil: writeFn() case types.ErrNoOpMsg: - sdkCtx.Logger().Debug("no-op on redundant relay", "source-channel", msg.Packet.SourceChannel) + sdkCtx.Logger().Debug("no-op on redundant relay", "source-client", msg.Packet.SourceClient) return &types.MsgAcknowledgementResponse{Result: types.NOOP}, nil default: - sdkCtx.Logger().Error("acknowledgement failed", "source-channel", msg.Packet.SourceChannel, "error", errorsmod.Wrap(err, "acknowledge packet verification failed")) + sdkCtx.Logger().Error("acknowledgement failed", "source-client", msg.Packet.SourceClient, "error", errorsmod.Wrap(err, "acknowledge packet verification failed")) return nil, errorsmod.Wrap(err, "acknowledge packet verification failed") } for i, pd := range msg.Packet.Payloads { cbs := k.Router.Route(pd.SourcePort) ack := msg.Acknowledgement.AppAcknowledgements[i] - err := cbs.OnAcknowledgementPacket(ctx, msg.Packet.SourceChannel, msg.Packet.DestinationChannel, msg.Packet.Sequence, ack, pd, relayer) + err := cbs.OnAcknowledgementPacket(ctx, msg.Packet.SourceClient, msg.Packet.DestinationClient, msg.Packet.Sequence, ack, pd, relayer) if err != nil { - return nil, errorsmod.Wrapf(err, "failed OnAcknowledgementPacket for source port %s, source channel %s, destination channel %s", pd.SourcePort, msg.Packet.SourceChannel, msg.Packet.DestinationChannel) + return nil, errorsmod.Wrapf(err, "failed OnAcknowledgementPacket for source port %s, source client %s, destination client %s", pd.SourcePort, msg.Packet.SourceClient, msg.Packet.DestinationClient) } } @@ -242,26 +196,26 @@ func (k *Keeper) Timeout(ctx context.Context, timeout *types.MsgTimeout) (*types cacheCtx, writeFn := sdkCtx.CacheContext() if err := k.timeoutPacket(cacheCtx, timeout.Packet, timeout.ProofUnreceived, timeout.ProofHeight); err != nil { - sdkCtx.Logger().Error("Timeout packet failed", "source-channel", timeout.Packet.SourceChannel, "destination-channel", timeout.Packet.DestinationChannel, "error", errorsmod.Wrap(err, "timeout packet failed")) - return nil, errorsmod.Wrapf(err, "timeout packet failed for source id: %s and destination id: %s", timeout.Packet.SourceChannel, timeout.Packet.DestinationChannel) + sdkCtx.Logger().Error("Timeout packet failed", "source-client", timeout.Packet.SourceClient, "destination-client", timeout.Packet.DestinationClient, "error", errorsmod.Wrap(err, "timeout packet failed")) + return nil, errorsmod.Wrapf(err, "timeout packet failed for source id: %s and destination id: %s", timeout.Packet.SourceClient, timeout.Packet.DestinationClient) } switch err { case nil: writeFn() case types.ErrNoOpMsg: - sdkCtx.Logger().Debug("no-op on redundant relay", "source-channel", timeout.Packet.SourceChannel) + sdkCtx.Logger().Debug("no-op on redundant relay", "source-client", timeout.Packet.SourceClient) return &types.MsgTimeoutResponse{Result: types.NOOP}, nil default: - sdkCtx.Logger().Error("timeout failed", "source-channel", timeout.Packet.SourceChannel, "error", errorsmod.Wrap(err, "timeout packet verification failed")) + sdkCtx.Logger().Error("timeout failed", "source-client", timeout.Packet.SourceClient, "error", errorsmod.Wrap(err, "timeout packet verification failed")) return nil, errorsmod.Wrap(err, "timeout packet verification failed") } for _, pd := range timeout.Packet.Payloads { cbs := k.Router.Route(pd.SourcePort) - err := cbs.OnTimeoutPacket(ctx, timeout.Packet.SourceChannel, timeout.Packet.DestinationChannel, timeout.Packet.Sequence, pd, signer) + err := cbs.OnTimeoutPacket(ctx, timeout.Packet.SourceClient, timeout.Packet.DestinationClient, timeout.Packet.Sequence, pd, signer) if err != nil { - return nil, errorsmod.Wrapf(err, "failed OnTimeoutPacket for source port %s, source channel %s, destination channel %s", pd.SourcePort, timeout.Packet.SourceChannel, timeout.Packet.DestinationChannel) + return nil, errorsmod.Wrapf(err, "failed OnTimeoutPacket for source port %s, source client %s, destination client %s", pd.SourcePort, timeout.Packet.SourceClient, timeout.Packet.DestinationClient) } } diff --git a/modules/core/04-channel/v2/keeper/msg_server_test.go b/modules/core/04-channel/v2/keeper/msg_server_test.go index 58dc3126dbd..6e02db44f75 100644 --- a/modules/core/04-channel/v2/keeper/msg_server_test.go +++ b/modules/core/04-channel/v2/keeper/msg_server_test.go @@ -11,94 +11,11 @@ import ( clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types" commitmenttypes "github.com/cosmos/ibc-go/v9/modules/core/23-commitment/types" - ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors" ibctesting "github.com/cosmos/ibc-go/v9/testing" "github.com/cosmos/ibc-go/v9/testing/mock" mockv2 "github.com/cosmos/ibc-go/v9/testing/mock/v2" ) -func (suite *KeeperTestSuite) TestRegisterCounterparty() { - var ( - path *ibctesting.Path - msg *types.MsgRegisterCounterparty - ) - cases := []struct { - name string - malleate func() - expError error - }{ - { - "success", - func() { - // set it before handler - suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetChannel(suite.chainA.GetContext(), msg.ChannelId, types.NewChannel(path.EndpointA.ClientID, "", ibctesting.MerklePath)) - }, - nil, - }, - { - "failure: creator not set", - func() { - suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.DeleteCreator(suite.chainA.GetContext(), path.EndpointA.ChannelID) - }, - ibcerrors.ErrUnauthorized, - }, - { - "failure: signer does not match creator", - func() { - suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetCreator(suite.chainA.GetContext(), path.EndpointA.ChannelID, ibctesting.TestAccAddress) - }, - ibcerrors.ErrUnauthorized, - }, - { - "failure: channel must already exist", - func() { - suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.DeleteCreator(suite.chainA.GetContext(), path.EndpointA.ChannelID) - suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.ChannelStore(suite.chainA.GetContext()).Delete([]byte(path.EndpointA.ChannelID)) - }, - types.ErrChannelNotFound, - }, - } - - for _, tc := range cases { - suite.Run(tc.name, func() { - suite.SetupTest() - - path = ibctesting.NewPath(suite.chainA, suite.chainB) - path.SetupClients() - - suite.Require().NoError(path.EndpointA.CreateChannel()) - suite.Require().NoError(path.EndpointB.CreateChannel()) - - signer := path.EndpointA.Chain.SenderAccount.GetAddress().String() - msg = types.NewMsgRegisterCounterparty(path.EndpointA.ChannelID, path.EndpointB.ChannelID, signer) - - tc.malleate() - - res, err := path.EndpointA.Chain.SendMsgs(msg) - - expPass := tc.expError == nil - if expPass { - suite.Require().NotNil(res) - suite.Require().Nil(err) - - // Assert counterparty channel id filled in and creator deleted - channel, found := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.GetChannel(suite.chainA.GetContext(), path.EndpointA.ChannelID) - suite.Require().True(found) - suite.Require().Equal(channel.CounterpartyChannelId, path.EndpointB.ChannelID) - - _, found = suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.GetCreator(suite.chainA.GetContext(), path.EndpointA.ChannelID) - suite.Require().False(found) - - seq, found := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.GetNextSequenceSend(suite.chainA.GetContext(), path.EndpointA.ChannelID) - suite.Require().True(found) - suite.Require().Equal(seq, uint64(1)) - } else { - ibctesting.RequireErrorIsOrContains(suite.T(), err, tc.expError, "expected error %q, got %q instead", tc.expError, err) - } - }) - } -} - func (suite *KeeperTestSuite) TestMsgSendPacket() { var ( path *ibctesting.Path @@ -122,7 +39,7 @@ func (suite *KeeperTestSuite) TestMsgSendPacket() { malleate: func() { // ensure a message timeout. timeoutTimestamp = uint64(suite.chainA.GetContext().BlockTime().Add(types.MaxTimeoutDelta - 10*time.Second).Unix()) - expectedPacket = types.NewPacket(1, path.EndpointA.ChannelID, path.EndpointB.ChannelID, timeoutTimestamp, payload) + expectedPacket = types.NewPacket(1, path.EndpointA.ClientID, path.EndpointB.ClientID, timeoutTimestamp, payload) }, expError: nil, }, @@ -167,11 +84,11 @@ func (suite *KeeperTestSuite) TestMsgSendPacket() { expError: mock.MockApplicationCallbackError, }, { - name: "failure: channel not found", + name: "failure: client not found", malleate: func() { - path.EndpointA.ChannelID = ibctesting.InvalidID + path.EndpointA.ClientID = ibctesting.InvalidID }, - expError: types.ErrChannelNotFound, + expError: clienttypes.ErrCounterpartyNotFound, }, { name: "failure: route to non existing app", @@ -194,7 +111,7 @@ func (suite *KeeperTestSuite) TestMsgSendPacket() { timeoutTimestamp = suite.chainA.GetTimeoutTimestampSecs() payload = mockv2.NewMockPayload(mockv2.ModuleNameA, mockv2.ModuleNameB) - expectedPacket = types.NewPacket(1, path.EndpointA.ChannelID, path.EndpointB.ChannelID, timeoutTimestamp, payload) + expectedPacket = types.NewPacket(1, path.EndpointA.ClientID, path.EndpointB.ClientID, timeoutTimestamp, payload) tc.malleate() @@ -207,11 +124,11 @@ func (suite *KeeperTestSuite) TestMsgSendPacket() { ck := path.EndpointA.Chain.GetSimApp().IBCKeeper.ChannelKeeperV2 - packetCommitment := ck.GetPacketCommitment(path.EndpointA.Chain.GetContext(), path.EndpointA.ChannelID, 1) + packetCommitment := ck.GetPacketCommitment(path.EndpointA.Chain.GetContext(), path.EndpointA.ClientID, 1) suite.Require().NotNil(packetCommitment) suite.Require().Equal(types.CommitPacket(expectedPacket), packetCommitment, "packet commitment is not stored correctly") - nextSequenceSend, ok := ck.GetNextSequenceSend(path.EndpointA.Chain.GetContext(), path.EndpointA.ChannelID) + nextSequenceSend, ok := ck.GetNextSequenceSend(path.EndpointA.Chain.GetContext(), path.EndpointA.ClientID) suite.Require().True(ok) suite.Require().Equal(uint64(2), nextSequenceSend, "next sequence send was not incremented correctly") @@ -269,7 +186,7 @@ func (suite *KeeperTestSuite) TestMsgRecvPacket() { { name: "success: NoOp", malleate: func() { - suite.chainB.App.GetIBCKeeper().ChannelKeeperV2.SetPacketReceipt(suite.chainB.GetContext(), packet.DestinationChannel, packet.Sequence) + suite.chainB.App.GetIBCKeeper().ChannelKeeperV2.SetPacketReceipt(suite.chainB.GetContext(), packet.DestinationClient, packet.Sequence) }, expError: nil, expAckWritten: false, @@ -278,9 +195,9 @@ func (suite *KeeperTestSuite) TestMsgRecvPacket() { name: "failure: counterparty not found", malleate: func() { // change the destination id to a non-existent channel. - packet.DestinationChannel = ibctesting.InvalidID + packet.DestinationClient = ibctesting.InvalidID }, - expError: types.ErrChannelNotFound, + expError: clienttypes.ErrCounterpartyNotFound, }, { name: "failure: invalid proof", @@ -339,10 +256,10 @@ func (suite *KeeperTestSuite) TestMsgRecvPacket() { suite.Require().NoError(err) // packet receipt should be written - _, ok := ck.GetPacketReceipt(path.EndpointB.Chain.GetContext(), packet.DestinationChannel, packet.Sequence) + _, ok := ck.GetPacketReceipt(path.EndpointB.Chain.GetContext(), packet.DestinationClient, packet.Sequence) suite.Require().True(ok) - ackWritten := ck.HasPacketAcknowledgement(path.EndpointB.Chain.GetContext(), packet.DestinationChannel, packet.Sequence) + ackWritten := ck.HasPacketAcknowledgement(path.EndpointB.Chain.GetContext(), packet.DestinationClient, packet.Sequence) if !tc.expAckWritten { // ack should not be written for async app or if the packet receipt was already present. @@ -352,13 +269,13 @@ func (suite *KeeperTestSuite) TestMsgRecvPacket() { suite.Require().True(ackWritten) expectedBz := types.CommitAcknowledgement(expectedAck) - actualAckBz := ck.GetPacketAcknowledgement(path.EndpointB.Chain.GetContext(), packet.DestinationChannel, packet.Sequence) + actualAckBz := ck.GetPacketAcknowledgement(path.EndpointB.Chain.GetContext(), packet.DestinationClient, packet.Sequence) suite.Require().Equal(expectedBz, actualAckBz) } } else { ibctesting.RequireErrorIsOrContains(suite.T(), err, tc.expError) - _, ok := ck.GetPacketReceipt(path.EndpointB.Chain.GetContext(), packet.SourceChannel, packet.Sequence) + _, ok := ck.GetPacketReceipt(path.EndpointB.Chain.GetContext(), packet.SourceClient, packet.Sequence) suite.Require().False(ok) } }) @@ -383,7 +300,7 @@ func (suite *KeeperTestSuite) TestMsgAcknowledgement() { { name: "success: NoOp", malleate: func() { - suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.DeletePacketCommitment(suite.chainA.GetContext(), packet.SourceChannel, packet.Sequence) + suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.DeletePacketCommitment(suite.chainA.GetContext(), packet.SourceClient, packet.Sequence) // Modify the callback to return an error. // This way, we can verify that the callback is not executed in a No-op case. @@ -405,14 +322,14 @@ func (suite *KeeperTestSuite) TestMsgAcknowledgement() { name: "failure: counterparty not found", malleate: func() { // change the source id to a non-existent channel. - packet.SourceChannel = "not-existent-channel" + packet.SourceClient = "not-existent-channel" }, - expError: types.ErrChannelNotFound, + expError: clienttypes.ErrCounterpartyNotFound, }, { name: "failure: invalid commitment", malleate: func() { - suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetPacketCommitment(suite.chainA.GetContext(), packet.SourceChannel, packet.Sequence, []byte("foo")) + suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetPacketCommitment(suite.chainA.GetContext(), packet.SourceClient, packet.Sequence, []byte("foo")) }, expError: types.ErrInvalidPacket, }, @@ -477,7 +394,7 @@ func (suite *KeeperTestSuite) TestMsgTimeout() { { name: "failure: no-op", malleate: func() { - suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.DeletePacketCommitment(suite.chainA.GetContext(), packet.SourceChannel, packet.Sequence) + suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.DeletePacketCommitment(suite.chainA.GetContext(), packet.SourceClient, packet.Sequence) // Modify the callback to return a different error. // This way, we can verify that the callback is not executed in a No-op case. @@ -497,24 +414,24 @@ func (suite *KeeperTestSuite) TestMsgTimeout() { expError: mock.MockApplicationCallbackError, }, { - name: "failure: channel not found", + name: "failure: client not found", malleate: func() { - // change the source id to a non-existent channel. - packet.SourceChannel = "not-existent-channel" + // change the source id to a non-existent client. + packet.SourceClient = "not-existent-client" }, - expError: types.ErrChannelNotFound, + expError: clienttypes.ErrCounterpartyNotFound, }, { name: "failure: invalid commitment", malleate: func() { - suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetPacketCommitment(suite.chainA.GetContext(), packet.SourceChannel, packet.Sequence, []byte("foo")) + suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetPacketCommitment(suite.chainA.GetContext(), packet.SourceClient, packet.Sequence, []byte("foo")) }, expError: types.ErrInvalidPacket, }, { name: "failure: unable to timeout if packet has been received", malleate: func() { - suite.chainB.App.GetIBCKeeper().ChannelKeeperV2.SetPacketReceipt(suite.chainB.GetContext(), packet.DestinationChannel, packet.Sequence) + suite.chainB.App.GetIBCKeeper().ChannelKeeperV2.SetPacketReceipt(suite.chainB.GetContext(), packet.DestinationClient, packet.Sequence) suite.Require().NoError(path.EndpointB.UpdateClient()) }, expError: commitmenttypes.ErrInvalidProof, diff --git a/modules/core/04-channel/v2/keeper/packet.go b/modules/core/04-channel/v2/keeper/packet.go index ef396bca6a5..ce00443cfe9 100644 --- a/modules/core/04-channel/v2/keeper/packet.go +++ b/modules/core/04-channel/v2/keeper/packet.go @@ -11,6 +11,7 @@ import ( clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types" + commitmenttypes "github.com/cosmos/ibc-go/v9/modules/core/23-commitment/types" hostv2 "github.com/cosmos/ibc-go/v9/modules/core/24-host/v2" "github.com/cosmos/ibc-go/v9/modules/core/exported" ) @@ -19,50 +20,40 @@ import ( // in order for the packet to be sent to the counterparty. func (k *Keeper) sendPacket( ctx context.Context, - sourceChannel string, + sourceClient string, timeoutTimestamp uint64, payloads []types.Payload, ) (uint64, string, error) { - // Lookup channel associated with our source channel to retrieve the destination channel - channel, ok := k.GetChannel(ctx, sourceChannel) + // lookup counterparty from client identifiers + counterparty, ok := k.ClientKeeper.GetClientCounterparty(ctx, sourceClient) if !ok { - // TODO: figure out how aliasing will work when more than one payload is sent. - channel, ok = k.convertV1Channel(ctx, payloads[0].SourcePort, sourceChannel) - if !ok { - return 0, "", errorsmod.Wrap(types.ErrChannelNotFound, sourceChannel) - } + return 0, "", errorsmod.Wrapf(clienttypes.ErrCounterpartyNotFound, "counterparty not found for client: %s", sourceClient) } - destChannel := channel.CounterpartyChannelId - clientID := channel.ClientId - - sequence, found := k.GetNextSequenceSend(ctx, sourceChannel) + sequence, found := k.GetNextSequenceSend(ctx, sourceClient) if !found { - return 0, "", errorsmod.Wrapf( - types.ErrSequenceSendNotFound, - "source channel: %s", sourceChannel, - ) + return 0, "", errorsmod.Wrapf(types.ErrSequenceSendNotFound, "source client: %s", sourceClient) } // construct packet from given fields and channel state - packet := types.NewPacket(sequence, sourceChannel, destChannel, timeoutTimestamp, payloads...) + packet := types.NewPacket(sequence, sourceClient, counterparty.ClientId, timeoutTimestamp, payloads...) if err := packet.ValidateBasic(); err != nil { return 0, "", errorsmod.Wrapf(types.ErrInvalidPacket, "constructed packet failed basic validation: %v", err) } // check that the client of counterparty chain is still active - if status := k.ClientKeeper.GetClientStatus(ctx, clientID); status != exported.Active { - return 0, "", errorsmod.Wrapf(clienttypes.ErrClientNotActive, "client (%s) status is %s", clientID, status) + if status := k.ClientKeeper.GetClientStatus(ctx, sourceClient); status != exported.Active { + return 0, "", errorsmod.Wrapf(clienttypes.ErrClientNotActive, "client (%s) status is %s", sourceClient, status) } // retrieve latest height and timestamp of the client of counterparty chain - latestHeight := k.ClientKeeper.GetClientLatestHeight(ctx, clientID) + latestHeight := k.ClientKeeper.GetClientLatestHeight(ctx, sourceClient) if latestHeight.IsZero() { - return 0, "", errorsmod.Wrapf(clienttypes.ErrInvalidHeight, "cannot send packet using client (%s) with zero height", clientID) + return 0, "", errorsmod.Wrapf(clienttypes.ErrInvalidHeight, "cannot send packet using client (%s) with zero height", sourceClient) } - latestTimestamp, err := k.ClientKeeper.GetClientTimestampAtHeight(ctx, clientID, latestHeight) + latestTimestamp, err := k.ClientKeeper.GetClientTimestampAtHeight(ctx, sourceClient, latestHeight) if err != nil { return 0, "", err } @@ -77,14 +68,14 @@ func (k *Keeper) sendPacket( commitment := types.CommitPacket(packet) // bump the sequence and set the packet commitment, so it is provable by the counterparty - k.SetNextSequenceSend(ctx, sourceChannel, sequence+1) - k.SetPacketCommitment(ctx, sourceChannel, packet.GetSequence(), commitment) + k.SetNextSequenceSend(ctx, sourceClient, sequence+1) + k.SetPacketCommitment(ctx, sourceClient, packet.GetSequence(), commitment) - k.Logger(ctx).Info("packet sent", "sequence", strconv.FormatUint(packet.Sequence, 10), "dest_channel_id", packet.DestinationChannel, "src_channel_id", packet.SourceChannel) + k.Logger(ctx).Info("packet sent", "sequence", strconv.FormatUint(packet.Sequence, 10), "dst_client_id", packet.DestinationClient, "src_client_id", packet.SourceClient) emitSendPacketEvents(ctx, packet) - return sequence, destChannel, nil + return sequence, counterparty.ClientId, nil } // recvPacket implements the packet receiving logic required by a packet handler. @@ -100,21 +91,16 @@ func (k *Keeper) recvPacket( proof []byte, proofHeight exported.Height, ) error { - channel, ok := k.GetChannel(ctx, packet.DestinationChannel) + // lookup counterparty from client identifiers + counterparty, ok := k.ClientKeeper.GetClientCounterparty(ctx, packet.DestinationClient) if !ok { - // TODO: figure out how aliasing will work when more than one payload is sent. - channel, ok = k.convertV1Channel(ctx, packet.Payloads[0].DestinationPort, packet.DestinationChannel) - if !ok { - return errorsmod.Wrap(types.ErrChannelNotFound, packet.DestinationChannel) - } + return errorsmod.Wrapf(clienttypes.ErrCounterpartyNotFound, "counterparty not found for client: %s", packet.DestinationClient) } - if channel.CounterpartyChannelId != packet.SourceChannel { - return errorsmod.Wrapf(types.ErrInvalidChannelIdentifier, "counterparty channel id (%s) does not match packet source channel id (%s)", channel.CounterpartyChannelId, packet.SourceChannel) + if counterparty.ClientId != packet.SourceClient { + return errorsmod.Wrapf(clienttypes.ErrInvalidCounterparty, "counterparty id (%s) does not match packet source id (%s)", counterparty.ClientId, packet.SourceClient) } - clientID := channel.ClientId - // check if packet timed out by comparing it with the latest height of the chain sdkCtx := sdk.UnwrapSDKContext(ctx) currentTimestamp := uint64(sdkCtx.BlockTime().Unix()) @@ -123,36 +109,37 @@ func (k *Keeper) recvPacket( } // REPLAY PROTECTION: Packet receipts will indicate that a packet has already been received - // on unordered channels. Packet receipts must not be pruned, unless it has been marked stale + // Packet receipts must not be pruned, unless it has been marked stale // by the increase of the recvStartSequence. - if k.HasPacketReceipt(ctx, packet.DestinationChannel, packet.Sequence) { + if k.HasPacketReceipt(ctx, packet.DestinationClient, packet.Sequence) { // This error indicates that the packet has already been relayed. Core IBC will // treat this error as a no-op in order to prevent an entire relay transaction // from failing and consuming unnecessary fees. return types.ErrNoOpMsg } - path := hostv2.PacketCommitmentKey(packet.SourceChannel, packet.Sequence) - merklePath := types.BuildMerklePath(channel.MerklePathPrefix, path) + path := hostv2.PacketCommitmentKey(packet.SourceClient, packet.Sequence) + merklePrefix := commitmenttypes.NewMerklePath(counterparty.MerklePrefix...) + merklePath := types.BuildMerklePath(merklePrefix, path) commitment := types.CommitPacket(packet) if err := k.ClientKeeper.VerifyMembership( ctx, - clientID, + packet.DestinationClient, proofHeight, 0, 0, proof, merklePath, commitment, ); err != nil { - return errorsmod.Wrapf(err, "failed packet commitment verification for client (%s)", clientID) + return errorsmod.Wrapf(err, "failed packet commitment verification for client (%s)", packet.DestinationClient) } // Set Packet Receipt to prevent timeout from occurring on counterparty - k.SetPacketReceipt(ctx, packet.DestinationChannel, packet.Sequence) + k.SetPacketReceipt(ctx, packet.DestinationClient, packet.Sequence) - k.Logger(ctx).Info("packet received", "sequence", strconv.FormatUint(packet.Sequence, 10), "src_id", packet.SourceChannel, "dst_id", packet.DestinationChannel) + k.Logger(ctx).Info("packet received", "sequence", strconv.FormatUint(packet.Sequence, 10), "src_client_id", packet.SourceClient, "dst_client_id", packet.DestinationClient) emitRecvPacketEvents(ctx, packet) @@ -166,36 +153,34 @@ func (k Keeper) WriteAcknowledgement( packet types.Packet, ack types.Acknowledgement, ) error { - // Lookup channel associated with destination channel ID and ensure - // that the packet was indeed sent by our counterparty by verifying - // packet sender is our channel's counterparty channel id. - channel, ok := k.GetChannel(ctx, packet.DestinationChannel) + // lookup counterparty from client identifiers + counterparty, ok := k.ClientKeeper.GetClientCounterparty(ctx, packet.DestinationClient) if !ok { - return errorsmod.Wrapf(types.ErrChannelNotFound, "channel (%s) not found", packet.DestinationChannel) + return errorsmod.Wrapf(clienttypes.ErrCounterpartyNotFound, "counterparty not found for client: %s", packet.DestinationClient) } - if channel.CounterpartyChannelId != packet.SourceChannel { - return errorsmod.Wrapf(types.ErrInvalidChannelIdentifier, "counterparty channel id (%s) does not match packet source channel id (%s)", channel.CounterpartyChannelId, packet.SourceChannel) + if counterparty.ClientId != packet.SourceClient { + return errorsmod.Wrapf(clienttypes.ErrInvalidCounterparty, "counterparty id (%s) does not match packet source id (%s)", counterparty.ClientId, packet.SourceClient) } // NOTE: IBC app modules might have written the acknowledgement synchronously on // the OnRecvPacket callback so we need to check if the acknowledgement is already // set on the store and return an error if so. - if k.HasPacketAcknowledgement(ctx, packet.DestinationChannel, packet.Sequence) { - return errorsmod.Wrapf(types.ErrAcknowledgementExists, "acknowledgement for channel %s, sequence %d already exists", packet.DestinationChannel, packet.Sequence) + if k.HasPacketAcknowledgement(ctx, packet.DestinationClient, packet.Sequence) { + return errorsmod.Wrapf(types.ErrAcknowledgementExists, "acknowledgement for id %s, sequence %d already exists", packet.DestinationClient, packet.Sequence) } - if _, found := k.GetPacketReceipt(ctx, packet.DestinationChannel, packet.Sequence); !found { + if _, found := k.GetPacketReceipt(ctx, packet.DestinationClient, packet.Sequence); !found { return errorsmod.Wrap(types.ErrInvalidPacket, "receipt not found for packet") } // set the acknowledgement so that it can be verified on the other side k.SetPacketAcknowledgement( - ctx, packet.DestinationChannel, packet.Sequence, + ctx, packet.DestinationClient, packet.Sequence, types.CommitAcknowledgement(ack), ) - k.Logger(ctx).Info("acknowledgement written", "sequence", strconv.FormatUint(packet.Sequence, 10), "dest-channel", packet.DestinationChannel) + k.Logger(ctx).Info("acknowledgement written", "sequence", strconv.FormatUint(packet.Sequence, 10), "dst_client_id", packet.DestinationClient) emitWriteAcknowledgementEvents(ctx, packet, ack) @@ -205,20 +190,17 @@ func (k Keeper) WriteAcknowledgement( } func (k *Keeper) acknowledgePacket(ctx context.Context, packet types.Packet, acknowledgement types.Acknowledgement, proof []byte, proofHeight exported.Height) error { - // Lookup counterparty associated with our channel and ensure - // that the packet was indeed sent by our counterparty. - channel, ok := k.GetChannel(ctx, packet.SourceChannel) + // lookup counterparty from client identifiers + counterparty, ok := k.ClientKeeper.GetClientCounterparty(ctx, packet.SourceClient) if !ok { - return errorsmod.Wrap(types.ErrChannelNotFound, packet.SourceChannel) + return errorsmod.Wrapf(clienttypes.ErrCounterpartyNotFound, "counterparty not found for client: %s", packet.SourceClient) } - if channel.CounterpartyChannelId != packet.DestinationChannel { - return errorsmod.Wrapf(types.ErrInvalidChannelIdentifier, "counterparty channel id (%s) does not match packet destination channel id (%s)", channel.CounterpartyChannelId, packet.DestinationChannel) + if counterparty.ClientId != packet.DestinationClient { + return errorsmod.Wrapf(clienttypes.ErrInvalidCounterparty, "counterparty id (%s) does not match packet destination id (%s)", counterparty.ClientId, packet.DestinationClient) } - clientID := channel.ClientId - - commitment := k.GetPacketCommitment(ctx, packet.SourceChannel, packet.Sequence) + commitment := k.GetPacketCommitment(ctx, packet.SourceClient, packet.Sequence) if len(commitment) == 0 { // This error indicates that the acknowledgement has already been relayed // or there is a misconfigured relayer attempting to prove an acknowledgement @@ -234,24 +216,25 @@ func (k *Keeper) acknowledgePacket(ctx context.Context, packet types.Packet, ack return errorsmod.Wrapf(types.ErrInvalidPacket, "commitment bytes are not equal: got (%v), expected (%v)", packetCommitment, commitment) } - path := hostv2.PacketAcknowledgementKey(packet.DestinationChannel, packet.Sequence) - merklePath := types.BuildMerklePath(channel.MerklePathPrefix, path) + path := hostv2.PacketAcknowledgementKey(packet.DestinationClient, packet.Sequence) + merklePrefix := commitmenttypes.NewMerklePath(counterparty.MerklePrefix...) + merklePath := types.BuildMerklePath(merklePrefix, path) if err := k.ClientKeeper.VerifyMembership( ctx, - clientID, + packet.SourceClient, proofHeight, 0, 0, proof, merklePath, types.CommitAcknowledgement(acknowledgement), ); err != nil { - return errorsmod.Wrapf(err, "failed packet acknowledgement verification for client (%s)", clientID) + return errorsmod.Wrapf(err, "failed packet acknowledgement verification for client (%s)", packet.SourceClient) } - k.DeletePacketCommitment(ctx, packet.SourceChannel, packet.Sequence) + k.DeletePacketCommitment(ctx, packet.SourceClient, packet.Sequence) - k.Logger(ctx).Info("packet acknowledged", "sequence", strconv.FormatUint(packet.GetSequence(), 10), "source_channel_id", packet.GetSourceChannel(), "destination_channel_id", packet.GetDestinationChannel()) + k.Logger(ctx).Info("packet acknowledged", "sequence", strconv.FormatUint(packet.GetSequence(), 10), "src_client_id", packet.GetSourceClient(), "dst_client_id", packet.GetDestinationClient()) emitAcknowledgePacketEvents(ctx, packet) @@ -271,19 +254,18 @@ func (k *Keeper) timeoutPacket( proof []byte, proofHeight exported.Height, ) error { - channel, ok := k.GetChannel(ctx, packet.SourceChannel) + // lookup counterparty from client identifiers + counterparty, ok := k.ClientKeeper.GetClientCounterparty(ctx, packet.SourceClient) if !ok { - return errorsmod.Wrap(types.ErrChannelNotFound, packet.SourceChannel) + return errorsmod.Wrapf(clienttypes.ErrCounterpartyNotFound, "counterparty not found for client: %s", packet.SourceClient) } - if channel.CounterpartyChannelId != packet.DestinationChannel { - return errorsmod.Wrapf(types.ErrInvalidChannelIdentifier, "counterparty channel id (%s) does not match packet destination channel id (%s)", channel.CounterpartyChannelId, packet.DestinationChannel) + if counterparty.ClientId != packet.DestinationClient { + return errorsmod.Wrapf(clienttypes.ErrInvalidCounterparty, "counterparty id (%s) does not match packet destination id (%s)", counterparty.ClientId, packet.DestinationClient) } - clientID := channel.ClientId - // check that timeout height or timeout timestamp has passed on the other end - proofTimestamp, err := k.ClientKeeper.GetClientTimestampAtHeight(ctx, clientID, proofHeight) + proofTimestamp, err := k.ClientKeeper.GetClientTimestampAtHeight(ctx, packet.SourceClient, proofHeight) if err != nil { return err } @@ -294,7 +276,7 @@ func (k *Keeper) timeoutPacket( } // check that the commitment has not been cleared and that it matches the packet sent by relayer - commitment := k.GetPacketCommitment(ctx, packet.SourceChannel, packet.Sequence) + commitment := k.GetPacketCommitment(ctx, packet.SourceClient, packet.Sequence) if len(commitment) == 0 { // This error indicates that the timeout has already been relayed // or there is a misconfigured relayer attempting to prove a timeout @@ -310,24 +292,25 @@ func (k *Keeper) timeoutPacket( } // verify packet receipt absence - path := hostv2.PacketReceiptKey(packet.DestinationChannel, packet.Sequence) - merklePath := types.BuildMerklePath(channel.MerklePathPrefix, path) + path := hostv2.PacketReceiptKey(packet.DestinationClient, packet.Sequence) + merklePrefix := commitmenttypes.NewMerklePath(counterparty.MerklePrefix...) + merklePath := types.BuildMerklePath(merklePrefix, path) if err := k.ClientKeeper.VerifyNonMembership( ctx, - clientID, + packet.SourceClient, proofHeight, 0, 0, proof, merklePath, ); err != nil { - return errorsmod.Wrapf(err, "failed packet receipt absence verification for client (%s)", clientID) + return errorsmod.Wrapf(err, "failed packet receipt absence verification for client (%s)", packet.SourceClient) } // delete packet commitment to prevent replay - k.DeletePacketCommitment(ctx, packet.SourceChannel, packet.Sequence) + k.DeletePacketCommitment(ctx, packet.SourceClient, packet.Sequence) - k.Logger(ctx).Info("packet timed out", "sequence", strconv.FormatUint(packet.Sequence, 10), "src_channel_id", packet.SourceChannel, "dst_channel_id", packet.DestinationChannel) + k.Logger(ctx).Info("packet timed out", "sequence", strconv.FormatUint(packet.Sequence, 10), "src_client_id", packet.SourceClient, "dst_client_id", packet.DestinationClient) emitTimeoutPacketEvents(ctx, packet) diff --git a/modules/core/04-channel/v2/keeper/packet_test.go b/modules/core/04-channel/v2/keeper/packet_test.go index eb826bd3b0d..4c988d2ee69 100644 --- a/modules/core/04-channel/v2/keeper/packet_test.go +++ b/modules/core/04-channel/v2/keeper/packet_test.go @@ -36,24 +36,24 @@ func (suite *KeeperTestSuite) TestSendPacket() { "success with later packet", func() { // send the same packet earlier so next packet send should be sequence 2 - _, _, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceChannel, packet.TimeoutTimestamp, packet.Payloads) + _, _, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceClient, packet.TimeoutTimestamp, packet.Payloads) suite.Require().NoError(err) expSequence = 2 }, nil, }, { - "channel not found", + "client not found", func() { - packet.SourceChannel = ibctesting.InvalidID + packet.SourceClient = ibctesting.InvalidID }, - types.ErrChannelNotFound, + clienttypes.ErrCounterpartyNotFound, }, { "packet failed basic validation", func() { // invalid data - packet.Payloads = nil + packet.Payloads[0].SourcePort = "" }, types.ErrInvalidPacket, }, @@ -101,7 +101,7 @@ func (suite *KeeperTestSuite) TestSendPacket() { timeoutTimestamp := uint64(suite.chainB.GetContext().BlockTime().Add(time.Hour).Unix()) // create standard packet that can be malleated - packet = types.NewPacket(1, path.EndpointA.ChannelID, path.EndpointB.ChannelID, + packet = types.NewPacket(1, path.EndpointA.ClientID, path.EndpointB.ClientID, timeoutTimestamp, payload) expSequence = 1 @@ -109,22 +109,22 @@ func (suite *KeeperTestSuite) TestSendPacket() { tc.malleate() // send packet - seq, destChannel, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceChannel, packet.TimeoutTimestamp, packet.Payloads) + seq, destClient, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceClient, packet.TimeoutTimestamp, packet.Payloads) expPass := tc.expError == nil if expPass { suite.Require().NoError(err) // verify send packet method instantiated packet with correct sequence and destination channel suite.Require().Equal(expSequence, seq) - suite.Require().Equal(path.EndpointB.ChannelID, destChannel) + suite.Require().Equal(path.EndpointB.ClientID, destClient) // verify send packet stored the packet commitment correctly expCommitment := types.CommitPacket(packet) - suite.Require().Equal(expCommitment, suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.GetPacketCommitment(suite.chainA.GetContext(), packet.SourceChannel, seq)) + suite.Require().Equal(expCommitment, suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.GetPacketCommitment(suite.chainA.GetContext(), packet.SourceClient, seq)) } else { suite.Require().Error(err) suite.Require().ErrorIs(err, tc.expError) suite.Require().Equal(uint64(0), seq) - suite.Require().Nil(suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.GetPacketCommitment(suite.chainA.GetContext(), packet.SourceChannel, seq)) + suite.Require().Nil(suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.GetPacketCommitment(suite.chainA.GetContext(), packet.SourceClient, seq)) } }) @@ -149,11 +149,11 @@ func (suite *KeeperTestSuite) TestRecvPacket() { nil, }, { - "failure: channel not found", + "failure: client not found", func() { - packet.DestinationChannel = ibctesting.InvalidID + packet.DestinationClient = ibctesting.InvalidID }, - types.ErrChannelNotFound, + clienttypes.ErrCounterpartyNotFound, }, { "failure: client is not active", @@ -163,11 +163,11 @@ func (suite *KeeperTestSuite) TestRecvPacket() { clienttypes.ErrClientNotActive, }, { - "failure: counterparty channel identifier different than source channel", + "failure: counterparty client identifier different than source client", func() { - packet.SourceChannel = unusedChannel + packet.SourceClient = unusedChannel }, - types.ErrInvalidChannelIdentifier, + clienttypes.ErrInvalidCounterparty, }, { "failure: packet has timed out", @@ -179,14 +179,14 @@ func (suite *KeeperTestSuite) TestRecvPacket() { { "failure: packet already received", func() { - suite.chainB.App.GetIBCKeeper().ChannelKeeperV2.SetPacketReceipt(suite.chainB.GetContext(), packet.DestinationChannel, packet.Sequence) + suite.chainB.App.GetIBCKeeper().ChannelKeeperV2.SetPacketReceipt(suite.chainB.GetContext(), packet.DestinationClient, packet.Sequence) }, types.ErrNoOpMsg, }, { "failure: verify membership failed", func() { - suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetPacketCommitment(suite.chainA.GetContext(), packet.SourceChannel, packet.Sequence, []byte("")) + suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetPacketCommitment(suite.chainA.GetContext(), packet.SourceClient, packet.Sequence, []byte("")) suite.coordinator.CommitBlock(path.EndpointA.Chain) suite.Require().NoError(path.EndpointB.UpdateClient()) }, @@ -214,7 +214,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { tc.malleate() // get proof of v2 packet commitment from chainA - packetKey := hostv2.PacketCommitmentKey(packet.GetSourceChannel(), packet.GetSequence()) + packetKey := hostv2.PacketCommitmentKey(packet.GetSourceClient(), packet.GetSequence()) proof, proofHeight := path.EndpointA.QueryProof(packetKey) err = suite.chainB.App.GetIBCKeeper().ChannelKeeperV2.RecvPacketTest(suite.chainB.GetContext(), packet, proof, proofHeight) @@ -223,7 +223,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { if expPass { suite.Require().NoError(err) - _, found := suite.chainB.App.GetIBCKeeper().ChannelKeeperV2.GetPacketReceipt(suite.chainB.GetContext(), packet.DestinationChannel, packet.Sequence) + _, found := suite.chainB.App.GetIBCKeeper().ChannelKeeperV2.GetPacketReceipt(suite.chainB.GetContext(), packet.DestinationClient, packet.Sequence) suite.Require().True(found) } else { suite.Require().Error(err) @@ -250,24 +250,24 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgement() { nil, }, { - "failure: channel not found", + "failure: client not found", func() { - packet.DestinationChannel = ibctesting.InvalidID + packet.DestinationClient = ibctesting.InvalidID }, - types.ErrChannelNotFound, + clienttypes.ErrCounterpartyNotFound, }, { - "failure: counterparty channel identifier different than source channel", + "failure: counterparty client identifier different than source client", func() { - packet.SourceChannel = unusedChannel + packet.SourceClient = unusedChannel }, - types.ErrInvalidChannelIdentifier, + clienttypes.ErrInvalidCounterparty, }, { "failure: ack already exists", func() { ackBz := types.CommitAcknowledgement(ack) - suite.chainB.App.GetIBCKeeper().ChannelKeeperV2.SetPacketAcknowledgement(suite.chainB.GetContext(), packet.DestinationChannel, packet.Sequence, ackBz) + suite.chainB.App.GetIBCKeeper().ChannelKeeperV2.SetPacketAcknowledgement(suite.chainB.GetContext(), packet.DestinationClient, packet.Sequence, ackBz) }, types.ErrAcknowledgementExists, }, @@ -293,7 +293,7 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgement() { timeoutTimestamp := uint64(suite.chainB.GetContext().BlockTime().Add(time.Hour).Unix()) // create standard packet that can be malleated - packet = types.NewPacket(1, path.EndpointA.ChannelID, path.EndpointB.ChannelID, + packet = types.NewPacket(1, path.EndpointA.ClientID, path.EndpointB.ClientID, timeoutTimestamp, payload) // create standard ack that can be malleated @@ -301,7 +301,7 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgement() { AppAcknowledgements: [][]byte{mockv2.MockRecvPacketResult.Acknowledgement}, } - suite.chainB.App.GetIBCKeeper().ChannelKeeperV2.SetPacketReceipt(suite.chainB.GetContext(), packet.DestinationChannel, packet.Sequence) + suite.chainB.App.GetIBCKeeper().ChannelKeeperV2.SetPacketReceipt(suite.chainB.GetContext(), packet.DestinationClient, packet.Sequence) tc.malleate() @@ -311,7 +311,7 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgement() { if expPass { suite.Require().NoError(err) - ackCommitment := suite.chainB.App.GetIBCKeeper().ChannelKeeperV2.GetPacketAcknowledgement(suite.chainB.GetContext(), packet.DestinationChannel, packet.Sequence) + ackCommitment := suite.chainB.App.GetIBCKeeper().ChannelKeeperV2.GetPacketAcknowledgement(suite.chainB.GetContext(), packet.DestinationClient, packet.Sequence) suite.Require().Equal(types.CommitAcknowledgement(ack), ackCommitment) } else { suite.Require().Error(err) @@ -342,23 +342,23 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { nil, }, { - "failure: channel not found", + "failure: client not found", func() { - packet.SourceChannel = ibctesting.InvalidID + packet.SourceClient = ibctesting.InvalidID }, - types.ErrChannelNotFound, + clienttypes.ErrCounterpartyNotFound, }, { - "failure: counterparty channel identifier different than source channel", + "failure: counterparty client identifier different than destination client", func() { - packet.DestinationChannel = unusedChannel + packet.DestinationClient = unusedChannel }, - types.ErrInvalidChannelIdentifier, + clienttypes.ErrInvalidCounterparty, }, { "failure: packet commitment doesn't exist.", func() { - suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.DeletePacketCommitment(suite.chainA.GetContext(), packet.SourceChannel, packet.Sequence) + suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.DeletePacketCommitment(suite.chainA.GetContext(), packet.SourceClient, packet.Sequence) }, types.ErrNoOpMsg, }, @@ -409,7 +409,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { tc.malleate() - packetKey := hostv2.PacketAcknowledgementKey(packet.DestinationChannel, packet.Sequence) + packetKey := hostv2.PacketAcknowledgementKey(packet.DestinationClient, packet.Sequence) proof, proofHeight := path.EndpointB.QueryProof(packetKey) if freezeClient { @@ -422,7 +422,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { if expPass { suite.Require().NoError(err) - commitment := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.GetPacketCommitment(suite.chainA.GetContext(), packet.SourceChannel, packet.Sequence) + commitment := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.GetPacketCommitment(suite.chainA.GetContext(), packet.SourceClient, packet.Sequence) suite.Require().Empty(commitment) } else { suite.Require().Error(err) @@ -448,35 +448,35 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { "success", func() { // send packet - _, _, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceChannel, + _, _, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceClient, packet.TimeoutTimestamp, packet.Payloads) suite.Require().NoError(err, "send packet failed") }, nil, }, { - "failure: channel not found", + "failure: client not found", func() { // send packet - _, _, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceChannel, + _, _, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceClient, packet.TimeoutTimestamp, packet.Payloads) suite.Require().NoError(err, "send packet failed") - packet.SourceChannel = ibctesting.InvalidID + packet.SourceClient = ibctesting.InvalidID }, - types.ErrChannelNotFound, + clienttypes.ErrCounterpartyNotFound, }, { - "failure: counterparty channel identifier different than source channel", + "failure: counterparty client identifier different than destination client", func() { // send packet - _, _, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceChannel, + _, _, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceClient, packet.TimeoutTimestamp, packet.Payloads) suite.Require().NoError(err, "send packet failed") - packet.DestinationChannel = unusedChannel + packet.DestinationClient = unusedChannel }, - types.ErrInvalidChannelIdentifier, + clienttypes.ErrInvalidCounterparty, }, { "failure: packet has not timed out yet", @@ -484,7 +484,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { packet.TimeoutTimestamp = uint64(suite.chainB.GetContext().BlockTime().Add(time.Hour).Unix()) // send packet - _, _, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceChannel, + _, _, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceClient, packet.TimeoutTimestamp, packet.Payloads) suite.Require().NoError(err, "send packet failed") }, @@ -498,7 +498,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { { "failure: packet does not match commitment", func() { - _, _, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceChannel, + _, _, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceClient, packet.TimeoutTimestamp, packet.Payloads) suite.Require().NoError(err, "send packet failed") @@ -511,7 +511,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { "failure: client status invalid", func() { // send packet - _, _, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceChannel, + _, _, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceClient, packet.TimeoutTimestamp, packet.Payloads) suite.Require().NoError(err, "send packet failed") @@ -523,12 +523,12 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { "failure: verify non-membership failed", func() { // send packet - _, _, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceChannel, + _, _, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceClient, packet.TimeoutTimestamp, packet.Payloads) suite.Require().NoError(err, "send packet failed") // set packet receipt to mock a valid past receive - suite.chainB.App.GetIBCKeeper().ChannelKeeperV2.SetPacketReceipt(suite.chainB.GetContext(), packet.DestinationChannel, packet.Sequence) + suite.chainB.App.GetIBCKeeper().ChannelKeeperV2.SetPacketReceipt(suite.chainB.GetContext(), packet.DestinationClient, packet.Sequence) }, commitmenttypes.ErrInvalidProof, }, @@ -551,7 +551,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { timeoutTimestamp := uint64(suite.chainB.GetContext().BlockTime().Unix()) // test cases may mutate timeout values - packet = types.NewPacket(1, path.EndpointA.ChannelID, path.EndpointB.ChannelID, + packet = types.NewPacket(1, path.EndpointA.ClientID, path.EndpointB.ClientID, timeoutTimestamp, payload) tc.malleate() @@ -563,7 +563,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { suite.Require().NoError(path.EndpointA.UpdateClient()) // get proof of packet receipt absence from chainB - receiptKey := hostv2.PacketReceiptKey(packet.DestinationChannel, packet.Sequence) + receiptKey := hostv2.PacketReceiptKey(packet.DestinationClient, packet.Sequence) proof, proofHeight := path.EndpointB.QueryProof(receiptKey) if freezeClient { @@ -576,7 +576,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { if expPass { suite.Require().NoError(err) - commitment := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.GetPacketCommitment(suite.chainA.GetContext(), packet.DestinationChannel, packet.Sequence) + commitment := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.GetPacketCommitment(suite.chainA.GetContext(), packet.DestinationClient, packet.Sequence) suite.Require().Nil(commitment, "packet commitment not deleted") } else { suite.Require().Error(err) diff --git a/modules/core/04-channel/v2/types/channel.go b/modules/core/04-channel/v2/types/channel.go deleted file mode 100644 index f4ab5b2afe4..00000000000 --- a/modules/core/04-channel/v2/types/channel.go +++ /dev/null @@ -1,51 +0,0 @@ -package types - -import ( - errorsmod "cosmossdk.io/errors" - - commitmenttypes "github.com/cosmos/ibc-go/v9/modules/core/23-commitment/types/v2" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" -) - -// NewChannel creates a new Channel instance -func NewChannel(clientID, counterpartyChannelID string, merklePathPrefix commitmenttypes.MerklePath) Channel { - return Channel{ - ClientId: clientID, - CounterpartyChannelId: counterpartyChannelID, - MerklePathPrefix: merklePathPrefix, - } -} - -// Validate validates the Channel -func (c Channel) Validate() error { - if err := host.ClientIdentifierValidator(c.ClientId); err != nil { - return err - } - - if err := host.ChannelIdentifierValidator(c.CounterpartyChannelId); err != nil { - return err - } - - if err := c.MerklePathPrefix.ValidateAsPrefix(); err != nil { - return errorsmod.Wrap(ErrInvalidChannel, err.Error()) - } - - return nil -} - -// NewIdentifiedChannel creates a new IdentifiedChannel instance -func NewIdentifiedChannel(channelID string, channel Channel) IdentifiedChannel { - return IdentifiedChannel{ - Channel: channel, - ChannelId: channelID, - } -} - -// ValidateBasic performs a basic validation of the identifiers and channel fields. -func (ic IdentifiedChannel) ValidateBasic() error { - if err := host.ChannelIdentifierValidator(ic.ChannelId); err != nil { - return errorsmod.Wrap(err, "invalid channel ID") - } - - return ic.Channel.Validate() -} diff --git a/modules/core/04-channel/v2/types/channel.pb.go b/modules/core/04-channel/v2/types/channel.pb.go deleted file mode 100644 index 8d3dafb35ae..00000000000 --- a/modules/core/04-channel/v2/types/channel.pb.go +++ /dev/null @@ -1,658 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: ibc/core/channel/v2/channel.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" - v2 "github.com/cosmos/ibc-go/v9/modules/core/23-commitment/types/v2" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// Channel defines the channel end on a chain that is implementing the version 2 IBC protocol -// Each side will maintain its own Channel to create an IBC channel -// The channel will be referenced by a channelID which will be used to send packets -// to the counterparty -// The channel will contain the client identifier that will provide proof verification for the channel -// and the counterparty channel identifier that the other channel end will be using -// to send packets to our channel end. -type Channel struct { - // the client identifier of the light client representing the counterparty chain - ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` - // the counterparty identifier that must be used by packets sent by counterparty - // to our channel end. - CounterpartyChannelId string `protobuf:"bytes,2,opt,name=counterparty_channel_id,json=counterpartyChannelId,proto3" json:"counterparty_channel_id,omitempty"` - // the key path used to store packet flow messages that the counterparty - // will use to send to us. In backwards compatible cases, we will append the channelID and sequence in order to create - // the final path. - MerklePathPrefix v2.MerklePath `protobuf:"bytes,3,opt,name=merkle_path_prefix,json=merklePathPrefix,proto3" json:"merkle_path_prefix"` -} - -func (m *Channel) Reset() { *m = Channel{} } -func (m *Channel) String() string { return proto.CompactTextString(m) } -func (*Channel) ProtoMessage() {} -func (*Channel) Descriptor() ([]byte, []int) { - return fileDescriptor_7e9b57d8f218397d, []int{0} -} -func (m *Channel) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Channel) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Channel.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 *Channel) XXX_Merge(src proto.Message) { - xxx_messageInfo_Channel.Merge(m, src) -} -func (m *Channel) XXX_Size() int { - return m.Size() -} -func (m *Channel) XXX_DiscardUnknown() { - xxx_messageInfo_Channel.DiscardUnknown(m) -} - -var xxx_messageInfo_Channel proto.InternalMessageInfo - -func (m *Channel) GetClientId() string { - if m != nil { - return m.ClientId - } - return "" -} - -func (m *Channel) GetCounterpartyChannelId() string { - if m != nil { - return m.CounterpartyChannelId - } - return "" -} - -func (m *Channel) GetMerklePathPrefix() v2.MerklePath { - if m != nil { - return m.MerklePathPrefix - } - return v2.MerklePath{} -} - -// IdentifiedChannel defines a channel with an additional channel identifier field. -type IdentifiedChannel struct { - // channel identified. - Channel Channel `protobuf:"bytes,1,opt,name=channel,proto3" json:"channel"` - // channel identifier - ChannelId string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` -} - -func (m *IdentifiedChannel) Reset() { *m = IdentifiedChannel{} } -func (m *IdentifiedChannel) String() string { return proto.CompactTextString(m) } -func (*IdentifiedChannel) ProtoMessage() {} -func (*IdentifiedChannel) Descriptor() ([]byte, []int) { - return fileDescriptor_7e9b57d8f218397d, []int{1} -} -func (m *IdentifiedChannel) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *IdentifiedChannel) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_IdentifiedChannel.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 *IdentifiedChannel) XXX_Merge(src proto.Message) { - xxx_messageInfo_IdentifiedChannel.Merge(m, src) -} -func (m *IdentifiedChannel) XXX_Size() int { - return m.Size() -} -func (m *IdentifiedChannel) XXX_DiscardUnknown() { - xxx_messageInfo_IdentifiedChannel.DiscardUnknown(m) -} - -var xxx_messageInfo_IdentifiedChannel proto.InternalMessageInfo - -func init() { - proto.RegisterType((*Channel)(nil), "ibc.core.channel.v2.Channel") - proto.RegisterType((*IdentifiedChannel)(nil), "ibc.core.channel.v2.IdentifiedChannel") -} - -func init() { proto.RegisterFile("ibc/core/channel/v2/channel.proto", fileDescriptor_7e9b57d8f218397d) } - -var fileDescriptor_7e9b57d8f218397d = []byte{ - // 356 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0xc1, 0x4e, 0xea, 0x40, - 0x14, 0x86, 0x3b, 0xf7, 0x92, 0xcb, 0x65, 0xd8, 0x68, 0xd5, 0x48, 0x50, 0x0b, 0xb2, 0x91, 0x0d, - 0x33, 0xa6, 0x1a, 0x13, 0x0d, 0x2b, 0x5c, 0xb1, 0x30, 0x21, 0x2c, 0x58, 0xb8, 0x69, 0xda, 0xe9, - 0xd0, 0x4e, 0xec, 0x74, 0x9a, 0x76, 0x68, 0xe4, 0x0d, 0x5c, 0xfa, 0x08, 0x3e, 0x85, 0xcf, 0xc0, - 0x92, 0xa5, 0x2b, 0x63, 0xe0, 0x45, 0x4c, 0xa7, 0x2d, 0x90, 0xe8, 0xee, 0xcc, 0x39, 0xff, 0xf9, - 0xf2, 0xff, 0x73, 0xe0, 0x39, 0x73, 0x08, 0x26, 0x22, 0xa6, 0x98, 0xf8, 0x76, 0x18, 0xd2, 0x00, - 0xa7, 0x66, 0x59, 0xa2, 0x28, 0x16, 0x52, 0xe8, 0x07, 0xcc, 0x21, 0x28, 0x93, 0xa0, 0xb2, 0x9f, - 0x9a, 0xcd, 0x43, 0x4f, 0x78, 0x42, 0xcd, 0x71, 0x56, 0xe5, 0xd2, 0xe6, 0xc5, 0x96, 0x26, 0x38, - 0x67, 0x92, 0xd3, 0x50, 0x2a, 0xe0, 0xe6, 0x95, 0x0b, 0x3b, 0xef, 0x00, 0x56, 0xef, 0x73, 0x9a, - 0x7e, 0x02, 0x6b, 0x24, 0x60, 0x34, 0x94, 0x16, 0x73, 0x1b, 0xa0, 0x0d, 0xba, 0xb5, 0xf1, 0xff, - 0xbc, 0x31, 0x74, 0xf5, 0x1b, 0x78, 0x4c, 0xc4, 0x2c, 0x94, 0x34, 0x8e, 0xec, 0x58, 0xce, 0xad, - 0xc2, 0x42, 0x26, 0xfd, 0xa3, 0xa4, 0x47, 0xbb, 0xe3, 0x02, 0x39, 0x74, 0xf5, 0x09, 0xd4, 0x39, - 0x8d, 0x9f, 0x02, 0x6a, 0x45, 0xb6, 0xf4, 0xad, 0x28, 0xa6, 0x53, 0xf6, 0xdc, 0xf8, 0xdb, 0x06, - 0xdd, 0xba, 0xd9, 0x41, 0xdb, 0x44, 0x5b, 0x63, 0xa9, 0x89, 0x1e, 0xd4, 0xc6, 0xc8, 0x96, 0xfe, - 0xa0, 0xb2, 0xf8, 0x6c, 0x69, 0xe3, 0x3d, 0xbe, 0xe9, 0x8c, 0x14, 0xa1, 0x93, 0xc2, 0xfd, 0xa1, - 0x4b, 0x43, 0xc9, 0xa6, 0x8c, 0xba, 0x65, 0x82, 0x3e, 0xac, 0x16, 0xbe, 0x94, 0xff, 0xba, 0x79, - 0x8a, 0x7e, 0xf9, 0x33, 0x54, 0xc8, 0x0b, 0x76, 0xb9, 0xa2, 0x9f, 0x41, 0xf8, 0x23, 0x55, 0x8d, - 0x94, 0x49, 0xee, 0x2a, 0x2f, 0x6f, 0x2d, 0x6d, 0x30, 0x59, 0xac, 0x0c, 0xb0, 0x5c, 0x19, 0xe0, - 0x6b, 0x65, 0x80, 0xd7, 0xb5, 0xa1, 0x2d, 0xd7, 0x86, 0xf6, 0xb1, 0x36, 0xb4, 0xc7, 0xbe, 0xc7, - 0xa4, 0x3f, 0x73, 0xb2, 0x28, 0x98, 0x88, 0x84, 0x8b, 0x04, 0x33, 0x87, 0xf4, 0x3c, 0x81, 0xd3, - 0x5b, 0xcc, 0x85, 0x3b, 0x0b, 0x68, 0x92, 0xdf, 0xe4, 0xf2, 0xba, 0xb7, 0x73, 0x64, 0x39, 0x8f, - 0x68, 0xe2, 0xfc, 0x53, 0xf7, 0xb8, 0xfa, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xc2, 0xc9, 0x7e, 0x8b, - 0x08, 0x02, 0x00, 0x00, -} - -func (m *Channel) 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 *Channel) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Channel) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.MerklePathPrefix.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintChannel(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.CounterpartyChannelId) > 0 { - i -= len(m.CounterpartyChannelId) - copy(dAtA[i:], m.CounterpartyChannelId) - i = encodeVarintChannel(dAtA, i, uint64(len(m.CounterpartyChannelId))) - i-- - dAtA[i] = 0x12 - } - if len(m.ClientId) > 0 { - i -= len(m.ClientId) - copy(dAtA[i:], m.ClientId) - i = encodeVarintChannel(dAtA, i, uint64(len(m.ClientId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *IdentifiedChannel) 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 *IdentifiedChannel) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *IdentifiedChannel) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ChannelId) > 0 { - i -= len(m.ChannelId) - copy(dAtA[i:], m.ChannelId) - i = encodeVarintChannel(dAtA, i, uint64(len(m.ChannelId))) - i-- - dAtA[i] = 0x12 - } - { - size, err := m.Channel.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintChannel(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintChannel(dAtA []byte, offset int, v uint64) int { - offset -= sovChannel(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Channel) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ClientId) - if l > 0 { - n += 1 + l + sovChannel(uint64(l)) - } - l = len(m.CounterpartyChannelId) - if l > 0 { - n += 1 + l + sovChannel(uint64(l)) - } - l = m.MerklePathPrefix.Size() - n += 1 + l + sovChannel(uint64(l)) - return n -} - -func (m *IdentifiedChannel) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Channel.Size() - n += 1 + l + sovChannel(uint64(l)) - l = len(m.ChannelId) - if l > 0 { - n += 1 + l + sovChannel(uint64(l)) - } - return n -} - -func sovChannel(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozChannel(x uint64) (n int) { - return sovChannel(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Channel) 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 ErrIntOverflowChannel - } - 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: Channel: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Channel: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - 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 ErrIntOverflowChannel - } - 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 ErrInvalidLengthChannel - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthChannel - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClientId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CounterpartyChannelId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowChannel - } - 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 ErrInvalidLengthChannel - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthChannel - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CounterpartyChannelId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MerklePathPrefix", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowChannel - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthChannel - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthChannel - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.MerklePathPrefix.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipChannel(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthChannel - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *IdentifiedChannel) 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 ErrIntOverflowChannel - } - 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: IdentifiedChannel: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IdentifiedChannel: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Channel", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowChannel - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthChannel - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthChannel - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Channel.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowChannel - } - 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 ErrInvalidLengthChannel - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthChannel - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChannelId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipChannel(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthChannel - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipChannel(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowChannel - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowChannel - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowChannel - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthChannel - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupChannel - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthChannel - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthChannel = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowChannel = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupChannel = fmt.Errorf("proto: unexpected end of group") -) diff --git a/modules/core/04-channel/v2/types/channel_test.go b/modules/core/04-channel/v2/types/channel_test.go deleted file mode 100644 index c6c71d9a157..00000000000 --- a/modules/core/04-channel/v2/types/channel_test.go +++ /dev/null @@ -1,58 +0,0 @@ -package types_test - -import ( - "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" - ibctesting "github.com/cosmos/ibc-go/v9/testing" -) - -func (s *TypesTestSuite) TestValidateChannel() { - var c types.Channel - testCases := []struct { - name string - malleate func() - expErr error - }{ - { - name: "success", - malleate: func() {}, - }, - { - name: "failure: invalid ClientID", - malleate: func() { - c.ClientId = "" - }, - expErr: host.ErrInvalidID, - }, - { - name: "failure: invalid counterparty channel id", - malleate: func() { - c.CounterpartyChannelId = "" - }, - expErr: host.ErrInvalidID, - }, - { - name: "failure: invalid Merkle Path Prefix", - malleate: func() { - c.MerklePathPrefix.KeyPath = [][]byte{} - }, - expErr: types.ErrInvalidChannel, - }, - } - for _, tc := range testCases { - s.Run(tc.name, func() { - c = types.NewChannel(ibctesting.FirstClientID, ibctesting.SecondClientID, ibctesting.MerklePath) - - tc.malleate() - - err := c.Validate() - - expPass := tc.expErr == nil - if expPass { - s.Require().NoError(err) - } else { - ibctesting.RequireErrorIsOrContains(s.T(), err, tc.expErr) - } - }) - } -} diff --git a/modules/core/04-channel/v2/types/codec.go b/modules/core/04-channel/v2/types/codec.go index 12124c4e841..1207e8d4899 100644 --- a/modules/core/04-channel/v2/types/codec.go +++ b/modules/core/04-channel/v2/types/codec.go @@ -11,8 +11,6 @@ import ( func RegisterInterfaces(registry coreregistry.InterfaceRegistrar) { registry.RegisterImplementations( (*sdk.Msg)(nil), - &MsgCreateChannel{}, - &MsgRegisterCounterparty{}, &MsgSendPacket{}, &MsgRecvPacket{}, &MsgTimeout{}, diff --git a/modules/core/04-channel/v2/types/commitment.go b/modules/core/04-channel/v2/types/commitment.go index 3f79cc3fad1..787b00bd4b4 100644 --- a/modules/core/04-channel/v2/types/commitment.go +++ b/modules/core/04-channel/v2/types/commitment.go @@ -7,13 +7,13 @@ import ( ) // CommitPacket returns the V2 packet commitment bytes. The commitment consists of: -// ha256_hash(0x02 + sha256_hash(destinationChannel) + sha256_hash(timeout) + sha256_hash(payload)) from a given packet. +// ha256_hash(0x02 + sha256_hash(destinationClient) + sha256_hash(timeout) + sha256_hash(payload)) from a given packet. // This results in a fixed length preimage of 32 bytes. // NOTE: A fixed length preimage is ESSENTIAL to prevent relayers from being able // to malleate the packet fields and create a commitment hash that matches the original packet. func CommitPacket(packet Packet) []byte { var buf []byte - destIDHash := sha256.Sum256([]byte(packet.DestinationChannel)) + destIDHash := sha256.Sum256([]byte(packet.DestinationClient)) buf = append(buf, destIDHash[:]...) timeoutBytes := sdk.Uint64ToBigEndian(packet.GetTimeoutTimestamp()) diff --git a/modules/core/04-channel/v2/types/commitment_test.go b/modules/core/04-channel/v2/types/commitment_test.go index d469a41a298..bad4d42e465 100644 --- a/modules/core/04-channel/v2/types/commitment_test.go +++ b/modules/core/04-channel/v2/types/commitment_test.go @@ -26,7 +26,7 @@ func TestCommitPacket(t *testing.T) { { "json packet", func() {}, // default is json packet - "450194f2ce25b12487f65593e106d91367a1e5c90b2efc03ed78265a54cfcebe", + "a096722aa6534040a0efbdae05765132a7b223ad306d6512f3734821bd046505", }, { "abi packet", @@ -42,7 +42,7 @@ func TestCommitPacket(t *testing.T) { packet.Payloads[0].Value = transferData packet.Payloads[0].Encoding = transfertypes.EncodingABI }, - "b691a1950f6fb0bbbcf4bdb16fe2c4d0aa7ef783eb7803073f475cb8164d9b7a", + "d408dca5088b9b375edb3c4df6bae0e18084fc0dbd90fcd0d028506553c81b25", }, } @@ -57,10 +57,10 @@ func TestCommitPacket(t *testing.T) { }) require.NoError(t, err) packet = types.Packet{ - Sequence: 1, - SourceChannel: "channel-0", - DestinationChannel: "channel-1", - TimeoutTimestamp: 100, + Sequence: 1, + SourceClient: "07-tendermint-0", + DestinationClient: "07-tendermint-1", + TimeoutTimestamp: 100, Payloads: []types.Payload{ { SourcePort: transfertypes.PortID, diff --git a/modules/core/04-channel/v2/types/errors.go b/modules/core/04-channel/v2/types/errors.go index eb64f47e5ce..6407370c5be 100644 --- a/modules/core/04-channel/v2/types/errors.go +++ b/modules/core/04-channel/v2/types/errors.go @@ -5,18 +5,15 @@ import ( ) var ( - ErrInvalidChannel = errorsmod.Register(SubModuleName, 2, "invalid channel") - ErrChannelNotFound = errorsmod.Register(SubModuleName, 3, "channel not found") - ErrInvalidPacket = errorsmod.Register(SubModuleName, 4, "invalid packet") - ErrInvalidPayload = errorsmod.Register(SubModuleName, 5, "invalid payload") - ErrSequenceSendNotFound = errorsmod.Register(SubModuleName, 6, "sequence send not found") - ErrInvalidAcknowledgement = errorsmod.Register(SubModuleName, 7, "invalid acknowledgement") - ErrPacketCommitmentNotFound = errorsmod.Register(SubModuleName, 8, "packet commitment not found") - ErrAcknowledgementNotFound = errorsmod.Register(SubModuleName, 9, "packet acknowledgement not found") - ErrInvalidTimeout = errorsmod.Register(SubModuleName, 10, "invalid packet timeout") - ErrTimeoutElapsed = errorsmod.Register(SubModuleName, 11, "timeout elapsed") - ErrTimeoutNotReached = errorsmod.Register(SubModuleName, 12, "timeout not reached") - ErrInvalidChannelIdentifier = errorsmod.Register(SubModuleName, 13, "invalid channel identifier") - ErrAcknowledgementExists = errorsmod.Register(SubModuleName, 14, "acknowledgement for packet already exists") - ErrNoOpMsg = errorsmod.Register(SubModuleName, 15, "message is redundant, no-op will be performed") + ErrInvalidPacket = errorsmod.Register(SubModuleName, 2, "invalid packet") + ErrInvalidPayload = errorsmod.Register(SubModuleName, 3, "invalid payload") + ErrSequenceSendNotFound = errorsmod.Register(SubModuleName, 4, "sequence send not found") + ErrInvalidAcknowledgement = errorsmod.Register(SubModuleName, 5, "invalid acknowledgement") + ErrPacketCommitmentNotFound = errorsmod.Register(SubModuleName, 6, "packet commitment not found") + ErrAcknowledgementNotFound = errorsmod.Register(SubModuleName, 7, "packet acknowledgement not found") + ErrInvalidTimeout = errorsmod.Register(SubModuleName, 8, "invalid packet timeout") + ErrTimeoutElapsed = errorsmod.Register(SubModuleName, 9, "timeout elapsed") + ErrTimeoutNotReached = errorsmod.Register(SubModuleName, 10, "timeout not reached") + ErrAcknowledgementExists = errorsmod.Register(SubModuleName, 11, "acknowledgement for packet already exists") + ErrNoOpMsg = errorsmod.Register(SubModuleName, 12, "message is redundant, no-op will be performed") ) diff --git a/modules/core/04-channel/v2/types/expected_keepers.go b/modules/core/04-channel/v2/types/expected_keepers.go index 32cda94bba8..41db0741876 100644 --- a/modules/core/04-channel/v2/types/expected_keepers.go +++ b/modules/core/04-channel/v2/types/expected_keepers.go @@ -23,4 +23,6 @@ type ClientKeeper interface { GetClientState(ctx context.Context, clientID string) (exported.ClientState, bool) // GetClientConsensusState gets the stored consensus state from a client at a given height. GetClientConsensusState(ctx context.Context, clientID string, height exported.Height) (exported.ConsensusState, bool) + // GetClientCounterparty returns the counterpartyInfo given a clientID + GetClientCounterparty(ctx context.Context, clientID string) (clienttypes.CounterpartyInfo, bool) } diff --git a/modules/core/04-channel/v2/types/genesis.go b/modules/core/04-channel/v2/types/genesis.go index 3b567f97c87..d94365b15de 100644 --- a/modules/core/04-channel/v2/types/genesis.go +++ b/modules/core/04-channel/v2/types/genesis.go @@ -4,16 +4,15 @@ import ( "errors" "fmt" - channeltypesv1 "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" host "github.com/cosmos/ibc-go/v9/modules/core/24-host" ) // NewPacketState creates a new PacketState instance. -func NewPacketState(channelID string, sequence uint64, data []byte) PacketState { +func NewPacketState(clientID string, sequence uint64, data []byte) PacketState { return PacketState{ - ChannelId: channelID, - Sequence: sequence, - Data: data, + ClientId: clientID, + Sequence: sequence, + Data: data, } } @@ -22,74 +21,47 @@ func (ps PacketState) Validate() error { if ps.Data == nil { return errors.New("data bytes cannot be nil") } - return validateGenFields(ps.ChannelId, ps.Sequence) + return validateGenFields(ps.ClientId, ps.Sequence) } // NewPacketSequence creates a new PacketSequences instance. -func NewPacketSequence(channelID string, sequence uint64) PacketSequence { +func NewPacketSequence(clientID string, sequence uint64) PacketSequence { return PacketSequence{ - ChannelId: channelID, - Sequence: sequence, + ClientId: clientID, + Sequence: sequence, } } // Validate performs basic validation of fields returning an error upon any failure. func (ps PacketSequence) Validate() error { - return validateGenFields(ps.ChannelId, ps.Sequence) + return validateGenFields(ps.ClientId, ps.Sequence) } // NewGenesisState creates a GenesisState instance. func NewGenesisState( - channels []IdentifiedChannel, acks, receipts, commitments []PacketState, - sendSeqs []PacketSequence, nextChannelSequence uint64, + acks, receipts, commitments []PacketState, + sendSeqs []PacketSequence, ) GenesisState { return GenesisState{ - Channels: channels, - Acknowledgements: acks, - Receipts: receipts, - Commitments: commitments, - SendSequences: sendSeqs, - NextChannelSequence: nextChannelSequence, + Acknowledgements: acks, + Receipts: receipts, + Commitments: commitments, + SendSequences: sendSeqs, } } // DefaultGenesisState returns the ibc channel v2 submodule's default genesis state. func DefaultGenesisState() GenesisState { return GenesisState{ - Channels: []IdentifiedChannel{}, - Acknowledgements: []PacketState{}, - Receipts: []PacketState{}, - Commitments: []PacketState{}, - SendSequences: []PacketSequence{}, - NextChannelSequence: 0, + Acknowledgements: []PacketState{}, + Receipts: []PacketState{}, + Commitments: []PacketState{}, + SendSequences: []PacketSequence{}, } } // Validate performs basic genesis state validation returning an error upon any failure. func (gs GenesisState) Validate() error { - // keep track of the max sequence to ensure it is less than - // the next sequence used in creating channel identifiers. - var maxSequence uint64 - - for i, channel := range gs.Channels { - sequence, err := channeltypesv1.ParseChannelSequence(channel.ChannelId) - if err != nil { - return err - } - - if sequence > maxSequence { - maxSequence = sequence - } - - if err := channel.ValidateBasic(); err != nil { - return fmt.Errorf("invalid channel %v channel index %d: %w", channel, i, err) - } - } - - if maxSequence != 0 && maxSequence >= gs.NextChannelSequence { - return fmt.Errorf("next channel sequence %d must be greater than maximum sequence used in channel identifier %d", gs.NextChannelSequence, maxSequence) - } - for i, ack := range gs.Acknowledgements { if err := ack.Validate(); err != nil { return fmt.Errorf("invalid acknowledgement %v ack index %d: %w", ack, i, err) @@ -123,8 +95,8 @@ func (gs GenesisState) Validate() error { return nil } -func validateGenFields(channelID string, sequence uint64) error { - if err := host.ChannelIdentifierValidator(channelID); err != nil { +func validateGenFields(clientID string, sequence uint64) error { + if err := host.ClientIdentifierValidator(clientID); err != nil { return fmt.Errorf("invalid channel Id: %w", err) } if sequence == 0 { diff --git a/modules/core/04-channel/v2/types/genesis.pb.go b/modules/core/04-channel/v2/types/genesis.pb.go index ea9c321819f..bb06101aec1 100644 --- a/modules/core/04-channel/v2/types/genesis.pb.go +++ b/modules/core/04-channel/v2/types/genesis.pb.go @@ -25,13 +25,10 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the ibc channel/v2 submodule's genesis state. type GenesisState struct { - Channels []IdentifiedChannel `protobuf:"bytes,1,rep,name=channels,proto3,casttype=IdentifiedChannel" json:"channels"` - Acknowledgements []PacketState `protobuf:"bytes,2,rep,name=acknowledgements,proto3" json:"acknowledgements"` - Commitments []PacketState `protobuf:"bytes,3,rep,name=commitments,proto3" json:"commitments"` - Receipts []PacketState `protobuf:"bytes,4,rep,name=receipts,proto3" json:"receipts"` - SendSequences []PacketSequence `protobuf:"bytes,5,rep,name=send_sequences,json=sendSequences,proto3" json:"send_sequences"` - // the sequence for the next generated channel identifier - NextChannelSequence uint64 `protobuf:"varint,6,opt,name=next_channel_sequence,json=nextChannelSequence,proto3" json:"next_channel_sequence,omitempty"` + Acknowledgements []PacketState `protobuf:"bytes,2,rep,name=acknowledgements,proto3" json:"acknowledgements"` + Commitments []PacketState `protobuf:"bytes,3,rep,name=commitments,proto3" json:"commitments"` + Receipts []PacketState `protobuf:"bytes,4,rep,name=receipts,proto3" json:"receipts"` + SendSequences []PacketSequence `protobuf:"bytes,5,rep,name=send_sequences,json=sendSequences,proto3" json:"send_sequences"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -67,13 +64,6 @@ func (m *GenesisState) XXX_DiscardUnknown() { var xxx_messageInfo_GenesisState proto.InternalMessageInfo -func (m *GenesisState) GetChannels() []IdentifiedChannel { - if m != nil { - return m.Channels - } - return nil -} - func (m *GenesisState) GetAcknowledgements() []PacketState { if m != nil { return m.Acknowledgements @@ -102,20 +92,13 @@ func (m *GenesisState) GetSendSequences() []PacketSequence { return nil } -func (m *GenesisState) GetNextChannelSequence() uint64 { - if m != nil { - return m.NextChannelSequence - } - return 0 -} - // PacketState defines the generic type necessary to retrieve and store // packet commitments, acknowledgements, and receipts. // Caller is responsible for knowing the context necessary to interpret this // state as a commitment, acknowledgement, or a receipt. type PacketState struct { - // channel unique identifier. - ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + // client unique identifier. + ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` // packet sequence. Sequence uint64 `protobuf:"varint,2,opt,name=sequence,proto3" json:"sequence,omitempty"` // embedded data that represents packet state. @@ -157,8 +140,8 @@ var xxx_messageInfo_PacketState proto.InternalMessageInfo // PacketSequence defines the genesis type necessary to retrieve and store next send sequences. type PacketSequence struct { - // channel unique identifier. - ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + // client unique identifier. + ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` // packet sequence Sequence uint64 `protobuf:"varint,2,opt,name=sequence,proto3" json:"sequence,omitempty"` } @@ -196,9 +179,9 @@ func (m *PacketSequence) XXX_DiscardUnknown() { var xxx_messageInfo_PacketSequence proto.InternalMessageInfo -func (m *PacketSequence) GetChannelId() string { +func (m *PacketSequence) GetClientId() string { if m != nil { - return m.ChannelId + return m.ClientId } return "" } @@ -219,35 +202,31 @@ func init() { func init() { proto.RegisterFile("ibc/core/channel/v2/genesis.proto", fileDescriptor_b5d374f126f051c3) } var fileDescriptor_b5d374f126f051c3 = []byte{ - // 436 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x92, 0x4f, 0x6b, 0xd4, 0x40, - 0x18, 0xc6, 0x33, 0xdd, 0x58, 0xb6, 0xb3, 0xb5, 0xe8, 0x54, 0x21, 0x2e, 0x98, 0x8d, 0x2b, 0x48, - 0x2e, 0xcd, 0x48, 0xf4, 0xa2, 0x78, 0x8a, 0x07, 0x2d, 0x5e, 0x4a, 0x04, 0x0f, 0x82, 0x94, 0x64, - 0xe6, 0x35, 0x1d, 0xba, 0x99, 0x59, 0x77, 0x66, 0x57, 0xfd, 0x06, 0x1e, 0xfd, 0x08, 0x7e, 0x9c, - 0x1e, 0x7b, 0x11, 0x3c, 0x15, 0xd9, 0xfd, 0x16, 0x9e, 0x24, 0x93, 0x3f, 0xac, 0x74, 0x11, 0x4a, - 0x6f, 0xef, 0xbc, 0xef, 0xf3, 0xfc, 0x9e, 0x97, 0xe1, 0xc5, 0x0f, 0x44, 0xce, 0x28, 0x53, 0x33, - 0xa0, 0xec, 0x24, 0x93, 0x12, 0x26, 0x74, 0x11, 0xd3, 0x02, 0x24, 0x68, 0xa1, 0xa3, 0xe9, 0x4c, - 0x19, 0x45, 0xf6, 0x45, 0xce, 0xa2, 0x4a, 0x12, 0x35, 0x92, 0x68, 0x11, 0x0f, 0xef, 0x14, 0xaa, - 0x50, 0x76, 0x4e, 0xab, 0xaa, 0x96, 0x0e, 0x37, 0xd2, 0x5a, 0x97, 0x95, 0x8c, 0x7f, 0xf6, 0xf0, - 0xee, 0xab, 0x9a, 0xff, 0xd6, 0x64, 0x06, 0xc8, 0x07, 0xdc, 0x6f, 0x14, 0xda, 0x43, 0x41, 0x2f, - 0x1c, 0xc4, 0x8f, 0xa2, 0x0d, 0x89, 0xd1, 0x21, 0x07, 0x69, 0xc4, 0x47, 0x01, 0xfc, 0x65, 0xdd, - 0x4c, 0xee, 0x9d, 0x5d, 0x8c, 0x9c, 0x3f, 0x17, 0xa3, 0xdb, 0x97, 0x46, 0x69, 0x87, 0x24, 0x29, - 0xbe, 0x95, 0xb1, 0x53, 0xa9, 0x3e, 0x4f, 0x80, 0x17, 0x50, 0x82, 0x34, 0xda, 0xdb, 0xb2, 0x31, - 0xc1, 0xc6, 0x98, 0xa3, 0x8c, 0x9d, 0x82, 0xb1, 0xab, 0x25, 0x6e, 0x15, 0x90, 0x5e, 0xf2, 0x93, - 0xd7, 0x78, 0xc0, 0x54, 0x59, 0x0a, 0x53, 0xe3, 0x7a, 0x57, 0xc2, 0xad, 0x5b, 0x49, 0x82, 0xfb, - 0x33, 0x60, 0x20, 0xa6, 0x46, 0x7b, 0xee, 0x95, 0x30, 0x9d, 0x8f, 0x1c, 0xe1, 0x3d, 0x0d, 0x92, - 0x1f, 0x6b, 0xf8, 0x34, 0x07, 0xc9, 0x40, 0x7b, 0x37, 0x2c, 0xe9, 0xe1, 0xff, 0x48, 0x8d, 0xb6, - 0x81, 0xdd, 0xac, 0x00, 0x6d, 0x4f, 0x93, 0x18, 0xdf, 0x95, 0xf0, 0xc5, 0x1c, 0x37, 0xb6, 0x8e, - 0xec, 0x6d, 0x07, 0x28, 0x74, 0xd3, 0xfd, 0x6a, 0xd8, 0xfc, 0x74, 0x6b, 0x1a, 0xe7, 0x78, 0xb0, - 0xb6, 0x24, 0xb9, 0x8f, 0x71, 0xeb, 0x16, 0xdc, 0x43, 0x01, 0x0a, 0x77, 0xd2, 0x9d, 0xa6, 0x73, - 0xc8, 0xc9, 0x10, 0xf7, 0x3b, 0xe8, 0x96, 0x85, 0x76, 0x6f, 0x42, 0xb0, 0xcb, 0x33, 0x93, 0x79, - 0xbd, 0x00, 0x85, 0xbb, 0xa9, 0xad, 0x9f, 0xbb, 0xdf, 0x7e, 0x8c, 0x9c, 0xf1, 0x1b, 0xbc, 0xf7, - 0xef, 0xfa, 0xd7, 0x88, 0x49, 0xde, 0x9d, 0x2d, 0x7d, 0x74, 0xbe, 0xf4, 0xd1, 0xef, 0xa5, 0x8f, - 0xbe, 0xaf, 0x7c, 0xe7, 0x7c, 0xe5, 0x3b, 0xbf, 0x56, 0xbe, 0xf3, 0xfe, 0x45, 0x21, 0xcc, 0xc9, - 0x3c, 0x8f, 0x98, 0x2a, 0x29, 0x53, 0xba, 0x54, 0x9a, 0x8a, 0x9c, 0x1d, 0x14, 0x8a, 0x2e, 0x9e, - 0xd1, 0x52, 0xf1, 0xf9, 0x04, 0x74, 0x7d, 0xe5, 0x8f, 0x9f, 0x1e, 0xac, 0x1d, 0xba, 0xf9, 0x3a, - 0x05, 0x9d, 0x6f, 0xdb, 0x3b, 0x7f, 0xf2, 0x37, 0x00, 0x00, 0xff, 0xff, 0x28, 0x88, 0xce, 0xb6, - 0x5a, 0x03, 0x00, 0x00, + // 370 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0x31, 0x4f, 0xfa, 0x40, + 0x18, 0xc6, 0x5b, 0xe8, 0xff, 0x1f, 0x38, 0x90, 0x98, 0xd3, 0xa1, 0xc1, 0xa4, 0x54, 0x5c, 0xba, + 0xd0, 0x33, 0xe8, 0xa2, 0x71, 0x62, 0x51, 0x36, 0x52, 0x13, 0x07, 0x17, 0x6c, 0xaf, 0x6f, 0xca, + 0x85, 0xf6, 0x0e, 0xb9, 0x03, 0xe3, 0x37, 0x70, 0xf4, 0x23, 0xf8, 0x59, 0x9c, 0x18, 0x19, 0x9d, + 0x8c, 0x81, 0x2f, 0x62, 0x68, 0x81, 0x60, 0x34, 0x26, 0xb8, 0xbd, 0xf7, 0xde, 0xf3, 0xfc, 0x9e, + 0x77, 0x78, 0xd0, 0x21, 0x0b, 0x28, 0xa1, 0x62, 0x08, 0x84, 0xf6, 0x7c, 0xce, 0x21, 0x26, 0xe3, + 0x26, 0x89, 0x80, 0x83, 0x64, 0xd2, 0x1d, 0x0c, 0x85, 0x12, 0x78, 0x8f, 0x05, 0xd4, 0x5d, 0x48, + 0xdc, 0xa5, 0xc4, 0x1d, 0x37, 0xab, 0xfb, 0x91, 0x88, 0x44, 0xfa, 0x4f, 0x16, 0x53, 0x26, 0xad, + 0xbf, 0xe6, 0x50, 0xf9, 0x32, 0x33, 0x5f, 0x2b, 0x5f, 0x01, 0xf6, 0xd0, 0xae, 0x4f, 0xfb, 0x5c, + 0x3c, 0xc4, 0x10, 0x46, 0x90, 0x00, 0x57, 0xd2, 0xcc, 0xd9, 0x79, 0xa7, 0xd4, 0xb4, 0xdd, 0x1f, + 0xb0, 0x6e, 0xc7, 0xa7, 0x7d, 0x50, 0xa9, 0xb7, 0x65, 0x4c, 0xde, 0x6b, 0x9a, 0xf7, 0xcd, 0x8f, + 0xaf, 0x50, 0x89, 0x8a, 0x24, 0x61, 0x2a, 0xc3, 0xe5, 0xb7, 0xc2, 0x6d, 0x5a, 0x71, 0x0b, 0x15, + 0x86, 0x40, 0x81, 0x0d, 0x94, 0x34, 0x8d, 0xad, 0x30, 0x6b, 0x1f, 0xee, 0xa0, 0x8a, 0x04, 0x1e, + 0x76, 0x25, 0xdc, 0x8f, 0x80, 0x53, 0x90, 0xe6, 0xbf, 0x94, 0x74, 0xf4, 0x1b, 0x69, 0xa9, 0x5d, + 0xc2, 0x76, 0x16, 0x80, 0xd5, 0x4e, 0xd6, 0xef, 0x50, 0x69, 0x23, 0x10, 0x1f, 0xa0, 0x22, 0x8d, + 0x19, 0x70, 0xd5, 0x65, 0xa1, 0xa9, 0xdb, 0xba, 0x53, 0xf4, 0x0a, 0xd9, 0xa2, 0x1d, 0xe2, 0x2a, + 0x2a, 0xac, 0x82, 0xcd, 0x9c, 0xad, 0x3b, 0x86, 0xb7, 0x7e, 0x63, 0x8c, 0x8c, 0xd0, 0x57, 0xbe, + 0x99, 0xb7, 0x75, 0xa7, 0xec, 0xa5, 0xf3, 0xb9, 0xf1, 0xf4, 0x52, 0xd3, 0xea, 0x6d, 0x54, 0xf9, + 0x7a, 0xc8, 0x9f, 0x43, 0x5a, 0x37, 0x93, 0x99, 0xa5, 0x4f, 0x67, 0x96, 0xfe, 0x31, 0xb3, 0xf4, + 0xe7, 0xb9, 0xa5, 0x4d, 0xe7, 0x96, 0xf6, 0x36, 0xb7, 0xb4, 0xdb, 0x8b, 0x88, 0xa9, 0xde, 0x28, + 0x70, 0xa9, 0x48, 0x08, 0x15, 0x32, 0x11, 0x92, 0xb0, 0x80, 0x36, 0x22, 0x41, 0xc6, 0x67, 0x24, + 0x11, 0xe1, 0x28, 0x06, 0x99, 0x35, 0xef, 0xf8, 0xb4, 0xb1, 0x51, 0x3e, 0xf5, 0x38, 0x00, 0x19, + 0xfc, 0x4f, 0x0b, 0x75, 0xf2, 0x19, 0x00, 0x00, 0xff, 0xff, 0xee, 0xb6, 0xa0, 0xcd, 0xa0, 0x02, + 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -270,11 +249,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.NextChannelSequence != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.NextChannelSequence)) - i-- - dAtA[i] = 0x30 - } if len(m.SendSequences) > 0 { for iNdEx := len(m.SendSequences) - 1; iNdEx >= 0; iNdEx-- { { @@ -331,20 +305,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x12 } } - if len(m.Channels) > 0 { - for iNdEx := len(m.Channels) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Channels[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } return len(dAtA) - i, nil } @@ -380,10 +340,10 @@ func (m *PacketState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x10 } - if len(m.ChannelId) > 0 { - i -= len(m.ChannelId) - copy(dAtA[i:], m.ChannelId) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.ChannelId))) + if len(m.ClientId) > 0 { + i -= len(m.ClientId) + copy(dAtA[i:], m.ClientId) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.ClientId))) i-- dAtA[i] = 0xa } @@ -415,10 +375,10 @@ func (m *PacketSequence) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x10 } - if len(m.ChannelId) > 0 { - i -= len(m.ChannelId) - copy(dAtA[i:], m.ChannelId) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.ChannelId))) + if len(m.ClientId) > 0 { + i -= len(m.ClientId) + copy(dAtA[i:], m.ClientId) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.ClientId))) i-- dAtA[i] = 0xa } @@ -442,12 +402,6 @@ func (m *GenesisState) Size() (n int) { } var l int _ = l - if len(m.Channels) > 0 { - for _, e := range m.Channels { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } if len(m.Acknowledgements) > 0 { for _, e := range m.Acknowledgements { l = e.Size() @@ -472,9 +426,6 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } - if m.NextChannelSequence != 0 { - n += 1 + sovGenesis(uint64(m.NextChannelSequence)) - } return n } @@ -484,7 +435,7 @@ func (m *PacketState) Size() (n int) { } var l int _ = l - l = len(m.ChannelId) + l = len(m.ClientId) if l > 0 { n += 1 + l + sovGenesis(uint64(l)) } @@ -504,7 +455,7 @@ func (m *PacketSequence) Size() (n int) { } var l int _ = l - l = len(m.ChannelId) + l = len(m.ClientId) if l > 0 { n += 1 + l + sovGenesis(uint64(l)) } @@ -549,40 +500,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Channels", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Channels = append(m.Channels, IdentifiedChannel{}) - if err := m.Channels[len(m.Channels)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Acknowledgements", wireType) @@ -719,25 +636,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NextChannelSequence", wireType) - } - m.NextChannelSequence = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NextChannelSequence |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) @@ -790,7 +688,7 @@ func (m *PacketState) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ClientId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -818,7 +716,7 @@ func (m *PacketState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ChannelId = string(dAtA[iNdEx:postIndex]) + m.ClientId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 0 { @@ -925,7 +823,7 @@ func (m *PacketSequence) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ClientId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -953,7 +851,7 @@ func (m *PacketSequence) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ChannelId = string(dAtA[iNdEx:postIndex]) + m.ClientId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 0 { diff --git a/modules/core/04-channel/v2/types/genesis_test.go b/modules/core/04-channel/v2/types/genesis_test.go index e70290d54b1..7b22f9c5719 100644 --- a/modules/core/04-channel/v2/types/genesis_test.go +++ b/modules/core/04-channel/v2/types/genesis_test.go @@ -2,13 +2,11 @@ package types_test import ( "errors" - "fmt" "testing" "github.com/stretchr/testify/require" "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" ibctesting "github.com/cosmos/ibc-go/v9/testing" ) @@ -26,29 +24,13 @@ func TestValidateGenesis(t *testing.T) { { "valid genesis", types.NewGenesisState( - []types.IdentifiedChannel{ - types.NewIdentifiedChannel( - ibctesting.FirstChannelID, types.NewChannel(ibctesting.FirstClientID, ibctesting.SecondChannelID, ibctesting.MerklePath), - ), - types.NewIdentifiedChannel( - ibctesting.SecondChannelID, types.NewChannel(ibctesting.SecondClientID, ibctesting.FirstChannelID, ibctesting.MerklePath), - ), - }, []types.PacketState{types.NewPacketState(ibctesting.FirstChannelID, 1, []byte("ack"))}, []types.PacketState{types.NewPacketState(ibctesting.SecondChannelID, 1, []byte(""))}, []types.PacketState{types.NewPacketState(ibctesting.FirstChannelID, 1, []byte("commit_hash"))}, []types.PacketSequence{types.NewPacketSequence(ibctesting.SecondChannelID, 1)}, - 2, ), nil, }, - { - "invalid channel identifier", - types.GenesisState{ - Channels: []types.IdentifiedChannel{types.NewIdentifiedChannel(ibctesting.InvalidID, types.NewChannel(ibctesting.FirstClientID, ibctesting.SecondChannelID, ibctesting.MerklePath))}, - }, - host.ErrInvalidID, - }, { "invalid ack", types.GenesisState{ @@ -76,16 +58,6 @@ func TestValidateGenesis(t *testing.T) { }, errors.New("sequence cannot be 0"), }, - { - "next channel sequence is less than maximum channel identifier sequence used", - types.GenesisState{ - Channels: []types.IdentifiedChannel{ - types.NewIdentifiedChannel("channel-10", types.NewChannel(ibctesting.FirstClientID, ibctesting.SecondChannelID, ibctesting.MerklePath)), - }, - NextChannelSequence: 0, - }, - fmt.Errorf("next channel sequence 0 must be greater than maximum sequence used in channel identifier 10"), - }, } for _, tc := range testCases { diff --git a/modules/core/04-channel/v2/types/keys.go b/modules/core/04-channel/v2/types/keys.go index 9b636340e38..98c8e520b46 100644 --- a/modules/core/04-channel/v2/types/keys.go +++ b/modules/core/04-channel/v2/types/keys.go @@ -3,14 +3,4 @@ package types const ( // SubModuleName defines the channelv2 module name. SubModuleName = "channelv2" - - // ChannelPrefix is the prefix under which all v2 channels are stored. - // It is imported from types since it is not part of the ics-24 host - // specification. - ChannelPrefix = "channels" - - // CreatorPrefix is the prefix under which all v2 channel creators are stored. - // It is imported from types since it is not part of the ics-24 host - // specification. - CreatorPrefix = "creators" ) diff --git a/modules/core/04-channel/v2/types/msgs.go b/modules/core/04-channel/v2/types/msgs.go index 8c9d3609be3..7c71e8972fe 100644 --- a/modules/core/04-channel/v2/types/msgs.go +++ b/modules/core/04-channel/v2/types/msgs.go @@ -9,7 +9,6 @@ import ( clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" commitmenttypesv1 "github.com/cosmos/ibc-go/v9/modules/core/23-commitment/types" - commitmenttypesv2 "github.com/cosmos/ibc-go/v9/modules/core/23-commitment/types/v2" host "github.com/cosmos/ibc-go/v9/modules/core/24-host" ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors" ) @@ -17,12 +16,6 @@ import ( const MaxTimeoutDelta time.Duration = 24 * time.Hour var ( - _ sdk.Msg = (*MsgCreateChannel)(nil) - _ sdk.HasValidateBasic = (*MsgCreateChannel)(nil) - - _ sdk.Msg = (*MsgRegisterCounterparty)(nil) - _ sdk.HasValidateBasic = (*MsgRegisterCounterparty)(nil) - _ sdk.Msg = (*MsgSendPacket)(nil) _ sdk.HasValidateBasic = (*MsgSendPacket)(nil) @@ -36,62 +29,10 @@ var ( _ sdk.HasValidateBasic = (*MsgAcknowledgement)(nil) ) -// NewMsgCreateChannel creates a new MsgCreateChannel instance -func NewMsgCreateChannel(clientID string, merklePathPrefix commitmenttypesv2.MerklePath, signer string) *MsgCreateChannel { - return &MsgCreateChannel{ - Signer: signer, - ClientId: clientID, - MerklePathPrefix: merklePathPrefix, - } -} - -// ValidateBasic performs basic checks on a MsgCreateChannel. -func (msg *MsgCreateChannel) ValidateBasic() error { - if _, err := sdk.AccAddressFromBech32(msg.Signer); err != nil { - return errorsmod.Wrapf(ibcerrors.ErrInvalidAddress, "string could not be parsed as address: %v", err) - } - - if err := host.ClientIdentifierValidator(msg.ClientId); err != nil { - return err - } - - if err := msg.MerklePathPrefix.ValidateAsPrefix(); err != nil { - return err - } - - return nil -} - -// NewMsgRegisterCounterparty creates a new MsgRegisterCounterparty instance -func NewMsgRegisterCounterparty(channelID, counterpartyChannelID string, signer string) *MsgRegisterCounterparty { - return &MsgRegisterCounterparty{ - Signer: signer, - ChannelId: channelID, - CounterpartyChannelId: counterpartyChannelID, - } -} - -// ValidateBasic performs basic checks on a MsgRegisterCounterparty. -func (msg *MsgRegisterCounterparty) ValidateBasic() error { - if _, err := sdk.AccAddressFromBech32(msg.Signer); err != nil { - return errorsmod.Wrapf(ibcerrors.ErrInvalidAddress, "string could not be parsed as address: %v", err) - } - - if err := host.ChannelIdentifierValidator(msg.ChannelId); err != nil { - return err - } - - if err := host.ChannelIdentifierValidator(msg.CounterpartyChannelId); err != nil { - return err - } - - return nil -} - // NewMsgSendPacket creates a new MsgSendPacket instance. -func NewMsgSendPacket(sourceChannel string, timeoutTimestamp uint64, signer string, payloads ...Payload) *MsgSendPacket { +func NewMsgSendPacket(sourceClient string, timeoutTimestamp uint64, signer string, payloads ...Payload) *MsgSendPacket { return &MsgSendPacket{ - SourceChannel: sourceChannel, + SourceClient: sourceClient, TimeoutTimestamp: timeoutTimestamp, Payloads: payloads, Signer: signer, @@ -100,7 +41,7 @@ func NewMsgSendPacket(sourceChannel string, timeoutTimestamp uint64, signer stri // ValidateBasic performs basic checks on a MsgSendPacket. func (msg *MsgSendPacket) ValidateBasic() error { - if err := host.ChannelIdentifierValidator(msg.SourceChannel); err != nil { + if err := host.ClientIdentifierValidator(msg.SourceClient); err != nil { return err } diff --git a/modules/core/04-channel/v2/types/msgs_test.go b/modules/core/04-channel/v2/types/msgs_test.go index 2097c106c09..e097a7fd173 100644 --- a/modules/core/04-channel/v2/types/msgs_test.go +++ b/modules/core/04-channel/v2/types/msgs_test.go @@ -1,7 +1,6 @@ package types_test import ( - "errors" "testing" "github.com/stretchr/testify/suite" @@ -36,117 +35,6 @@ func TestTypesTestSuite(t *testing.T) { suite.Run(t, new(TypesTestSuite)) } -func (s *TypesTestSuite) TestMsgRegisterCounterpartyValidateBasic() { - var msg *types.MsgRegisterCounterparty - - testCases := []struct { - name string - malleate func() - expError error - }{ - { - "success", - func() {}, - nil, - }, - { - "failure: invalid signer address", - func() { - msg.Signer = "invalid" - }, - ibcerrors.ErrInvalidAddress, - }, - { - "failure: invalid channel ID", - func() { - msg.ChannelId = "" - }, - host.ErrInvalidID, - }, - { - "failure: invalid counterparty channel ID", - func() { - msg.CounterpartyChannelId = "" - }, - host.ErrInvalidID, - }, - } - - for _, tc := range testCases { - msg = types.NewMsgRegisterCounterparty( - ibctesting.FirstChannelID, - ibctesting.SecondChannelID, - ibctesting.TestAccAddress, - ) - - tc.malleate() - - err := msg.ValidateBasic() - expPass := tc.expError == nil - if expPass { - s.Require().NoError(err, "valid case %s failed", tc.name) - } else { - s.Require().ErrorIs(err, tc.expError, "invalid case %s passed", tc.name) - } - } -} - -// TestMsgCreateChannelValidateBasic tests ValidateBasic for MsgCreateChannel -func (s *TypesTestSuite) TestMsgCreateChannelValidateBasic() { - var msg *types.MsgCreateChannel - - testCases := []struct { - name string - malleate func() - expError error - }{ - { - "success", - func() {}, - nil, - }, - { - "failure: invalid signer address", - func() { - msg.Signer = "invalid" - }, - ibcerrors.ErrInvalidAddress, - }, - { - "failure: invalid client ID", - func() { - msg.ClientId = "" - }, - host.ErrInvalidID, - }, - { - "failure: empty key path", - func() { - msg.MerklePathPrefix.KeyPath = nil - }, - errors.New("path cannot have length 0"), - }, - } - - for _, tc := range testCases { - msg = types.NewMsgCreateChannel( - ibctesting.FirstClientID, - commitmenttypes.NewMerklePath([]byte("key")), - ibctesting.TestAccAddress, - ) - - tc.malleate() - - err := msg.ValidateBasic() - expPass := tc.expError == nil - if expPass { - s.Require().NoError(err, "valid case %s failed", tc.name) - } else { - s.Require().ErrorContains(err, tc.expError.Error(), "invalid case %s passed", tc.name) - } - } -} - func (s *TypesTestSuite) TestMsgSendPacketValidateBasic() { var msg *types.MsgSendPacket testCases := []struct { @@ -161,7 +49,7 @@ func (s *TypesTestSuite) TestMsgSendPacketValidateBasic() { { name: "failure: invalid source channel", malleate: func() { - msg.SourceChannel = "" + msg.SourceClient = "" }, expError: host.ErrInvalidID, }, diff --git a/modules/core/04-channel/v2/types/packet.go b/modules/core/04-channel/v2/types/packet.go index 9fe360c5a6c..e78a598fa6e 100644 --- a/modules/core/04-channel/v2/types/packet.go +++ b/modules/core/04-channel/v2/types/packet.go @@ -10,13 +10,13 @@ import ( ) // NewPacket constructs a new packet. -func NewPacket(sequence uint64, sourceChannel, destinationChannel string, timeoutTimestamp uint64, payloads ...Payload) Packet { +func NewPacket(sequence uint64, sourceClient, destinationClient string, timeoutTimestamp uint64, payloads ...Payload) Packet { return Packet{ - Sequence: sequence, - SourceChannel: sourceChannel, - DestinationChannel: destinationChannel, - TimeoutTimestamp: timeoutTimestamp, - Payloads: payloads, + Sequence: sequence, + SourceClient: sourceClient, + DestinationClient: destinationClient, + TimeoutTimestamp: timeoutTimestamp, + Payloads: payloads, } } @@ -43,11 +43,11 @@ func (p Packet) ValidateBasic() error { } } - if err := host.ChannelIdentifierValidator(p.SourceChannel); err != nil { - return errorsmod.Wrap(err, "invalid source channel ID") + if err := host.ChannelIdentifierValidator(p.SourceClient); err != nil { + return errorsmod.Wrap(err, "invalid source ID") } - if err := host.ChannelIdentifierValidator(p.DestinationChannel); err != nil { - return errorsmod.Wrap(err, "invalid destination channel ID") + if err := host.ChannelIdentifierValidator(p.DestinationClient); err != nil { + return errorsmod.Wrap(err, "invalid destination ID") } if p.Sequence == 0 { diff --git a/modules/core/04-channel/v2/types/packet.pb.go b/modules/core/04-channel/v2/types/packet.pb.go index cb14c1e8880..2c52ed19bf9 100644 --- a/modules/core/04-channel/v2/types/packet.pb.go +++ b/modules/core/04-channel/v2/types/packet.pb.go @@ -65,10 +65,10 @@ type Packet struct { // with an earlier sequence number must be sent and received before a Packet // with a later sequence number. Sequence uint64 `protobuf:"varint,1,opt,name=sequence,proto3" json:"sequence,omitempty"` - // identifies the sending chain. - SourceChannel string `protobuf:"bytes,2,opt,name=source_channel,json=sourceChannel,proto3" json:"source_channel,omitempty"` - // identifies the receiving chain. - DestinationChannel string `protobuf:"bytes,3,opt,name=destination_channel,json=destinationChannel,proto3" json:"destination_channel,omitempty"` + // identifies the sending client on the sending chain. + SourceClient string `protobuf:"bytes,2,opt,name=source_client,json=sourceClient,proto3" json:"source_client,omitempty"` + // identifies the receiving client on the receiving chain. + DestinationClient string `protobuf:"bytes,3,opt,name=destination_client,json=destinationClient,proto3" json:"destination_client,omitempty"` // timeout timestamp in seconds after which the packet times out. TimeoutTimestamp uint64 `protobuf:"varint,4,opt,name=timeout_timestamp,json=timeoutTimestamp,proto3" json:"timeout_timestamp,omitempty"` // a list of payloads, each one for a specific application. @@ -115,16 +115,16 @@ func (m *Packet) GetSequence() uint64 { return 0 } -func (m *Packet) GetSourceChannel() string { +func (m *Packet) GetSourceClient() string { if m != nil { - return m.SourceChannel + return m.SourceClient } return "" } -func (m *Packet) GetDestinationChannel() string { +func (m *Packet) GetDestinationClient() string { if m != nil { - return m.DestinationChannel + return m.DestinationClient } return "" } @@ -336,44 +336,44 @@ func init() { func init() { proto.RegisterFile("ibc/core/channel/v2/packet.proto", fileDescriptor_2f814aba9ca97169) } var fileDescriptor_2f814aba9ca97169 = []byte{ - // 587 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x93, 0xc1, 0x6e, 0xd3, 0x30, - 0x18, 0xc7, 0xeb, 0xb5, 0xdd, 0x56, 0xaf, 0x6c, 0xc1, 0x1d, 0x52, 0xa8, 0x50, 0x17, 0x2a, 0x01, - 0x05, 0xb4, 0x04, 0x0a, 0x97, 0x49, 0x08, 0xa9, 0xcb, 0x32, 0x69, 0x02, 0x95, 0xca, 0x69, 0x91, - 0xe0, 0x52, 0xb9, 0xae, 0x95, 0x45, 0x4b, 0xe2, 0x10, 0x3b, 0x99, 0xf6, 0x0a, 0x3b, 0xf1, 0x02, - 0x3b, 0x70, 0xe6, 0x45, 0x76, 0xdc, 0x91, 0x13, 0x42, 0xdb, 0x89, 0xb7, 0x40, 0x75, 0xb2, 0xaa, - 0x1b, 0x70, 0x4a, 0xbe, 0xff, 0xf7, 0xfb, 0xdb, 0xfa, 0x7f, 0xd6, 0x07, 0x0d, 0x7f, 0x42, 0x2d, - 0xca, 0x13, 0x66, 0xd1, 0x43, 0x12, 0x45, 0x2c, 0xb0, 0xb2, 0xae, 0x15, 0x13, 0x7a, 0xc4, 0xa4, - 0x19, 0x27, 0x5c, 0x72, 0xd4, 0xf0, 0x27, 0xd4, 0x9c, 0x11, 0x66, 0x41, 0x98, 0x59, 0xb7, 0xb9, - 0xe9, 0x71, 0x8f, 0xab, 0xbe, 0x35, 0xfb, 0xcb, 0xd1, 0xf6, 0x6f, 0x00, 0x97, 0x07, 0xca, 0x8b, - 0x9a, 0x70, 0x55, 0xb0, 0x2f, 0x29, 0x8b, 0x28, 0xd3, 0x81, 0x01, 0x3a, 0x15, 0x3c, 0xaf, 0xd1, - 0x23, 0xb8, 0x2e, 0x78, 0x9a, 0x50, 0x36, 0x2e, 0x4e, 0xd4, 0x97, 0x0c, 0xd0, 0xa9, 0xe1, 0x3b, - 0xb9, 0x6a, 0xe7, 0x22, 0xb2, 0x60, 0x63, 0xca, 0x84, 0xf4, 0x23, 0x22, 0x7d, 0x1e, 0xcd, 0xd9, - 0xb2, 0x62, 0xd1, 0x42, 0xeb, 0xda, 0xf0, 0x1c, 0xde, 0x95, 0x7e, 0xc8, 0x78, 0x2a, 0xc7, 0xb3, - 0xaf, 0x90, 0x24, 0x8c, 0xf5, 0x8a, 0xba, 0x5c, 0x2b, 0x1a, 0xc3, 0x6b, 0x1d, 0xbd, 0x85, 0xab, - 0x31, 0x39, 0x09, 0x38, 0x99, 0x0a, 0xbd, 0x6a, 0x94, 0x3b, 0x6b, 0xdd, 0x07, 0xe6, 0x3f, 0x92, - 0x9a, 0x83, 0x1c, 0xda, 0xad, 0x9c, 0xff, 0xdc, 0x2a, 0xe1, 0xb9, 0xa7, 0xfd, 0x0d, 0xc0, 0x95, - 0xa2, 0x87, 0xb6, 0xe0, 0x5a, 0x11, 0x28, 0xe6, 0x89, 0x54, 0x79, 0x6b, 0x18, 0xe6, 0xd2, 0x80, - 0x27, 0x12, 0x3d, 0x85, 0xda, 0x62, 0x14, 0x45, 0xe5, 0x99, 0x37, 0x16, 0x74, 0x85, 0xea, 0x70, - 0x25, 0x63, 0x89, 0xf0, 0x79, 0x54, 0x24, 0xbd, 0x2e, 0x67, 0x23, 0x65, 0x11, 0xe5, 0x53, 0x3f, - 0xf2, 0x54, 0xaa, 0x1a, 0x9e, 0xd7, 0x68, 0x13, 0x56, 0x33, 0x12, 0xa4, 0x4c, 0xaf, 0x1a, 0xa0, - 0x53, 0xc7, 0x79, 0xd1, 0xde, 0x83, 0x1b, 0x3d, 0x7a, 0x14, 0xf1, 0xe3, 0x80, 0x4d, 0x3d, 0x16, - 0xb2, 0x48, 0xa2, 0x97, 0x70, 0x93, 0xc4, 0xf1, 0x98, 0xdc, 0x94, 0x85, 0x0e, 0x8c, 0x72, 0xa7, - 0x8e, 0x1b, 0x24, 0x8e, 0x6f, 0x39, 0x44, 0xfb, 0x18, 0x6a, 0x98, 0xd1, 0x2c, 0x7f, 0x58, 0xcc, - 0x44, 0x1a, 0x48, 0xb4, 0x03, 0x97, 0x85, 0x24, 0x32, 0x15, 0x2a, 0xec, 0x7a, 0xf7, 0xe1, 0x7f, - 0x66, 0x37, 0xb3, 0xb8, 0x0a, 0xc4, 0x85, 0x01, 0x75, 0xe0, 0xc6, 0xad, 0xdb, 0xd5, 0x28, 0xea, - 0xf8, 0xb6, 0xfc, 0xec, 0x3b, 0x80, 0xf5, 0xc5, 0x23, 0xd0, 0x13, 0x78, 0x7f, 0xd0, 0xb3, 0xdf, - 0x39, 0xc3, 0xb1, 0x3b, 0xec, 0x0d, 0x47, 0xee, 0x78, 0xd4, 0x77, 0x07, 0x8e, 0x7d, 0xb0, 0x7f, - 0xe0, 0xec, 0x69, 0xa5, 0xe6, 0xea, 0xe9, 0x99, 0x51, 0xe9, 0x7f, 0xe8, 0x3b, 0xe8, 0x31, 0xbc, - 0x77, 0x13, 0x74, 0x47, 0xb6, 0xed, 0xb8, 0xae, 0x06, 0x9a, 0x6b, 0xa7, 0x67, 0xc6, 0x8a, 0x9b, - 0x52, 0xca, 0x84, 0xf8, 0x9b, 0xdb, 0xef, 0x1d, 0xbc, 0x1f, 0x61, 0x47, 0x5b, 0xca, 0xb9, 0x7d, - 0xe2, 0x07, 0x69, 0xc2, 0x50, 0x1b, 0x36, 0x6e, 0x72, 0x3d, 0xf7, 0x53, 0xdf, 0xd6, 0xca, 0xcd, - 0xda, 0xe9, 0x99, 0x51, 0xed, 0x89, 0x93, 0x88, 0xee, 0x7e, 0x3c, 0xbf, 0x6c, 0x81, 0x8b, 0xcb, - 0x16, 0xf8, 0x75, 0xd9, 0x02, 0x5f, 0xaf, 0x5a, 0xa5, 0x8b, 0xab, 0x56, 0xe9, 0xc7, 0x55, 0xab, - 0xf4, 0xf9, 0x8d, 0xe7, 0xcb, 0xc3, 0x74, 0x62, 0x52, 0x1e, 0x5a, 0x94, 0x8b, 0x90, 0x0b, 0xcb, - 0x9f, 0xd0, 0x6d, 0x8f, 0x5b, 0xd9, 0x8e, 0x15, 0xf2, 0x69, 0x1a, 0x30, 0x91, 0xef, 0xe0, 0x8b, - 0xd7, 0xdb, 0x0b, 0x6b, 0x28, 0x4f, 0x62, 0x26, 0x26, 0xcb, 0x6a, 0xb7, 0x5e, 0xfd, 0x09, 0x00, - 0x00, 0xff, 0xff, 0x23, 0xd8, 0x40, 0xe5, 0xaa, 0x03, 0x00, 0x00, + // 588 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x93, 0xc1, 0x6e, 0xd3, 0x40, + 0x10, 0x86, 0xb3, 0x4d, 0xd2, 0x36, 0xdb, 0x40, 0xdd, 0x6d, 0x91, 0x4c, 0x84, 0x52, 0x13, 0x24, + 0x08, 0xa0, 0xda, 0x10, 0xb8, 0x54, 0x42, 0x48, 0xa9, 0xeb, 0x4a, 0x15, 0x28, 0x44, 0xeb, 0x04, + 0x09, 0x2e, 0xd1, 0x66, 0xb3, 0x72, 0xad, 0xda, 0x5e, 0xe3, 0x5d, 0xbb, 0xea, 0x2b, 0xf4, 0xc4, + 0x0b, 0xf4, 0xc0, 0x99, 0x17, 0xe9, 0xb1, 0x47, 0x4e, 0x08, 0xb5, 0xe2, 0x3d, 0x90, 0xd7, 0x6e, + 0x95, 0x16, 0x38, 0xd9, 0xf3, 0xcf, 0xf7, 0x7b, 0xf4, 0x8f, 0x35, 0xd0, 0xf0, 0xa7, 0xd4, 0xa2, + 0x3c, 0x61, 0x16, 0x3d, 0x20, 0x51, 0xc4, 0x02, 0x2b, 0xeb, 0x59, 0x31, 0xa1, 0x87, 0x4c, 0x9a, + 0x71, 0xc2, 0x25, 0x47, 0xeb, 0xfe, 0x94, 0x9a, 0x39, 0x61, 0x96, 0x84, 0x99, 0xf5, 0x5a, 0x1b, + 0x1e, 0xf7, 0xb8, 0xea, 0x5b, 0xf9, 0x5b, 0x81, 0x76, 0x7e, 0x03, 0xb8, 0x38, 0x54, 0x5e, 0xd4, + 0x82, 0xcb, 0x82, 0x7d, 0x49, 0x59, 0x44, 0x99, 0x0e, 0x0c, 0xd0, 0xad, 0xe1, 0xeb, 0x1a, 0x3d, + 0x82, 0x77, 0x04, 0x4f, 0x13, 0xca, 0x26, 0x34, 0xf0, 0x59, 0x24, 0xf5, 0x05, 0x03, 0x74, 0x1b, + 0xb8, 0x59, 0x88, 0xb6, 0xd2, 0xd0, 0x16, 0x44, 0x33, 0x26, 0xa4, 0x1f, 0x11, 0xe9, 0xf3, 0xe8, + 0x8a, 0xac, 0x2a, 0x72, 0x6d, 0xae, 0x53, 0xe2, 0xcf, 0xe1, 0x9a, 0xf4, 0x43, 0xc6, 0x53, 0x39, + 0xc9, 0x9f, 0x42, 0x92, 0x30, 0xd6, 0x6b, 0x6a, 0xb0, 0x56, 0x36, 0x46, 0x57, 0x3a, 0x7a, 0x0b, + 0x97, 0x63, 0x72, 0x1c, 0x70, 0x32, 0x13, 0x7a, 0xdd, 0xa8, 0x76, 0x57, 0x7a, 0x0f, 0xcc, 0x7f, + 0xa4, 0x34, 0x87, 0x05, 0xb4, 0x53, 0x3b, 0xfb, 0xb9, 0x59, 0xc1, 0xd7, 0x9e, 0xce, 0x37, 0x00, + 0x97, 0xca, 0x1e, 0xda, 0x84, 0x2b, 0x65, 0x98, 0x98, 0x27, 0x52, 0x65, 0x6d, 0x60, 0x58, 0x48, + 0x43, 0x9e, 0x48, 0xf4, 0x14, 0x6a, 0xf3, 0x41, 0x14, 0x55, 0x04, 0x5e, 0x9d, 0xd3, 0x15, 0xaa, + 0xc3, 0xa5, 0x8c, 0x25, 0xc2, 0xe7, 0x51, 0x19, 0xf4, 0xaa, 0xcc, 0xd7, 0xc9, 0x22, 0xca, 0x67, + 0x7e, 0xe4, 0xa9, 0x54, 0x0d, 0x7c, 0x5d, 0xa3, 0x0d, 0x58, 0xcf, 0x48, 0x90, 0x32, 0xbd, 0x6e, + 0x80, 0x6e, 0x13, 0x17, 0x45, 0x67, 0x17, 0xae, 0xf6, 0xe9, 0x61, 0xc4, 0x8f, 0x02, 0x36, 0xf3, + 0x58, 0x98, 0xef, 0xe8, 0x25, 0xdc, 0x20, 0x71, 0x3c, 0x21, 0x37, 0x65, 0xa1, 0x03, 0xa3, 0xda, + 0x6d, 0xe2, 0x75, 0x12, 0xc7, 0xb7, 0x1c, 0xa2, 0x73, 0x04, 0x35, 0xcc, 0x68, 0x56, 0xfc, 0x54, + 0xcc, 0x44, 0x1a, 0x48, 0xb4, 0x0d, 0x17, 0x85, 0x24, 0x32, 0x15, 0x2a, 0xec, 0xdd, 0xde, 0xc3, + 0xff, 0xec, 0x2e, 0xb7, 0xb8, 0x0a, 0xc4, 0xa5, 0x01, 0x75, 0xe1, 0xea, 0xad, 0xe9, 0x6a, 0x15, + 0x4d, 0x7c, 0x5b, 0x7e, 0xf6, 0x1d, 0xc0, 0xe6, 0xfc, 0x27, 0xd0, 0x13, 0x78, 0x7f, 0xd8, 0xb7, + 0xdf, 0x39, 0xa3, 0x89, 0x3b, 0xea, 0x8f, 0xc6, 0xee, 0x64, 0x3c, 0x70, 0x87, 0x8e, 0xbd, 0xbf, + 0xb7, 0xef, 0xec, 0x6a, 0x95, 0xd6, 0xf2, 0xc9, 0xa9, 0x51, 0x1b, 0x7c, 0x18, 0x38, 0xe8, 0x31, + 0xbc, 0x77, 0x13, 0x74, 0xc7, 0xb6, 0xed, 0xb8, 0xae, 0x06, 0x5a, 0x2b, 0x27, 0xa7, 0xc6, 0x92, + 0x9b, 0x52, 0xca, 0x84, 0xf8, 0x9b, 0xdb, 0xeb, 0xef, 0xbf, 0x1f, 0x63, 0x47, 0x5b, 0x28, 0xb8, + 0x3d, 0xe2, 0x07, 0x69, 0xc2, 0x50, 0x07, 0xae, 0xdf, 0xe4, 0xfa, 0xee, 0xa7, 0x81, 0xad, 0x55, + 0x5b, 0x8d, 0x93, 0x53, 0xa3, 0xde, 0x17, 0xc7, 0x11, 0xdd, 0xf9, 0x78, 0x76, 0xd1, 0x06, 0xe7, + 0x17, 0x6d, 0xf0, 0xeb, 0xa2, 0x0d, 0xbe, 0x5e, 0xb6, 0x2b, 0xe7, 0x97, 0xed, 0xca, 0x8f, 0xcb, + 0x76, 0xe5, 0xf3, 0x1b, 0xcf, 0x97, 0x07, 0xe9, 0xd4, 0xa4, 0x3c, 0xb4, 0x28, 0x17, 0x21, 0x17, + 0x96, 0x3f, 0xa5, 0x5b, 0x1e, 0xb7, 0xb2, 0x6d, 0x2b, 0xe4, 0xb3, 0x34, 0x60, 0xa2, 0xb8, 0xbf, + 0x17, 0xaf, 0xb7, 0xe6, 0x4e, 0x50, 0x1e, 0xc7, 0x4c, 0x4c, 0x17, 0xd5, 0x5d, 0xbd, 0xfa, 0x13, + 0x00, 0x00, 0xff, 0xff, 0x4f, 0x60, 0x44, 0x2c, 0xa6, 0x03, 0x00, 0x00, } func (m *Packet) Marshal() (dAtA []byte, err error) { @@ -415,17 +415,17 @@ func (m *Packet) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x20 } - if len(m.DestinationChannel) > 0 { - i -= len(m.DestinationChannel) - copy(dAtA[i:], m.DestinationChannel) - i = encodeVarintPacket(dAtA, i, uint64(len(m.DestinationChannel))) + if len(m.DestinationClient) > 0 { + i -= len(m.DestinationClient) + copy(dAtA[i:], m.DestinationClient) + i = encodeVarintPacket(dAtA, i, uint64(len(m.DestinationClient))) i-- dAtA[i] = 0x1a } - if len(m.SourceChannel) > 0 { - i -= len(m.SourceChannel) - copy(dAtA[i:], m.SourceChannel) - i = encodeVarintPacket(dAtA, i, uint64(len(m.SourceChannel))) + if len(m.SourceClient) > 0 { + i -= len(m.SourceClient) + copy(dAtA[i:], m.SourceClient) + i = encodeVarintPacket(dAtA, i, uint64(len(m.SourceClient))) i-- dAtA[i] = 0x12 } @@ -582,11 +582,11 @@ func (m *Packet) Size() (n int) { if m.Sequence != 0 { n += 1 + sovPacket(uint64(m.Sequence)) } - l = len(m.SourceChannel) + l = len(m.SourceClient) if l > 0 { n += 1 + l + sovPacket(uint64(l)) } - l = len(m.DestinationChannel) + l = len(m.DestinationClient) if l > 0 { n += 1 + l + sovPacket(uint64(l)) } @@ -718,7 +718,7 @@ func (m *Packet) Unmarshal(dAtA []byte) error { } case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SourceChannel", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field SourceClient", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -746,11 +746,11 @@ func (m *Packet) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.SourceChannel = string(dAtA[iNdEx:postIndex]) + m.SourceClient = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DestinationChannel", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DestinationClient", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -778,7 +778,7 @@ func (m *Packet) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.DestinationChannel = string(dAtA[iNdEx:postIndex]) + m.DestinationClient = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: if wireType != 0 { diff --git a/modules/core/04-channel/v2/types/packet_test.go b/modules/core/04-channel/v2/types/packet_test.go index 4952e03671d..ec5d5776160 100644 --- a/modules/core/04-channel/v2/types/packet_test.go +++ b/modules/core/04-channel/v2/types/packet_test.go @@ -55,16 +55,16 @@ func TestValidateBasic(t *testing.T) { host.ErrInvalidID, }, { - "failure: invalid source channel ID", + "failure: invalid source ID", func() { - packet.SourceChannel = "" + packet.SourceClient = "" }, host.ErrInvalidID, }, { - "failure: invalid dest channel ID", + "failure: invalid dest ID", func() { - packet.DestinationChannel = "" + packet.DestinationClient = "" }, host.ErrInvalidID, }, diff --git a/modules/core/04-channel/v2/types/query.go b/modules/core/04-channel/v2/types/query.go index 92913c0ae19..fdc87dccb39 100644 --- a/modules/core/04-channel/v2/types/query.go +++ b/modules/core/04-channel/v2/types/query.go @@ -1,55 +1,13 @@ package types import ( - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" ) -// NewQueryChannelRequest creates and returns a new channel query request. -func NewQueryChannelRequest(channelID string) *QueryChannelRequest { - return &QueryChannelRequest{ - ChannelId: channelID, - } -} - -// NewQueryChannelResponse creates and returns a new channel query response. -func NewQueryChannelResponse(channel Channel) *QueryChannelResponse { - return &QueryChannelResponse{ - Channel: channel, - } -} - -// NewQueryChannelClientStateRequest creates and returns a new ChannelClientState query request. -func NewQueryChannelClientStateRequest(channelID string) *QueryChannelClientStateRequest { - return &QueryChannelClientStateRequest{ - ChannelId: channelID, - } -} - -// NewQueryChannelClientStateResponse creates and returns a new ChannelClientState query response. -func NewQueryChannelClientStateResponse(identifiedClientState clienttypes.IdentifiedClientState, proof []byte, height clienttypes.Height) *QueryChannelClientStateResponse { - return &QueryChannelClientStateResponse{ - IdentifiedClientState: &identifiedClientState, - Proof: proof, - ProofHeight: height, - } -} - -// NewQueryChannelConsensusStateResponse creates and returns a new ChannelConsensusState query response. -func NewQueryChannelConsensusStateResponse(clientID string, anyConsensusState *codectypes.Any, proof []byte, height clienttypes.Height) *QueryChannelConsensusStateResponse { - return &QueryChannelConsensusStateResponse{ - ConsensusState: anyConsensusState, - ClientId: clientID, - Proof: proof, - ProofHeight: height, - } -} - // NewQueryNextSequenceSendRequest creates a new next sequence send query. -func NewQueryNextSequenceSendRequest(channelID string) *QueryNextSequenceSendRequest { +func NewQueryNextSequenceSendRequest(clientID string) *QueryNextSequenceSendRequest { return &QueryNextSequenceSendRequest{ - ChannelId: channelID, + ClientId: clientID, } } @@ -65,10 +23,10 @@ func NewQueryNextSequenceSendResponse( } // NewQueryPacketCommitmentRequest creates and returns a new packet commitment query request. -func NewQueryPacketCommitmentRequest(channelID string, sequence uint64) *QueryPacketCommitmentRequest { +func NewQueryPacketCommitmentRequest(clientID string, sequence uint64) *QueryPacketCommitmentRequest { return &QueryPacketCommitmentRequest{ - ChannelId: channelID, - Sequence: sequence, + ClientId: clientID, + Sequence: sequence, } } @@ -82,10 +40,10 @@ func NewQueryPacketCommitmentResponse(commitmentHash []byte, proof []byte, proof } // NewQueryPacketAcknowledgementRequest creates and returns a new packet acknowledgement query request. -func NewQueryPacketAcknowledgementRequest(channelID string, sequence uint64) *QueryPacketAcknowledgementRequest { +func NewQueryPacketAcknowledgementRequest(clientID string, sequence uint64) *QueryPacketAcknowledgementRequest { return &QueryPacketAcknowledgementRequest{ - ChannelId: channelID, - Sequence: sequence, + ClientId: clientID, + Sequence: sequence, } } @@ -99,10 +57,10 @@ func NewQueryPacketAcknowledgementResponse(acknowledgementHash []byte, proof []b } // NewQueryPacketReceiptRequest creates and returns a new packet receipt query request. -func NewQueryPacketReceiptRequest(channelID string, sequence uint64) *QueryPacketReceiptRequest { +func NewQueryPacketReceiptRequest(clientID string, sequence uint64) *QueryPacketReceiptRequest { return &QueryPacketReceiptRequest{ - ChannelId: channelID, - Sequence: sequence, + ClientId: clientID, + Sequence: sequence, } } @@ -116,9 +74,9 @@ func NewQueryPacketReceiptResponse(exists bool, proof []byte, height clienttypes } // NewQueryPacketReceiptRequest creates and returns a new packet receipt query request. -func NewQueryUnreceivedPacketsRequest(channelID string, sequences []uint64) *QueryUnreceivedPacketsRequest { +func NewQueryUnreceivedPacketsRequest(clientID string, sequences []uint64) *QueryUnreceivedPacketsRequest { return &QueryUnreceivedPacketsRequest{ - ChannelId: channelID, + ClientId: clientID, Sequences: sequences, } } diff --git a/modules/core/04-channel/v2/types/query.pb.go b/modules/core/04-channel/v2/types/query.pb.go index 90f01927af7..4f230d4757a 100644 --- a/modules/core/04-channel/v2/types/query.pb.go +++ b/modules/core/04-channel/v2/types/query.pb.go @@ -6,7 +6,6 @@ package types import ( context "context" fmt "fmt" - types1 "github.com/cosmos/cosmos-sdk/codec/types" query "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" @@ -32,359 +31,17 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// QueryChannelRequest is the request type for the Query/Channel RPC method -type QueryChannelRequest struct { - ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` -} - -func (m *QueryChannelRequest) Reset() { *m = QueryChannelRequest{} } -func (m *QueryChannelRequest) String() string { return proto.CompactTextString(m) } -func (*QueryChannelRequest) ProtoMessage() {} -func (*QueryChannelRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a328cba4986edcab, []int{0} -} -func (m *QueryChannelRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryChannelRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryChannelRequest.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 *QueryChannelRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryChannelRequest.Merge(m, src) -} -func (m *QueryChannelRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryChannelRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryChannelRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryChannelRequest proto.InternalMessageInfo - -func (m *QueryChannelRequest) GetChannelId() string { - if m != nil { - return m.ChannelId - } - return "" -} - -// QueryChannelRequest is the response type for the Query/Channel RPC method -type QueryChannelResponse struct { - // the channel associated with the provided channel id - Channel Channel `protobuf:"bytes,1,opt,name=channel,proto3" json:"channel"` -} - -func (m *QueryChannelResponse) Reset() { *m = QueryChannelResponse{} } -func (m *QueryChannelResponse) String() string { return proto.CompactTextString(m) } -func (*QueryChannelResponse) ProtoMessage() {} -func (*QueryChannelResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a328cba4986edcab, []int{1} -} -func (m *QueryChannelResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryChannelResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryChannelResponse.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 *QueryChannelResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryChannelResponse.Merge(m, src) -} -func (m *QueryChannelResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryChannelResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryChannelResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryChannelResponse proto.InternalMessageInfo - -func (m *QueryChannelResponse) GetChannel() Channel { - if m != nil { - return m.Channel - } - return Channel{} -} - -// QueryChannelClientStateRequest is the request type for the Query/ClientState -// RPC method -type QueryChannelClientStateRequest struct { - // channel unique identifier - ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` -} - -func (m *QueryChannelClientStateRequest) Reset() { *m = QueryChannelClientStateRequest{} } -func (m *QueryChannelClientStateRequest) String() string { return proto.CompactTextString(m) } -func (*QueryChannelClientStateRequest) ProtoMessage() {} -func (*QueryChannelClientStateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a328cba4986edcab, []int{2} -} -func (m *QueryChannelClientStateRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryChannelClientStateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryChannelClientStateRequest.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 *QueryChannelClientStateRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryChannelClientStateRequest.Merge(m, src) -} -func (m *QueryChannelClientStateRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryChannelClientStateRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryChannelClientStateRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryChannelClientStateRequest proto.InternalMessageInfo - -func (m *QueryChannelClientStateRequest) GetChannelId() string { - if m != nil { - return m.ChannelId - } - return "" -} - -// QueryChannelClientStateResponse is the Response type for the -// Query/QueryChannelClientState RPC method -type QueryChannelClientStateResponse struct { - // client state associated with the channel - IdentifiedClientState *types.IdentifiedClientState `protobuf:"bytes,1,opt,name=identified_client_state,json=identifiedClientState,proto3" json:"identified_client_state,omitempty"` - // merkle proof of existence - Proof []byte `protobuf:"bytes,2,opt,name=proof,proto3" json:"proof,omitempty"` - // height at which the proof was retrieved - ProofHeight types.Height `protobuf:"bytes,3,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height"` -} - -func (m *QueryChannelClientStateResponse) Reset() { *m = QueryChannelClientStateResponse{} } -func (m *QueryChannelClientStateResponse) String() string { return proto.CompactTextString(m) } -func (*QueryChannelClientStateResponse) ProtoMessage() {} -func (*QueryChannelClientStateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a328cba4986edcab, []int{3} -} -func (m *QueryChannelClientStateResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryChannelClientStateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryChannelClientStateResponse.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 *QueryChannelClientStateResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryChannelClientStateResponse.Merge(m, src) -} -func (m *QueryChannelClientStateResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryChannelClientStateResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryChannelClientStateResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryChannelClientStateResponse proto.InternalMessageInfo - -func (m *QueryChannelClientStateResponse) GetIdentifiedClientState() *types.IdentifiedClientState { - if m != nil { - return m.IdentifiedClientState - } - return nil -} - -func (m *QueryChannelClientStateResponse) GetProof() []byte { - if m != nil { - return m.Proof - } - return nil -} - -func (m *QueryChannelClientStateResponse) GetProofHeight() types.Height { - if m != nil { - return m.ProofHeight - } - return types.Height{} -} - -// QueryChannelConsensusStateRequest is the request type for the Query/ConsensusState -// RPC method -type QueryChannelConsensusStateRequest struct { - // channel unique identifier - ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` - // revision number of the consensus state - RevisionNumber uint64 `protobuf:"varint,2,opt,name=revision_number,json=revisionNumber,proto3" json:"revision_number,omitempty"` - // revision height of the consensus state - RevisionHeight uint64 `protobuf:"varint,3,opt,name=revision_height,json=revisionHeight,proto3" json:"revision_height,omitempty"` -} - -func (m *QueryChannelConsensusStateRequest) Reset() { *m = QueryChannelConsensusStateRequest{} } -func (m *QueryChannelConsensusStateRequest) String() string { return proto.CompactTextString(m) } -func (*QueryChannelConsensusStateRequest) ProtoMessage() {} -func (*QueryChannelConsensusStateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a328cba4986edcab, []int{4} -} -func (m *QueryChannelConsensusStateRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryChannelConsensusStateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryChannelConsensusStateRequest.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 *QueryChannelConsensusStateRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryChannelConsensusStateRequest.Merge(m, src) -} -func (m *QueryChannelConsensusStateRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryChannelConsensusStateRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryChannelConsensusStateRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryChannelConsensusStateRequest proto.InternalMessageInfo - -func (m *QueryChannelConsensusStateRequest) GetChannelId() string { - if m != nil { - return m.ChannelId - } - return "" -} - -func (m *QueryChannelConsensusStateRequest) GetRevisionNumber() uint64 { - if m != nil { - return m.RevisionNumber - } - return 0 -} - -func (m *QueryChannelConsensusStateRequest) GetRevisionHeight() uint64 { - if m != nil { - return m.RevisionHeight - } - return 0 -} - -// QueryChannelConsensusStateResponse is the Response type for the -// Query/QueryChannelConsensusState RPC method -type QueryChannelConsensusStateResponse struct { - // consensus state associated with the channel - ConsensusState *types1.Any `protobuf:"bytes,1,opt,name=consensus_state,json=consensusState,proto3" json:"consensus_state,omitempty"` - // client ID associated with the consensus state - ClientId string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` - // merkle proof of existence - Proof []byte `protobuf:"bytes,3,opt,name=proof,proto3" json:"proof,omitempty"` - // height at which the proof was retrieved - ProofHeight types.Height `protobuf:"bytes,4,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height"` -} - -func (m *QueryChannelConsensusStateResponse) Reset() { *m = QueryChannelConsensusStateResponse{} } -func (m *QueryChannelConsensusStateResponse) String() string { return proto.CompactTextString(m) } -func (*QueryChannelConsensusStateResponse) ProtoMessage() {} -func (*QueryChannelConsensusStateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a328cba4986edcab, []int{5} -} -func (m *QueryChannelConsensusStateResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryChannelConsensusStateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryChannelConsensusStateResponse.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 *QueryChannelConsensusStateResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryChannelConsensusStateResponse.Merge(m, src) -} -func (m *QueryChannelConsensusStateResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryChannelConsensusStateResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryChannelConsensusStateResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryChannelConsensusStateResponse proto.InternalMessageInfo - -func (m *QueryChannelConsensusStateResponse) GetConsensusState() *types1.Any { - if m != nil { - return m.ConsensusState - } - return nil -} - -func (m *QueryChannelConsensusStateResponse) GetClientId() string { - if m != nil { - return m.ClientId - } - return "" -} - -func (m *QueryChannelConsensusStateResponse) GetProof() []byte { - if m != nil { - return m.Proof - } - return nil -} - -func (m *QueryChannelConsensusStateResponse) GetProofHeight() types.Height { - if m != nil { - return m.ProofHeight - } - return types.Height{} -} - // QueryNextSequenceSendRequest is the request type for the Query/QueryNextSequenceSend RPC method type QueryNextSequenceSendRequest struct { - // channel unique identifier - ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + // client unique identifier + ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` } func (m *QueryNextSequenceSendRequest) Reset() { *m = QueryNextSequenceSendRequest{} } func (m *QueryNextSequenceSendRequest) String() string { return proto.CompactTextString(m) } func (*QueryNextSequenceSendRequest) ProtoMessage() {} func (*QueryNextSequenceSendRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a328cba4986edcab, []int{6} + return fileDescriptor_a328cba4986edcab, []int{0} } func (m *QueryNextSequenceSendRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -413,9 +70,9 @@ func (m *QueryNextSequenceSendRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryNextSequenceSendRequest proto.InternalMessageInfo -func (m *QueryNextSequenceSendRequest) GetChannelId() string { +func (m *QueryNextSequenceSendRequest) GetClientId() string { if m != nil { - return m.ChannelId + return m.ClientId } return "" } @@ -434,7 +91,7 @@ func (m *QueryNextSequenceSendResponse) Reset() { *m = QueryNextSequence func (m *QueryNextSequenceSendResponse) String() string { return proto.CompactTextString(m) } func (*QueryNextSequenceSendResponse) ProtoMessage() {} func (*QueryNextSequenceSendResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a328cba4986edcab, []int{7} + return fileDescriptor_a328cba4986edcab, []int{1} } func (m *QueryNextSequenceSendResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -486,8 +143,8 @@ func (m *QueryNextSequenceSendResponse) GetProofHeight() types.Height { // QueryPacketCommitmentRequest is the request type for the Query/PacketCommitment RPC method. type QueryPacketCommitmentRequest struct { - // channel unique identifier - ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + // client unique identifier + ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` // packet sequence Sequence uint64 `protobuf:"varint,2,opt,name=sequence,proto3" json:"sequence,omitempty"` } @@ -496,7 +153,7 @@ func (m *QueryPacketCommitmentRequest) Reset() { *m = QueryPacketCommitm func (m *QueryPacketCommitmentRequest) String() string { return proto.CompactTextString(m) } func (*QueryPacketCommitmentRequest) ProtoMessage() {} func (*QueryPacketCommitmentRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a328cba4986edcab, []int{8} + return fileDescriptor_a328cba4986edcab, []int{2} } func (m *QueryPacketCommitmentRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -525,9 +182,9 @@ func (m *QueryPacketCommitmentRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryPacketCommitmentRequest proto.InternalMessageInfo -func (m *QueryPacketCommitmentRequest) GetChannelId() string { +func (m *QueryPacketCommitmentRequest) GetClientId() string { if m != nil { - return m.ChannelId + return m.ClientId } return "" } @@ -553,7 +210,7 @@ func (m *QueryPacketCommitmentResponse) Reset() { *m = QueryPacketCommit func (m *QueryPacketCommitmentResponse) String() string { return proto.CompactTextString(m) } func (*QueryPacketCommitmentResponse) ProtoMessage() {} func (*QueryPacketCommitmentResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a328cba4986edcab, []int{9} + return fileDescriptor_a328cba4986edcab, []int{3} } func (m *QueryPacketCommitmentResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -605,8 +262,8 @@ func (m *QueryPacketCommitmentResponse) GetProofHeight() types.Height { // QueryPacketCommitmentsRequest is the request type for the Query/PacketCommitments RPC method. type QueryPacketCommitmentsRequest struct { - // channel unique identifier - ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + // client unique identifier + ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` // pagination request Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } @@ -615,7 +272,7 @@ func (m *QueryPacketCommitmentsRequest) Reset() { *m = QueryPacketCommit func (m *QueryPacketCommitmentsRequest) String() string { return proto.CompactTextString(m) } func (*QueryPacketCommitmentsRequest) ProtoMessage() {} func (*QueryPacketCommitmentsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a328cba4986edcab, []int{10} + return fileDescriptor_a328cba4986edcab, []int{4} } func (m *QueryPacketCommitmentsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -644,9 +301,9 @@ func (m *QueryPacketCommitmentsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryPacketCommitmentsRequest proto.InternalMessageInfo -func (m *QueryPacketCommitmentsRequest) GetChannelId() string { +func (m *QueryPacketCommitmentsRequest) GetClientId() string { if m != nil { - return m.ChannelId + return m.ClientId } return "" } @@ -672,7 +329,7 @@ func (m *QueryPacketCommitmentsResponse) Reset() { *m = QueryPacketCommi func (m *QueryPacketCommitmentsResponse) String() string { return proto.CompactTextString(m) } func (*QueryPacketCommitmentsResponse) ProtoMessage() {} func (*QueryPacketCommitmentsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a328cba4986edcab, []int{11} + return fileDescriptor_a328cba4986edcab, []int{5} } func (m *QueryPacketCommitmentsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -724,8 +381,8 @@ func (m *QueryPacketCommitmentsResponse) GetHeight() types.Height { // QueryPacketAcknowledgementRequest is the request type for the Query/PacketAcknowledgement RPC method. type QueryPacketAcknowledgementRequest struct { - // channel unique identifier - ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + // client unique identifier + ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` // packet sequence Sequence uint64 `protobuf:"varint,2,opt,name=sequence,proto3" json:"sequence,omitempty"` } @@ -734,7 +391,7 @@ func (m *QueryPacketAcknowledgementRequest) Reset() { *m = QueryPacketAc func (m *QueryPacketAcknowledgementRequest) String() string { return proto.CompactTextString(m) } func (*QueryPacketAcknowledgementRequest) ProtoMessage() {} func (*QueryPacketAcknowledgementRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a328cba4986edcab, []int{12} + return fileDescriptor_a328cba4986edcab, []int{6} } func (m *QueryPacketAcknowledgementRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -763,9 +420,9 @@ func (m *QueryPacketAcknowledgementRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryPacketAcknowledgementRequest proto.InternalMessageInfo -func (m *QueryPacketAcknowledgementRequest) GetChannelId() string { +func (m *QueryPacketAcknowledgementRequest) GetClientId() string { if m != nil { - return m.ChannelId + return m.ClientId } return "" } @@ -791,7 +448,7 @@ func (m *QueryPacketAcknowledgementResponse) Reset() { *m = QueryPacketA func (m *QueryPacketAcknowledgementResponse) String() string { return proto.CompactTextString(m) } func (*QueryPacketAcknowledgementResponse) ProtoMessage() {} func (*QueryPacketAcknowledgementResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a328cba4986edcab, []int{13} + return fileDescriptor_a328cba4986edcab, []int{7} } func (m *QueryPacketAcknowledgementResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -844,8 +501,8 @@ func (m *QueryPacketAcknowledgementResponse) GetProofHeight() types.Height { // QueryPacketAcknowledgementsRequest is the request type for the // Query/QueryPacketCommitments RPC method type QueryPacketAcknowledgementsRequest struct { - // channel unique identifier - ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + // client unique identifier + ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` // pagination request Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` // list of packet sequences @@ -856,7 +513,7 @@ func (m *QueryPacketAcknowledgementsRequest) Reset() { *m = QueryPacketA func (m *QueryPacketAcknowledgementsRequest) String() string { return proto.CompactTextString(m) } func (*QueryPacketAcknowledgementsRequest) ProtoMessage() {} func (*QueryPacketAcknowledgementsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a328cba4986edcab, []int{14} + return fileDescriptor_a328cba4986edcab, []int{8} } func (m *QueryPacketAcknowledgementsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -885,9 +542,9 @@ func (m *QueryPacketAcknowledgementsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryPacketAcknowledgementsRequest proto.InternalMessageInfo -func (m *QueryPacketAcknowledgementsRequest) GetChannelId() string { +func (m *QueryPacketAcknowledgementsRequest) GetClientId() string { if m != nil { - return m.ChannelId + return m.ClientId } return "" } @@ -920,7 +577,7 @@ func (m *QueryPacketAcknowledgementsResponse) Reset() { *m = QueryPacket func (m *QueryPacketAcknowledgementsResponse) String() string { return proto.CompactTextString(m) } func (*QueryPacketAcknowledgementsResponse) ProtoMessage() {} func (*QueryPacketAcknowledgementsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a328cba4986edcab, []int{15} + return fileDescriptor_a328cba4986edcab, []int{9} } func (m *QueryPacketAcknowledgementsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -972,19 +629,17 @@ func (m *QueryPacketAcknowledgementsResponse) GetHeight() types.Height { // QueryPacketReceiptRequest is the request type for the Query/PacketReceipt RPC method. type QueryPacketReceiptRequest struct { - // port unique identifier - PortId string `protobuf:"bytes,1,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty"` - // channel unique identifier - ChannelId string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + // client unique identifier + ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` // packet sequence - Sequence uint64 `protobuf:"varint,3,opt,name=sequence,proto3" json:"sequence,omitempty"` + Sequence uint64 `protobuf:"varint,2,opt,name=sequence,proto3" json:"sequence,omitempty"` } func (m *QueryPacketReceiptRequest) Reset() { *m = QueryPacketReceiptRequest{} } func (m *QueryPacketReceiptRequest) String() string { return proto.CompactTextString(m) } func (*QueryPacketReceiptRequest) ProtoMessage() {} func (*QueryPacketReceiptRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a328cba4986edcab, []int{16} + return fileDescriptor_a328cba4986edcab, []int{10} } func (m *QueryPacketReceiptRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1013,16 +668,9 @@ func (m *QueryPacketReceiptRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryPacketReceiptRequest proto.InternalMessageInfo -func (m *QueryPacketReceiptRequest) GetPortId() string { - if m != nil { - return m.PortId - } - return "" -} - -func (m *QueryPacketReceiptRequest) GetChannelId() string { +func (m *QueryPacketReceiptRequest) GetClientId() string { if m != nil { - return m.ChannelId + return m.ClientId } return "" } @@ -1048,7 +696,7 @@ func (m *QueryPacketReceiptResponse) Reset() { *m = QueryPacketReceiptRe func (m *QueryPacketReceiptResponse) String() string { return proto.CompactTextString(m) } func (*QueryPacketReceiptResponse) ProtoMessage() {} func (*QueryPacketReceiptResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a328cba4986edcab, []int{17} + return fileDescriptor_a328cba4986edcab, []int{11} } func (m *QueryPacketReceiptResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1100,8 +748,8 @@ func (m *QueryPacketReceiptResponse) GetProofHeight() types.Height { // QueryUnreceivedPacketsRequest is the request type for the Query/UnreceivedPackets RPC method type QueryUnreceivedPacketsRequest struct { - // channel unique identifier - ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + // client unique identifier + ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` // list of packet sequences Sequences []uint64 `protobuf:"varint,2,rep,packed,name=sequences,proto3" json:"sequences,omitempty"` } @@ -1110,7 +758,7 @@ func (m *QueryUnreceivedPacketsRequest) Reset() { *m = QueryUnreceivedPa func (m *QueryUnreceivedPacketsRequest) String() string { return proto.CompactTextString(m) } func (*QueryUnreceivedPacketsRequest) ProtoMessage() {} func (*QueryUnreceivedPacketsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a328cba4986edcab, []int{18} + return fileDescriptor_a328cba4986edcab, []int{12} } func (m *QueryUnreceivedPacketsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1139,9 +787,9 @@ func (m *QueryUnreceivedPacketsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryUnreceivedPacketsRequest proto.InternalMessageInfo -func (m *QueryUnreceivedPacketsRequest) GetChannelId() string { +func (m *QueryUnreceivedPacketsRequest) GetClientId() string { if m != nil { - return m.ChannelId + return m.ClientId } return "" } @@ -1165,7 +813,7 @@ func (m *QueryUnreceivedPacketsResponse) Reset() { *m = QueryUnreceivedP func (m *QueryUnreceivedPacketsResponse) String() string { return proto.CompactTextString(m) } func (*QueryUnreceivedPacketsResponse) ProtoMessage() {} func (*QueryUnreceivedPacketsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a328cba4986edcab, []int{19} + return fileDescriptor_a328cba4986edcab, []int{13} } func (m *QueryUnreceivedPacketsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1211,8 +859,8 @@ func (m *QueryUnreceivedPacketsResponse) GetHeight() types.Height { // QueryUnreceivedAcks is the request type for the // Query/UnreceivedAcks RPC method type QueryUnreceivedAcksRequest struct { - // channel unique identifier - ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + // client unique identifier + ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` // list of acknowledgement sequences PacketAckSequences []uint64 `protobuf:"varint,2,rep,packed,name=packet_ack_sequences,json=packetAckSequences,proto3" json:"packet_ack_sequences,omitempty"` } @@ -1221,7 +869,7 @@ func (m *QueryUnreceivedAcksRequest) Reset() { *m = QueryUnreceivedAcksR func (m *QueryUnreceivedAcksRequest) String() string { return proto.CompactTextString(m) } func (*QueryUnreceivedAcksRequest) ProtoMessage() {} func (*QueryUnreceivedAcksRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a328cba4986edcab, []int{20} + return fileDescriptor_a328cba4986edcab, []int{14} } func (m *QueryUnreceivedAcksRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1250,9 +898,9 @@ func (m *QueryUnreceivedAcksRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryUnreceivedAcksRequest proto.InternalMessageInfo -func (m *QueryUnreceivedAcksRequest) GetChannelId() string { +func (m *QueryUnreceivedAcksRequest) GetClientId() string { if m != nil { - return m.ChannelId + return m.ClientId } return "" } @@ -1277,7 +925,7 @@ func (m *QueryUnreceivedAcksResponse) Reset() { *m = QueryUnreceivedAcks func (m *QueryUnreceivedAcksResponse) String() string { return proto.CompactTextString(m) } func (*QueryUnreceivedAcksResponse) ProtoMessage() {} func (*QueryUnreceivedAcksResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a328cba4986edcab, []int{21} + return fileDescriptor_a328cba4986edcab, []int{15} } func (m *QueryUnreceivedAcksResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1321,12 +969,6 @@ func (m *QueryUnreceivedAcksResponse) GetHeight() types.Height { } func init() { - proto.RegisterType((*QueryChannelRequest)(nil), "ibc.core.channel.v2.QueryChannelRequest") - proto.RegisterType((*QueryChannelResponse)(nil), "ibc.core.channel.v2.QueryChannelResponse") - proto.RegisterType((*QueryChannelClientStateRequest)(nil), "ibc.core.channel.v2.QueryChannelClientStateRequest") - proto.RegisterType((*QueryChannelClientStateResponse)(nil), "ibc.core.channel.v2.QueryChannelClientStateResponse") - proto.RegisterType((*QueryChannelConsensusStateRequest)(nil), "ibc.core.channel.v2.QueryChannelConsensusStateRequest") - proto.RegisterType((*QueryChannelConsensusStateResponse)(nil), "ibc.core.channel.v2.QueryChannelConsensusStateResponse") proto.RegisterType((*QueryNextSequenceSendRequest)(nil), "ibc.core.channel.v2.QueryNextSequenceSendRequest") proto.RegisterType((*QueryNextSequenceSendResponse)(nil), "ibc.core.channel.v2.QueryNextSequenceSendResponse") proto.RegisterType((*QueryPacketCommitmentRequest)(nil), "ibc.core.channel.v2.QueryPacketCommitmentRequest") @@ -1348,91 +990,72 @@ func init() { func init() { proto.RegisterFile("ibc/core/channel/v2/query.proto", fileDescriptor_a328cba4986edcab) } var fileDescriptor_a328cba4986edcab = []byte{ - // 1334 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0xcf, 0x4f, 0xdc, 0x46, - 0x14, 0x66, 0x58, 0x92, 0xc0, 0x23, 0x0d, 0x30, 0x81, 0x06, 0x0c, 0x59, 0x88, 0x2b, 0x35, 0x9b, - 0x28, 0xb1, 0x61, 0x41, 0x4d, 0x52, 0x41, 0x11, 0xd0, 0x34, 0x21, 0x6a, 0x23, 0x6a, 0xda, 0x4a, - 0xad, 0xa2, 0xac, 0xbc, 0xf6, 0xb0, 0x58, 0xec, 0x8e, 0x9d, 0x1d, 0xef, 0x16, 0x14, 0x71, 0xe9, - 0xa1, 0xe7, 0xaa, 0xe9, 0xa9, 0x7f, 0x41, 0xfb, 0x57, 0x34, 0x52, 0x2f, 0x91, 0xd2, 0x43, 0xa4, - 0x1c, 0x5a, 0xa9, 0x52, 0x7f, 0x40, 0xa5, 0xfe, 0x07, 0x3d, 0x57, 0x3b, 0x1e, 0xef, 0xda, 0xbb, - 0x5e, 0x63, 0x27, 0xa1, 0xea, 0x6d, 0x3d, 0x7e, 0xef, 0xcd, 0xf7, 0x7d, 0xf3, 0x66, 0xe6, 0xf3, - 0xc2, 0xb4, 0x55, 0x34, 0x54, 0xc3, 0xae, 0x12, 0xd5, 0xd8, 0xd6, 0x29, 0x25, 0x65, 0xb5, 0x9e, - 0x57, 0x1f, 0xd4, 0x48, 0x75, 0x4f, 0x71, 0xaa, 0xb6, 0x6b, 0xe3, 0xb3, 0x56, 0xd1, 0x50, 0x1a, - 0x01, 0x8a, 0x08, 0x50, 0xea, 0x79, 0xe9, 0xb2, 0x61, 0xb3, 0x8a, 0xcd, 0xd4, 0xa2, 0xce, 0x88, - 0x17, 0xad, 0xd6, 0xe7, 0x8a, 0xc4, 0xd5, 0xe7, 0x54, 0x47, 0x2f, 0x59, 0x54, 0x77, 0x2d, 0x9b, - 0x7a, 0x05, 0xa4, 0x0b, 0x51, 0x33, 0xf8, 0xb5, 0x62, 0x42, 0x4a, 0x84, 0x12, 0x66, 0x31, 0x11, - 0x12, 0xc0, 0x59, 0xb6, 0x08, 0x75, 0xd5, 0xfa, 0x9c, 0xf8, 0x25, 0x02, 0xa6, 0x4a, 0xb6, 0x5d, - 0x2a, 0x13, 0x55, 0x77, 0x2c, 0x55, 0xa7, 0xd4, 0x76, 0x39, 0x06, 0x3f, 0x7d, 0x42, 0xbc, 0xe5, - 0x4f, 0xc5, 0xda, 0x96, 0xaa, 0x53, 0x41, 0x50, 0x1a, 0x2d, 0xd9, 0x25, 0x9b, 0xff, 0x54, 0x1b, - 0xbf, 0xbc, 0x51, 0x79, 0x01, 0xce, 0x7e, 0xd8, 0xe0, 0xb5, 0xe6, 0x01, 0xd2, 0xc8, 0x83, 0x1a, - 0x61, 0x2e, 0x3e, 0x0f, 0x20, 0x20, 0x16, 0x2c, 0x73, 0x1c, 0xcd, 0xa0, 0xdc, 0x80, 0x36, 0x20, - 0x46, 0xd6, 0x4d, 0xf9, 0x23, 0x18, 0x0d, 0x67, 0x31, 0xc7, 0xa6, 0x8c, 0xe0, 0x45, 0x38, 0x25, - 0x82, 0x78, 0xce, 0x60, 0x7e, 0x4a, 0x89, 0x90, 0x55, 0x11, 0x69, 0xab, 0x7d, 0x4f, 0x7e, 0x9b, - 0xee, 0xd1, 0xfc, 0x14, 0x79, 0x19, 0xb2, 0xc1, 0xaa, 0x6b, 0x9c, 0xf6, 0xa6, 0xab, 0xbb, 0x24, - 0x21, 0xac, 0xdf, 0x11, 0x4c, 0x77, 0xad, 0x20, 0x20, 0xea, 0x70, 0xce, 0x32, 0x09, 0x75, 0xad, - 0x2d, 0x8b, 0x98, 0x05, 0x4f, 0xda, 0x02, 0x6b, 0x84, 0x08, 0xc8, 0x97, 0x02, 0x90, 0x3d, 0xe1, - 0xeb, 0x73, 0xca, 0x7a, 0x33, 0x25, 0x58, 0x73, 0xcc, 0x8a, 0x1a, 0xc6, 0xa3, 0x70, 0xc2, 0xa9, - 0xda, 0xf6, 0xd6, 0x78, 0xef, 0x0c, 0xca, 0x9d, 0xd6, 0xbc, 0x07, 0xbc, 0x06, 0xa7, 0xf9, 0x8f, - 0xc2, 0x36, 0xb1, 0x4a, 0xdb, 0xee, 0x78, 0x86, 0xcf, 0x26, 0x45, 0xcd, 0x76, 0x9b, 0x47, 0x08, - 0x79, 0x06, 0x79, 0x96, 0x37, 0x24, 0x7f, 0x83, 0xe0, 0x42, 0x88, 0x61, 0x83, 0x13, 0x65, 0x35, - 0x96, 0x42, 0x26, 0x7c, 0x11, 0x86, 0xaa, 0xa4, 0x6e, 0x31, 0xcb, 0xa6, 0x05, 0x5a, 0xab, 0x14, - 0x49, 0x95, 0x23, 0xed, 0xd3, 0xce, 0xf8, 0xc3, 0x77, 0xf9, 0x68, 0x28, 0x30, 0x80, 0x3a, 0x10, - 0x28, 0x60, 0xfd, 0x8a, 0x40, 0x8e, 0x83, 0x25, 0xb4, 0x5f, 0x82, 0x21, 0xc3, 0x7f, 0x13, 0xd2, - 0x7c, 0x54, 0xf1, 0xfa, 0x56, 0xf1, 0xfb, 0x56, 0x59, 0xa1, 0x7b, 0xda, 0x19, 0x23, 0x54, 0x06, - 0x4f, 0xc2, 0x80, 0x58, 0x2f, 0xcb, 0xe4, 0x88, 0x07, 0xb4, 0x7e, 0x6f, 0x60, 0xdd, 0x6c, 0x89, - 0x9e, 0x89, 0x13, 0xbd, 0xef, 0x45, 0x44, 0x5f, 0x82, 0x29, 0x4e, 0xee, 0x2e, 0xd9, 0x75, 0x37, - 0x1b, 0x12, 0x53, 0x83, 0x6c, 0x12, 0x6a, 0x26, 0xec, 0xca, 0xef, 0x10, 0x9c, 0xef, 0x92, 0x2f, - 0x74, 0xb9, 0x02, 0x98, 0x92, 0x5d, 0xb7, 0xc0, 0xc4, 0xcb, 0x02, 0x23, 0xd4, 0x2b, 0xd4, 0xa7, - 0x0d, 0xd3, 0xb6, 0xac, 0xe3, 0x6c, 0xaf, 0x4f, 0x05, 0xd3, 0x0d, 0xdd, 0xd8, 0x21, 0xee, 0x9a, - 0x5d, 0xa9, 0x58, 0x6e, 0x85, 0x50, 0x37, 0x61, 0x63, 0x49, 0xd0, 0xef, 0x53, 0x10, 0x1d, 0xd5, - 0x7c, 0x96, 0xbf, 0xf5, 0x55, 0xe8, 0xac, 0x2d, 0x54, 0xc8, 0x02, 0x18, 0xcd, 0x51, 0x5e, 0xfc, - 0xb4, 0x16, 0x18, 0x39, 0x4e, 0xde, 0x5f, 0x76, 0x03, 0xc7, 0x12, 0x32, 0x7f, 0x0f, 0xa0, 0x75, - 0x21, 0x70, 0x80, 0x83, 0xf9, 0x37, 0x15, 0xef, 0xf6, 0x50, 0x1a, 0xb7, 0x87, 0xe2, 0xdd, 0x35, - 0xe2, 0xf6, 0x50, 0x36, 0xf4, 0x92, 0xbf, 0x5b, 0xb5, 0x40, 0xa6, 0xfc, 0x37, 0x12, 0x67, 0x60, - 0x04, 0x10, 0x21, 0xd3, 0x2a, 0x0c, 0xb6, 0x44, 0x61, 0xe3, 0x68, 0x26, 0x93, 0x1b, 0xcc, 0xcf, - 0x44, 0x9e, 0xb3, 0x5e, 0x11, 0x6f, 0x0f, 0x06, 0x93, 0xf0, 0xad, 0x08, 0xb8, 0x17, 0x8f, 0x84, - 0xeb, 0x01, 0x08, 0xe2, 0xc5, 0xd7, 0xe1, 0x64, 0x4a, 0xdd, 0x45, 0xbc, 0x7c, 0x5f, 0x1c, 0x64, - 0x1e, 0xc6, 0x15, 0x63, 0x87, 0xda, 0x9f, 0x97, 0x89, 0x59, 0x22, 0xaf, 0xa8, 0xdf, 0xbe, 0xf7, - 0x8f, 0xa4, 0x2e, 0x13, 0x08, 0x35, 0x73, 0x30, 0xa4, 0x87, 0x5f, 0x89, 0xce, 0x6b, 0x1f, 0x3e, - 0xce, 0xf6, 0x7b, 0x1a, 0x8b, 0xf5, 0x3f, 0xee, 0x41, 0xfc, 0x0e, 0x4c, 0x3a, 0x1c, 0x47, 0xa1, - 0xd5, 0x32, 0xcd, 0xa3, 0x89, 0x8d, 0x67, 0x66, 0x32, 0xb9, 0x3e, 0x6d, 0xc2, 0x69, 0x6b, 0x50, - 0xff, 0x88, 0x62, 0xf2, 0x3f, 0x08, 0xde, 0x88, 0x65, 0x23, 0xa4, 0x7f, 0x1f, 0x86, 0xdb, 0x34, - 0x4e, 0xde, 0xcd, 0x1d, 0x99, 0xff, 0x87, 0x96, 0xb6, 0x61, 0x22, 0xc0, 0x5b, 0x23, 0x06, 0xb1, - 0x9c, 0x66, 0x2b, 0x9f, 0x83, 0x53, 0x8e, 0x5d, 0x75, 0x5b, 0x2b, 0x77, 0xb2, 0xf1, 0xb8, 0x6e, - 0xb6, 0xad, 0x6a, 0x6f, 0x5c, 0x8f, 0x67, 0xda, 0x7a, 0xfc, 0x11, 0x02, 0x29, 0x6a, 0x46, 0x21, - 0xb0, 0x04, 0xfd, 0xd5, 0xc6, 0x50, 0x9d, 0x78, 0x75, 0xfb, 0xb5, 0xe6, 0xf3, 0x71, 0x5e, 0x97, - 0xf7, 0xc4, 0x59, 0xfa, 0x31, 0xf5, 0x67, 0xf3, 0xe0, 0x25, 0xed, 0xe3, 0x29, 0x18, 0x68, 0x75, - 0x5b, 0x2f, 0xef, 0xb6, 0xd6, 0x80, 0xbc, 0x2b, 0x0e, 0xc8, 0x88, 0xea, 0x82, 0x76, 0x28, 0x1f, - 0xb5, 0xe5, 0x07, 0x96, 0xb7, 0x37, 0xe5, 0xf2, 0x56, 0x84, 0xd8, 0xad, 0x99, 0x57, 0x8c, 0x9d, - 0xa4, 0xa4, 0x66, 0x61, 0x54, 0x6c, 0x2a, 0xdd, 0xd8, 0x29, 0xb4, 0xf3, 0xc3, 0x8e, 0xbf, 0x55, - 0x5a, 0xdb, 0xa8, 0x06, 0x93, 0x91, 0xd3, 0x1d, 0x2f, 0xcb, 0xfc, 0xe3, 0x11, 0x38, 0xc1, 0xe7, - 0xc5, 0x5f, 0x23, 0x38, 0x25, 0xfc, 0x1c, 0xce, 0x45, 0xee, 0xc8, 0x88, 0x2f, 0x07, 0xe9, 0x52, - 0x82, 0x48, 0x8f, 0x82, 0x9c, 0xff, 0xe2, 0xf9, 0x5f, 0x8f, 0x7a, 0xaf, 0xe0, 0xcb, 0x6a, 0xcc, - 0xa7, 0x13, 0x53, 0x1f, 0xb6, 0x74, 0xdd, 0xc7, 0x8f, 0x11, 0xe0, 0x4e, 0x77, 0x8f, 0xe7, 0x8f, - 0x9c, 0xb5, 0xf3, 0x6b, 0x42, 0x5a, 0x48, 0x97, 0x24, 0x50, 0x2f, 0x73, 0xd4, 0x37, 0xf0, 0xb5, - 0xe4, 0xa8, 0xd5, 0xe0, 0x67, 0x06, 0xfe, 0x09, 0xc1, 0x58, 0xa4, 0x4f, 0xc6, 0x6f, 0x1d, 0x0d, - 0x28, 0xca, 0xef, 0x4b, 0xd7, 0x52, 0xe7, 0x09, 0x2e, 0xab, 0x9c, 0xcb, 0x22, 0x7e, 0x3b, 0x0d, - 0x97, 0xb0, 0x83, 0x6f, 0xac, 0xc8, 0x70, 0xbb, 0xb3, 0xc5, 0x73, 0xdd, 0x11, 0x75, 0x71, 0xd1, - 0x52, 0x3e, 0x4d, 0x8a, 0xc0, 0x7f, 0x93, 0xe3, 0x5f, 0xc6, 0x4b, 0x29, 0xf0, 0x77, 0x3a, 0x6d, - 0xfc, 0x14, 0xc1, 0x70, 0xbb, 0xe1, 0x8a, 0xa3, 0xd0, 0xc5, 0x1e, 0xc7, 0x51, 0xe8, 0xe6, 0x7a, - 0xe5, 0x0d, 0x4e, 0xe1, 0x0e, 0xbe, 0x9d, 0x82, 0x42, 0xc7, 0xf5, 0xcc, 0xd4, 0x87, 0x3e, 0xa3, - 0x7d, 0xfc, 0x23, 0x82, 0x91, 0x0e, 0xfb, 0x88, 0x53, 0x60, 0xf3, 0xcf, 0x34, 0x69, 0x3e, 0x55, - 0xce, 0x4b, 0xac, 0x49, 0x27, 0x21, 0xfc, 0x1c, 0xc1, 0x58, 0xa4, 0x81, 0x88, 0xdb, 0x25, 0x71, - 0x66, 0x32, 0x6e, 0x97, 0xc4, 0x7a, 0x44, 0x79, 0x9d, 0x33, 0x5a, 0xc3, 0x2b, 0xe9, 0x19, 0xe9, - 0xc6, 0x4e, 0x68, 0x6d, 0x7e, 0x46, 0xf0, 0x7a, 0xb4, 0x2d, 0xc2, 0x69, 0xe1, 0x35, 0x57, 0xe9, - 0x7a, 0xfa, 0x44, 0x41, 0xec, 0x0e, 0x27, 0xf6, 0x2e, 0x5e, 0x7d, 0x21, 0x62, 0x61, 0xf8, 0x3f, - 0x20, 0x78, 0x2d, 0x64, 0x43, 0xb0, 0x72, 0x14, 0xae, 0xb0, 0x43, 0x92, 0xd4, 0xc4, 0xf1, 0x02, - 0xfe, 0x07, 0x1c, 0xfe, 0x2d, 0x7c, 0x33, 0x3d, 0xfc, 0xaa, 0x57, 0x2a, 0xb4, 0x36, 0x07, 0x08, - 0x46, 0x3a, 0x5c, 0x45, 0xdc, 0xbe, 0xe9, 0x66, 0x70, 0xe2, 0xf6, 0x4d, 0x57, 0xdb, 0x22, 0x9b, - 0x9c, 0xcd, 0x7d, 0x7c, 0xef, 0x15, 0x1d, 0x04, 0x6c, 0x5f, 0xad, 0x35, 0x27, 0x2b, 0x38, 0x82, - 0xce, 0x9f, 0x08, 0xce, 0x84, 0x1d, 0x05, 0x56, 0x93, 0xa0, 0x0d, 0x58, 0x1d, 0x69, 0x36, 0x79, - 0x82, 0xe0, 0x56, 0xe6, 0xdc, 0xb6, 0xb0, 0xf9, 0x92, 0xdc, 0xa2, 0x2c, 0x54, 0x88, 0x66, 0x63, - 0xbf, 0xad, 0x7e, 0xf2, 0xe4, 0x20, 0x8b, 0x9e, 0x1d, 0x64, 0xd1, 0x1f, 0x07, 0x59, 0xf4, 0xd5, - 0x61, 0xb6, 0xe7, 0xd9, 0x61, 0xb6, 0xe7, 0x97, 0xc3, 0x6c, 0xcf, 0x67, 0x8b, 0x25, 0xcb, 0xdd, - 0xae, 0x15, 0x15, 0xc3, 0xae, 0xa8, 0xe2, 0xaf, 0x5d, 0xab, 0x68, 0x5c, 0x2d, 0xd9, 0x6a, 0xfd, - 0x86, 0x5a, 0xb1, 0xcd, 0x5a, 0x99, 0x30, 0x0f, 0xde, 0xec, 0xc2, 0xd5, 0x00, 0x42, 0x77, 0xcf, - 0x21, 0xac, 0x78, 0x92, 0xff, 0x3b, 0x35, 0xff, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc0, 0x2a, - 0x4b, 0x9b, 0x4c, 0x16, 0x00, 0x00, + // 1031 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0x4d, 0x6f, 0x1b, 0x45, + 0x18, 0xce, 0xc4, 0x6e, 0x95, 0xbe, 0x4e, 0x21, 0x1d, 0x02, 0x72, 0x37, 0xc1, 0x75, 0x17, 0x09, + 0x2c, 0x44, 0x77, 0x62, 0x17, 0x41, 0x51, 0xf9, 0x4a, 0x22, 0xda, 0x20, 0x50, 0x55, 0x36, 0x7c, + 0x48, 0x51, 0x25, 0x6b, 0xbd, 0x1e, 0x36, 0x8b, 0xed, 0x9d, 0xad, 0x67, 0x6d, 0x52, 0x55, 0xb9, + 0x20, 0x2e, 0xdc, 0x90, 0x7a, 0xe3, 0x17, 0xc0, 0x8f, 0x00, 0x89, 0x5b, 0x7b, 0x2b, 0x42, 0x48, + 0x9c, 0xa0, 0x4a, 0x90, 0xf8, 0x07, 0x9c, 0x91, 0x67, 0xc6, 0xf6, 0xae, 0xbd, 0xde, 0xec, 0xa6, + 0x0d, 0xe2, 0x36, 0x3b, 0x7e, 0x3f, 0x9e, 0xe7, 0x9d, 0xe7, 0x9d, 0x77, 0x12, 0xb8, 0xe0, 0x36, + 0x6c, 0x62, 0xb3, 0x2e, 0x25, 0xf6, 0xae, 0xe5, 0x79, 0xb4, 0x4d, 0xfa, 0x35, 0x72, 0xbb, 0x47, + 0xbb, 0x77, 0x0c, 0xbf, 0xcb, 0x02, 0x86, 0x9f, 0x71, 0x1b, 0xb6, 0x31, 0x30, 0x30, 0x94, 0x81, + 0xd1, 0xaf, 0x69, 0x2f, 0xdb, 0x8c, 0x77, 0x18, 0x27, 0x0d, 0x8b, 0x53, 0x69, 0x4d, 0xfa, 0xd5, + 0x06, 0x0d, 0xac, 0x2a, 0xf1, 0x2d, 0xc7, 0xf5, 0xac, 0xc0, 0x65, 0x9e, 0x0c, 0xa0, 0x5d, 0x8c, + 0xcb, 0xe0, 0x50, 0x8f, 0x72, 0x97, 0x2b, 0x93, 0x10, 0x88, 0xb6, 0x4b, 0xbd, 0x80, 0xf4, 0xab, + 0x6a, 0xa5, 0x0c, 0x56, 0x1d, 0xc6, 0x9c, 0x36, 0x25, 0x96, 0xef, 0x12, 0xcb, 0xf3, 0x58, 0x20, + 0x12, 0x0c, 0xdd, 0x97, 0x1d, 0xe6, 0x30, 0xb1, 0x24, 0x83, 0x95, 0xdc, 0xd5, 0xaf, 0xc2, 0xea, + 0x47, 0x03, 0x64, 0x37, 0xe8, 0x5e, 0xb0, 0x4d, 0x6f, 0xf7, 0xa8, 0x67, 0xd3, 0x6d, 0xea, 0x35, + 0xcd, 0xc1, 0x9a, 0x07, 0x78, 0x05, 0xce, 0xc8, 0x1c, 0x75, 0xb7, 0x59, 0x44, 0x65, 0x54, 0x39, + 0x63, 0x2e, 0xc8, 0x8d, 0xf7, 0x9b, 0xfa, 0xf7, 0x08, 0x9e, 0x9f, 0xe1, 0xcd, 0x7d, 0xe6, 0x71, + 0x8a, 0x5f, 0x01, 0xec, 0xd1, 0xbd, 0xa0, 0xce, 0xd5, 0x8f, 0x75, 0x4e, 0x3d, 0x19, 0x27, 0x6f, + 0x2e, 0x79, 0x13, 0x5e, 0x78, 0x19, 0x4e, 0xf9, 0x5d, 0xc6, 0x3e, 0x2f, 0xce, 0x97, 0x51, 0x65, + 0xd1, 0x94, 0x1f, 0x78, 0x13, 0x16, 0xc5, 0xa2, 0xbe, 0x4b, 0x5d, 0x67, 0x37, 0x28, 0xe6, 0xca, + 0xa8, 0x52, 0xa8, 0x69, 0xc6, 0xb8, 0xe4, 0xb2, 0x08, 0xfd, 0xaa, 0xb1, 0x25, 0x2c, 0x36, 0xf2, + 0xf7, 0xff, 0xb8, 0x30, 0x67, 0x16, 0x84, 0x97, 0xdc, 0xd2, 0x3f, 0x53, 0x3c, 0x6f, 0x5a, 0x76, + 0x8b, 0x06, 0x9b, 0xac, 0xd3, 0x71, 0x83, 0x0e, 0xf5, 0x82, 0x34, 0x3c, 0xb1, 0x06, 0x0b, 0x43, + 0x02, 0x02, 0x5a, 0xde, 0x1c, 0x7d, 0xeb, 0xdf, 0x0d, 0x6b, 0x30, 0x1d, 0x59, 0xd5, 0xa0, 0x04, + 0x60, 0x8f, 0x76, 0x45, 0xec, 0x45, 0x33, 0xb4, 0x73, 0x92, 0xac, 0xbf, 0x9e, 0x05, 0x8e, 0xa7, + 0xe2, 0x7d, 0x0d, 0x60, 0x2c, 0x54, 0x01, 0xaf, 0x50, 0x7b, 0xd1, 0x90, 0xaa, 0x36, 0x06, 0xaa, + 0x36, 0x64, 0x0f, 0x28, 0x55, 0x1b, 0x37, 0x2d, 0x87, 0xaa, 0xc0, 0x66, 0xc8, 0x53, 0xff, 0x1b, + 0x41, 0x69, 0x16, 0x0c, 0x55, 0xa4, 0x0d, 0x28, 0x8c, 0x4b, 0xc2, 0x8b, 0xa8, 0x9c, 0xab, 0x14, + 0x6a, 0x65, 0x23, 0xa6, 0xad, 0x0c, 0x19, 0x64, 0x3b, 0xb0, 0x02, 0x6a, 0x86, 0x9d, 0xf0, 0xf5, + 0x18, 0xb8, 0x2f, 0x1d, 0x09, 0x57, 0x02, 0x08, 0xe3, 0xc5, 0x57, 0xe0, 0x74, 0xc6, 0xaa, 0x2b, + 0x7b, 0xfd, 0x16, 0x5c, 0x0c, 0x11, 0x5d, 0xb7, 0x5b, 0x1e, 0xfb, 0xb2, 0x4d, 0x9b, 0x0e, 0x7d, + 0x22, 0x5a, 0xfb, 0x01, 0x81, 0x9e, 0x14, 0x5e, 0xd5, 0xb2, 0x02, 0x4f, 0x5b, 0xd1, 0x9f, 0x94, + 0xea, 0x26, 0xb7, 0x4f, 0x52, 0x7a, 0x0f, 0x12, 0xb1, 0xfe, 0xa7, 0xfa, 0xc3, 0x6f, 0xc3, 0x8a, + 0x2f, 0x50, 0xd4, 0xc7, 0x72, 0x19, 0x5d, 0x49, 0xbc, 0x98, 0x2b, 0xe7, 0x2a, 0x79, 0xf3, 0xbc, + 0x3f, 0x21, 0xce, 0xe1, 0xd5, 0xc4, 0xf5, 0x7f, 0x10, 0xbc, 0x90, 0xc8, 0x45, 0x15, 0xfe, 0x43, + 0x58, 0x9a, 0xa8, 0x70, 0x7a, 0x25, 0x4f, 0x79, 0xfe, 0x1f, 0xe4, 0xfc, 0x31, 0x9c, 0x0f, 0xf1, + 0x36, 0xa9, 0x4d, 0x5d, 0xff, 0xf1, 0x65, 0x7c, 0x0f, 0x81, 0x16, 0x17, 0x56, 0x55, 0x51, 0x83, + 0x85, 0xee, 0x60, 0xab, 0x4f, 0x9b, 0xc2, 0x75, 0xc1, 0x1c, 0x7d, 0x8f, 0x05, 0x9b, 0x4b, 0x12, + 0x6c, 0xfe, 0x38, 0x82, 0xdd, 0x51, 0x57, 0xe5, 0x27, 0xde, 0x30, 0x9b, 0x84, 0x97, 0x4e, 0xaa, + 0xab, 0x70, 0x66, 0x2c, 0xa8, 0x79, 0x21, 0xa8, 0xf1, 0x86, 0xbe, 0xa7, 0xee, 0xbf, 0x98, 0xd8, + 0x8a, 0x74, 0xc4, 0x1f, 0x4d, 0xf8, 0x87, 0x4e, 0x70, 0x3e, 0xe3, 0x09, 0xb6, 0x54, 0xa9, 0xc7, + 0x99, 0xd7, 0xed, 0x56, 0x3a, 0x4a, 0x6b, 0xb0, 0xac, 0xba, 0xc6, 0xb2, 0x5b, 0xf5, 0x49, 0x76, + 0xd8, 0x1f, 0xf6, 0xc2, 0xb8, 0x4f, 0x7a, 0xb0, 0x12, 0x9b, 0xec, 0x64, 0x39, 0xd6, 0xbe, 0x39, + 0x0b, 0xa7, 0x44, 0x5e, 0xfc, 0x13, 0x82, 0xa5, 0xc9, 0xb7, 0x08, 0xae, 0xc6, 0xf6, 0x5e, 0xd2, + 0xab, 0x47, 0xab, 0x65, 0x71, 0x91, 0xec, 0xf4, 0xcd, 0xaf, 0x7e, 0xfd, 0xeb, 0xde, 0xfc, 0x5b, + 0xf8, 0x2a, 0x89, 0x7b, 0xca, 0x49, 0x0a, 0x9c, 0xdc, 0x1d, 0xd5, 0x7b, 0x9f, 0x4c, 0xbf, 0x8c, + 0xf0, 0x03, 0x04, 0x4b, 0x93, 0x43, 0x32, 0x89, 0xc0, 0x8c, 0xe7, 0x4c, 0x12, 0x81, 0x59, 0xef, + 0x14, 0xfd, 0x86, 0x20, 0xb0, 0x85, 0xaf, 0xa5, 0x26, 0x30, 0x75, 0xa9, 0x72, 0x72, 0x77, 0xc8, + 0x67, 0x1f, 0xff, 0x8c, 0xe0, 0xdc, 0xd4, 0xc0, 0xc7, 0x19, 0x90, 0x0d, 0x65, 0xaa, 0x5d, 0xce, + 0xe4, 0x73, 0xec, 0xf3, 0x98, 0xa6, 0x83, 0x7f, 0x41, 0xf0, 0x6c, 0xec, 0xa5, 0x8f, 0x5f, 0x3b, + 0x0a, 0x53, 0xfc, 0xf0, 0xd7, 0x5e, 0xcf, 0xec, 0xa7, 0xf8, 0x5c, 0x17, 0x7c, 0xd6, 0xf1, 0x3b, + 0x59, 0xf9, 0x58, 0x76, 0x2b, 0x72, 0x2e, 0xbf, 0x21, 0x78, 0x2e, 0x7e, 0x90, 0xe1, 0xac, 0xe0, + 0x46, 0x27, 0x74, 0x25, 0xbb, 0xa3, 0xa2, 0xb5, 0x25, 0x68, 0x6d, 0xe0, 0x77, 0x8f, 0x41, 0x2b, + 0x0a, 0xfe, 0x47, 0x04, 0x67, 0x23, 0x13, 0x05, 0x1b, 0x47, 0xa1, 0x8a, 0x4e, 0x34, 0x8d, 0xa4, + 0xb6, 0x57, 0xe0, 0x3f, 0x10, 0xe0, 0xdf, 0xc3, 0x9b, 0x59, 0xc1, 0x77, 0x65, 0xa0, 0xc8, 0xb9, + 0x3c, 0x42, 0x70, 0x6e, 0x6a, 0x40, 0x24, 0xf5, 0xcb, 0xac, 0x49, 0x95, 0xd4, 0x2f, 0x33, 0x27, + 0x90, 0xde, 0x10, 0x5c, 0x6e, 0xe1, 0x9d, 0x27, 0xd2, 0xfe, 0x7c, 0x9f, 0xf4, 0x46, 0xa9, 0xea, + 0xbe, 0x22, 0xf3, 0x27, 0x82, 0xa7, 0xa2, 0xc3, 0x01, 0x93, 0x34, 0x58, 0x43, 0x33, 0x4b, 0x5b, + 0x4b, 0xef, 0xa0, 0x98, 0x7d, 0x21, 0x98, 0x35, 0x71, 0xe3, 0xb1, 0x98, 0xc5, 0xcd, 0xc2, 0x08, + 0xc9, 0x41, 0x9f, 0x6d, 0x7c, 0x7a, 0xff, 0xa0, 0x84, 0x1e, 0x1e, 0x94, 0xd0, 0xa3, 0x83, 0x12, + 0xfa, 0xf6, 0xb0, 0x34, 0xf7, 0xf0, 0xb0, 0x34, 0xf7, 0xfb, 0x61, 0x69, 0x6e, 0xe7, 0x4d, 0xc7, + 0x0d, 0x76, 0x7b, 0x0d, 0xc3, 0x66, 0x1d, 0xa2, 0xfe, 0x31, 0xe0, 0x36, 0xec, 0x4b, 0x0e, 0x23, + 0xfd, 0x37, 0x48, 0x87, 0x35, 0x7b, 0x6d, 0xca, 0x25, 0xb8, 0xb5, 0x57, 0x2f, 0x85, 0xf0, 0x05, + 0x77, 0x7c, 0xca, 0x1b, 0xa7, 0xc5, 0x9f, 0xeb, 0x97, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xdc, + 0x82, 0xc5, 0xf4, 0x8a, 0x10, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1447,14 +1070,6 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { - // Channel queries the counterparty of an IBC client. - Channel(ctx context.Context, in *QueryChannelRequest, opts ...grpc.CallOption) (*QueryChannelResponse, error) - // ChannelClientState queries for the client state for the channel associated - // with the provided channel identifiers. - ChannelClientState(ctx context.Context, in *QueryChannelClientStateRequest, opts ...grpc.CallOption) (*QueryChannelClientStateResponse, error) - // ChannelConsensusState queries for the consensus state for the channel associated - // with the provided channel identifiers. - ChannelConsensusState(ctx context.Context, in *QueryChannelConsensusStateRequest, opts ...grpc.CallOption) (*QueryChannelConsensusStateResponse, error) // NextSequenceSend returns the next send sequence for a given channel. NextSequenceSend(ctx context.Context, in *QueryNextSequenceSendRequest, opts ...grpc.CallOption) (*QueryNextSequenceSendResponse, error) // PacketCommitment queries a stored packet commitment hash. @@ -1481,45 +1096,18 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } -func (c *queryClient) Channel(ctx context.Context, in *QueryChannelRequest, opts ...grpc.CallOption) (*QueryChannelResponse, error) { - out := new(QueryChannelResponse) - err := c.cc.Invoke(ctx, "/ibc.core.channel.v2.Query/Channel", in, out, opts...) +func (c *queryClient) NextSequenceSend(ctx context.Context, in *QueryNextSequenceSendRequest, opts ...grpc.CallOption) (*QueryNextSequenceSendResponse, error) { + out := new(QueryNextSequenceSendResponse) + err := c.cc.Invoke(ctx, "/ibc.core.channel.v2.Query/NextSequenceSend", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *queryClient) ChannelClientState(ctx context.Context, in *QueryChannelClientStateRequest, opts ...grpc.CallOption) (*QueryChannelClientStateResponse, error) { - out := new(QueryChannelClientStateResponse) - err := c.cc.Invoke(ctx, "/ibc.core.channel.v2.Query/ChannelClientState", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) ChannelConsensusState(ctx context.Context, in *QueryChannelConsensusStateRequest, opts ...grpc.CallOption) (*QueryChannelConsensusStateResponse, error) { - out := new(QueryChannelConsensusStateResponse) - err := c.cc.Invoke(ctx, "/ibc.core.channel.v2.Query/ChannelConsensusState", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) NextSequenceSend(ctx context.Context, in *QueryNextSequenceSendRequest, opts ...grpc.CallOption) (*QueryNextSequenceSendResponse, error) { - out := new(QueryNextSequenceSendResponse) - err := c.cc.Invoke(ctx, "/ibc.core.channel.v2.Query/NextSequenceSend", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) PacketCommitment(ctx context.Context, in *QueryPacketCommitmentRequest, opts ...grpc.CallOption) (*QueryPacketCommitmentResponse, error) { - out := new(QueryPacketCommitmentResponse) - err := c.cc.Invoke(ctx, "/ibc.core.channel.v2.Query/PacketCommitment", in, out, opts...) +func (c *queryClient) PacketCommitment(ctx context.Context, in *QueryPacketCommitmentRequest, opts ...grpc.CallOption) (*QueryPacketCommitmentResponse, error) { + out := new(QueryPacketCommitmentResponse) + err := c.cc.Invoke(ctx, "/ibc.core.channel.v2.Query/PacketCommitment", in, out, opts...) if err != nil { return nil, err } @@ -1582,14 +1170,6 @@ func (c *queryClient) UnreceivedAcks(ctx context.Context, in *QueryUnreceivedAck // QueryServer is the server API for Query service. type QueryServer interface { - // Channel queries the counterparty of an IBC client. - Channel(context.Context, *QueryChannelRequest) (*QueryChannelResponse, error) - // ChannelClientState queries for the client state for the channel associated - // with the provided channel identifiers. - ChannelClientState(context.Context, *QueryChannelClientStateRequest) (*QueryChannelClientStateResponse, error) - // ChannelConsensusState queries for the consensus state for the channel associated - // with the provided channel identifiers. - ChannelConsensusState(context.Context, *QueryChannelConsensusStateRequest) (*QueryChannelConsensusStateResponse, error) // NextSequenceSend returns the next send sequence for a given channel. NextSequenceSend(context.Context, *QueryNextSequenceSendRequest) (*QueryNextSequenceSendResponse, error) // PacketCommitment queries a stored packet commitment hash. @@ -1612,15 +1192,6 @@ type QueryServer interface { type UnimplementedQueryServer struct { } -func (*UnimplementedQueryServer) Channel(ctx context.Context, req *QueryChannelRequest) (*QueryChannelResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Channel not implemented") -} -func (*UnimplementedQueryServer) ChannelClientState(ctx context.Context, req *QueryChannelClientStateRequest) (*QueryChannelClientStateResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ChannelClientState not implemented") -} -func (*UnimplementedQueryServer) ChannelConsensusState(ctx context.Context, req *QueryChannelConsensusStateRequest) (*QueryChannelConsensusStateResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ChannelConsensusState not implemented") -} func (*UnimplementedQueryServer) NextSequenceSend(ctx context.Context, req *QueryNextSequenceSendRequest) (*QueryNextSequenceSendResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method NextSequenceSend not implemented") } @@ -1650,60 +1221,6 @@ func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } -func _Query_Channel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryChannelRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Channel(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ibc.core.channel.v2.Query/Channel", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Channel(ctx, req.(*QueryChannelRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_ChannelClientState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryChannelClientStateRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).ChannelClientState(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ibc.core.channel.v2.Query/ChannelClientState", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ChannelClientState(ctx, req.(*QueryChannelClientStateRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_ChannelConsensusState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryChannelConsensusStateRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).ChannelConsensusState(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ibc.core.channel.v2.Query/ChannelConsensusState", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ChannelConsensusState(ctx, req.(*QueryChannelConsensusStateRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _Query_NextSequenceSend_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryNextSequenceSendRequest) if err := dec(in); err != nil { @@ -1852,18 +1369,6 @@ var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "ibc.core.channel.v2.Query", HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ - { - MethodName: "Channel", - Handler: _Query_Channel_Handler, - }, - { - MethodName: "ChannelClientState", - Handler: _Query_ChannelClientState_Handler, - }, - { - MethodName: "ChannelConsensusState", - Handler: _Query_ChannelConsensusState_Handler, - }, { MethodName: "NextSequenceSend", Handler: _Query_NextSequenceSend_Handler, @@ -1901,7 +1406,7 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Metadata: "ibc/core/channel/v2/query.proto", } -func (m *QueryChannelRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryNextSequenceSendRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1911,27 +1416,27 @@ func (m *QueryChannelRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryChannelRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryNextSequenceSendRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryChannelRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryNextSequenceSendRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.ChannelId) > 0 { - i -= len(m.ChannelId) - copy(dAtA[i:], m.ChannelId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ChannelId))) + if len(m.ClientId) > 0 { + i -= len(m.ClientId) + copy(dAtA[i:], m.ClientId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ClientId))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryChannelResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryNextSequenceSendResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1941,18 +1446,18 @@ func (m *QueryChannelResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryChannelResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryNextSequenceSendResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryChannelResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryNextSequenceSendResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l { - size, err := m.Channel.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.ProofHeight.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1960,11 +1465,23 @@ func (m *QueryChannelResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0xa + dAtA[i] = 0x1a + if len(m.Proof) > 0 { + i -= len(m.Proof) + copy(dAtA[i:], m.Proof) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Proof))) + i-- + dAtA[i] = 0x12 + } + if m.NextSequenceSend != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.NextSequenceSend)) + i-- + dAtA[i] = 0x8 + } return len(dAtA) - i, nil } -func (m *QueryChannelClientStateRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryPacketCommitmentRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1974,27 +1491,32 @@ func (m *QueryChannelClientStateRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryChannelClientStateRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryPacketCommitmentRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryChannelClientStateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryPacketCommitmentRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.ChannelId) > 0 { - i -= len(m.ChannelId) - copy(dAtA[i:], m.ChannelId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ChannelId))) + if m.Sequence != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Sequence)) + i-- + dAtA[i] = 0x10 + } + if len(m.ClientId) > 0 { + i -= len(m.ClientId) + copy(dAtA[i:], m.ClientId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ClientId))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryChannelClientStateResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryPacketCommitmentResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2004,12 +1526,12 @@ func (m *QueryChannelClientStateResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryChannelClientStateResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryPacketCommitmentResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryChannelClientStateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryPacketCommitmentResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2031,22 +1553,17 @@ func (m *QueryChannelClientStateResponse) MarshalToSizedBuffer(dAtA []byte) (int i-- dAtA[i] = 0x12 } - if m.IdentifiedClientState != nil { - { - size, err := m.IdentifiedClientState.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } + if len(m.Commitment) > 0 { + i -= len(m.Commitment) + copy(dAtA[i:], m.Commitment) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Commitment))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryChannelConsensusStateRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryPacketCommitmentsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2056,37 +1573,39 @@ func (m *QueryChannelConsensusStateRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryChannelConsensusStateRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryPacketCommitmentsRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryChannelConsensusStateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryPacketCommitmentsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.RevisionHeight != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.RevisionHeight)) - i-- - dAtA[i] = 0x18 - } - if m.RevisionNumber != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.RevisionNumber)) + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } i-- - dAtA[i] = 0x10 + dAtA[i] = 0x12 } - if len(m.ChannelId) > 0 { - i -= len(m.ChannelId) - copy(dAtA[i:], m.ChannelId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ChannelId))) + if len(m.ClientId) > 0 { + i -= len(m.ClientId) + copy(dAtA[i:], m.ClientId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ClientId))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryChannelConsensusStateResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryPacketCommitmentsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2096,18 +1615,18 @@ func (m *QueryChannelConsensusStateResponse) Marshal() (dAtA []byte, err error) return dAtA[:n], nil } -func (m *QueryChannelConsensusStateResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryPacketCommitmentsResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryChannelConsensusStateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryPacketCommitmentsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l { - size, err := m.ProofHeight.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Height.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2115,24 +1634,10 @@ func (m *QueryChannelConsensusStateResponse) MarshalToSizedBuffer(dAtA []byte) ( i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x22 - if len(m.Proof) > 0 { - i -= len(m.Proof) - copy(dAtA[i:], m.Proof) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Proof))) - i-- - dAtA[i] = 0x1a - } - if len(m.ClientId) > 0 { - i -= len(m.ClientId) - copy(dAtA[i:], m.ClientId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ClientId))) - i-- - dAtA[i] = 0x12 - } - if m.ConsensusState != nil { + dAtA[i] = 0x1a + if m.Pagination != nil { { - size, err := m.ConsensusState.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2140,12 +1645,26 @@ func (m *QueryChannelConsensusStateResponse) MarshalToSizedBuffer(dAtA []byte) ( i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0xa + dAtA[i] = 0x12 + } + if len(m.Commitments) > 0 { + for iNdEx := len(m.Commitments) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Commitments[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } } return len(dAtA) - i, nil } -func (m *QueryNextSequenceSendRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryPacketAcknowledgementRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2155,27 +1674,32 @@ func (m *QueryNextSequenceSendRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryNextSequenceSendRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryPacketAcknowledgementRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryNextSequenceSendRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryPacketAcknowledgementRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.ChannelId) > 0 { - i -= len(m.ChannelId) - copy(dAtA[i:], m.ChannelId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ChannelId))) + if m.Sequence != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Sequence)) + i-- + dAtA[i] = 0x10 + } + if len(m.ClientId) > 0 { + i -= len(m.ClientId) + copy(dAtA[i:], m.ClientId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ClientId))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryNextSequenceSendResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryPacketAcknowledgementResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2185,12 +1709,12 @@ func (m *QueryNextSequenceSendResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryNextSequenceSendResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryPacketAcknowledgementResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryNextSequenceSendResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryPacketAcknowledgementResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2212,15 +1736,17 @@ func (m *QueryNextSequenceSendResponse) MarshalToSizedBuffer(dAtA []byte) (int, i-- dAtA[i] = 0x12 } - if m.NextSequenceSend != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.NextSequenceSend)) + if len(m.Acknowledgement) > 0 { + i -= len(m.Acknowledgement) + copy(dAtA[i:], m.Acknowledgement) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Acknowledgement))) i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryPacketCommitmentRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryPacketAcknowledgementsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2230,32 +1756,57 @@ func (m *QueryPacketCommitmentRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryPacketCommitmentRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryPacketAcknowledgementsRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryPacketCommitmentRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryPacketAcknowledgementsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Sequence != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.Sequence)) + if len(m.PacketCommitmentSequences) > 0 { + dAtA8 := make([]byte, len(m.PacketCommitmentSequences)*10) + var j7 int + for _, num := range m.PacketCommitmentSequences { + for num >= 1<<7 { + dAtA8[j7] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j7++ + } + dAtA8[j7] = uint8(num) + j7++ + } + i -= j7 + copy(dAtA[i:], dAtA8[:j7]) + i = encodeVarintQuery(dAtA, i, uint64(j7)) i-- - dAtA[i] = 0x10 + dAtA[i] = 0x1a + } + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } - if len(m.ChannelId) > 0 { - i -= len(m.ChannelId) - copy(dAtA[i:], m.ChannelId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ChannelId))) + if len(m.ClientId) > 0 { + i -= len(m.ClientId) + copy(dAtA[i:], m.ClientId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ClientId))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryPacketCommitmentResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryPacketAcknowledgementsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2265,107 +1816,18 @@ func (m *QueryPacketCommitmentResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryPacketCommitmentResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryPacketAcknowledgementsResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryPacketCommitmentResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryPacketAcknowledgementsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l { - size, err := m.ProofHeight.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.Proof) > 0 { - i -= len(m.Proof) - copy(dAtA[i:], m.Proof) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Proof))) - i-- - dAtA[i] = 0x12 - } - if len(m.Commitment) > 0 { - i -= len(m.Commitment) - copy(dAtA[i:], m.Commitment) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Commitment))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryPacketCommitmentsRequest) 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 *QueryPacketCommitmentsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryPacketCommitmentsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.ChannelId) > 0 { - i -= len(m.ChannelId) - copy(dAtA[i:], m.ChannelId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ChannelId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryPacketCommitmentsResponse) 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 *QueryPacketCommitmentsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryPacketCommitmentsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Height.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Height.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2386,10 +1848,10 @@ func (m *QueryPacketCommitmentsResponse) MarshalToSizedBuffer(dAtA []byte) (int, i-- dAtA[i] = 0x12 } - if len(m.Commitments) > 0 { - for iNdEx := len(m.Commitments) - 1; iNdEx >= 0; iNdEx-- { + if len(m.Acknowledgements) > 0 { + for iNdEx := len(m.Acknowledgements) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.Commitments[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Acknowledgements[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2403,7 +1865,7 @@ func (m *QueryPacketCommitmentsResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func (m *QueryPacketAcknowledgementRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryPacketReceiptRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2413,12 +1875,12 @@ func (m *QueryPacketAcknowledgementRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryPacketAcknowledgementRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryPacketReceiptRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryPacketAcknowledgementRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryPacketReceiptRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2428,17 +1890,17 @@ func (m *QueryPacketAcknowledgementRequest) MarshalToSizedBuffer(dAtA []byte) (i i-- dAtA[i] = 0x10 } - if len(m.ChannelId) > 0 { - i -= len(m.ChannelId) - copy(dAtA[i:], m.ChannelId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ChannelId))) + if len(m.ClientId) > 0 { + i -= len(m.ClientId) + copy(dAtA[i:], m.ClientId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ClientId))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryPacketAcknowledgementResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryPacketReceiptResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2448,12 +1910,12 @@ func (m *QueryPacketAcknowledgementResponse) Marshal() (dAtA []byte, err error) return dAtA[:n], nil } -func (m *QueryPacketAcknowledgementResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryPacketReceiptResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryPacketAcknowledgementResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryPacketReceiptResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2467,25 +1929,28 @@ func (m *QueryPacketAcknowledgementResponse) MarshalToSizedBuffer(dAtA []byte) ( i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a + dAtA[i] = 0x22 if len(m.Proof) > 0 { i -= len(m.Proof) copy(dAtA[i:], m.Proof) i = encodeVarintQuery(dAtA, i, uint64(len(m.Proof))) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x1a } - if len(m.Acknowledgement) > 0 { - i -= len(m.Acknowledgement) - copy(dAtA[i:], m.Acknowledgement) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Acknowledgement))) + if m.Received { i-- - dAtA[i] = 0xa + if m.Received { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 } return len(dAtA) - i, nil } -func (m *QueryPacketAcknowledgementsRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryUnreceivedPacketsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2495,57 +1960,45 @@ func (m *QueryPacketAcknowledgementsRequest) Marshal() (dAtA []byte, err error) return dAtA[:n], nil } -func (m *QueryPacketAcknowledgementsRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryUnreceivedPacketsRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryPacketAcknowledgementsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryUnreceivedPacketsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.PacketCommitmentSequences) > 0 { - dAtA13 := make([]byte, len(m.PacketCommitmentSequences)*10) - var j12 int - for _, num := range m.PacketCommitmentSequences { + if len(m.Sequences) > 0 { + dAtA14 := make([]byte, len(m.Sequences)*10) + var j13 int + for _, num := range m.Sequences { for num >= 1<<7 { - dAtA13[j12] = uint8(uint64(num)&0x7f | 0x80) + dAtA14[j13] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j12++ - } - dAtA13[j12] = uint8(num) - j12++ - } - i -= j12 - copy(dAtA[i:], dAtA13[:j12]) - i = encodeVarintQuery(dAtA, i, uint64(j12)) - i-- - dAtA[i] = 0x1a - } - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + j13++ } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + dAtA14[j13] = uint8(num) + j13++ } + i -= j13 + copy(dAtA[i:], dAtA14[:j13]) + i = encodeVarintQuery(dAtA, i, uint64(j13)) i-- dAtA[i] = 0x12 } - if len(m.ChannelId) > 0 { - i -= len(m.ChannelId) - copy(dAtA[i:], m.ChannelId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ChannelId))) + if len(m.ClientId) > 0 { + i -= len(m.ClientId) + copy(dAtA[i:], m.ClientId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ClientId))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryPacketAcknowledgementsResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryUnreceivedPacketsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2555,12 +2008,12 @@ func (m *QueryPacketAcknowledgementsResponse) Marshal() (dAtA []byte, err error) return dAtA[:n], nil } -func (m *QueryPacketAcknowledgementsResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryUnreceivedPacketsResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryPacketAcknowledgementsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryUnreceivedPacketsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2574,37 +2027,29 @@ func (m *QueryPacketAcknowledgementsResponse) MarshalToSizedBuffer(dAtA []byte) i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + dAtA[i] = 0x12 + if len(m.Sequences) > 0 { + dAtA17 := make([]byte, len(m.Sequences)*10) + var j16 int + for _, num := range m.Sequences { + for num >= 1<<7 { + dAtA17[j16] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j16++ } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + dAtA17[j16] = uint8(num) + j16++ } + i -= j16 + copy(dAtA[i:], dAtA17[:j16]) + i = encodeVarintQuery(dAtA, i, uint64(j16)) i-- - dAtA[i] = 0x12 - } - if len(m.Acknowledgements) > 0 { - for iNdEx := len(m.Acknowledgements) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Acknowledgements[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } + dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryPacketReceiptRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryUnreceivedAcksRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2614,39 +2059,45 @@ func (m *QueryPacketReceiptRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryPacketReceiptRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryUnreceivedAcksRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryPacketReceiptRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryUnreceivedAcksRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Sequence != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.Sequence)) - i-- - dAtA[i] = 0x18 - } - if len(m.ChannelId) > 0 { - i -= len(m.ChannelId) - copy(dAtA[i:], m.ChannelId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ChannelId))) + if len(m.PacketAckSequences) > 0 { + dAtA19 := make([]byte, len(m.PacketAckSequences)*10) + var j18 int + for _, num := range m.PacketAckSequences { + for num >= 1<<7 { + dAtA19[j18] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j18++ + } + dAtA19[j18] = uint8(num) + j18++ + } + i -= j18 + copy(dAtA[i:], dAtA19[:j18]) + i = encodeVarintQuery(dAtA, i, uint64(j18)) i-- dAtA[i] = 0x12 } - if len(m.PortId) > 0 { - i -= len(m.PortId) - copy(dAtA[i:], m.PortId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.PortId))) + if len(m.ClientId) > 0 { + i -= len(m.ClientId) + copy(dAtA[i:], m.ClientId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ClientId))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryPacketReceiptResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryUnreceivedAcksResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2656,18 +2107,18 @@ func (m *QueryPacketReceiptResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryPacketReceiptResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryUnreceivedAcksResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryPacketReceiptResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryUnreceivedAcksResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l { - size, err := m.ProofHeight.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Height.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2675,221 +2126,24 @@ func (m *QueryPacketReceiptResponse) MarshalToSizedBuffer(dAtA []byte) (int, err i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x22 - if len(m.Proof) > 0 { - i -= len(m.Proof) - copy(dAtA[i:], m.Proof) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Proof))) - i-- - dAtA[i] = 0x1a - } - if m.Received { - i-- - if m.Received { - dAtA[i] = 1 - } else { - dAtA[i] = 0 + dAtA[i] = 0x12 + if len(m.Sequences) > 0 { + dAtA22 := make([]byte, len(m.Sequences)*10) + var j21 int + for _, num := range m.Sequences { + for num >= 1<<7 { + dAtA22[j21] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j21++ + } + dAtA22[j21] = uint8(num) + j21++ } + i -= j21 + copy(dAtA[i:], dAtA22[:j21]) + i = encodeVarintQuery(dAtA, i, uint64(j21)) i-- - dAtA[i] = 0x10 - } - return len(dAtA) - i, nil -} - -func (m *QueryUnreceivedPacketsRequest) 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 *QueryUnreceivedPacketsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryUnreceivedPacketsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Sequences) > 0 { - dAtA19 := make([]byte, len(m.Sequences)*10) - var j18 int - for _, num := range m.Sequences { - for num >= 1<<7 { - dAtA19[j18] = uint8(uint64(num)&0x7f | 0x80) - num >>= 7 - j18++ - } - dAtA19[j18] = uint8(num) - j18++ - } - i -= j18 - copy(dAtA[i:], dAtA19[:j18]) - i = encodeVarintQuery(dAtA, i, uint64(j18)) - i-- - dAtA[i] = 0x12 - } - if len(m.ChannelId) > 0 { - i -= len(m.ChannelId) - copy(dAtA[i:], m.ChannelId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ChannelId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryUnreceivedPacketsResponse) 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 *QueryUnreceivedPacketsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryUnreceivedPacketsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Height.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.Sequences) > 0 { - dAtA22 := make([]byte, len(m.Sequences)*10) - var j21 int - for _, num := range m.Sequences { - for num >= 1<<7 { - dAtA22[j21] = uint8(uint64(num)&0x7f | 0x80) - num >>= 7 - j21++ - } - dAtA22[j21] = uint8(num) - j21++ - } - i -= j21 - copy(dAtA[i:], dAtA22[:j21]) - i = encodeVarintQuery(dAtA, i, uint64(j21)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryUnreceivedAcksRequest) 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 *QueryUnreceivedAcksRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryUnreceivedAcksRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.PacketAckSequences) > 0 { - dAtA24 := make([]byte, len(m.PacketAckSequences)*10) - var j23 int - for _, num := range m.PacketAckSequences { - for num >= 1<<7 { - dAtA24[j23] = uint8(uint64(num)&0x7f | 0x80) - num >>= 7 - j23++ - } - dAtA24[j23] = uint8(num) - j23++ - } - i -= j23 - copy(dAtA[i:], dAtA24[:j23]) - i = encodeVarintQuery(dAtA, i, uint64(j23)) - i-- - dAtA[i] = 0x12 - } - if len(m.ChannelId) > 0 { - i -= len(m.ChannelId) - copy(dAtA[i:], m.ChannelId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ChannelId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryUnreceivedAcksResponse) 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 *QueryUnreceivedAcksResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryUnreceivedAcksResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Height.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.Sequences) > 0 { - dAtA27 := make([]byte, len(m.Sequences)*10) - var j26 int - for _, num := range m.Sequences { - for num >= 1<<7 { - dAtA27[j26] = uint8(uint64(num)&0x7f | 0x80) - num >>= 7 - j26++ - } - dAtA27[j26] = uint8(num) - j26++ - } - i -= j26 - copy(dAtA[i:], dAtA27[:j26]) - i = encodeVarintQuery(dAtA, i, uint64(j26)) - i-- - dAtA[i] = 0xa + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -2905,111 +2159,13 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *QueryChannelRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChannelId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryChannelResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Channel.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryChannelClientStateRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChannelId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryChannelClientStateResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.IdentifiedClientState != nil { - l = m.IdentifiedClientState.Size() - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Proof) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = m.ProofHeight.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryChannelConsensusStateRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChannelId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.RevisionNumber != 0 { - n += 1 + sovQuery(uint64(m.RevisionNumber)) - } - if m.RevisionHeight != 0 { - n += 1 + sovQuery(uint64(m.RevisionHeight)) - } - return n -} - -func (m *QueryChannelConsensusStateResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ConsensusState != nil { - l = m.ConsensusState.Size() - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.ClientId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Proof) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = m.ProofHeight.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - func (m *QueryNextSequenceSendRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.ChannelId) + l = len(m.ClientId) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -3040,7 +2196,7 @@ func (m *QueryPacketCommitmentRequest) Size() (n int) { } var l int _ = l - l = len(m.ChannelId) + l = len(m.ClientId) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -3075,7 +2231,7 @@ func (m *QueryPacketCommitmentsRequest) Size() (n int) { } var l int _ = l - l = len(m.ChannelId) + l = len(m.ClientId) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -3113,7 +2269,7 @@ func (m *QueryPacketAcknowledgementRequest) Size() (n int) { } var l int _ = l - l = len(m.ChannelId) + l = len(m.ClientId) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -3148,7 +2304,7 @@ func (m *QueryPacketAcknowledgementsRequest) Size() (n int) { } var l int _ = l - l = len(m.ChannelId) + l = len(m.ClientId) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -3193,11 +2349,7 @@ func (m *QueryPacketReceiptRequest) Size() (n int) { } var l int _ = l - l = len(m.PortId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.ChannelId) + l = len(m.ClientId) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -3231,7 +2383,7 @@ func (m *QueryUnreceivedPacketsRequest) Size() (n int) { } var l int _ = l - l = len(m.ChannelId) + l = len(m.ClientId) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -3267,750 +2419,45 @@ func (m *QueryUnreceivedAcksRequest) Size() (n int) { if m == nil { return 0 } - var l int - _ = l - l = len(m.ChannelId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if len(m.PacketAckSequences) > 0 { - l = 0 - for _, e := range m.PacketAckSequences { - l += sovQuery(uint64(e)) - } - n += 1 + sovQuery(uint64(l)) + l - } - return n -} - -func (m *QueryUnreceivedAcksResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Sequences) > 0 { - l = 0 - for _, e := range m.Sequences { - l += sovQuery(uint64(e)) - } - n += 1 + sovQuery(uint64(l)) + l - } - l = m.Height.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *QueryChannelRequest) 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 ErrIntOverflowQuery - } - 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: QueryChannelRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryChannelRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChannelId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryChannelResponse) 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 ErrIntOverflowQuery - } - 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: QueryChannelResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryChannelResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Channel", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Channel.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryChannelClientStateRequest) 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 ErrIntOverflowQuery - } - 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: QueryChannelClientStateRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryChannelClientStateRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChannelId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryChannelClientStateResponse) 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 ErrIntOverflowQuery - } - 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: QueryChannelClientStateResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryChannelClientStateResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IdentifiedClientState", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.IdentifiedClientState == nil { - m.IdentifiedClientState = &types.IdentifiedClientState{} - } - if err := m.IdentifiedClientState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Proof = append(m.Proof[:0], dAtA[iNdEx:postIndex]...) - if m.Proof == nil { - m.Proof = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProofHeight", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ProofHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryChannelConsensusStateRequest) 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 ErrIntOverflowQuery - } - 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: QueryChannelConsensusStateRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryChannelConsensusStateRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChannelId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RevisionNumber", wireType) - } - m.RevisionNumber = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RevisionNumber |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RevisionHeight", wireType) - } - m.RevisionHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RevisionHeight |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy + var l int + _ = l + l = len(m.ClientId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if len(m.PacketAckSequences) > 0 { + l = 0 + for _, e := range m.PacketAckSequences { + l += sovQuery(uint64(e)) } + n += 1 + sovQuery(uint64(l)) + l } + return n +} - if iNdEx > l { - return io.ErrUnexpectedEOF +func (m *QueryUnreceivedAcksResponse) Size() (n int) { + if m == nil { + return 0 } - return nil -} -func (m *QueryChannelConsensusStateResponse) 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 ErrIntOverflowQuery - } - 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: QueryChannelConsensusStateResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryChannelConsensusStateResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConsensusState", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ConsensusState == nil { - m.ConsensusState = &types1.Any{} - } - if err := m.ConsensusState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - 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 ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - 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 Proof", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Proof = append(m.Proof[:0], dAtA[iNdEx:postIndex]...) - if m.Proof == nil { - m.Proof = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProofHeight", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ProofHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy + var l int + _ = l + if len(m.Sequences) > 0 { + l = 0 + for _, e := range m.Sequences { + l += sovQuery(uint64(e)) } + n += 1 + sovQuery(uint64(l)) + l } + l = m.Height.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } func (m *QueryNextSequenceSendRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) @@ -4043,7 +2490,7 @@ func (m *QueryNextSequenceSendRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ClientId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4071,7 +2518,7 @@ func (m *QueryNextSequenceSendRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ChannelId = string(dAtA[iNdEx:postIndex]) + m.ClientId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -4261,7 +2708,7 @@ func (m *QueryPacketCommitmentRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ClientId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4289,7 +2736,7 @@ func (m *QueryPacketCommitmentRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ChannelId = string(dAtA[iNdEx:postIndex]) + m.ClientId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 0 { @@ -4513,7 +2960,7 @@ func (m *QueryPacketCommitmentsRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ClientId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4541,7 +2988,7 @@ func (m *QueryPacketCommitmentsRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ChannelId = string(dAtA[iNdEx:postIndex]) + m.ClientId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -4784,7 +3231,7 @@ func (m *QueryPacketAcknowledgementRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ClientId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4812,7 +3259,7 @@ func (m *QueryPacketAcknowledgementRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ChannelId = string(dAtA[iNdEx:postIndex]) + m.ClientId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 0 { @@ -5036,7 +3483,7 @@ func (m *QueryPacketAcknowledgementsRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ClientId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5064,7 +3511,7 @@ func (m *QueryPacketAcknowledgementsRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ChannelId = string(dAtA[iNdEx:postIndex]) + m.ClientId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -5383,7 +3830,7 @@ func (m *QueryPacketReceiptRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PortId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ClientId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5411,41 +3858,9 @@ func (m *QueryPacketReceiptRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.PortId = string(dAtA[iNdEx:postIndex]) + m.ClientId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChannelId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Sequence", wireType) } @@ -5653,7 +4068,7 @@ func (m *QueryUnreceivedPacketsRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ClientId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5681,7 +4096,7 @@ func (m *QueryUnreceivedPacketsRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ChannelId = string(dAtA[iNdEx:postIndex]) + m.ClientId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType == 0 { @@ -5970,7 +4385,7 @@ func (m *QueryUnreceivedAcksRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ClientId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5998,7 +4413,7 @@ func (m *QueryUnreceivedAcksRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ChannelId = string(dAtA[iNdEx:postIndex]) + m.ClientId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType == 0 { diff --git a/modules/core/04-channel/v2/types/query.pb.gw.go b/modules/core/04-channel/v2/types/query.pb.gw.go index 2d87052d3ba..63572d446cc 100644 --- a/modules/core/04-channel/v2/types/query.pb.gw.go +++ b/modules/core/04-channel/v2/types/query.pb.gw.go @@ -33,186 +33,6 @@ var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage var _ = metadata.Join -func request_Query_Channel_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryChannelRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["channel_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") - } - - protoReq.ChannelId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) - } - - msg, err := client.Channel(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Channel_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryChannelRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["channel_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") - } - - protoReq.ChannelId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) - } - - msg, err := server.Channel(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_ChannelClientState_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryChannelClientStateRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["channel_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") - } - - protoReq.ChannelId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) - } - - msg, err := client.ChannelClientState(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_ChannelClientState_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryChannelClientStateRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["channel_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") - } - - protoReq.ChannelId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) - } - - msg, err := server.ChannelClientState(ctx, &protoReq) - return msg, metadata, err - -} - -var ( - filter_Query_ChannelConsensusState_0 = &utilities.DoubleArray{Encoding: map[string]int{"channel_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} -) - -func request_Query_ChannelConsensusState_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryChannelConsensusStateRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["channel_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") - } - - protoReq.ChannelId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) - } - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ChannelConsensusState_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.ChannelConsensusState(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_ChannelConsensusState_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryChannelConsensusStateRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["channel_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") - } - - protoReq.ChannelId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) - } - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ChannelConsensusState_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.ChannelConsensusState(ctx, &protoReq) - return msg, metadata, err - -} - func request_Query_NextSequenceSend_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryNextSequenceSendRequest var metadata runtime.ServerMetadata @@ -224,15 +44,15 @@ func request_Query_NextSequenceSend_0(ctx context.Context, marshaler runtime.Mar _ = err ) - val, ok = pathParams["channel_id"] + val, ok = pathParams["client_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "client_id") } - protoReq.ChannelId, err = runtime.String(val) + protoReq.ClientId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "client_id", err) } msg, err := client.NextSequenceSend(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -251,15 +71,15 @@ func local_request_Query_NextSequenceSend_0(ctx context.Context, marshaler runti _ = err ) - val, ok = pathParams["channel_id"] + val, ok = pathParams["client_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "client_id") } - protoReq.ChannelId, err = runtime.String(val) + protoReq.ClientId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "client_id", err) } msg, err := server.NextSequenceSend(ctx, &protoReq) @@ -278,15 +98,15 @@ func request_Query_PacketCommitment_0(ctx context.Context, marshaler runtime.Mar _ = err ) - val, ok = pathParams["channel_id"] + val, ok = pathParams["client_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "client_id") } - protoReq.ChannelId, err = runtime.String(val) + protoReq.ClientId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "client_id", err) } val, ok = pathParams["sequence"] @@ -316,15 +136,15 @@ func local_request_Query_PacketCommitment_0(ctx context.Context, marshaler runti _ = err ) - val, ok = pathParams["channel_id"] + val, ok = pathParams["client_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "client_id") } - protoReq.ChannelId, err = runtime.String(val) + protoReq.ClientId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "client_id", err) } val, ok = pathParams["sequence"] @@ -344,7 +164,7 @@ func local_request_Query_PacketCommitment_0(ctx context.Context, marshaler runti } var ( - filter_Query_PacketCommitments_0 = &utilities.DoubleArray{Encoding: map[string]int{"channel_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} + filter_Query_PacketCommitments_0 = &utilities.DoubleArray{Encoding: map[string]int{"client_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_Query_PacketCommitments_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -358,15 +178,15 @@ func request_Query_PacketCommitments_0(ctx context.Context, marshaler runtime.Ma _ = err ) - val, ok = pathParams["channel_id"] + val, ok = pathParams["client_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "client_id") } - protoReq.ChannelId, err = runtime.String(val) + protoReq.ClientId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "client_id", err) } if err := req.ParseForm(); err != nil { @@ -392,15 +212,15 @@ func local_request_Query_PacketCommitments_0(ctx context.Context, marshaler runt _ = err ) - val, ok = pathParams["channel_id"] + val, ok = pathParams["client_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "client_id") } - protoReq.ChannelId, err = runtime.String(val) + protoReq.ClientId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "client_id", err) } if err := req.ParseForm(); err != nil { @@ -426,15 +246,15 @@ func request_Query_PacketAcknowledgement_0(ctx context.Context, marshaler runtim _ = err ) - val, ok = pathParams["channel_id"] + val, ok = pathParams["client_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "client_id") } - protoReq.ChannelId, err = runtime.String(val) + protoReq.ClientId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "client_id", err) } val, ok = pathParams["sequence"] @@ -464,15 +284,15 @@ func local_request_Query_PacketAcknowledgement_0(ctx context.Context, marshaler _ = err ) - val, ok = pathParams["channel_id"] + val, ok = pathParams["client_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "client_id") } - protoReq.ChannelId, err = runtime.String(val) + protoReq.ClientId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "client_id", err) } val, ok = pathParams["sequence"] @@ -492,7 +312,7 @@ func local_request_Query_PacketAcknowledgement_0(ctx context.Context, marshaler } var ( - filter_Query_PacketAcknowledgements_0 = &utilities.DoubleArray{Encoding: map[string]int{"channel_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} + filter_Query_PacketAcknowledgements_0 = &utilities.DoubleArray{Encoding: map[string]int{"client_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_Query_PacketAcknowledgements_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -506,15 +326,15 @@ func request_Query_PacketAcknowledgements_0(ctx context.Context, marshaler runti _ = err ) - val, ok = pathParams["channel_id"] + val, ok = pathParams["client_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "client_id") } - protoReq.ChannelId, err = runtime.String(val) + protoReq.ClientId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "client_id", err) } if err := req.ParseForm(); err != nil { @@ -540,15 +360,15 @@ func local_request_Query_PacketAcknowledgements_0(ctx context.Context, marshaler _ = err ) - val, ok = pathParams["channel_id"] + val, ok = pathParams["client_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "client_id") } - protoReq.ChannelId, err = runtime.String(val) + protoReq.ClientId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "client_id", err) } if err := req.ParseForm(); err != nil { @@ -563,10 +383,6 @@ func local_request_Query_PacketAcknowledgements_0(ctx context.Context, marshaler } -var ( - filter_Query_PacketReceipt_0 = &utilities.DoubleArray{Encoding: map[string]int{"channel_id": 0, "sequence": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} -) - func request_Query_PacketReceipt_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryPacketReceiptRequest var metadata runtime.ServerMetadata @@ -578,15 +394,15 @@ func request_Query_PacketReceipt_0(ctx context.Context, marshaler runtime.Marsha _ = err ) - val, ok = pathParams["channel_id"] + val, ok = pathParams["client_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "client_id") } - protoReq.ChannelId, err = runtime.String(val) + protoReq.ClientId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "client_id", err) } val, ok = pathParams["sequence"] @@ -600,13 +416,6 @@ func request_Query_PacketReceipt_0(ctx context.Context, marshaler runtime.Marsha return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sequence", err) } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_PacketReceipt_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - msg, err := client.PacketReceipt(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err @@ -623,15 +432,15 @@ func local_request_Query_PacketReceipt_0(ctx context.Context, marshaler runtime. _ = err ) - val, ok = pathParams["channel_id"] + val, ok = pathParams["client_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "client_id") } - protoReq.ChannelId, err = runtime.String(val) + protoReq.ClientId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "client_id", err) } val, ok = pathParams["sequence"] @@ -645,13 +454,6 @@ func local_request_Query_PacketReceipt_0(ctx context.Context, marshaler runtime. return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sequence", err) } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_PacketReceipt_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - msg, err := server.PacketReceipt(ctx, &protoReq) return msg, metadata, err @@ -668,15 +470,15 @@ func request_Query_UnreceivedPackets_0(ctx context.Context, marshaler runtime.Ma _ = err ) - val, ok = pathParams["channel_id"] + val, ok = pathParams["client_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "client_id") } - protoReq.ChannelId, err = runtime.String(val) + protoReq.ClientId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "client_id", err) } val, ok = pathParams["sequences"] @@ -706,15 +508,15 @@ func local_request_Query_UnreceivedPackets_0(ctx context.Context, marshaler runt _ = err ) - val, ok = pathParams["channel_id"] + val, ok = pathParams["client_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "client_id") } - protoReq.ChannelId, err = runtime.String(val) + protoReq.ClientId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "client_id", err) } val, ok = pathParams["sequences"] @@ -744,15 +546,15 @@ func request_Query_UnreceivedAcks_0(ctx context.Context, marshaler runtime.Marsh _ = err ) - val, ok = pathParams["channel_id"] + val, ok = pathParams["client_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "client_id") } - protoReq.ChannelId, err = runtime.String(val) + protoReq.ClientId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "client_id", err) } val, ok = pathParams["packet_ack_sequences"] @@ -782,15 +584,15 @@ func local_request_Query_UnreceivedAcks_0(ctx context.Context, marshaler runtime _ = err ) - val, ok = pathParams["channel_id"] + val, ok = pathParams["client_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "client_id") } - protoReq.ChannelId, err = runtime.String(val) + protoReq.ClientId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "client_id", err) } val, ok = pathParams["packet_ack_sequences"] @@ -815,75 +617,6 @@ func local_request_Query_UnreceivedAcks_0(ctx context.Context, marshaler runtime // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_Channel_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Channel_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Channel_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_ChannelClientState_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_ChannelClientState_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_ChannelClientState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_ChannelConsensusState_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_ChannelConsensusState_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_ChannelConsensusState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_NextSequenceSend_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1109,66 +842,6 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - mux.Handle("GET", pattern_Query_Channel_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Channel_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Channel_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_ChannelClientState_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_ChannelClientState_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_ChannelClientState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_ChannelConsensusState_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_ChannelConsensusState_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_ChannelConsensusState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_NextSequenceSend_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1333,36 +1006,24 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_Channel_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"ibc", "core", "channel", "v2", "channels", "channel_id"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_ChannelClientState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6}, []string{"ibc", "core", "channel", "v2", "channels", "channel_id", "client_state"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_ChannelConsensusState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6}, []string{"ibc", "core", "channel", "v2", "channels", "channel_id", "consensus_state"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_NextSequenceSend_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6}, []string{"ibc", "core", "channel", "v2", "clients", "client_id", "next_sequence_send"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_NextSequenceSend_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6}, []string{"ibc", "core", "channel", "v2", "channels", "channel_id", "next_sequence_send"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_PacketCommitment_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7}, []string{"ibc", "core", "channel", "v2", "clients", "client_id", "packet_commitments", "sequence"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_PacketCommitment_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7}, []string{"ibc", "core", "channel", "v2", "channels", "channel_id", "packet_commitments", "sequence"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_PacketCommitments_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6}, []string{"ibc", "core", "channel", "v2", "clients", "client_id", "packet_commitments"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_PacketCommitments_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6}, []string{"ibc", "core", "channel", "v2", "channels", "channel_id", "packet_commitments"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_PacketAcknowledgement_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7}, []string{"ibc", "core", "channel", "v2", "clients", "client_id", "packet_acks", "sequence"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_PacketAcknowledgement_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7}, []string{"ibc", "core", "channel", "v2", "channels", "channel_id", "packet_acks", "sequence"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_PacketAcknowledgements_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6}, []string{"ibc", "core", "channel", "v2", "clients", "client_id", "packet_acknowledgements"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_PacketAcknowledgements_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6}, []string{"ibc", "core", "channel", "v2", "channels", "channel_id", "packet_acknowledgements"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_PacketReceipt_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7}, []string{"ibc", "core", "channel", "v2", "clients", "client_id", "packet_receipts", "sequence"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_PacketReceipt_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7}, []string{"ibc", "core", "channel", "v2", "channels", "channel_id", "packet_receipts", "sequence"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_UnreceivedPackets_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 2, 8}, []string{"ibc", "core", "channel", "v2", "clients", "client_id", "packet_commitments", "sequences", "unreceived_packets"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_UnreceivedPackets_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 2, 8}, []string{"ibc", "core", "channel", "v2", "channels", "channel_id", "packet_commitments", "sequences", "unreceived_packets"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_UnreceivedAcks_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 2, 8}, []string{"ibc", "core", "channel", "v2", "channels", "channel_id", "packet_commitments", "packet_ack_sequences", "unreceived_acks"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_UnreceivedAcks_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 2, 8}, []string{"ibc", "core", "channel", "v2", "clients", "client_id", "packet_commitments", "packet_ack_sequences", "unreceived_acks"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( - forward_Query_Channel_0 = runtime.ForwardResponseMessage - - forward_Query_ChannelClientState_0 = runtime.ForwardResponseMessage - - forward_Query_ChannelConsensusState_0 = runtime.ForwardResponseMessage - forward_Query_NextSequenceSend_0 = runtime.ForwardResponseMessage forward_Query_PacketCommitment_0 = runtime.ForwardResponseMessage diff --git a/modules/core/04-channel/v2/types/tx.pb.go b/modules/core/04-channel/v2/types/tx.pb.go index b40a86332a0..ba67180f946 100644 --- a/modules/core/04-channel/v2/types/tx.pb.go +++ b/modules/core/04-channel/v2/types/tx.pb.go @@ -11,7 +11,6 @@ import ( grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" types "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" - v2 "github.com/cosmos/ibc-go/v9/modules/core/23-commitment/types/v2" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -67,172 +66,9 @@ func (ResponseResultType) EnumDescriptor() ([]byte, []int) { return fileDescriptor_d421c7119e969b99, []int{0} } -// MsgCreateChannel defines the message used to create a v2 Channel. -type MsgCreateChannel struct { - // the client identifier of the light client representing the counterparty chain - ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` - // the key path used to store packet flow messages that the counterparty - // will use to send to us. - MerklePathPrefix v2.MerklePath `protobuf:"bytes,2,opt,name=merkle_path_prefix,json=merklePathPrefix,proto3" json:"merkle_path_prefix"` - // signer address - Signer string `protobuf:"bytes,3,opt,name=signer,proto3" json:"signer,omitempty"` -} - -func (m *MsgCreateChannel) Reset() { *m = MsgCreateChannel{} } -func (m *MsgCreateChannel) String() string { return proto.CompactTextString(m) } -func (*MsgCreateChannel) ProtoMessage() {} -func (*MsgCreateChannel) Descriptor() ([]byte, []int) { - return fileDescriptor_d421c7119e969b99, []int{0} -} -func (m *MsgCreateChannel) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCreateChannel) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCreateChannel.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 *MsgCreateChannel) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreateChannel.Merge(m, src) -} -func (m *MsgCreateChannel) XXX_Size() int { - return m.Size() -} -func (m *MsgCreateChannel) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreateChannel.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCreateChannel proto.InternalMessageInfo - -// MsgCreateChannelResponse defines the Msg/CreateChannel response type. -type MsgCreateChannelResponse struct { - ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` -} - -func (m *MsgCreateChannelResponse) Reset() { *m = MsgCreateChannelResponse{} } -func (m *MsgCreateChannelResponse) String() string { return proto.CompactTextString(m) } -func (*MsgCreateChannelResponse) ProtoMessage() {} -func (*MsgCreateChannelResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d421c7119e969b99, []int{1} -} -func (m *MsgCreateChannelResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCreateChannelResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCreateChannelResponse.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 *MsgCreateChannelResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreateChannelResponse.Merge(m, src) -} -func (m *MsgCreateChannelResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgCreateChannelResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreateChannelResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCreateChannelResponse proto.InternalMessageInfo - -// MsgRegisterCounterparty defines the message used to provide the counterparty channel -// identifier. -type MsgRegisterCounterparty struct { - // unique identifier we will use to write all packet messages sent to counterparty - ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` - // counterparty channel identifier - CounterpartyChannelId string `protobuf:"bytes,2,opt,name=counterparty_channel_id,json=counterpartyChannelId,proto3" json:"counterparty_channel_id,omitempty"` - // signer address - Signer string `protobuf:"bytes,3,opt,name=signer,proto3" json:"signer,omitempty"` -} - -func (m *MsgRegisterCounterparty) Reset() { *m = MsgRegisterCounterparty{} } -func (m *MsgRegisterCounterparty) String() string { return proto.CompactTextString(m) } -func (*MsgRegisterCounterparty) ProtoMessage() {} -func (*MsgRegisterCounterparty) Descriptor() ([]byte, []int) { - return fileDescriptor_d421c7119e969b99, []int{2} -} -func (m *MsgRegisterCounterparty) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgRegisterCounterparty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgRegisterCounterparty.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 *MsgRegisterCounterparty) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRegisterCounterparty.Merge(m, src) -} -func (m *MsgRegisterCounterparty) XXX_Size() int { - return m.Size() -} -func (m *MsgRegisterCounterparty) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRegisterCounterparty.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgRegisterCounterparty proto.InternalMessageInfo - -// MsgRegisterCounterpartyResponse defines the Msg/RegisterCounterparty response type. -type MsgRegisterCounterpartyResponse struct { -} - -func (m *MsgRegisterCounterpartyResponse) Reset() { *m = MsgRegisterCounterpartyResponse{} } -func (m *MsgRegisterCounterpartyResponse) String() string { return proto.CompactTextString(m) } -func (*MsgRegisterCounterpartyResponse) ProtoMessage() {} -func (*MsgRegisterCounterpartyResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d421c7119e969b99, []int{3} -} -func (m *MsgRegisterCounterpartyResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgRegisterCounterpartyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgRegisterCounterpartyResponse.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 *MsgRegisterCounterpartyResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRegisterCounterpartyResponse.Merge(m, src) -} -func (m *MsgRegisterCounterpartyResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgRegisterCounterpartyResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRegisterCounterpartyResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgRegisterCounterpartyResponse proto.InternalMessageInfo - // MsgSendPacket sends an outgoing IBC packet. type MsgSendPacket struct { - SourceChannel string `protobuf:"bytes,1,opt,name=source_channel,json=sourceChannel,proto3" json:"source_channel,omitempty"` + SourceClient string `protobuf:"bytes,1,opt,name=source_client,json=sourceClient,proto3" json:"source_client,omitempty"` TimeoutTimestamp uint64 `protobuf:"varint,2,opt,name=timeout_timestamp,json=timeoutTimestamp,proto3" json:"timeout_timestamp,omitempty"` Payloads []Payload `protobuf:"bytes,3,rep,name=payloads,proto3" json:"payloads"` Signer string `protobuf:"bytes,4,opt,name=signer,proto3" json:"signer,omitempty"` @@ -242,7 +78,7 @@ func (m *MsgSendPacket) Reset() { *m = MsgSendPacket{} } func (m *MsgSendPacket) String() string { return proto.CompactTextString(m) } func (*MsgSendPacket) ProtoMessage() {} func (*MsgSendPacket) Descriptor() ([]byte, []int) { - return fileDescriptor_d421c7119e969b99, []int{4} + return fileDescriptor_d421c7119e969b99, []int{0} } func (m *MsgSendPacket) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -280,7 +116,7 @@ func (m *MsgSendPacketResponse) Reset() { *m = MsgSendPacketResponse{} } func (m *MsgSendPacketResponse) String() string { return proto.CompactTextString(m) } func (*MsgSendPacketResponse) ProtoMessage() {} func (*MsgSendPacketResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d421c7119e969b99, []int{5} + return fileDescriptor_d421c7119e969b99, []int{1} } func (m *MsgSendPacketResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -321,7 +157,7 @@ func (m *MsgRecvPacket) Reset() { *m = MsgRecvPacket{} } func (m *MsgRecvPacket) String() string { return proto.CompactTextString(m) } func (*MsgRecvPacket) ProtoMessage() {} func (*MsgRecvPacket) Descriptor() ([]byte, []int) { - return fileDescriptor_d421c7119e969b99, []int{6} + return fileDescriptor_d421c7119e969b99, []int{2} } func (m *MsgRecvPacket) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -359,7 +195,7 @@ func (m *MsgRecvPacketResponse) Reset() { *m = MsgRecvPacketResponse{} } func (m *MsgRecvPacketResponse) String() string { return proto.CompactTextString(m) } func (*MsgRecvPacketResponse) ProtoMessage() {} func (*MsgRecvPacketResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d421c7119e969b99, []int{7} + return fileDescriptor_d421c7119e969b99, []int{3} } func (m *MsgRecvPacketResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -400,7 +236,7 @@ func (m *MsgTimeout) Reset() { *m = MsgTimeout{} } func (m *MsgTimeout) String() string { return proto.CompactTextString(m) } func (*MsgTimeout) ProtoMessage() {} func (*MsgTimeout) Descriptor() ([]byte, []int) { - return fileDescriptor_d421c7119e969b99, []int{8} + return fileDescriptor_d421c7119e969b99, []int{4} } func (m *MsgTimeout) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -438,7 +274,7 @@ func (m *MsgTimeoutResponse) Reset() { *m = MsgTimeoutResponse{} } func (m *MsgTimeoutResponse) String() string { return proto.CompactTextString(m) } func (*MsgTimeoutResponse) ProtoMessage() {} func (*MsgTimeoutResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d421c7119e969b99, []int{9} + return fileDescriptor_d421c7119e969b99, []int{5} } func (m *MsgTimeoutResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -480,7 +316,7 @@ func (m *MsgAcknowledgement) Reset() { *m = MsgAcknowledgement{} } func (m *MsgAcknowledgement) String() string { return proto.CompactTextString(m) } func (*MsgAcknowledgement) ProtoMessage() {} func (*MsgAcknowledgement) Descriptor() ([]byte, []int) { - return fileDescriptor_d421c7119e969b99, []int{10} + return fileDescriptor_d421c7119e969b99, []int{6} } func (m *MsgAcknowledgement) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -518,7 +354,7 @@ func (m *MsgAcknowledgementResponse) Reset() { *m = MsgAcknowledgementRe func (m *MsgAcknowledgementResponse) String() string { return proto.CompactTextString(m) } func (*MsgAcknowledgementResponse) ProtoMessage() {} func (*MsgAcknowledgementResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d421c7119e969b99, []int{11} + return fileDescriptor_d421c7119e969b99, []int{7} } func (m *MsgAcknowledgementResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -549,10 +385,6 @@ var xxx_messageInfo_MsgAcknowledgementResponse proto.InternalMessageInfo func init() { proto.RegisterEnum("ibc.core.channel.v2.ResponseResultType", ResponseResultType_name, ResponseResultType_value) - proto.RegisterType((*MsgCreateChannel)(nil), "ibc.core.channel.v2.MsgCreateChannel") - proto.RegisterType((*MsgCreateChannelResponse)(nil), "ibc.core.channel.v2.MsgCreateChannelResponse") - proto.RegisterType((*MsgRegisterCounterparty)(nil), "ibc.core.channel.v2.MsgRegisterCounterparty") - proto.RegisterType((*MsgRegisterCounterpartyResponse)(nil), "ibc.core.channel.v2.MsgRegisterCounterpartyResponse") proto.RegisterType((*MsgSendPacket)(nil), "ibc.core.channel.v2.MsgSendPacket") proto.RegisterType((*MsgSendPacketResponse)(nil), "ibc.core.channel.v2.MsgSendPacketResponse") proto.RegisterType((*MsgRecvPacket)(nil), "ibc.core.channel.v2.MsgRecvPacket") @@ -566,70 +398,58 @@ func init() { func init() { proto.RegisterFile("ibc/core/channel/v2/tx.proto", fileDescriptor_d421c7119e969b99) } var fileDescriptor_d421c7119e969b99 = []byte{ - // 993 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x96, 0x5d, 0x6f, 0xdb, 0x54, - 0x18, 0xc7, 0xe3, 0x26, 0xeb, 0xda, 0x27, 0xed, 0x12, 0xcc, 0x46, 0x83, 0x57, 0x92, 0x10, 0x31, - 0xb5, 0x14, 0x1a, 0x33, 0x33, 0x90, 0x3a, 0x21, 0xa6, 0x2e, 0x64, 0x22, 0xd2, 0xd2, 0x46, 0x4e, - 0x32, 0x89, 0x17, 0x61, 0x39, 0xce, 0x99, 0x63, 0x35, 0xf6, 0x31, 0x3e, 0x4e, 0x58, 0xb9, 0x42, - 0x5c, 0x4d, 0xbd, 0xe2, 0x96, 0x8b, 0x4a, 0x48, 0x7c, 0x81, 0x5e, 0xf0, 0x21, 0x76, 0xc1, 0xc5, - 0x2e, 0x77, 0x85, 0xa6, 0xf6, 0x62, 0x57, 0x7c, 0x07, 0xe4, 0x73, 0x4e, 0x1c, 0x37, 0xb5, 0xd7, - 0x22, 0xca, 0x55, 0xec, 0xe7, 0xfc, 0x9e, 0xb7, 0xff, 0x73, 0xe2, 0x73, 0x60, 0xd5, 0xea, 0x19, - 0xb2, 0x81, 0x3d, 0x24, 0x1b, 0x03, 0xdd, 0x71, 0xd0, 0x50, 0x1e, 0x2b, 0xb2, 0xff, 0xa4, 0xea, - 0x7a, 0xd8, 0xc7, 0xe2, 0x9b, 0x56, 0xcf, 0xa8, 0x06, 0xab, 0x55, 0xbe, 0x5a, 0x1d, 0x2b, 0xd2, - 0x75, 0x13, 0x9b, 0x98, 0xae, 0xcb, 0xc1, 0x13, 0x43, 0xa5, 0x15, 0x03, 0x13, 0x1b, 0x13, 0xd9, - 0x26, 0xa6, 0x3c, 0xbe, 0x1d, 0xfc, 0xf0, 0x85, 0x72, 0x5c, 0x06, 0x57, 0x37, 0xf6, 0x90, 0xcf, - 0x89, 0xd2, 0x94, 0x18, 0x5a, 0xc8, 0xf1, 0x03, 0x7f, 0xf6, 0xc4, 0x81, 0xb5, 0x29, 0x80, 0x6d, - 0xdb, 0xf2, 0x6d, 0x0a, 0x29, 0x91, 0x37, 0x06, 0x56, 0x8e, 0x04, 0xc8, 0x37, 0x89, 0x59, 0xf3, - 0x90, 0xee, 0xa3, 0x1a, 0x4b, 0x27, 0xde, 0x84, 0x45, 0x16, 0x4d, 0xb3, 0xfa, 0x05, 0xa1, 0x2c, - 0xac, 0x2f, 0xaa, 0x0b, 0xcc, 0xd0, 0xe8, 0x8b, 0x8f, 0x40, 0xb4, 0x91, 0xb7, 0x37, 0x44, 0x9a, - 0xab, 0xfb, 0x03, 0xcd, 0xf5, 0xd0, 0x63, 0xeb, 0x49, 0x61, 0xae, 0x2c, 0xac, 0x67, 0x95, 0x4a, - 0x75, 0xda, 0xfe, 0x34, 0xd3, 0x58, 0xa9, 0x36, 0xa9, 0x47, 0x4b, 0xf7, 0x07, 0xf7, 0x33, 0xcf, - 0xfe, 0x2a, 0xa5, 0xd4, 0xbc, 0x1d, 0x5a, 0x5a, 0x34, 0x82, 0xf8, 0x16, 0xcc, 0x13, 0xcb, 0x74, - 0x90, 0x57, 0x48, 0xd3, 0x8c, 0xfc, 0xed, 0x6e, 0xee, 0xe9, 0x6f, 0xa5, 0xd4, 0xcf, 0xaf, 0x8e, - 0x36, 0xb8, 0xa1, 0x72, 0x0f, 0x0a, 0xb3, 0x15, 0xab, 0x88, 0xb8, 0xd8, 0x21, 0x48, 0x7c, 0x07, - 0x80, 0x6b, 0x36, 0x2d, 0x7d, 0x91, 0x5b, 0x1a, 0xfd, 0xbb, 0x99, 0x20, 0x56, 0xe5, 0x57, 0x01, - 0x56, 0x9a, 0xc4, 0x54, 0x91, 0x69, 0x11, 0x1f, 0x79, 0x35, 0x3c, 0x72, 0x7c, 0xe4, 0xb9, 0xba, - 0xe7, 0xef, 0x9f, 0x13, 0x40, 0xfc, 0x14, 0x56, 0x8c, 0x08, 0xae, 0x45, 0xd8, 0x39, 0xca, 0xde, - 0x88, 0x2e, 0xd7, 0x42, 0xbf, 0x0b, 0x37, 0xf7, 0x2e, 0x94, 0x12, 0x4a, 0x9b, 0xf4, 0x58, 0xf9, - 0x53, 0x80, 0xe5, 0x26, 0x31, 0xdb, 0xc8, 0xe9, 0xb7, 0xe8, 0xa6, 0x10, 0x6f, 0xc1, 0x35, 0x82, - 0x47, 0x9e, 0x81, 0x26, 0xf5, 0xf0, 0xc2, 0x97, 0x99, 0x75, 0x32, 0xd6, 0x0f, 0xe0, 0x0d, 0xdf, - 0xb2, 0x11, 0x1e, 0xf9, 0x5a, 0xf0, 0x4b, 0x7c, 0xdd, 0x76, 0x69, 0xd9, 0x19, 0x35, 0xcf, 0x17, - 0x3a, 0x13, 0xbb, 0xf8, 0x39, 0x2c, 0xb8, 0xfa, 0xfe, 0x10, 0xeb, 0x7d, 0x52, 0x48, 0x97, 0xd3, - 0xeb, 0x59, 0x65, 0xb5, 0x1a, 0xb3, 0xb7, 0xab, 0x2d, 0x06, 0xf1, 0xb1, 0x86, 0x3e, 0x91, 0x8e, - 0x33, 0xaf, 0xef, 0x78, 0x0b, 0x6e, 0x9c, 0xea, 0x26, 0x9c, 0xa5, 0x04, 0x0b, 0x04, 0x7d, 0x3f, - 0x42, 0x8e, 0x81, 0x68, 0x3f, 0x19, 0x35, 0x7c, 0xe7, 0x83, 0x3c, 0x61, 0x4a, 0xa8, 0xc8, 0x18, - 0x73, 0x25, 0xb6, 0x60, 0x9e, 0xfd, 0x51, 0xa8, 0x47, 0x56, 0xb9, 0x99, 0x50, 0x73, 0x80, 0xf0, - 0x92, 0xb9, 0x83, 0xf8, 0x3e, 0xe4, 0x5d, 0x0f, 0xe3, 0xc7, 0xda, 0x74, 0xe7, 0x52, 0x71, 0x96, - 0xd4, 0x1c, 0xb5, 0xd7, 0x42, 0xb3, 0x58, 0x83, 0x25, 0x86, 0x0e, 0x90, 0x65, 0x0e, 0x7c, 0x3a, - 0xd3, 0xac, 0x22, 0x45, 0x72, 0xb1, 0xff, 0xe2, 0xf8, 0x76, 0xf5, 0x4b, 0x4a, 0xf0, 0x54, 0x59, - 0xea, 0xc5, 0x4c, 0x17, 0x17, 0xe8, 0x3b, 0x2a, 0xd0, 0xb4, 0xc9, 0x50, 0xa0, 0x7b, 0x30, 0xef, - 0x21, 0x32, 0x1a, 0xb2, 0x66, 0xaf, 0x29, 0x6b, 0xb1, 0xcd, 0x4e, 0x70, 0x95, 0xa2, 0x9d, 0x7d, - 0x17, 0xa9, 0xdc, 0x8d, 0xab, 0xf8, 0x52, 0x00, 0x68, 0x12, 0xb3, 0xc3, 0x76, 0xc0, 0xa5, 0x48, - 0x38, 0x72, 0x3c, 0x64, 0x20, 0x6b, 0x8c, 0xfa, 0xa7, 0x24, 0xec, 0x86, 0xe6, 0xcb, 0x96, 0xf0, - 0xca, 0xeb, 0x25, 0xfc, 0x06, 0xc4, 0x69, 0x87, 0x97, 0xad, 0xdf, 0x1f, 0x73, 0x34, 0xfa, 0xb6, - 0xb1, 0xe7, 0xe0, 0x1f, 0x86, 0xa8, 0x6f, 0x22, 0xba, 0x49, 0xfe, 0x83, 0x8e, 0x1d, 0xc8, 0xe9, - 0xa7, 0xa3, 0xf1, 0xef, 0xeb, 0x7b, 0xb1, 0x31, 0x66, 0x32, 0xf3, 0x60, 0xb3, 0x21, 0xc4, 0x12, - 0x30, 0xf1, 0xb4, 0x20, 0x49, 0x9f, 0x2a, 0xbe, 0xa4, 0x02, 0x35, 0x6d, 0x07, 0x96, 0x33, 0x33, - 0xc9, 0xfc, 0xaf, 0x33, 0x31, 0x40, 0x3a, 0xab, 0xda, 0x25, 0xcf, 0x66, 0xe3, 0x85, 0x00, 0xe2, - 0x59, 0x48, 0xfc, 0x04, 0xca, 0x6a, 0xbd, 0xdd, 0xda, 0xdd, 0x69, 0xd7, 0x35, 0xb5, 0xde, 0xee, - 0x3e, 0xec, 0x68, 0x9d, 0xaf, 0x5a, 0x75, 0xad, 0xbb, 0xd3, 0x6e, 0xd5, 0x6b, 0x8d, 0x07, 0x8d, - 0xfa, 0x17, 0xf9, 0x94, 0x94, 0x3b, 0x38, 0x2c, 0x67, 0x23, 0x26, 0x71, 0x0d, 0xde, 0x8e, 0x75, - 0xdb, 0xd9, 0xdd, 0x6d, 0xe5, 0x05, 0x69, 0xe1, 0xe0, 0xb0, 0x9c, 0x09, 0x9e, 0xc5, 0x4d, 0x58, - 0x8d, 0x05, 0xdb, 0xdd, 0x5a, 0xad, 0xde, 0x6e, 0xe7, 0xe7, 0xa4, 0xec, 0xc1, 0x61, 0xf9, 0x2a, - 0x7f, 0x4d, 0xc4, 0x1f, 0x6c, 0x37, 0x1e, 0x76, 0xd5, 0x7a, 0x3e, 0xcd, 0x70, 0xfe, 0x2a, 0x65, - 0x9e, 0xfe, 0x5e, 0x4c, 0x29, 0x7f, 0x67, 0x20, 0xdd, 0x24, 0xa6, 0x88, 0x60, 0xf9, 0xf4, 0xe9, - 0x7d, 0x2b, 0x56, 0xaa, 0xd9, 0x23, 0x53, 0xda, 0xbc, 0x10, 0x16, 0x0e, 0xe4, 0x47, 0xb8, 0x1e, - 0x7b, 0x60, 0x7e, 0x98, 0x14, 0x26, 0x8e, 0x96, 0xee, 0xfc, 0x1b, 0x3a, 0xcc, 0xfd, 0x2d, 0x40, - 0xe4, 0xb4, 0xab, 0x24, 0xc5, 0x98, 0x32, 0xd2, 0xc6, 0xf9, 0x4c, 0x34, 0x7a, 0xe4, 0x04, 0xa9, - 0x24, 0x57, 0x38, 0x61, 0x92, 0xa3, 0xc7, 0x7c, 0xa4, 0xdb, 0x70, 0x75, 0xf2, 0x65, 0x2d, 0x25, - 0xb9, 0x71, 0x40, 0x5a, 0x3b, 0x07, 0x08, 0x83, 0xee, 0x41, 0x6e, 0xf6, 0x73, 0x93, 0xe8, 0x3b, - 0x03, 0x4a, 0xf2, 0x05, 0xc1, 0x49, 0x32, 0xe9, 0xca, 0x4f, 0xaf, 0x8e, 0x36, 0x84, 0xfb, 0x8f, - 0x9e, 0x1d, 0x17, 0x85, 0xe7, 0xc7, 0x45, 0xe1, 0xe5, 0x71, 0x51, 0xf8, 0xe5, 0xa4, 0x98, 0x7a, - 0x7e, 0x52, 0x4c, 0xbd, 0x38, 0x29, 0xa6, 0xbe, 0xfe, 0xcc, 0xb4, 0xfc, 0xc1, 0xa8, 0x17, 0x5c, - 0xf9, 0x64, 0x7e, 0xa7, 0xb5, 0x7a, 0xc6, 0xa6, 0x89, 0xe5, 0xf1, 0x96, 0x6c, 0xe3, 0xfe, 0x68, - 0x88, 0x08, 0xbb, 0x8c, 0x7e, 0x74, 0x67, 0x33, 0x7a, 0x69, 0xde, 0x77, 0x11, 0xe9, 0xcd, 0xd3, - 0x8b, 0xe8, 0xc7, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x1d, 0x8d, 0xa1, 0xe9, 0x58, 0x0b, 0x00, - 0x00, + // 803 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x96, 0x4d, 0x6f, 0xda, 0x48, + 0x18, 0xc7, 0x71, 0x70, 0x48, 0x76, 0x20, 0x0b, 0xeb, 0x7d, 0x63, 0xbd, 0x11, 0x58, 0xec, 0x4a, + 0xc9, 0xb2, 0x8a, 0xbd, 0x61, 0x77, 0x0f, 0x89, 0x56, 0x5b, 0x25, 0xd4, 0x51, 0x23, 0xe5, 0x05, + 0xd9, 0x50, 0xa9, 0x6d, 0x54, 0x04, 0x66, 0x6a, 0xac, 0x60, 0x8f, 0xcb, 0x18, 0xda, 0xdc, 0xaa, + 0x9e, 0x22, 0x4e, 0xfd, 0x02, 0x91, 0x2a, 0xf5, 0x0b, 0xe4, 0xd0, 0x0f, 0x11, 0xf5, 0x94, 0x63, + 0x4e, 0x55, 0x14, 0x0e, 0xf9, 0x1a, 0x95, 0x67, 0x86, 0xd7, 0x98, 0x26, 0x52, 0xe9, 0x09, 0xcf, + 0x7f, 0x7e, 0xcf, 0xf3, 0xcc, 0xf3, 0x1f, 0x33, 0x63, 0xb0, 0x68, 0x55, 0x0d, 0xc5, 0x40, 0x4d, + 0xa8, 0x18, 0xf5, 0x8a, 0xe3, 0xc0, 0x86, 0xd2, 0xce, 0x29, 0xde, 0x4b, 0xd9, 0x6d, 0x22, 0x0f, + 0x09, 0xdf, 0x5b, 0x55, 0x43, 0xf6, 0x67, 0x65, 0x36, 0x2b, 0xb7, 0x73, 0xe2, 0x0f, 0x26, 0x32, + 0x11, 0x99, 0x57, 0xfc, 0x27, 0x8a, 0x8a, 0x3f, 0x1b, 0x08, 0xdb, 0x08, 0x2b, 0x36, 0x36, 0x95, + 0xf6, 0xaa, 0xff, 0xc3, 0x26, 0xa4, 0xa0, 0x0a, 0x6e, 0xc5, 0x38, 0x84, 0x1e, 0x23, 0xd2, 0x03, + 0xa2, 0x61, 0x41, 0xc7, 0xf3, 0xe3, 0xe9, 0x13, 0x05, 0x32, 0x1f, 0x38, 0xb0, 0xb0, 0x8b, 0x4d, + 0x1d, 0x3a, 0xb5, 0x02, 0x09, 0x14, 0x7e, 0x03, 0x0b, 0x18, 0xb5, 0x9a, 0x06, 0x2c, 0x53, 0x30, + 0xc9, 0x49, 0xdc, 0xf2, 0x37, 0x5a, 0x8c, 0x8a, 0x79, 0xa2, 0x09, 0x7f, 0x82, 0xef, 0x3c, 0xcb, + 0x86, 0xa8, 0xe5, 0x95, 0xfd, 0x5f, 0xec, 0x55, 0x6c, 0x37, 0x39, 0x23, 0x71, 0xcb, 0xbc, 0x96, + 0x60, 0x13, 0xc5, 0x9e, 0x2e, 0xfc, 0x0f, 0xe6, 0xdd, 0xca, 0x51, 0x03, 0x55, 0x6a, 0x38, 0x19, + 0x96, 0xc2, 0xcb, 0xd1, 0xdc, 0xa2, 0x1c, 0xd0, 0xbd, 0x5c, 0xa0, 0xd0, 0x26, 0x7f, 0xf6, 0x31, + 0x1d, 0xd2, 0xfa, 0x31, 0xc2, 0x4f, 0x20, 0x82, 0x2d, 0xd3, 0x81, 0xcd, 0x24, 0x4f, 0x96, 0xc2, + 0x46, 0xeb, 0xf1, 0xe3, 0xb7, 0xe9, 0xd0, 0xeb, 0xeb, 0xd3, 0x2c, 0x13, 0x32, 0x6b, 0xe0, 0xc7, + 0x91, 0x5e, 0x34, 0x88, 0x5d, 0xe4, 0x60, 0x28, 0x88, 0x60, 0x1e, 0xc3, 0xe7, 0x2d, 0xe8, 0x18, + 0x90, 0xb4, 0xc3, 0x6b, 0xfd, 0xf1, 0x3a, 0xef, 0x67, 0xc9, 0x74, 0xa9, 0x0f, 0x1a, 0x34, 0xda, + 0xcc, 0x87, 0x35, 0x10, 0xa1, 0x56, 0x92, 0x88, 0x68, 0xee, 0xd7, 0x09, 0x6b, 0xf6, 0x11, 0xb6, + 0x64, 0x16, 0x20, 0xfc, 0x01, 0x12, 0x6e, 0x13, 0xa1, 0x67, 0x65, 0x03, 0xd9, 0xb6, 0xe5, 0xd9, + 0xbe, 0x8b, 0xbe, 0x39, 0x31, 0x2d, 0x4e, 0xf4, 0x7c, 0x5f, 0x16, 0xf2, 0x20, 0x46, 0xd1, 0x3a, + 0xb4, 0xcc, 0xba, 0x97, 0x0c, 0x93, 0x5a, 0xe2, 0x50, 0x2d, 0xba, 0x5b, 0xed, 0x55, 0xf9, 0x01, + 0x21, 0x58, 0xa9, 0x28, 0x89, 0xa2, 0xd2, 0xdd, 0x0d, 0x7a, 0x4a, 0x0c, 0x1a, 0x34, 0xd9, 0x37, + 0xe8, 0x1e, 0x88, 0x34, 0x21, 0x6e, 0x35, 0x68, 0xb3, 0xdf, 0xe6, 0x96, 0x02, 0x9b, 0xed, 0xe1, + 0x1a, 0x41, 0x8b, 0x47, 0x2e, 0xd4, 0x58, 0x18, 0x73, 0xf1, 0x92, 0x03, 0x60, 0x17, 0x9b, 0x45, + 0xfa, 0x06, 0x4c, 0xc5, 0xc2, 0x96, 0xd3, 0x84, 0x06, 0xb4, 0xda, 0xb0, 0x36, 0x62, 0x61, 0xa9, + 0x2f, 0x4f, 0xdb, 0xc2, 0xd9, 0xcf, 0x5b, 0xf8, 0x04, 0x08, 0x83, 0x0e, 0xa7, 0xed, 0xdf, 0xfb, + 0x19, 0x92, 0x7d, 0xc3, 0x38, 0x74, 0xd0, 0x8b, 0x06, 0xac, 0x99, 0x90, 0xbc, 0x24, 0x5f, 0xe0, + 0x63, 0x11, 0xc4, 0x2b, 0xa3, 0xd9, 0x88, 0x8d, 0xd1, 0xdc, 0xef, 0x81, 0x39, 0xc6, 0x2a, 0xb3, + 0x64, 0xe3, 0x29, 0x84, 0x34, 0xa0, 0xe6, 0x95, 0xfd, 0x22, 0x35, 0xe2, 0x78, 0x4c, 0x03, 0x44, + 0xda, 0xf0, 0x95, 0x1b, 0x7b, 0xc2, 0x7f, 0xd5, 0x3d, 0x31, 0x80, 0x78, 0xd3, 0xb5, 0x29, 0xef, + 0x4d, 0xf6, 0x82, 0x03, 0xc2, 0x4d, 0x48, 0xf8, 0x17, 0x48, 0x9a, 0xaa, 0x17, 0xf6, 0xf7, 0x74, + 0xb5, 0xac, 0xa9, 0x7a, 0x69, 0xa7, 0x58, 0x2e, 0x3e, 0x2a, 0xa8, 0xe5, 0xd2, 0x9e, 0x5e, 0x50, + 0xf3, 0xdb, 0x5b, 0xdb, 0xea, 0xfd, 0x44, 0x48, 0x8c, 0x77, 0x4e, 0xa4, 0xe8, 0x90, 0x24, 0x2c, + 0x81, 0x5f, 0x02, 0xc3, 0xf6, 0xf6, 0xf7, 0x0b, 0x09, 0x4e, 0x9c, 0xef, 0x9c, 0x48, 0xbc, 0xff, + 0x2c, 0xac, 0x80, 0xc5, 0x40, 0x50, 0x2f, 0xe5, 0xf3, 0xaa, 0xae, 0x27, 0x66, 0xc4, 0x68, 0xe7, + 0x44, 0x9a, 0x63, 0xc3, 0x89, 0xf8, 0xd6, 0xc6, 0xf6, 0x4e, 0x49, 0x53, 0x13, 0x61, 0x8a, 0xb3, + 0xa1, 0xc8, 0x1f, 0xbf, 0x4b, 0x85, 0x72, 0x9d, 0x30, 0x08, 0xef, 0x62, 0x53, 0x38, 0x00, 0x60, + 0xe8, 0x22, 0xc8, 0x04, 0xfa, 0x34, 0x72, 0xc0, 0x8a, 0xd9, 0xdb, 0x99, 0xfe, 0x3e, 0x1c, 0x00, + 0x30, 0x74, 0xbc, 0x4e, 0xcc, 0x3e, 0x60, 0x26, 0x67, 0x0f, 0x38, 0xc1, 0x74, 0x30, 0xd7, 0x3b, + 0x76, 0xd2, 0x93, 0xc2, 0x18, 0x20, 0x2e, 0xdd, 0x02, 0xf4, 0x93, 0x1e, 0x82, 0xf8, 0xf8, 0x7f, + 0x71, 0x62, 0xec, 0x18, 0x28, 0x2a, 0x77, 0x04, 0x7b, 0xc5, 0xc4, 0xd9, 0x57, 0xd7, 0xa7, 0x59, + 0x6e, 0xf3, 0xe1, 0xd9, 0x55, 0x8a, 0x3b, 0xbf, 0x4a, 0x71, 0x97, 0x57, 0x29, 0xee, 0x4d, 0x37, + 0x15, 0x3a, 0xef, 0xa6, 0x42, 0x17, 0xdd, 0x54, 0xe8, 0xf1, 0x7f, 0xa6, 0xe5, 0xd5, 0x5b, 0x55, + 0xd9, 0x40, 0xb6, 0xc2, 0x3e, 0x09, 0xac, 0xaa, 0xb1, 0x62, 0x22, 0xa5, 0xbd, 0xa6, 0xd8, 0xa8, + 0xd6, 0x6a, 0x40, 0x4c, 0x2f, 0xfb, 0xbf, 0xfe, 0x59, 0x19, 0xfe, 0xe6, 0x38, 0x72, 0x21, 0xae, + 0x46, 0xc8, 0x85, 0xff, 0xf7, 0xa7, 0x00, 0x00, 0x00, 0xff, 0xff, 0x40, 0xb6, 0x94, 0x19, 0x97, + 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -644,10 +464,6 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { - // CreateChannel defines a rpc handler method for MsgCreateChannel - CreateChannel(ctx context.Context, in *MsgCreateChannel, opts ...grpc.CallOption) (*MsgCreateChannelResponse, error) - // RegisterCounterparty defines a rpc handler method for MsgRegisterCounterparty. - RegisterCounterparty(ctx context.Context, in *MsgRegisterCounterparty, opts ...grpc.CallOption) (*MsgRegisterCounterpartyResponse, error) // SendPacket defines a rpc handler method for MsgSendPacket. SendPacket(ctx context.Context, in *MsgSendPacket, opts ...grpc.CallOption) (*MsgSendPacketResponse, error) // RecvPacket defines a rpc handler method for MsgRecvPacket. @@ -666,24 +482,6 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } -func (c *msgClient) CreateChannel(ctx context.Context, in *MsgCreateChannel, opts ...grpc.CallOption) (*MsgCreateChannelResponse, error) { - out := new(MsgCreateChannelResponse) - err := c.cc.Invoke(ctx, "/ibc.core.channel.v2.Msg/CreateChannel", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) RegisterCounterparty(ctx context.Context, in *MsgRegisterCounterparty, opts ...grpc.CallOption) (*MsgRegisterCounterpartyResponse, error) { - out := new(MsgRegisterCounterpartyResponse) - err := c.cc.Invoke(ctx, "/ibc.core.channel.v2.Msg/RegisterCounterparty", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *msgClient) SendPacket(ctx context.Context, in *MsgSendPacket, opts ...grpc.CallOption) (*MsgSendPacketResponse, error) { out := new(MsgSendPacketResponse) err := c.cc.Invoke(ctx, "/ibc.core.channel.v2.Msg/SendPacket", in, out, opts...) @@ -722,10 +520,6 @@ func (c *msgClient) Acknowledgement(ctx context.Context, in *MsgAcknowledgement, // MsgServer is the server API for Msg service. type MsgServer interface { - // CreateChannel defines a rpc handler method for MsgCreateChannel - CreateChannel(context.Context, *MsgCreateChannel) (*MsgCreateChannelResponse, error) - // RegisterCounterparty defines a rpc handler method for MsgRegisterCounterparty. - RegisterCounterparty(context.Context, *MsgRegisterCounterparty) (*MsgRegisterCounterpartyResponse, error) // SendPacket defines a rpc handler method for MsgSendPacket. SendPacket(context.Context, *MsgSendPacket) (*MsgSendPacketResponse, error) // RecvPacket defines a rpc handler method for MsgRecvPacket. @@ -740,12 +534,6 @@ type MsgServer interface { type UnimplementedMsgServer struct { } -func (*UnimplementedMsgServer) CreateChannel(ctx context.Context, req *MsgCreateChannel) (*MsgCreateChannelResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateChannel not implemented") -} -func (*UnimplementedMsgServer) RegisterCounterparty(ctx context.Context, req *MsgRegisterCounterparty) (*MsgRegisterCounterpartyResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RegisterCounterparty not implemented") -} func (*UnimplementedMsgServer) SendPacket(ctx context.Context, req *MsgSendPacket) (*MsgSendPacketResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SendPacket not implemented") } @@ -763,42 +551,6 @@ func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } -func _Msg_CreateChannel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgCreateChannel) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).CreateChannel(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ibc.core.channel.v2.Msg/CreateChannel", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).CreateChannel(ctx, req.(*MsgCreateChannel)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_RegisterCounterparty_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgRegisterCounterparty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).RegisterCounterparty(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ibc.core.channel.v2.Msg/RegisterCounterparty", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).RegisterCounterparty(ctx, req.(*MsgRegisterCounterparty)) - } - return interceptor(ctx, in, info, handler) -} - func _Msg_SendPacket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgSendPacket) if err := dec(in); err != nil { @@ -875,14 +627,6 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "ibc.core.channel.v2.Msg", HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{ - { - MethodName: "CreateChannel", - Handler: _Msg_CreateChannel_Handler, - }, - { - MethodName: "RegisterCounterparty", - Handler: _Msg_RegisterCounterparty_Handler, - }, { MethodName: "SendPacket", Handler: _Msg_SendPacket_Handler, @@ -904,7 +648,7 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Metadata: "ibc/core/channel/v2/tx.proto", } -func (m *MsgCreateChannel) Marshal() (dAtA []byte, err error) { +func (m *MsgSendPacket) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -914,12 +658,12 @@ func (m *MsgCreateChannel) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgCreateChannel) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgSendPacket) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgCreateChannel) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgSendPacket) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -929,29 +673,38 @@ func (m *MsgCreateChannel) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.Signer) i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x22 } - { - size, err := m.MerklePathPrefix.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if len(m.Payloads) > 0 { + for iNdEx := len(m.Payloads) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Payloads[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) } - i-- - dAtA[i] = 0x12 - if len(m.ClientId) > 0 { - i -= len(m.ClientId) - copy(dAtA[i:], m.ClientId) - i = encodeVarintTx(dAtA, i, uint64(len(m.ClientId))) + if m.TimeoutTimestamp != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.TimeoutTimestamp)) + i-- + dAtA[i] = 0x10 + } + if len(m.SourceClient) > 0 { + i -= len(m.SourceClient) + copy(dAtA[i:], m.SourceClient) + i = encodeVarintTx(dAtA, i, uint64(len(m.SourceClient))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *MsgCreateChannelResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgSendPacketResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -961,27 +714,25 @@ func (m *MsgCreateChannelResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgCreateChannelResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgSendPacketResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgCreateChannelResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgSendPacketResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.ChannelId) > 0 { - i -= len(m.ChannelId) - copy(dAtA[i:], m.ChannelId) - i = encodeVarintTx(dAtA, i, uint64(len(m.ChannelId))) + if m.Sequence != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Sequence)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } -func (m *MsgRegisterCounterparty) Marshal() (dAtA []byte, err error) { +func (m *MsgRecvPacket) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -991,12 +742,12 @@ func (m *MsgRegisterCounterparty) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgRegisterCounterparty) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgRecvPacket) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgRegisterCounterparty) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgRecvPacket) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1006,26 +757,39 @@ func (m *MsgRegisterCounterparty) MarshalToSizedBuffer(dAtA []byte) (int, error) copy(dAtA[i:], m.Signer) i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x22 + } + { + size, err := m.ProofHeight.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) } - if len(m.CounterpartyChannelId) > 0 { - i -= len(m.CounterpartyChannelId) - copy(dAtA[i:], m.CounterpartyChannelId) - i = encodeVarintTx(dAtA, i, uint64(len(m.CounterpartyChannelId))) + i-- + dAtA[i] = 0x1a + if len(m.ProofCommitment) > 0 { + i -= len(m.ProofCommitment) + copy(dAtA[i:], m.ProofCommitment) + i = encodeVarintTx(dAtA, i, uint64(len(m.ProofCommitment))) i-- dAtA[i] = 0x12 } - if len(m.ChannelId) > 0 { - i -= len(m.ChannelId) - copy(dAtA[i:], m.ChannelId) - i = encodeVarintTx(dAtA, i, uint64(len(m.ChannelId))) - i-- - dAtA[i] = 0xa + { + size, err := m.Packet.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *MsgRegisterCounterpartyResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgRecvPacketResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1035,20 +799,25 @@ func (m *MsgRegisterCounterpartyResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgRegisterCounterpartyResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgRecvPacketResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgRegisterCounterpartyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgRecvPacketResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l + if m.Result != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Result)) + i-- + dAtA[i] = 0x8 + } return len(dAtA) - i, nil } -func (m *MsgSendPacket) Marshal() (dAtA []byte, err error) { +func (m *MsgTimeout) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1058,12 +827,12 @@ func (m *MsgSendPacket) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgSendPacket) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgTimeout) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgSendPacket) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgTimeout) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1073,193 +842,24 @@ func (m *MsgSendPacket) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.Signer) i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x2a } - if len(m.Payloads) > 0 { - for iNdEx := len(m.Payloads) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Payloads[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a + { + size, err := m.ProofHeight.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) } - if m.TimeoutTimestamp != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.TimeoutTimestamp)) + i-- + dAtA[i] = 0x1a + if len(m.ProofUnreceived) > 0 { + i -= len(m.ProofUnreceived) + copy(dAtA[i:], m.ProofUnreceived) + i = encodeVarintTx(dAtA, i, uint64(len(m.ProofUnreceived))) i-- - dAtA[i] = 0x10 - } - if len(m.SourceChannel) > 0 { - i -= len(m.SourceChannel) - copy(dAtA[i:], m.SourceChannel) - i = encodeVarintTx(dAtA, i, uint64(len(m.SourceChannel))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgSendPacketResponse) 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 *MsgSendPacketResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgSendPacketResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Sequence != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.Sequence)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *MsgRecvPacket) 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 *MsgRecvPacket) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgRecvPacket) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Signer) > 0 { - i -= len(m.Signer) - copy(dAtA[i:], m.Signer) - i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) - i-- - dAtA[i] = 0x22 - } - { - size, err := m.ProofHeight.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.ProofCommitment) > 0 { - i -= len(m.ProofCommitment) - copy(dAtA[i:], m.ProofCommitment) - i = encodeVarintTx(dAtA, i, uint64(len(m.ProofCommitment))) - i-- - dAtA[i] = 0x12 - } - { - size, err := m.Packet.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgRecvPacketResponse) 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 *MsgRecvPacketResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgRecvPacketResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Result != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.Result)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *MsgTimeout) 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 *MsgTimeout) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgTimeout) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Signer) > 0 { - i -= len(m.Signer) - copy(dAtA[i:], m.Signer) - i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) - i-- - dAtA[i] = 0x2a - } - { - size, err := m.ProofHeight.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.ProofUnreceived) > 0 { - i -= len(m.ProofUnreceived) - copy(dAtA[i:], m.ProofUnreceived) - i = encodeVarintTx(dAtA, i, uint64(len(m.ProofUnreceived))) - i-- - dAtA[i] = 0x12 + dAtA[i] = 0x12 } { size, err := m.Packet.MarshalToSizedBuffer(dAtA[:i]) @@ -1408,75 +1008,13 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *MsgCreateChannel) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ClientId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = m.MerklePathPrefix.Size() - n += 1 + l + sovTx(uint64(l)) - l = len(m.Signer) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgCreateChannelResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChannelId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgRegisterCounterparty) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChannelId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.CounterpartyChannelId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Signer) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgRegisterCounterpartyResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - func (m *MsgSendPacket) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.SourceChannel) + l = len(m.SourceClient) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -1615,431 +1153,6 @@ func sovTx(x uint64) (n int) { func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *MsgCreateChannel) 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 ErrIntOverflowTx - } - 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: MsgCreateChannel: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateChannel: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - 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 ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClientId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MerklePathPrefix", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.MerklePathPrefix.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signer = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgCreateChannelResponse) 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 ErrIntOverflowTx - } - 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: MsgCreateChannelResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateChannelResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChannelId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgRegisterCounterparty) 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 ErrIntOverflowTx - } - 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: MsgRegisterCounterparty: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRegisterCounterparty: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChannelId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CounterpartyChannelId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CounterpartyChannelId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signer = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgRegisterCounterpartyResponse) 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 ErrIntOverflowTx - } - 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: MsgRegisterCounterpartyResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRegisterCounterpartyResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *MsgSendPacket) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2071,7 +1184,7 @@ func (m *MsgSendPacket) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SourceChannel", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field SourceClient", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2099,7 +1212,7 @@ func (m *MsgSendPacket) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.SourceChannel = string(dAtA[iNdEx:postIndex]) + m.SourceClient = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 0 { diff --git a/modules/core/ante/ante_test.go b/modules/core/ante/ante_test.go index 6e8472c6847..4a8f53f5a16 100644 --- a/modules/core/ante/ante_test.go +++ b/modules/core/ante/ante_test.go @@ -91,7 +91,7 @@ func (suite *AnteTestSuite) createRecvPacketMessageV2(isRedundant bool) *channel err = suite.path.EndpointB.UpdateClient() suite.Require().NoError(err) - packetKey := hostv2.PacketCommitmentKey(packet.SourceChannel, packet.Sequence) + packetKey := hostv2.PacketCommitmentKey(packet.SourceClient, packet.Sequence) proof, proofHeight := suite.chainA.QueryProof(packetKey) return channeltypesv2.NewMsgRecvPacket(packet, proof, proofHeight, suite.path.EndpointA.Chain.SenderAccount.GetAddress().String()) @@ -134,7 +134,7 @@ func (suite *AnteTestSuite) createAcknowledgementMessageV2(isRedundant bool) *ch suite.Require().NoError(err) } - packetKey := hostv2.PacketAcknowledgementKey(packet.DestinationChannel, packet.Sequence) + packetKey := hostv2.PacketAcknowledgementKey(packet.DestinationClient, packet.Sequence) proof, proofHeight := suite.chainA.QueryProof(packetKey) return channeltypesv2.NewMsgAcknowledgement(packet, ack, proof, proofHeight, suite.path.EndpointA.Chain.SenderAccount.GetAddress().String()) @@ -184,7 +184,7 @@ func (suite *AnteTestSuite) createTimeoutMessageV2(isRedundant bool) *channeltyp suite.Require().NoError(err) } - packetKey := hostv2.PacketReceiptKey(packet.SourceChannel, packet.Sequence) + packetKey := hostv2.PacketReceiptKey(packet.SourceClient, packet.Sequence) proof, proofHeight := suite.chainA.QueryProof(packetKey) return channeltypesv2.NewMsgTimeout(packet, proof, proofHeight, suite.path.EndpointA.Chain.SenderAccount.GetAddress().String()) diff --git a/modules/core/internal/v2/telemetry/packet.go b/modules/core/internal/v2/telemetry/packet.go index 8d12f785960..a126f085725 100644 --- a/modules/core/internal/v2/telemetry/packet.go +++ b/modules/core/internal/v2/telemetry/packet.go @@ -16,9 +16,9 @@ func ReportRecvPacket(packet types.Packet) { 1, []metrics.Label{ telemetry.NewLabel(ibcmetrics.LabelSourcePort, payload.SourcePort), - telemetry.NewLabel(ibcmetrics.LabelSourceChannel, packet.SourceChannel), + telemetry.NewLabel(ibcmetrics.LabelSourceChannel, packet.SourceClient), telemetry.NewLabel(ibcmetrics.LabelDestinationPort, payload.DestinationPort), - telemetry.NewLabel(ibcmetrics.LabelDestinationChannel, packet.DestinationChannel), + telemetry.NewLabel(ibcmetrics.LabelDestinationChannel, packet.DestinationClient), }, ) } @@ -31,9 +31,9 @@ func ReportTimeoutPacket(packet types.Packet) { 1, []metrics.Label{ telemetry.NewLabel(ibcmetrics.LabelSourcePort, payload.SourcePort), - telemetry.NewLabel(ibcmetrics.LabelSourceChannel, packet.SourceChannel), + telemetry.NewLabel(ibcmetrics.LabelSourceChannel, packet.SourceClient), telemetry.NewLabel(ibcmetrics.LabelDestinationPort, payload.DestinationPort), - telemetry.NewLabel(ibcmetrics.LabelDestinationChannel, packet.DestinationChannel), + telemetry.NewLabel(ibcmetrics.LabelDestinationChannel, packet.DestinationClient), telemetry.NewLabel(ibcmetrics.LabelTimeoutType, "height"), }, ) @@ -47,9 +47,9 @@ func ReportAcknowledgePacket(packet types.Packet) { 1, []metrics.Label{ telemetry.NewLabel(ibcmetrics.LabelSourcePort, payload.SourcePort), - telemetry.NewLabel(ibcmetrics.LabelSourceChannel, packet.SourceChannel), + telemetry.NewLabel(ibcmetrics.LabelSourceChannel, packet.SourceClient), telemetry.NewLabel(ibcmetrics.LabelDestinationPort, payload.DestinationPort), - telemetry.NewLabel(ibcmetrics.LabelDestinationChannel, packet.DestinationChannel), + telemetry.NewLabel(ibcmetrics.LabelDestinationChannel, packet.DestinationClient), }, ) } diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index e99b58d3b9c..5bb96f2dff4 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -18,9 +18,10 @@ import ( ) var ( - _ clienttypes.MsgServer = (*Keeper)(nil) - _ connectiontypes.MsgServer = (*Keeper)(nil) - _ channeltypes.MsgServer = (*Keeper)(nil) + _ clienttypes.MsgServer = (*Keeper)(nil) + _ clienttypes.CounterpartyMsgServer = (*Keeper)(nil) + _ connectiontypes.MsgServer = (*Keeper)(nil) + _ channeltypes.MsgServer = (*Keeper)(nil) ) // CreateClient defines a rpc handler method for MsgCreateClient. @@ -40,9 +41,33 @@ func (k *Keeper) CreateClient(ctx context.Context, msg *clienttypes.MsgCreateCli return nil, err } + // set the client creator so that eureka counterparty can be set by same relayer + k.ClientKeeper.SetClientCreator(ctx, clientID, sdk.AccAddress(msg.Signer)) + return &clienttypes.MsgCreateClientResponse{ClientId: clientID}, nil } +// RegisterCounterparty will register the eureka counterparty info for the given client id +// it must be called by the same relayer that called CreateClient +func (k *Keeper) RegisterCounterparty(ctx context.Context, msg *clienttypes.MsgRegisterCounterparty) (*clienttypes.MsgRegisterCounterpartyResponse, error) { + creator := k.ClientKeeper.GetClientCreator(ctx, msg.ClientId) + if !creator.Equals(sdk.AccAddress(msg.Signer)) { + return nil, errorsmod.Wrapf(ibcerrors.ErrUnauthorized, "expected same signer as createClient submittor %s, got %s", creator, msg.Signer) + } + + counterpartyInfo := clienttypes.CounterpartyInfo{ + MerklePrefix: msg.CounterpartyMerklePrefix, + ClientId: msg.CounterpartyClientId, + } + k.ClientKeeper.SetClientCounterparty(ctx, msg.ClientId, counterpartyInfo) + + // initialize next sequence send to enable packet flow + k.ChannelKeeperV2.SetNextSequenceSend(ctx, msg.ClientId, 1) + + k.ClientKeeper.DeleteClientCreator(ctx, msg.ClientId) + return &clienttypes.MsgRegisterCounterpartyResponse{}, nil +} + // UpdateClient defines a rpc handler method for MsgUpdateClient. func (k *Keeper) UpdateClient(ctx context.Context, msg *clienttypes.MsgUpdateClient) (*clienttypes.MsgUpdateClientResponse, error) { clientMsg, err := clienttypes.UnpackClientMessage(msg.ClientMessage) diff --git a/modules/core/keeper/msg_server_test.go b/modules/core/keeper/msg_server_test.go index 83f444f1c7d..fc76dff18a0 100644 --- a/modules/core/keeper/msg_server_test.go +++ b/modules/core/keeper/msg_server_test.go @@ -31,6 +31,64 @@ var ( maxSequence = uint64(10) ) +// TestRegisterCounterparty tests that counterpartyInfo is correctly stored +// and only if the submittor is the same submittor as prior createClient msg +func (suite *KeeperTestSuite) TestRegisterCounterparty() { + var path *ibctesting.Path + testCases := []struct { + name string + malleate func() + expError error + }{ + { + "success", + func() { + path.SetupClients() + }, + nil, + }, + { + "client not created first", + func() {}, + ibcerrors.ErrUnauthorized, + }, + { + "creator is different than expected", + func() { + path.SetupClients() + path.EndpointA.Chain.App.GetIBCKeeper().ClientKeeper.SetClientCreator(suite.chainA.GetContext(), path.EndpointA.ClientID, sdk.AccAddress(ibctesting.TestAccAddress)) + }, + ibcerrors.ErrUnauthorized, + }, + } + for _, tc := range testCases { + tc := tc + suite.Run(tc.name, func() { + suite.SetupTest() + path = ibctesting.NewPath(suite.chainA, suite.chainB) + + tc.malleate() + merklePrefix := [][]byte{[]byte("ibc"), []byte("channel-7")} + msg := clienttypes.NewMsgRegisterCounterparty(path.EndpointA.ClientID, merklePrefix, path.EndpointB.ClientID, suite.chainA.SenderAccount.GetAddress().String()) + _, err := suite.chainA.App.GetIBCKeeper().RegisterCounterparty(suite.chainA.GetContext(), msg) + if tc.expError != nil { + suite.Require().Error(err) + suite.Require().True(errors.Is(err, tc.expError)) + } else { + suite.Require().NoError(err) + counterpartyInfo, ok := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientCounterparty(suite.chainA.GetContext(), path.EndpointA.ClientID) + suite.Require().True(ok) + suite.Require().Equal(counterpartyInfo, clienttypes.NewCounterpartyInfo(merklePrefix, path.EndpointB.ClientID)) + nextSeqSend, ok := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.GetNextSequenceSend(suite.chainA.GetContext(), path.EndpointA.ClientID) + suite.Require().True(ok) + suite.Require().Equal(nextSeqSend, uint64(1)) + creator := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientCreator(suite.chainA.GetContext(), path.EndpointA.ClientID) + suite.Require().Empty(creator) + } + }) + } +} + // tests the IBC handler receiving a packet on ordered and unordered channels. // It verifies that the storing of an acknowledgement on success occurs. It // tests high level properties like ordering and basic sanity checks. More diff --git a/modules/core/module.go b/modules/core/module.go index e330c99043e..2855c1cf65f 100644 --- a/modules/core/module.go +++ b/modules/core/module.go @@ -126,6 +126,7 @@ func (AppModule) RegisterInterfaces(registry coreregistry.InterfaceRegistrar) { // RegisterServices registers module services. func (am AppModule) RegisterServices(cfg module.Configurator) { clienttypes.RegisterMsgServer(cfg.MsgServer(), am.keeper) + clienttypes.RegisterCounterpartyMsgServer(cfg.MsgServer(), am.keeper) connectiontypes.RegisterMsgServer(cfg.MsgServer(), am.keeper) channeltypes.RegisterMsgServer(cfg.MsgServer(), am.keeper) channeltypesv2.RegisterMsgServer(cfg.MsgServer(), am.keeper.ChannelKeeperV2) diff --git a/proto/ibc/core/channel/v2/channel.proto b/proto/ibc/core/channel/v2/channel.proto deleted file mode 100644 index f3ac209cdd9..00000000000 --- a/proto/ibc/core/channel/v2/channel.proto +++ /dev/null @@ -1,37 +0,0 @@ -syntax = "proto3"; - -package ibc.core.channel.v2; - -option go_package = "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types"; - -import "gogoproto/gogo.proto"; -import "ibc/core/commitment/v2/commitment.proto"; - -// Channel defines the channel end on a chain that is implementing the version 2 IBC protocol -// Each side will maintain its own Channel to create an IBC channel -// The channel will be referenced by a channelID which will be used to send packets -// to the counterparty -// The channel will contain the client identifier that will provide proof verification for the channel -// and the counterparty channel identifier that the other channel end will be using -// to send packets to our channel end. -message Channel { - // the client identifier of the light client representing the counterparty chain - string client_id = 1; - // the counterparty identifier that must be used by packets sent by counterparty - // to our channel end. - string counterparty_channel_id = 2; - // the key path used to store packet flow messages that the counterparty - // will use to send to us. In backwards compatible cases, we will append the channelID and sequence in order to create - // the final path. - ibc.core.commitment.v2.MerklePath merkle_path_prefix = 3 [(gogoproto.nullable) = false]; -} - -// IdentifiedChannel defines a channel with an additional channel identifier field. -message IdentifiedChannel { - option (gogoproto.goproto_getters) = false; - - // channel identified. - Channel channel = 1 [(gogoproto.nullable) = false]; - // channel identifier - string channel_id = 2; -} diff --git a/proto/ibc/core/channel/v2/genesis.proto b/proto/ibc/core/channel/v2/genesis.proto index a4c54a91977..cb32dca06ea 100644 --- a/proto/ibc/core/channel/v2/genesis.proto +++ b/proto/ibc/core/channel/v2/genesis.proto @@ -5,17 +5,13 @@ package ibc.core.channel.v2; option go_package = "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types"; import "gogoproto/gogo.proto"; -import "ibc/core/channel/v2/channel.proto"; // GenesisState defines the ibc channel/v2 submodule's genesis state. message GenesisState { - repeated IdentifiedChannel channels = 1 [(gogoproto.casttype) = "IdentifiedChannel", (gogoproto.nullable) = false]; - repeated PacketState acknowledgements = 2 [(gogoproto.nullable) = false]; - repeated PacketState commitments = 3 [(gogoproto.nullable) = false]; - repeated PacketState receipts = 4 [(gogoproto.nullable) = false]; - repeated PacketSequence send_sequences = 5 [(gogoproto.nullable) = false]; - // the sequence for the next generated channel identifier - uint64 next_channel_sequence = 6; + repeated PacketState acknowledgements = 2 [(gogoproto.nullable) = false]; + repeated PacketState commitments = 3 [(gogoproto.nullable) = false]; + repeated PacketState receipts = 4 [(gogoproto.nullable) = false]; + repeated PacketSequence send_sequences = 5 [(gogoproto.nullable) = false]; } // PacketState defines the generic type necessary to retrieve and store @@ -25,8 +21,8 @@ message GenesisState { message PacketState { option (gogoproto.goproto_getters) = false; - // channel unique identifier. - string channel_id = 1; + // client unique identifier. + string client_id = 1; // packet sequence. uint64 sequence = 2; // embedded data that represents packet state. @@ -35,8 +31,8 @@ message PacketState { // PacketSequence defines the genesis type necessary to retrieve and store next send sequences. message PacketSequence { - // channel unique identifier. - string channel_id = 1; + // client unique identifier. + string client_id = 1; // packet sequence uint64 sequence = 2; } diff --git a/proto/ibc/core/channel/v2/packet.proto b/proto/ibc/core/channel/v2/packet.proto index ea14112c643..8a311967237 100644 --- a/proto/ibc/core/channel/v2/packet.proto +++ b/proto/ibc/core/channel/v2/packet.proto @@ -13,10 +13,10 @@ message Packet { // with an earlier sequence number must be sent and received before a Packet // with a later sequence number. uint64 sequence = 1; - // identifies the sending chain. - string source_channel = 2; - // identifies the receiving chain. - string destination_channel = 3; + // identifies the sending client on the sending chain. + string source_client = 2; + // identifies the receiving client on the receiving chain. + string destination_client = 3; // timeout timestamp in seconds after which the packet times out. uint64 timeout_timestamp = 4; // a list of payloads, each one for a specific application. diff --git a/proto/ibc/core/channel/v2/query.proto b/proto/ibc/core/channel/v2/query.proto index 9d16a457a9e..3efb9fcfe7d 100644 --- a/proto/ibc/core/channel/v2/query.proto +++ b/proto/ibc/core/channel/v2/query.proto @@ -5,132 +5,60 @@ package ibc.core.channel.v2; option go_package = "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types"; import "cosmos/base/query/v1beta1/pagination.proto"; -import "ibc/core/channel/v2/channel.proto"; import "ibc/core/channel/v2/genesis.proto"; import "ibc/core/client/v1/client.proto"; import "google/api/annotations.proto"; -import "google/protobuf/any.proto"; import "gogoproto/gogo.proto"; // Query provides defines the gRPC querier service service Query { - // Channel queries the counterparty of an IBC client. - rpc Channel(QueryChannelRequest) returns (QueryChannelResponse) { - option (google.api.http).get = "/ibc/core/channel/v2/channels/{channel_id}"; - } - - // ChannelClientState queries for the client state for the channel associated - // with the provided channel identifiers. - rpc ChannelClientState(QueryChannelClientStateRequest) returns (QueryChannelClientStateResponse) { - option (google.api.http).get = "/ibc/core/channel/v2/channels/{channel_id}/client_state"; - } - - // ChannelConsensusState queries for the consensus state for the channel associated - // with the provided channel identifiers. - rpc ChannelConsensusState(QueryChannelConsensusStateRequest) returns (QueryChannelConsensusStateResponse) { - option (google.api.http).get = "/ibc/core/channel/v2/channels/{channel_id}/consensus_state"; - } - // NextSequenceSend returns the next send sequence for a given channel. rpc NextSequenceSend(QueryNextSequenceSendRequest) returns (QueryNextSequenceSendResponse) { - option (google.api.http).get = "/ibc/core/channel/v2/channels/{channel_id}/next_sequence_send"; + option (google.api.http).get = "/ibc/core/channel/v2/clients/{client_id}/next_sequence_send"; } // PacketCommitment queries a stored packet commitment hash. rpc PacketCommitment(QueryPacketCommitmentRequest) returns (QueryPacketCommitmentResponse) { - option (google.api.http).get = "/ibc/core/channel/v2/channels/{channel_id}/packet_commitments/{sequence}"; + option (google.api.http).get = "/ibc/core/channel/v2/clients/{client_id}/packet_commitments/{sequence}"; } // PacketCommitments queries a stored packet commitment hash. rpc PacketCommitments(QueryPacketCommitmentsRequest) returns (QueryPacketCommitmentsResponse) { - option (google.api.http).get = "/ibc/core/channel/v2/channels/{channel_id}/packet_commitments"; + option (google.api.http).get = "/ibc/core/channel/v2/clients/{client_id}/packet_commitments"; } // PacketAcknowledgement queries a stored acknowledgement commitment hash. rpc PacketAcknowledgement(QueryPacketAcknowledgementRequest) returns (QueryPacketAcknowledgementResponse) { - option (google.api.http).get = "/ibc/core/channel/v2/channels/{channel_id}/packet_acks/{sequence}"; + option (google.api.http).get = "/ibc/core/channel/v2/clients/{client_id}/packet_acks/{sequence}"; } // PacketAcknowledgements returns all packet acknowledgements associated with a channel. rpc PacketAcknowledgements(QueryPacketAcknowledgementsRequest) returns (QueryPacketAcknowledgementsResponse) { - option (google.api.http).get = "/ibc/core/channel/v2/channels/{channel_id}/packet_acknowledgements"; + option (google.api.http).get = "/ibc/core/channel/v2/clients/{client_id}/packet_acknowledgements"; } // PacketReceipt queries a stored packet receipt. rpc PacketReceipt(QueryPacketReceiptRequest) returns (QueryPacketReceiptResponse) { - option (google.api.http).get = "/ibc/core/channel/v2/channels/{channel_id}/packet_receipts/{sequence}"; + option (google.api.http).get = "/ibc/core/channel/v2/clients/{client_id}/packet_receipts/{sequence}"; } // UnreceivedPackets returns all the unreceived IBC packets associated with a channel and sequences. rpc UnreceivedPackets(QueryUnreceivedPacketsRequest) returns (QueryUnreceivedPacketsResponse) { - option (google.api.http).get = "/ibc/core/channel/v2/channels/{channel_id}/packet_commitments/" + option (google.api.http).get = "/ibc/core/channel/v2/clients/{client_id}/packet_commitments/" "{sequences}/unreceived_packets"; } // UnreceivedAcks returns all the unreceived IBC acknowledgements associated with a channel and sequences. rpc UnreceivedAcks(QueryUnreceivedAcksRequest) returns (QueryUnreceivedAcksResponse) { option (google.api.http).get = - "/ibc/core/channel/v2/channels/{channel_id}/packet_commitments/{packet_ack_sequences}/unreceived_acks"; + "/ibc/core/channel/v2/clients/{client_id}/packet_commitments/{packet_ack_sequences}/unreceived_acks"; } } -// QueryChannelRequest is the request type for the Query/Channel RPC method -message QueryChannelRequest { - string channel_id = 1; -} - -// QueryChannelRequest is the response type for the Query/Channel RPC method -message QueryChannelResponse { - // the channel associated with the provided channel id - Channel channel = 1 [(gogoproto.nullable) = false]; -} - -// QueryChannelClientStateRequest is the request type for the Query/ClientState -// RPC method -message QueryChannelClientStateRequest { - // channel unique identifier - string channel_id = 1; -} - -// QueryChannelClientStateResponse is the Response type for the -// Query/QueryChannelClientState RPC method -message QueryChannelClientStateResponse { - // client state associated with the channel - ibc.core.client.v1.IdentifiedClientState identified_client_state = 1; - // merkle proof of existence - bytes proof = 2; - // height at which the proof was retrieved - ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false]; -} - -// QueryChannelConsensusStateRequest is the request type for the Query/ConsensusState -// RPC method -message QueryChannelConsensusStateRequest { - // channel unique identifier - string channel_id = 1; - // revision number of the consensus state - uint64 revision_number = 2; - // revision height of the consensus state - uint64 revision_height = 3; -} - -// QueryChannelConsensusStateResponse is the Response type for the -// Query/QueryChannelConsensusState RPC method -message QueryChannelConsensusStateResponse { - // consensus state associated with the channel - google.protobuf.Any consensus_state = 1; - // client ID associated with the consensus state - string client_id = 2; - // merkle proof of existence - bytes proof = 3; - // height at which the proof was retrieved - ibc.core.client.v1.Height proof_height = 4 [(gogoproto.nullable) = false]; -} - // QueryNextSequenceSendRequest is the request type for the Query/QueryNextSequenceSend RPC method message QueryNextSequenceSendRequest { - // channel unique identifier - string channel_id = 1; + // client unique identifier + string client_id = 1; } // QueryNextSequenceSendResponse is the response type for the Query/QueryNextSequenceSend RPC method @@ -145,8 +73,8 @@ message QueryNextSequenceSendResponse { // QueryPacketCommitmentRequest is the request type for the Query/PacketCommitment RPC method. message QueryPacketCommitmentRequest { - // channel unique identifier - string channel_id = 1; + // client unique identifier + string client_id = 1; // packet sequence uint64 sequence = 2; } @@ -163,8 +91,8 @@ message QueryPacketCommitmentResponse { // QueryPacketCommitmentsRequest is the request type for the Query/PacketCommitments RPC method. message QueryPacketCommitmentsRequest { - // channel unique identifier - string channel_id = 1; + // client unique identifier + string client_id = 1; // pagination request cosmos.base.query.v1beta1.PageRequest pagination = 2; } @@ -181,8 +109,8 @@ message QueryPacketCommitmentsResponse { // QueryPacketAcknowledgementRequest is the request type for the Query/PacketAcknowledgement RPC method. message QueryPacketAcknowledgementRequest { - // channel unique identifier - string channel_id = 1; + // client unique identifier + string client_id = 1; // packet sequence uint64 sequence = 2; } @@ -200,8 +128,8 @@ message QueryPacketAcknowledgementResponse { // QueryPacketAcknowledgementsRequest is the request type for the // Query/QueryPacketCommitments RPC method message QueryPacketAcknowledgementsRequest { - // channel unique identifier - string channel_id = 1; + // client unique identifier + string client_id = 1; // pagination request cosmos.base.query.v1beta1.PageRequest pagination = 2; // list of packet sequences @@ -220,12 +148,10 @@ message QueryPacketAcknowledgementsResponse { // QueryPacketReceiptRequest is the request type for the Query/PacketReceipt RPC method. message QueryPacketReceiptRequest { - // port unique identifier - string port_id = 1; - // channel unique identifier - string channel_id = 2; + // client unique identifier + string client_id = 1; // packet sequence - uint64 sequence = 3; + uint64 sequence = 2; } // QueryPacketReceiptResponse is the response type for the Query/PacketReceipt RPC method. @@ -240,8 +166,8 @@ message QueryPacketReceiptResponse { // QueryUnreceivedPacketsRequest is the request type for the Query/UnreceivedPackets RPC method message QueryUnreceivedPacketsRequest { - // channel unique identifier - string channel_id = 1; + // client unique identifier + string client_id = 1; // list of packet sequences repeated uint64 sequences = 2; } @@ -253,11 +179,12 @@ message QueryUnreceivedPacketsResponse { // query block height ibc.core.client.v1.Height height = 2 [(gogoproto.nullable) = false]; } + // QueryUnreceivedAcks is the request type for the // Query/UnreceivedAcks RPC method message QueryUnreceivedAcksRequest { - // channel unique identifier - string channel_id = 1; + // client unique identifier + string client_id = 1; // list of acknowledgement sequences repeated uint64 packet_ack_sequences = 2; } diff --git a/proto/ibc/core/channel/v2/tx.proto b/proto/ibc/core/channel/v2/tx.proto index 27eaa08c805..6c3c224c2ea 100644 --- a/proto/ibc/core/channel/v2/tx.proto +++ b/proto/ibc/core/channel/v2/tx.proto @@ -8,18 +8,11 @@ import "gogoproto/gogo.proto"; import "cosmos/msg/v1/msg.proto"; import "ibc/core/channel/v2/packet.proto"; import "ibc/core/client/v1/client.proto"; -import "ibc/core/commitment/v2/commitment.proto"; // Msg defines the ibc/channel/v2 Msg service. service Msg { option (cosmos.msg.v1.service) = true; - // CreateChannel defines a rpc handler method for MsgCreateChannel - rpc CreateChannel(MsgCreateChannel) returns (MsgCreateChannelResponse); - - // RegisterCounterparty defines a rpc handler method for MsgRegisterCounterparty. - rpc RegisterCounterparty(MsgRegisterCounterparty) returns (MsgRegisterCounterpartyResponse); - // SendPacket defines a rpc handler method for MsgSendPacket. rpc SendPacket(MsgSendPacket) returns (MsgSendPacketResponse); @@ -33,52 +26,12 @@ service Msg { rpc Acknowledgement(MsgAcknowledgement) returns (MsgAcknowledgementResponse); } -// MsgCreateChannel defines the message used to create a v2 Channel. -message MsgCreateChannel { - option (cosmos.msg.v1.signer) = "signer"; - - option (gogoproto.goproto_getters) = false; - - // the client identifier of the light client representing the counterparty chain - string client_id = 1; - // the key path used to store packet flow messages that the counterparty - // will use to send to us. - ibc.core.commitment.v2.MerklePath merkle_path_prefix = 2 [(gogoproto.nullable) = false]; - // signer address - string signer = 3; -} - -// MsgCreateChannelResponse defines the Msg/CreateChannel response type. -message MsgCreateChannelResponse { - option (gogoproto.goproto_getters) = false; - - string channel_id = 1; -} - -// MsgRegisterCounterparty defines the message used to provide the counterparty channel -// identifier. -message MsgRegisterCounterparty { - option (cosmos.msg.v1.signer) = "signer"; - - option (gogoproto.goproto_getters) = false; - - // unique identifier we will use to write all packet messages sent to counterparty - string channel_id = 1; - // counterparty channel identifier - string counterparty_channel_id = 2; - // signer address - string signer = 3; -} - -// MsgRegisterCounterpartyResponse defines the Msg/RegisterCounterparty response type. -message MsgRegisterCounterpartyResponse {} - // MsgSendPacket sends an outgoing IBC packet. message MsgSendPacket { option (cosmos.msg.v1.signer) = "signer"; option (gogoproto.goproto_getters) = false; - string source_channel = 1; + string source_client = 1; uint64 timeout_timestamp = 2; repeated Payload payloads = 3 [(gogoproto.nullable) = false]; string signer = 4; diff --git a/proto/ibc/core/client/v2/counterparty.proto b/proto/ibc/core/client/v2/counterparty.proto new file mode 100644 index 00000000000..4ed4f6e03ed --- /dev/null +++ b/proto/ibc/core/client/v2/counterparty.proto @@ -0,0 +1,43 @@ +syntax = "proto3"; + +package ibc.core.client.v2; + +option go_package = "github.com/cosmos/ibc-go/v9/modules/core/02-client/types"; + +import "cosmos/msg/v1/msg.proto"; +import "gogoproto/gogo.proto"; + +// CounterpartyInfo defines the key that the counterparty will use to message our client +message CounterpartyInfo { + // merkle prefix key is the prefix that ics provable keys are stored under + repeated bytes merkle_prefix = 1; + // client identifier is the identifier used to send packet messages to our client + string client_id = 2; +} + +// CounterpartyMsg defines the ibc/client CounterpartyMsg service. +service CounterpartyMsg { + option (cosmos.msg.v1.service) = true; + + // RegisterCounterparty defines a rpc handler method for MsgRegisterCounterparty. + rpc RegisterCounterparty(MsgRegisterCounterparty) returns (MsgRegisterCounterpartyResponse); +} + +// MsgRegisterCounterparty defines a message to register a counterparty on a client +message MsgRegisterCounterparty { + option (cosmos.msg.v1.signer) = "signer"; + + option (gogoproto.goproto_getters) = false; + + // client identifier + string client_id = 1; + // counterparty merkle prefix + repeated bytes counterparty_merkle_prefix = 2; + // counterparty client identifier + string counterparty_client_id = 3; + // signer address + string signer = 4; +} + +// MsgRegisterCounterpartyResponse defines the Msg/RegisterCounterparty response type. +message MsgRegisterCounterpartyResponse {} \ No newline at end of file diff --git a/testing/endpoint_v2.go b/testing/endpoint_v2.go index be1fd011aa8..cbde15f925c 100644 --- a/testing/endpoint_v2.go +++ b/testing/endpoint_v2.go @@ -5,32 +5,14 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" + clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" channeltypesv2 "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types" hostv2 "github.com/cosmos/ibc-go/v9/modules/core/24-host/v2" ) -// CreateChannel will construct and execute a new MsgCreateChannel on the associated endpoint. -func (endpoint *Endpoint) CreateChannel() (err error) { - endpoint.IncrementNextChannelSequence() - msg := channeltypesv2.NewMsgCreateChannel(endpoint.ClientID, endpoint.MerklePathPrefix, endpoint.Chain.SenderAccount.GetAddress().String()) - - // create channel - res, err := endpoint.Chain.SendMsgs(msg) - if err != nil { - return err - } - - endpoint.ChannelID, err = ParseChannelIDFromEvents(res.Events) - if err != nil { - return err - } - - return nil -} - // RegisterCounterparty will construct and execute a MsgRegisterCounterparty on the associated endpoint. func (endpoint *Endpoint) RegisterCounterparty() (err error) { - msg := channeltypesv2.NewMsgRegisterCounterparty(endpoint.ChannelID, endpoint.Counterparty.ChannelID, endpoint.Chain.SenderAccount.GetAddress().String()) + msg := clienttypes.NewMsgRegisterCounterparty(endpoint.ClientID, endpoint.Counterparty.MerklePathPrefix.KeyPath, endpoint.Counterparty.ClientID, endpoint.Chain.SenderAccount.GetAddress().String()) // setup counterparty _, err = endpoint.Chain.SendMsgs(msg) @@ -50,7 +32,7 @@ func (endpoint *Endpoint) MsgSendPacket(timeoutTimestamp uint64, payload channel // MsgSendPacketWithSender sends a packet on the associated endpoint using the provided sender. The constructed packet is returned. func (endpoint *Endpoint) MsgSendPacketWithSender(timeoutTimestamp uint64, payload channeltypesv2.Payload, sender SenderAccount) (channeltypesv2.Packet, error) { - msgSendPacket := channeltypesv2.NewMsgSendPacket(endpoint.ChannelID, timeoutTimestamp, sender.SenderAccount.GetAddress().String(), payload) + msgSendPacket := channeltypesv2.NewMsgSendPacket(endpoint.ClientID, timeoutTimestamp, sender.SenderAccount.GetAddress().String(), payload) res, err := endpoint.Chain.SendMsgsWithSender(sender, msgSendPacket) if err != nil { @@ -74,7 +56,7 @@ func (endpoint *Endpoint) MsgSendPacketWithSender(timeoutTimestamp uint64, paylo if err != nil { return channeltypesv2.Packet{}, err } - packet := channeltypesv2.NewPacket(sendResponse.Sequence, endpoint.ChannelID, endpoint.Counterparty.ChannelID, timeoutTimestamp, payload) + packet := channeltypesv2.NewPacket(sendResponse.Sequence, endpoint.ClientID, endpoint.Counterparty.ClientID, timeoutTimestamp, payload) return packet, nil } @@ -82,7 +64,7 @@ func (endpoint *Endpoint) MsgSendPacketWithSender(timeoutTimestamp uint64, paylo // MsgRecvPacket sends a MsgRecvPacket on the associated endpoint with the provided packet. func (endpoint *Endpoint) MsgRecvPacket(packet channeltypesv2.Packet) error { // get proof of packet commitment from chainA - packetKey := hostv2.PacketCommitmentKey(packet.SourceChannel, packet.Sequence) + packetKey := hostv2.PacketCommitmentKey(packet.SourceClient, packet.Sequence) proof, proofHeight := endpoint.Counterparty.QueryProof(packetKey) msg := channeltypesv2.NewMsgRecvPacket(packet, proof, proofHeight, endpoint.Chain.SenderAccount.GetAddress().String()) @@ -96,7 +78,7 @@ func (endpoint *Endpoint) MsgRecvPacket(packet channeltypesv2.Packet) error { // MsgAcknowledgePacket sends a MsgAcknowledgement on the associated endpoint with the provided packet and ack. func (endpoint *Endpoint) MsgAcknowledgePacket(packet channeltypesv2.Packet, ack channeltypesv2.Acknowledgement) error { - packetKey := hostv2.PacketAcknowledgementKey(packet.DestinationChannel, packet.Sequence) + packetKey := hostv2.PacketAcknowledgementKey(packet.DestinationClient, packet.Sequence) proof, proofHeight := endpoint.Counterparty.QueryProof(packetKey) msg := channeltypesv2.NewMsgAcknowledgement(packet, ack, proof, proofHeight, endpoint.Chain.SenderAccount.GetAddress().String()) @@ -110,7 +92,7 @@ func (endpoint *Endpoint) MsgAcknowledgePacket(packet channeltypesv2.Packet, ack // MsgTimeoutPacket sends a MsgTimeout on the associated endpoint with the provided packet. func (endpoint *Endpoint) MsgTimeoutPacket(packet channeltypesv2.Packet) error { - packetKey := hostv2.PacketReceiptKey(packet.DestinationChannel, packet.Sequence) + packetKey := hostv2.PacketReceiptKey(packet.DestinationClient, packet.Sequence) proof, proofHeight := endpoint.Counterparty.QueryProof(packetKey) msg := channeltypesv2.NewMsgTimeout(packet, proof, proofHeight, endpoint.Chain.SenderAccount.GetAddress().String()) diff --git a/testing/path.go b/testing/path.go index 862b03d3691..a63cb3da563 100644 --- a/testing/path.go +++ b/testing/path.go @@ -160,8 +160,6 @@ func (path *Path) Setup() { func (path *Path) SetupV2() { path.SetupClients() - path.CreateChannelsV2() - path.SetupCounterparties() } @@ -262,19 +260,6 @@ func (path *Path) CreateChannels() { } } -// CreateChannelsV2 initializes two channel endpoints by executing CreateChannel on both chainA and chainB. -func (path *Path) CreateChannelsV2() { - err := path.EndpointA.CreateChannel() - if err != nil { - panic(err) - } - - err = path.EndpointB.CreateChannel() - if err != nil { - panic(err) - } -} - // EnableFeeOnPath enables fee on a channel given a path. func EnableFeeOnPath(path *Path) *Path { path.EndpointA.ChannelConfig.Version = ibcmock.MockFeeVersion