From e1167c9684eb2f0f74ef225a8a9e26b87f51760a Mon Sep 17 00:00:00 2001 From: Aditya Sripal <14364734+AdityaSripal@users.noreply.github.com> Date: Mon, 13 Jan 2025 16:44:33 +0100 Subject: [PATCH 01/18] add back client registerCounterparty --- modules/core/02-client/keeper/keeper.go | 39 + modules/core/02-client/keeper/keeper_test.go | 19 + modules/core/02-client/types/counterparty.go | 7 + .../core/02-client/types/counterparty.pb.go | 806 ++++++++++++++++++ modules/core/02-client/types/errors.go | 1 + modules/core/02-client/types/keys.go | 12 + modules/core/02-client/types/msgs.go | 23 + modules/core/02-client/types/msgs_test.go | 57 ++ modules/core/04-channel/v2/types/query.pb.go | 8 +- modules/core/keeper/msg_server.go | 20 + modules/core/keeper/msg_server_test.go | 56 ++ proto/ibc/core/client/v2/counterparty.proto | 42 + 12 files changed, 1086 insertions(+), 4 deletions(-) create mode 100644 modules/core/02-client/types/counterparty.go create mode 100644 modules/core/02-client/types/counterparty.pb.go create mode 100644 proto/ibc/core/client/v2/counterparty.proto diff --git a/modules/core/02-client/keeper/keeper.go b/modules/core/02-client/keeper/keeper.go index 4275ae4048b..f3a7102a0e6 100644 --- a/modules/core/02-client/keeper/keeper.go +++ b/modules/core/02-client/keeper/keeper.go @@ -115,6 +115,45 @@ 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()) +} + +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)) +} + +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..83c7594126e 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")}) + 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/counterparty.go b/modules/core/02-client/types/counterparty.go new file mode 100644 index 00000000000..3abed9259d7 --- /dev/null +++ b/modules/core/02-client/types/counterparty.go @@ -0,0 +1,7 @@ +package types + +func NewCounterpartyInfo(counterpartyMessagingKey [][]byte) CounterpartyInfo { + return CounterpartyInfo{ + CounterpartyMessagingKey: counterpartyMessagingKey, + } +} 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..9f7cdb2fdd9 --- /dev/null +++ b/modules/core/02-client/types/counterparty.pb.go @@ -0,0 +1,806 @@ +// 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 { + // counterparty messaging key prefix is the key that the counterparty will store + // all outgoing IBC packet messages intended for our chain. + // the provable messages will be stored with the following key prefix and the + // ICS24 standardized path for the given message type + CounterpartyMessagingKey [][]byte `protobuf:"bytes,1,rep,name=counterparty_messaging_key,json=counterpartyMessagingKey,proto3" json:"counterparty_messaging_key,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) GetCounterpartyMessagingKey() [][]byte { + if m != nil { + return m.CounterpartyMessagingKey + } + return nil +} + +// 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 messaging key + CounterpartyMessagingKey [][]byte `protobuf:"bytes,2,rep,name=counterparty_messaging_key,json=counterpartyMessagingKey,proto3" json:"counterparty_messaging_key,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_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{ + // 360 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, + 0xe0, 0x12, 0x70, 0x46, 0x32, 0xd8, 0x33, 0x2f, 0x2d, 0x5f, 0xc8, 0x86, 0x4b, 0x0a, 0xd9, 0xb2, + 0xf8, 0xdc, 0xd4, 0xe2, 0xe2, 0xc4, 0xf4, 0xcc, 0xbc, 0xf4, 0xf8, 0xec, 0xd4, 0x4a, 0x09, 0x46, + 0x05, 0x66, 0x0d, 0x9e, 0x20, 0x09, 0x64, 0x15, 0xbe, 0x30, 0x05, 0xde, 0xa9, 0x95, 0x4a, 0x73, + 0x19, 0xb9, 0xc4, 0x7d, 0x8b, 0xd3, 0x83, 0x52, 0xd3, 0x33, 0x8b, 0x4b, 0x52, 0x8b, 0x90, 0x4d, + 0x17, 0x92, 0xe6, 0xe2, 0x84, 0xb8, 0x34, 0x3e, 0x33, 0x45, 0x82, 0x51, 0x81, 0x51, 0x83, 0x33, + 0x88, 0x03, 0x22, 0xe0, 0x99, 0x42, 0xc0, 0x5a, 0x26, 0xfc, 0xd6, 0x0a, 0x89, 0x71, 0xb1, 0x15, + 0x67, 0xa6, 0xe7, 0xa5, 0x16, 0x49, 0x30, 0x83, 0xcd, 0x85, 0xf2, 0xac, 0xf8, 0x3b, 0x16, 0xc8, + 0x33, 0x34, 0x3d, 0xdf, 0xa0, 0x05, 0x15, 0x50, 0x52, 0xe4, 0x92, 0xc7, 0xe1, 0xbc, 0xa0, 0xd4, + 0xe2, 0x82, 0xfc, 0xbc, 0xe2, 0x54, 0xa3, 0x49, 0x8c, 0x5c, 0xfc, 0xc8, 0x12, 0xbe, 0xc5, 0xe9, + 0x42, 0x15, 0x5c, 0x22, 0x58, 0xbd, 0xa4, 0xad, 0x87, 0x19, 0x09, 0x7a, 0x38, 0x2c, 0x90, 0x32, + 0x26, 0x41, 0x31, 0xcc, 0x35, 0x52, 0xac, 0x0d, 0xcf, 0x37, 0x68, 0x31, 0x3a, 0x05, 0x9d, 0x78, + 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, + 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x45, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, + 0x5e, 0x72, 0x7e, 0xae, 0x3e, 0x34, 0xf6, 0x33, 0x93, 0x92, 0x75, 0xd3, 0xf3, 0xf5, 0xcb, 0x2c, + 0xf5, 0x73, 0xf3, 0x53, 0x4a, 0x73, 0x52, 0x8b, 0x21, 0xa9, 0xc9, 0xc0, 0x48, 0x17, 0x9a, 0xa0, + 0x4a, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x89, 0xc0, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, + 0x63, 0x9f, 0xd3, 0xcf, 0x70, 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.CounterpartyMessagingKey) > 0 { + for iNdEx := len(m.CounterpartyMessagingKey) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.CounterpartyMessagingKey[iNdEx]) + copy(dAtA[i:], m.CounterpartyMessagingKey[iNdEx]) + i = encodeVarintCounterparty(dAtA, i, uint64(len(m.CounterpartyMessagingKey[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] = 0x1a + } + if len(m.CounterpartyMessagingKey) > 0 { + for iNdEx := len(m.CounterpartyMessagingKey) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.CounterpartyMessagingKey[iNdEx]) + copy(dAtA[i:], m.CounterpartyMessagingKey[iNdEx]) + i = encodeVarintCounterparty(dAtA, i, uint64(len(m.CounterpartyMessagingKey[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.CounterpartyMessagingKey) > 0 { + for _, b := range m.CounterpartyMessagingKey { + l = len(b) + 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.CounterpartyMessagingKey) > 0 { + for _, b := range m.CounterpartyMessagingKey { + l = len(b) + 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 CounterpartyMessagingKey", 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.CounterpartyMessagingKey = append(m.CounterpartyMessagingKey, make([]byte, postIndex-iNdEx)) + copy(m.CounterpartyMessagingKey[len(m.CounterpartyMessagingKey)-1], 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 CounterpartyMessagingKey", 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.CounterpartyMessagingKey = append(m.CounterpartyMessagingKey, make([]byte, postIndex-iNdEx)) + copy(m.CounterpartyMessagingKey[len(m.CounterpartyMessagingKey)-1], 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 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..116e322ac6d 100644 --- a/modules/core/02-client/types/errors.go +++ b/modules/core/02-client/types/errors.go @@ -38,4 +38,5 @@ 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") ) diff --git a/modules/core/02-client/types/keys.go b/modules/core/02-client/types/keys.go index 76ce77f08c7..f286b28523d 100644 --- a/modules/core/02-client/types/keys.go +++ b/modules/core/02-client/types/keys.go @@ -29,6 +29,10 @@ const ( // ParamsKey is the store key for the IBC client parameters ParamsKey = "clientParams" + KeyCreator = "creator" + + 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 +95,11 @@ func MustParseClientIdentifier(clientID string) string { return clientType } + +func CreatorKey() []byte { + return []byte(KeyCreator) +} + +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..119bca08e11 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,23 @@ func (msg *MsgUpdateParams) ValidateBasic() error { } return msg.Params.Validate() } + +// NewMsgRegisterCounterparty creates a new instance of MsgRegisterCounterparty. +func NewMsgRegisterCounterparty(clientId string, counterpartyMsgKey [][]byte, signer string) *MsgRegisterCounterparty { + return &MsgRegisterCounterparty{ + ClientId: clientId, + CounterpartyMessagingKey: counterpartyMsgKey, + 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.CounterpartyMessagingKey) == 0 { + return errorsmod.Wrap(ErrInvalidCounterparty, "counterparty messaging key cannot be empty") + } + return host.ClientIdentifierValidator(msg.ClientId) +} diff --git a/modules/core/02-client/types/msgs_test.go b/modules/core/02-client/types/msgs_test.go index 112b7beb211..1e8d71a5cf3 100644 --- a/modules/core/02-client/types/msgs_test.go +++ b/modules/core/02-client/types/msgs_test.go @@ -981,3 +981,60 @@ 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")}, + signer, + ), + nil, + }, + { + "failure: empty client id", + types.NewMsgRegisterCounterparty( + "", + [][]byte{[]byte("ibc"), []byte("channel-9")}, + signer, + ), + host.ErrInvalidID, + }, + { + "failure: empty counterparty messaging key", + types.NewMsgRegisterCounterparty( + "testclientid", + [][]byte{}, + signer, + ), + types.ErrInvalidCounterparty, + }, + { + "failure: empty signer", + types.NewMsgRegisterCounterparty( + "testclientid", + [][]byte{[]byte("ibc"), []byte("channel-9")}, + "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/types/query.pb.go b/modules/core/04-channel/v2/types/query.pb.go index 90f01927af7..c6db77defa7 100644 --- a/modules/core/04-channel/v2/types/query.pb.go +++ b/modules/core/04-channel/v2/types/query.pb.go @@ -6,11 +6,11 @@ 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" proto "github.com/cosmos/gogoproto/proto" + any "github.com/cosmos/gogoproto/types/any" types "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" @@ -304,7 +304,7 @@ func (m *QueryChannelConsensusStateRequest) GetRevisionHeight() uint64 { // 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"` + ConsensusState *any.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 @@ -346,7 +346,7 @@ func (m *QueryChannelConsensusStateResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryChannelConsensusStateResponse proto.InternalMessageInfo -func (m *QueryChannelConsensusStateResponse) GetConsensusState() *types1.Any { +func (m *QueryChannelConsensusStateResponse) GetConsensusState() *any.Any { if m != nil { return m.ConsensusState } @@ -3886,7 +3886,7 @@ func (m *QueryChannelConsensusStateResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ConsensusState == nil { - m.ConsensusState = &types1.Any{} + m.ConsensusState = &any.Any{} } if err := m.ConsensusState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index e99b58d3b9c..9410634ef52 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -40,9 +40,29 @@ 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{ + CounterpartyMessagingKey: msg.CounterpartyMessagingKey, + } + k.ClientKeeper.SetClientCounterparty(ctx, msg.ClientId, counterpartyInfo) + + 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..a36afc1f54d 100644 --- a/modules/core/keeper/msg_server_test.go +++ b/modules/core/keeper/msg_server_test.go @@ -31,6 +31,62 @@ 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() + counterpartyKey := [][]byte{[]byte("ibc"), []byte("channel-7")} + msg := clienttypes.NewMsgRegisterCounterparty(path.EndpointA.ClientID, counterpartyKey, 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.CounterpartyInfo{counterpartyKey}) + 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/proto/ibc/core/client/v2/counterparty.proto b/proto/ibc/core/client/v2/counterparty.proto new file mode 100644 index 00000000000..fd5424e3fcb --- /dev/null +++ b/proto/ibc/core/client/v2/counterparty.proto @@ -0,0 +1,42 @@ +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 { + // counterparty messaging key prefix is the key that the counterparty will store + // all outgoing IBC packet messages intended for our chain. + // the provable messages will be stored with the following key prefix and the + // ICS24 standardized path for the given message type + repeated bytes counterparty_messaging_key = 1; +} + +// 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 messaging key + repeated bytes counterparty_messaging_key = 2; + // signer address + string signer = 3; +} + +// MsgRegisterCounterpartyResponse defines the Msg/RegisterCounterparty response type. +message MsgRegisterCounterpartyResponse {} \ No newline at end of file From 09eacf4e0898af44d5d89f84fcd38b1018c47daf Mon Sep 17 00:00:00 2001 From: Aditya Sripal <14364734+AdityaSripal@users.noreply.github.com> Date: Tue, 14 Jan 2025 14:05:12 +0100 Subject: [PATCH 02/18] change channel to id in packet --- modules/core/04-channel/v2/keeper/events.go | 20 +-- .../core/04-channel/v2/keeper/msg_server.go | 32 ++--- .../04-channel/v2/keeper/msg_server_test.go | 26 ++-- modules/core/04-channel/v2/keeper/packet.go | 70 +++++------ .../core/04-channel/v2/keeper/packet_test.go | 64 +++++----- .../core/04-channel/v2/types/commitment.go | 4 +- .../04-channel/v2/types/commitment_test.go | 8 +- modules/core/04-channel/v2/types/packet.go | 20 +-- modules/core/04-channel/v2/types/packet.pb.go | 116 +++++++++--------- .../core/04-channel/v2/types/packet_test.go | 8 +- modules/core/ante/ante_test.go | 6 +- modules/core/internal/v2/telemetry/packet.go | 12 +- proto/ibc/core/channel/v2/packet.proto | 4 +- testing/endpoint_v2.go | 6 +- 14 files changed, 198 insertions(+), 198 deletions(-) diff --git a/modules/core/04-channel/v2/keeper/events.go b/modules/core/04-channel/v2/keeper/events.go index eb1a71b5481..52177e643ca 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.SourceId), + sdk.NewAttribute(types.AttributeKeyDstChannel, packet.DestinationId), 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.SourceId), + sdk.NewAttribute(types.AttributeKeyDstChannel, packet.DestinationId), 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.SourceId), + sdk.NewAttribute(types.AttributeKeyDstChannel, packet.DestinationId), 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.SourceId), + sdk.NewAttribute(types.AttributeKeyDstChannel, packet.DestinationId), 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.SourceId), + sdk.NewAttribute(types.AttributeKeyDstChannel, packet.DestinationId), 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)), diff --git a/modules/core/04-channel/v2/keeper/msg_server.go b/modules/core/04-channel/v2/keeper/msg_server.go index 179e44fd93f..d4d19e5c1eb 100644 --- a/modules/core/04-channel/v2/keeper/msg_server.go +++ b/modules/core/04-channel/v2/keeper/msg_server.go @@ -122,10 +122,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-channel", msg.Packet.SourceId) 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-channel", msg.Packet.SourceId, "error", errorsmod.Wrap(err, "receive packet verification failed")) return nil, errorsmod.Wrap(err, "receive packet verification failed") } @@ -139,7 +139,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.SourceId, msg.Packet.DestinationId, msg.Packet.Sequence, pd, signer) if res.Status != types.PacketStatus_Failure { // write application state changes for asynchronous and successful acknowledgements @@ -169,8 +169,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-channel", msg.Packet.SourceId, "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.SourceId) } if !isAsync { @@ -189,7 +189,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-channel", msg.Packet.SourceId, "dest-channel", msg.Packet.DestinationId, "result", types.SUCCESS.String()) return &types.MsgRecvPacketResponse{Result: types.SUCCESS}, nil } @@ -209,19 +209,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-channel", msg.Packet.SourceId) 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-channel", msg.Packet.SourceId, "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.SourceId, msg.Packet.DestinationId, 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 channel %s, destination channel %s", pd.SourcePort, msg.Packet.SourceId, msg.Packet.DestinationId) } } @@ -242,26 +242,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-channel", timeout.Packet.SourceId, "destination-channel", timeout.Packet.DestinationId, "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.SourceId, timeout.Packet.DestinationId) } 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-channel", timeout.Packet.SourceId) 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-channel", timeout.Packet.SourceId, "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.SourceId, timeout.Packet.DestinationId, 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 channel %s, destination channel %s", pd.SourcePort, timeout.Packet.SourceId, timeout.Packet.DestinationId) } } 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..7a084994b6f 100644 --- a/modules/core/04-channel/v2/keeper/msg_server_test.go +++ b/modules/core/04-channel/v2/keeper/msg_server_test.go @@ -269,7 +269,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.DestinationId, packet.Sequence) }, expError: nil, expAckWritten: false, @@ -278,7 +278,7 @@ 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.DestinationId = ibctesting.InvalidID }, expError: types.ErrChannelNotFound, }, @@ -339,10 +339,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.DestinationId, 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.DestinationId, packet.Sequence) if !tc.expAckWritten { // ack should not be written for async app or if the packet receipt was already present. @@ -352,13 +352,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.DestinationId, 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.SourceId, packet.Sequence) suite.Require().False(ok) } }) @@ -383,7 +383,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().IdKeeperV2.DeletePacketCommitment(suite.chainA.GetContext(), packet.SourceId, 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 +405,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.SourceId = "not-existent-channel" }, expError: types.ErrChannelNotFound, }, { 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.SourceId, packet.Sequence, []byte("foo")) }, expError: types.ErrInvalidPacket, }, @@ -477,7 +477,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.SourceId, 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. @@ -500,21 +500,21 @@ func (suite *KeeperTestSuite) TestMsgTimeout() { name: "failure: channel not found", malleate: func() { // change the source id to a non-existent channel. - packet.SourceChannel = "not-existent-channel" + packet.SourceId = "not-existent-channel" }, expError: types.ErrChannelNotFound, }, { 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.SourceId, 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.DestinationId, 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..10b2a0b2a10 100644 --- a/modules/core/04-channel/v2/keeper/packet.go +++ b/modules/core/04-channel/v2/keeper/packet.go @@ -80,7 +80,7 @@ func (k *Keeper) sendPacket( k.SetNextSequenceSend(ctx, sourceChannel, sequence+1) k.SetPacketCommitment(ctx, sourceChannel, 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), "dest_id", packet.DestinationId, "src_id", packet.SourceId) emitSendPacketEvents(ctx, packet) @@ -100,17 +100,17 @@ func (k *Keeper) recvPacket( proof []byte, proofHeight exported.Height, ) error { - channel, ok := k.GetChannel(ctx, packet.DestinationChannel) + channel, ok := k.GetChannel(ctx, packet.DestinationId) 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) + channel, ok = k.convertV1Channel(ctx, packet.Payloads[0].DestinationPort, packet.DestinationId) if !ok { - return errorsmod.Wrap(types.ErrChannelNotFound, packet.DestinationChannel) + return errorsmod.Wrap(types.ErrChannelNotFound, packet.DestinationId) } } - 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 channel.CounterpartyChannelId != packet.SourceId { + return errorsmod.Wrapf(types.ErrInvalidChannelIdentifier, "counterparty channel id (%s) does not match packet source channel id (%s)", channel.CounterpartyChannelId, packet.SourceId) } clientID := channel.ClientId @@ -125,14 +125,14 @@ 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 // by the increase of the recvStartSequence. - if k.HasPacketReceipt(ctx, packet.DestinationChannel, packet.Sequence) { + if k.HasPacketReceipt(ctx, packet.DestinationId, 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) + path := hostv2.PacketCommitmentKey(packet.SourceId, packet.Sequence) merklePath := types.BuildMerklePath(channel.MerklePathPrefix, path) commitment := types.CommitPacket(packet) @@ -150,9 +150,9 @@ func (k *Keeper) recvPacket( } // Set Packet Receipt to prevent timeout from occurring on counterparty - k.SetPacketReceipt(ctx, packet.DestinationChannel, packet.Sequence) + k.SetPacketReceipt(ctx, packet.DestinationId, 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_id", packet.SourceId, "dst_id", packet.DestinationId) emitRecvPacketEvents(ctx, packet) @@ -169,33 +169,33 @@ func (k Keeper) WriteAcknowledgement( // 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) + channel, ok := k.GetChannel(ctx, packet.DestinationId) if !ok { - return errorsmod.Wrapf(types.ErrChannelNotFound, "channel (%s) not found", packet.DestinationChannel) + return errorsmod.Wrapf(types.ErrChannelNotFound, "channel (%s) not found", packet.DestinationId) } - 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 channel.CounterpartyChannelId != packet.SourceId { + return errorsmod.Wrapf(types.ErrInvalidChannelIdentifier, "counterparty channel id (%s) does not match packet source channel id (%s)", channel.CounterpartyChannelId, packet.SourceId) } // 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.DestinationId, packet.Sequence) { + return errorsmod.Wrapf(types.ErrAcknowledgementExists, "acknowledgement for channel %s, sequence %d already exists", packet.DestinationId, packet.Sequence) } - if _, found := k.GetPacketReceipt(ctx, packet.DestinationChannel, packet.Sequence); !found { + if _, found := k.GetPacketReceipt(ctx, packet.DestinationId, 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.DestinationId, 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), "dest-id", packet.DestinationId) emitWriteAcknowledgementEvents(ctx, packet, ack) @@ -207,18 +207,18 @@ 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) + channel, ok := k.GetChannel(ctx, packet.SourceId) if !ok { - return errorsmod.Wrap(types.ErrChannelNotFound, packet.SourceChannel) + return errorsmod.Wrap(types.ErrChannelNotFound, packet.SourceId) } - 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 channel.CounterpartyChannelId != packet.DestinationId { + return errorsmod.Wrapf(types.ErrInvalidChannelIdentifier, "counterparty channel id (%s) does not match packet destination id (%s)", channel.CounterpartyChannelId, packet.DestinationId) } clientID := channel.ClientId - commitment := k.GetPacketCommitment(ctx, packet.SourceChannel, packet.Sequence) + commitment := k.GetPacketCommitment(ctx, packet.SourceId, 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,7 +234,7 @@ 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) + path := hostv2.PacketAcknowledgementKey(packet.DestinationId, packet.Sequence) merklePath := types.BuildMerklePath(channel.MerklePathPrefix, path) if err := k.ClientKeeper.VerifyMembership( @@ -249,9 +249,9 @@ func (k *Keeper) acknowledgePacket(ctx context.Context, packet types.Packet, ack return errorsmod.Wrapf(err, "failed packet acknowledgement verification for client (%s)", clientID) } - k.DeletePacketCommitment(ctx, packet.SourceChannel, packet.Sequence) + k.DeletePacketCommitment(ctx, packet.SourceId, 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), "source_id", packet.GetSourceId(), "destination_id", packet.GetDestinationId()) emitAcknowledgePacketEvents(ctx, packet) @@ -271,13 +271,13 @@ func (k *Keeper) timeoutPacket( proof []byte, proofHeight exported.Height, ) error { - channel, ok := k.GetChannel(ctx, packet.SourceChannel) + channel, ok := k.GetChannel(ctx, packet.SourceId) if !ok { - return errorsmod.Wrap(types.ErrChannelNotFound, packet.SourceChannel) + return errorsmod.Wrap(types.ErrChannelNotFound, packet.SourceId) } - 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 channel.CounterpartyChannelId != packet.DestinationId { + return errorsmod.Wrapf(types.ErrInvalidChannelIdentifier, "counterparty channel id (%s) does not match packet destination id (%s)", channel.CounterpartyChannelId, packet.DestinationId) } clientID := channel.ClientId @@ -294,7 +294,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.SourceId, 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,7 +310,7 @@ func (k *Keeper) timeoutPacket( } // verify packet receipt absence - path := hostv2.PacketReceiptKey(packet.DestinationChannel, packet.Sequence) + path := hostv2.PacketReceiptKey(packet.DestinationId, packet.Sequence) merklePath := types.BuildMerklePath(channel.MerklePathPrefix, path) if err := k.ClientKeeper.VerifyNonMembership( @@ -325,9 +325,9 @@ func (k *Keeper) timeoutPacket( } // delete packet commitment to prevent replay - k.DeletePacketCommitment(ctx, packet.SourceChannel, packet.Sequence) + k.DeletePacketCommitment(ctx, packet.SourceId, 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_channel_id", packet.SourceId, "dst_channel_id", packet.DestinationId) 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..91e59aa62e3 100644 --- a/modules/core/04-channel/v2/keeper/packet_test.go +++ b/modules/core/04-channel/v2/keeper/packet_test.go @@ -36,7 +36,7 @@ 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.SourceId, packet.TimeoutTimestamp, packet.Payloads) suite.Require().NoError(err) expSequence = 2 }, @@ -45,7 +45,7 @@ func (suite *KeeperTestSuite) TestSendPacket() { { "channel not found", func() { - packet.SourceChannel = ibctesting.InvalidID + packet.SourceId = ibctesting.InvalidID }, types.ErrChannelNotFound, }, @@ -109,7 +109,7 @@ 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, destChannel, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceId, packet.TimeoutTimestamp, packet.Payloads) expPass := tc.expError == nil if expPass { @@ -119,12 +119,12 @@ func (suite *KeeperTestSuite) TestSendPacket() { suite.Require().Equal(path.EndpointB.ChannelID, destChannel) // 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.SourceId, 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.SourceId, seq)) } }) @@ -151,7 +151,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { { "failure: channel not found", func() { - packet.DestinationChannel = ibctesting.InvalidID + packet.DestinationId = ibctesting.InvalidID }, types.ErrChannelNotFound, }, @@ -165,7 +165,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { { "failure: counterparty channel identifier different than source channel", func() { - packet.SourceChannel = unusedChannel + packet.SourceId = unusedChannel }, types.ErrInvalidChannelIdentifier, }, @@ -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.DestinationId, 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.SourceId, packet.Sequence, []byte("")) suite.coordinator.CommitBlock(path.EndpointA.Chain) suite.Require().NoError(path.EndpointB.UpdateClient()) }, @@ -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.DestinationId, packet.Sequence) suite.Require().True(found) } else { suite.Require().Error(err) @@ -252,14 +252,14 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgement() { { "failure: channel not found", func() { - packet.DestinationChannel = ibctesting.InvalidID + packet.DestinationId = ibctesting.InvalidID }, types.ErrChannelNotFound, }, { "failure: counterparty channel identifier different than source channel", func() { - packet.SourceChannel = unusedChannel + packet.SourceId = unusedChannel }, types.ErrInvalidChannelIdentifier, }, @@ -267,7 +267,7 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgement() { "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.DestinationId, packet.Sequence, ackBz) }, types.ErrAcknowledgementExists, }, @@ -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.DestinationId, 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.DestinationId, packet.Sequence) suite.Require().Equal(types.CommitAcknowledgement(ack), ackCommitment) } else { suite.Require().Error(err) @@ -344,21 +344,21 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { { "failure: channel not found", func() { - packet.SourceChannel = ibctesting.InvalidID + packet.SourceId = ibctesting.InvalidID }, types.ErrChannelNotFound, }, { "failure: counterparty channel identifier different than source channel", func() { - packet.DestinationChannel = unusedChannel + packet.DestinationId = unusedChannel }, types.ErrInvalidChannelIdentifier, }, { "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.SourceId, 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.DestinationId, 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.SourceId, packet.Sequence) suite.Require().Empty(commitment) } else { suite.Require().Error(err) @@ -448,7 +448,7 @@ 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.SourceId, packet.TimeoutTimestamp, packet.Payloads) suite.Require().NoError(err, "send packet failed") }, @@ -458,11 +458,11 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { "failure: channel 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.SourceId, packet.TimeoutTimestamp, packet.Payloads) suite.Require().NoError(err, "send packet failed") - packet.SourceChannel = ibctesting.InvalidID + packet.SourceId = ibctesting.InvalidID }, types.ErrChannelNotFound, }, @@ -470,11 +470,11 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { "failure: counterparty channel identifier different than source channel", 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.SourceId, packet.TimeoutTimestamp, packet.Payloads) suite.Require().NoError(err, "send packet failed") - packet.DestinationChannel = unusedChannel + packet.DestinationId = unusedChannel }, types.ErrInvalidChannelIdentifier, }, @@ -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.SourceId, 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.SourceId, 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.SourceId, 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.SourceId, 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.DestinationId, packet.Sequence) }, commitmenttypes.ErrInvalidProof, }, @@ -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.DestinationId, 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.DestinationId, packet.Sequence) suite.Require().Nil(commitment, "packet commitment not deleted") } else { suite.Require().Error(err) diff --git a/modules/core/04-channel/v2/types/commitment.go b/modules/core/04-channel/v2/types/commitment.go index 3f79cc3fad1..70f4e11fcb4 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(destinationId) + 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.DestinationId)) 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..264faf73b50 100644 --- a/modules/core/04-channel/v2/types/commitment_test.go +++ b/modules/core/04-channel/v2/types/commitment_test.go @@ -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, + SourceId: "channel-0", + DestinationId: "channel-1", + TimeoutTimestamp: 100, Payloads: []types.Payload{ { SourcePort: transfertypes.PortID, diff --git a/modules/core/04-channel/v2/types/packet.go b/modules/core/04-channel/v2/types/packet.go index 9fe360c5a6c..935f98e7789 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, sourceId, destinationId string, timeoutTimestamp uint64, payloads ...Payload) Packet { return Packet{ - Sequence: sequence, - SourceChannel: sourceChannel, - DestinationChannel: destinationChannel, - TimeoutTimestamp: timeoutTimestamp, - Payloads: payloads, + Sequence: sequence, + SourceId: sourceId, + DestinationId: destinationId, + 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.SourceId); 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.DestinationId); 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..e3772a5a84f 100644 --- a/modules/core/04-channel/v2/types/packet.pb.go +++ b/modules/core/04-channel/v2/types/packet.pb.go @@ -66,9 +66,9 @@ type Packet struct { // 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"` + SourceId string `protobuf:"bytes,2,opt,name=source_id,json=sourceId,proto3" json:"source_id,omitempty"` // identifies the receiving chain. - DestinationChannel string `protobuf:"bytes,3,opt,name=destination_channel,json=destinationChannel,proto3" json:"destination_channel,omitempty"` + DestinationId string `protobuf:"bytes,3,opt,name=destination_id,json=destinationId,proto3" json:"destination_id,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) GetSourceId() string { if m != nil { - return m.SourceChannel + return m.SourceId } return "" } -func (m *Packet) GetDestinationChannel() string { +func (m *Packet) GetDestinationId() string { if m != nil { - return m.DestinationChannel + return m.DestinationId } 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, 0x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a2, 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, + // 589 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x93, 0xc1, 0x6e, 0xd3, 0x4c, + 0x14, 0x85, 0x33, 0x4d, 0xd2, 0x26, 0xd3, 0xfc, 0xad, 0xff, 0x69, 0x91, 0x4c, 0x40, 0xa9, 0x89, + 0x04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0x11, 0xd0, 0xf5, 0x38, 0x96, 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.DestinationId) > 0 { + i -= len(m.DestinationId) + copy(dAtA[i:], m.DestinationId) + i = encodeVarintPacket(dAtA, i, uint64(len(m.DestinationId))) 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.SourceId) > 0 { + i -= len(m.SourceId) + copy(dAtA[i:], m.SourceId) + i = encodeVarintPacket(dAtA, i, uint64(len(m.SourceId))) 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.SourceId) if l > 0 { n += 1 + l + sovPacket(uint64(l)) } - l = len(m.DestinationChannel) + l = len(m.DestinationId) 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 SourceId", 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.SourceId = 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 DestinationId", 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.DestinationId = 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..1d476b11474 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.SourceId = "" }, host.ErrInvalidID, }, { - "failure: invalid dest channel ID", + "failure: invalid dest ID", func() { - packet.DestinationChannel = "" + packet.DestinationId = "" }, host.ErrInvalidID, }, diff --git a/modules/core/ante/ante_test.go b/modules/core/ante/ante_test.go index 6e8472c6847..b22d8edb64c 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.SourceId, 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.DestinationId, 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.SourceId, 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..b508e12b8f4 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.SourceId), telemetry.NewLabel(ibcmetrics.LabelDestinationPort, payload.DestinationPort), - telemetry.NewLabel(ibcmetrics.LabelDestinationChannel, packet.DestinationChannel), + telemetry.NewLabel(ibcmetrics.LabelDestinationChannel, packet.DestinationId), }, ) } @@ -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.SourceId), telemetry.NewLabel(ibcmetrics.LabelDestinationPort, payload.DestinationPort), - telemetry.NewLabel(ibcmetrics.LabelDestinationChannel, packet.DestinationChannel), + telemetry.NewLabel(ibcmetrics.LabelDestinationChannel, packet.DestinationId), 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.SourceId), telemetry.NewLabel(ibcmetrics.LabelDestinationPort, payload.DestinationPort), - telemetry.NewLabel(ibcmetrics.LabelDestinationChannel, packet.DestinationChannel), + telemetry.NewLabel(ibcmetrics.LabelDestinationChannel, packet.DestinationId), }, ) } diff --git a/proto/ibc/core/channel/v2/packet.proto b/proto/ibc/core/channel/v2/packet.proto index ea14112c643..56f5ed3a798 100644 --- a/proto/ibc/core/channel/v2/packet.proto +++ b/proto/ibc/core/channel/v2/packet.proto @@ -14,9 +14,9 @@ message Packet { // with a later sequence number. uint64 sequence = 1; // identifies the sending chain. - string source_channel = 2; + string source_id = 2; // identifies the receiving chain. - string destination_channel = 3; + string destination_id = 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/testing/endpoint_v2.go b/testing/endpoint_v2.go index be1fd011aa8..3442e66f27a 100644 --- a/testing/endpoint_v2.go +++ b/testing/endpoint_v2.go @@ -82,7 +82,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.SourceId, packet.Sequence) proof, proofHeight := endpoint.Counterparty.QueryProof(packetKey) msg := channeltypesv2.NewMsgRecvPacket(packet, proof, proofHeight, endpoint.Chain.SenderAccount.GetAddress().String()) @@ -96,7 +96,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.DestinationId, packet.Sequence) proof, proofHeight := endpoint.Counterparty.QueryProof(packetKey) msg := channeltypesv2.NewMsgAcknowledgement(packet, ack, proof, proofHeight, endpoint.Chain.SenderAccount.GetAddress().String()) @@ -110,7 +110,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.DestinationId, packet.Sequence) proof, proofHeight := endpoint.Counterparty.QueryProof(packetKey) msg := channeltypesv2.NewMsgTimeout(packet, proof, proofHeight, endpoint.Chain.SenderAccount.GetAddress().String()) From 70d5872cd9fb5a30ef776d5e02f1ede19c0331cc Mon Sep 17 00:00:00 2001 From: Aditya Sripal <14364734+AdityaSripal@users.noreply.github.com> Date: Tue, 14 Jan 2025 14:28:53 +0100 Subject: [PATCH 03/18] fix tests --- modules/apps/transfer/v2/keeper/msg_server_test.go | 8 ++++---- modules/core/04-channel/v2/keeper/msg_server_test.go | 2 +- modules/core/04-channel/v2/keeper/packet_test.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/apps/transfer/v2/keeper/msg_server_test.go b/modules/apps/transfer/v2/keeper/msg_server_test.go index e12cdf43cb5..9a86492b04a 100644 --- a/modules/apps/transfer/v2/keeper/msg_server_test.go +++ b/modules/apps/transfer/v2/keeper/msg_server_test.go @@ -268,7 +268,7 @@ func (suite *KeeperTestSuite) TestMsgRecvPacketTransfer() { "failure: invalid destination channel on received packet", func() {}, func() { - packet.DestinationChannel = ibctesting.InvalidID + packet.DestinationId = ibctesting.InvalidID }, channeltypesv2.ErrChannelNotFound, }, @@ -276,7 +276,7 @@ func (suite *KeeperTestSuite) TestMsgRecvPacketTransfer() { "failure: counter party channel does not match source channel", func() {}, func() { - packet.SourceChannel = ibctesting.InvalidID + packet.SourceId = ibctesting.InvalidID }, channeltypes.ErrInvalidChannelIdentifier, }, @@ -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.DestinationId, 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.DestinationId), }, } 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 7a084994b6f..0bb8706b386 100644 --- a/modules/core/04-channel/v2/keeper/msg_server_test.go +++ b/modules/core/04-channel/v2/keeper/msg_server_test.go @@ -383,7 +383,7 @@ func (suite *KeeperTestSuite) TestMsgAcknowledgement() { { name: "success: NoOp", malleate: func() { - suite.chainA.App.GetIBCKeeper().IdKeeperV2.DeletePacketCommitment(suite.chainA.GetContext(), packet.SourceId, packet.Sequence) + suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.DeletePacketCommitment(suite.chainA.GetContext(), packet.SourceId, 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. diff --git a/modules/core/04-channel/v2/keeper/packet_test.go b/modules/core/04-channel/v2/keeper/packet_test.go index 91e59aa62e3..c6bcc50f3ea 100644 --- a/modules/core/04-channel/v2/keeper/packet_test.go +++ b/modules/core/04-channel/v2/keeper/packet_test.go @@ -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.GetSourceId(), packet.GetSequence()) proof, proofHeight := path.EndpointA.QueryProof(packetKey) err = suite.chainB.App.GetIBCKeeper().ChannelKeeperV2.RecvPacketTest(suite.chainB.GetContext(), packet, proof, proofHeight) From f2bf1ed8fcd9cc4dfb55941ecf6f272bb7d5f3ef Mon Sep 17 00:00:00 2001 From: Aditya Sripal <14364734+AdityaSripal@users.noreply.github.com> Date: Tue, 14 Jan 2025 18:19:07 +0100 Subject: [PATCH 04/18] split messaging key to prefix and clientId --- modules/core/02-client/keeper/keeper_test.go | 2 +- modules/core/02-client/types/counterparty.go | 5 +- .../core/02-client/types/counterparty.pb.go | 191 +++++++++++++----- modules/core/02-client/types/msgs.go | 16 +- modules/core/02-client/types/msgs_test.go | 14 ++ modules/core/04-channel/v2/keeper/keeper.go | 13 ++ .../04-channel/v2/types/expected_keepers.go | 2 + modules/core/keeper/msg_server.go | 3 +- modules/core/keeper/msg_server_test.go | 6 +- proto/ibc/core/client/v2/counterparty.proto | 17 +- 10 files changed, 200 insertions(+), 69 deletions(-) diff --git a/modules/core/02-client/keeper/keeper_test.go b/modules/core/02-client/keeper/keeper_test.go index 83c7594126e..4d9e025e990 100644 --- a/modules/core/02-client/keeper/keeper_test.go +++ b/modules/core/02-client/keeper/keeper_test.go @@ -138,7 +138,7 @@ func (suite *KeeperTestSuite) TestSetClientCreator() { } func (suite *KeeperTestSuite) TestSetClientCounterparty() { - counterparty := types.NewCounterpartyInfo([][]byte{[]byte("ibc"), []byte("channel-7")}) + 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) diff --git a/modules/core/02-client/types/counterparty.go b/modules/core/02-client/types/counterparty.go index 3abed9259d7..7d591152be0 100644 --- a/modules/core/02-client/types/counterparty.go +++ b/modules/core/02-client/types/counterparty.go @@ -1,7 +1,8 @@ package types -func NewCounterpartyInfo(counterpartyMessagingKey [][]byte) CounterpartyInfo { +func NewCounterpartyInfo(merklePrefix [][]byte, clientId string) CounterpartyInfo { return CounterpartyInfo{ - CounterpartyMessagingKey: counterpartyMessagingKey, + MerklePrefix: merklePrefix, + ClientId: clientId, } } diff --git a/modules/core/02-client/types/counterparty.pb.go b/modules/core/02-client/types/counterparty.pb.go index 9f7cdb2fdd9..11d7b5c220f 100644 --- a/modules/core/02-client/types/counterparty.pb.go +++ b/modules/core/02-client/types/counterparty.pb.go @@ -31,11 +31,10 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // CounterpartyInfo defines the key that the counterparty will use to message our client type CounterpartyInfo struct { - // counterparty messaging key prefix is the key that the counterparty will store - // all outgoing IBC packet messages intended for our chain. - // the provable messages will be stored with the following key prefix and the - // ICS24 standardized path for the given message type - CounterpartyMessagingKey [][]byte `protobuf:"bytes,1,rep,name=counterparty_messaging_key,json=counterpartyMessagingKey,proto3" json:"counterparty_messaging_key,omitempty"` + // 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{} } @@ -71,21 +70,30 @@ func (m *CounterpartyInfo) XXX_DiscardUnknown() { var xxx_messageInfo_CounterpartyInfo proto.InternalMessageInfo -func (m *CounterpartyInfo) GetCounterpartyMessagingKey() [][]byte { +func (m *CounterpartyInfo) GetMerklePrefix() [][]byte { if m != nil { - return m.CounterpartyMessagingKey + 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 messaging key - CounterpartyMessagingKey [][]byte `protobuf:"bytes,2,rep,name=counterparty_messaging_key,json=counterpartyMessagingKey,proto3" json:"counterparty_messaging_key,omitempty"` + // counterparty merkle prefix + MerklePrefix [][]byte `protobuf:"bytes,2,rep,name=merkle_prefix,json=merklePrefix,proto3" json:"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,3,opt,name=signer,proto3" json:"signer,omitempty"` + Signer string `protobuf:"bytes,4,opt,name=signer,proto3" json:"signer,omitempty"` } func (m *MsgRegisterCounterparty) Reset() { *m = MsgRegisterCounterparty{} } @@ -169,30 +177,31 @@ func init() { } var fileDescriptor_bc4a81c3d2196cf1 = []byte{ - // 360 bytes of a gzipped FileDescriptorProto + // 376 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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15, 0x50, 0x52, 0xe4, 0x92, 0xc7, 0xe1, 0xbc, 0xa0, 0xd4, - 0xe2, 0x82, 0xfc, 0xbc, 0xe2, 0x54, 0xa3, 0x49, 0x8c, 0x5c, 0xfc, 0xc8, 0x12, 0xbe, 0xc5, 0xe9, - 0x42, 0x15, 0x5c, 0x22, 0x58, 0xbd, 0xa4, 0xad, 0x87, 0x19, 0x09, 0x7a, 0x38, 0x2c, 0x90, 0x32, - 0x26, 0x41, 0x31, 0xcc, 0x35, 0x52, 0xac, 0x0d, 0xcf, 0x37, 0x68, 0x31, 0x3a, 0x05, 0x9d, 0x78, - 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, - 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x45, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, - 0x5e, 0x72, 0x7e, 0xae, 0x3e, 0x34, 0xf6, 0x33, 0x93, 0x92, 0x75, 0xd3, 0xf3, 0xf5, 0xcb, 0x2c, - 0xf5, 0x73, 0xf3, 0x53, 0x4a, 0x73, 0x52, 0x8b, 0x21, 0xa9, 0xc9, 0xc0, 0x48, 0x17, 0x9a, 0xa0, - 0x4a, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x89, 0xc0, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, - 0x63, 0x9f, 0xd3, 0xcf, 0x70, 0x02, 0x00, 0x00, + 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, 0x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0xe4, 0xfc, 0x5c, 0x7d, 0x68, 0xf2, 0xc8, 0x4c, 0x4a, 0xd6, 0x4d, 0xcf, 0xd7, 0x2f, 0xb3, 0xd4, + 0xcf, 0xcd, 0x4f, 0x29, 0xcd, 0x49, 0x2d, 0x86, 0x24, 0x37, 0x03, 0x23, 0x5d, 0x68, 0x8a, 0x2b, + 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0xa7, 0x12, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, + 0x6e, 0x69, 0x35, 0x60, 0x91, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -297,11 +306,18 @@ func (m *CounterpartyInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.CounterpartyMessagingKey) > 0 { - for iNdEx := len(m.CounterpartyMessagingKey) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.CounterpartyMessagingKey[iNdEx]) - copy(dAtA[i:], m.CounterpartyMessagingKey[iNdEx]) - i = encodeVarintCounterparty(dAtA, i, uint64(len(m.CounterpartyMessagingKey[iNdEx]))) + 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 } @@ -334,13 +350,20 @@ func (m *MsgRegisterCounterparty) MarshalToSizedBuffer(dAtA []byte) (int, error) 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.CounterpartyMessagingKey) > 0 { - for iNdEx := len(m.CounterpartyMessagingKey) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.CounterpartyMessagingKey[iNdEx]) - copy(dAtA[i:], m.CounterpartyMessagingKey[iNdEx]) - i = encodeVarintCounterparty(dAtA, i, uint64(len(m.CounterpartyMessagingKey[iNdEx]))) + 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] = 0x12 } @@ -395,12 +418,16 @@ func (m *CounterpartyInfo) Size() (n int) { } var l int _ = l - if len(m.CounterpartyMessagingKey) > 0 { - for _, b := range m.CounterpartyMessagingKey { + 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 } @@ -414,12 +441,16 @@ func (m *MsgRegisterCounterparty) Size() (n int) { if l > 0 { n += 1 + l + sovCounterparty(uint64(l)) } - if len(m.CounterpartyMessagingKey) > 0 { - for _, b := range m.CounterpartyMessagingKey { + if len(m.MerklePrefix) > 0 { + for _, b := range m.MerklePrefix { 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)) @@ -473,7 +504,7 @@ func (m *CounterpartyInfo) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CounterpartyMessagingKey", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MerklePrefix", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -500,8 +531,40 @@ func (m *CounterpartyInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.CounterpartyMessagingKey = append(m.CounterpartyMessagingKey, make([]byte, postIndex-iNdEx)) - copy(m.CounterpartyMessagingKey[len(m.CounterpartyMessagingKey)-1], dAtA[iNdEx:postIndex]) + 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 @@ -587,7 +650,7 @@ func (m *MsgRegisterCounterparty) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CounterpartyMessagingKey", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MerklePrefix", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -614,10 +677,42 @@ func (m *MsgRegisterCounterparty) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.CounterpartyMessagingKey = append(m.CounterpartyMessagingKey, make([]byte, postIndex-iNdEx)) - copy(m.CounterpartyMessagingKey[len(m.CounterpartyMessagingKey)-1], dAtA[iNdEx:postIndex]) + m.MerklePrefix = append(m.MerklePrefix, make([]byte, postIndex-iNdEx)) + copy(m.MerklePrefix[len(m.MerklePrefix)-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) } diff --git a/modules/core/02-client/types/msgs.go b/modules/core/02-client/types/msgs.go index 119bca08e11..179ca2bc43a 100644 --- a/modules/core/02-client/types/msgs.go +++ b/modules/core/02-client/types/msgs.go @@ -325,11 +325,12 @@ func (msg *MsgUpdateParams) ValidateBasic() error { } // NewMsgRegisterCounterparty creates a new instance of MsgRegisterCounterparty. -func NewMsgRegisterCounterparty(clientId string, counterpartyMsgKey [][]byte, signer string) *MsgRegisterCounterparty { +func NewMsgRegisterCounterparty(clientId string, merklePrefix [][]byte, counterpartyClientId string, signer string) *MsgRegisterCounterparty { return &MsgRegisterCounterparty{ - ClientId: clientId, - CounterpartyMessagingKey: counterpartyMsgKey, - Signer: signer, + ClientId: clientId, + MerklePrefix: merklePrefix, + CounterpartyClientId: counterpartyClientId, + Signer: signer, } } @@ -338,8 +339,11 @@ 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.CounterpartyMessagingKey) == 0 { + if len(msg.MerklePrefix) == 0 { return errorsmod.Wrap(ErrInvalidCounterparty, "counterparty messaging key cannot be empty") } - return host.ClientIdentifierValidator(msg.ClientId) + 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 1e8d71a5cf3..ca51a240f37 100644 --- a/modules/core/02-client/types/msgs_test.go +++ b/modules/core/02-client/types/msgs_test.go @@ -994,6 +994,7 @@ func TestMsgRegisterCounterpartyValidateBasic(t *testing.T) { types.NewMsgRegisterCounterparty( "testclientid", [][]byte{[]byte("ibc"), []byte("channel-9")}, + "testclientid3", signer, ), nil, @@ -1003,6 +1004,17 @@ func TestMsgRegisterCounterpartyValidateBasic(t *testing.T) { 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, @@ -1012,6 +1024,7 @@ func TestMsgRegisterCounterpartyValidateBasic(t *testing.T) { types.NewMsgRegisterCounterparty( "testclientid", [][]byte{}, + "testclientid3", signer, ), types.ErrInvalidCounterparty, @@ -1021,6 +1034,7 @@ func TestMsgRegisterCounterpartyValidateBasic(t *testing.T) { types.NewMsgRegisterCounterparty( "testclientid", [][]byte{[]byte("ibc"), []byte("channel-9")}, + "testclientid3", "badsigner", ), ibcerrors.ErrInvalidAddress, diff --git a/modules/core/04-channel/v2/keeper/keeper.go b/modules/core/04-channel/v2/keeper/keeper.go index e9843f71bb3..eae72f2d0c9 100644 --- a/modules/core/04-channel/v2/keeper/keeper.go +++ b/modules/core/04-channel/v2/keeper/keeper.go @@ -252,6 +252,19 @@ func (k *Keeper) aliasV1Channel(ctx context.Context, portID, channelID string) ( return channelv2, true } +// resolveV2Identifiers returns the client identifier and the counterpartyInfo for the client given the packetId +// Note: For fresh eureka channels, the client identifier and packet identifier are the same. +// For aliased channels, the packet identifier will be the original channel ID and the counterpartyInfo will be constructed from the channel +func (k *Keeper) resolveV2Identifiers(ctx context.Context, portId string, packetId string) (string, clienttypes.CounterpartyInfo, error) { + counterpartyInfo, ok := k.ClientKeeper.GetClientCounterparty(ctx, packetId) + if !ok { + channel, ok := k.channelKeeperV1.GetChannel(ctx, portId, packetId) + if ok { + connection, ok := k.connectionKeeper.GetConnection(ctx, channel.ConnectionHops[0]) + } + } +} + // 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) { 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/keeper/msg_server.go b/modules/core/keeper/msg_server.go index 9410634ef52..f4af9cde1cf 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -55,7 +55,8 @@ func (k *Keeper) RegisterCounterparty(ctx context.Context, msg *clienttypes.MsgR } counterpartyInfo := clienttypes.CounterpartyInfo{ - CounterpartyMessagingKey: msg.CounterpartyMessagingKey, + MerklePrefix: msg.MerklePrefix, + ClientId: msg.CounterpartyClientId, } k.ClientKeeper.SetClientCounterparty(ctx, msg.ClientId, counterpartyInfo) diff --git a/modules/core/keeper/msg_server_test.go b/modules/core/keeper/msg_server_test.go index a36afc1f54d..f913b9eb9d2 100644 --- a/modules/core/keeper/msg_server_test.go +++ b/modules/core/keeper/msg_server_test.go @@ -68,8 +68,8 @@ func (suite *KeeperTestSuite) TestRegisterCounterparty() { path = ibctesting.NewPath(suite.chainA, suite.chainB) tc.malleate() - counterpartyKey := [][]byte{[]byte("ibc"), []byte("channel-7")} - msg := clienttypes.NewMsgRegisterCounterparty(path.EndpointA.ClientID, counterpartyKey, suite.chainA.SenderAccount.GetAddress().String()) + 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) @@ -78,7 +78,7 @@ func (suite *KeeperTestSuite) TestRegisterCounterparty() { 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.CounterpartyInfo{counterpartyKey}) + suite.Require().Equal(counterpartyInfo, clienttypes.NewCounterpartyInfo(merklePrefix, path.EndpointB.ClientID)) creator := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientCreator(suite.chainA.GetContext(), path.EndpointA.ClientID) suite.Require().Empty(creator) } diff --git a/proto/ibc/core/client/v2/counterparty.proto b/proto/ibc/core/client/v2/counterparty.proto index fd5424e3fcb..042fa63adc7 100644 --- a/proto/ibc/core/client/v2/counterparty.proto +++ b/proto/ibc/core/client/v2/counterparty.proto @@ -9,11 +9,10 @@ import "gogoproto/gogo.proto"; // CounterpartyInfo defines the key that the counterparty will use to message our client message CounterpartyInfo { - // counterparty messaging key prefix is the key that the counterparty will store - // all outgoing IBC packet messages intended for our chain. - // the provable messages will be stored with the following key prefix and the - // ICS24 standardized path for the given message type - repeated bytes counterparty_messaging_key = 1; + // 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. @@ -32,10 +31,12 @@ message MsgRegisterCounterparty { // client identifier string client_id = 1; - // counterparty messaging key - repeated bytes counterparty_messaging_key = 2; + // counterparty merkle prefix + repeated bytes merkle_prefix = 2; + // counterparty client identifier + string counterparty_client_id = 3; // signer address - string signer = 3; + string signer = 4; } // MsgRegisterCounterpartyResponse defines the Msg/RegisterCounterparty response type. From 180e5f17200e0867e18887b9c4c4601ede63ef57 Mon Sep 17 00:00:00 2001 From: Aditya Sripal <14364734+AdityaSripal@users.noreply.github.com> Date: Wed, 15 Jan 2025 11:54:44 +0100 Subject: [PATCH 05/18] change eureka packet handlers to no longer rely on channel --- modules/core/04-channel/v2/keeper/keeper.go | 12 +++ modules/core/04-channel/v2/keeper/packet.go | 102 +++++++++----------- 2 files changed, 56 insertions(+), 58 deletions(-) diff --git a/modules/core/04-channel/v2/keeper/keeper.go b/modules/core/04-channel/v2/keeper/keeper.go index eae72f2d0c9..5f71e05b392 100644 --- a/modules/core/04-channel/v2/keeper/keeper.go +++ b/modules/core/04-channel/v2/keeper/keeper.go @@ -13,6 +13,7 @@ import ( "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" + clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/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" @@ -261,8 +262,19 @@ func (k *Keeper) resolveV2Identifiers(ctx context.Context, portId string, packet channel, ok := k.channelKeeperV1.GetChannel(ctx, portId, packetId) if ok { connection, ok := k.connectionKeeper.GetConnection(ctx, channel.ConnectionHops[0]) + if !ok { + // should never happen since the connection should exist if the channel exists + return "", clienttypes.CounterpartyInfo{}, types.ErrInvalidChannel + } + // convert v1 merkle prefix into the v2 path format + merklePrefix := [][]byte{connection.Counterparty.Prefix.KeyPrefix, []byte("")} + // create the counterparty info, here we set the counterparty client Id to the the counterparty channel id + // this is because we want to preserve the original identifiers that are used to write provable paths to each other + counterpartyInfo = clienttypes.NewCounterpartyInfo(merklePrefix, channel.Counterparty.ChannelId) + return connection.ClientId, counterpartyInfo, nil } } + return packetId, counterpartyInfo, nil } // convertV1Channel attempts to retrieve a v1 channel from the channel keeper if it exists, then converts it diff --git a/modules/core/04-channel/v2/keeper/packet.go b/modules/core/04-channel/v2/keeper/packet.go index 10b2a0b2a10..d2eec72ac6d 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,33 +20,26 @@ import ( // in order for the packet to be sent to the counterparty. func (k *Keeper) sendPacket( ctx context.Context, - sourceChannel string, + sourceId 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) - 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) - } + // lookup counterparty and clientid from packet identifiers + clientID, counterparty, err := k.resolveV2Identifiers(ctx, payloads[0].SourcePort, sourceId) + if err != nil { + return 0, "", err } - destChannel := channel.CounterpartyChannelId - clientID := channel.ClientId - - sequence, found := k.GetNextSequenceSend(ctx, sourceChannel) + sequence, found := k.GetNextSequenceSend(ctx, sourceId) if !found { return 0, "", errorsmod.Wrapf( types.ErrSequenceSendNotFound, - "source channel: %s", sourceChannel, + "source id: %s", sourceId, ) } // construct packet from given fields and channel state - packet := types.NewPacket(sequence, sourceChannel, destChannel, timeoutTimestamp, payloads...) + packet := types.NewPacket(sequence, sourceId, counterparty.ClientId, timeoutTimestamp, payloads...) if err := packet.ValidateBasic(); err != nil { return 0, "", errorsmod.Wrapf(types.ErrInvalidPacket, "constructed packet failed basic validation: %v", err) @@ -77,14 +71,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, sourceId, sequence+1) + k.SetPacketCommitment(ctx, sourceId, packet.GetSequence(), commitment) k.Logger(ctx).Info("packet sent", "sequence", strconv.FormatUint(packet.Sequence, 10), "dest_id", packet.DestinationId, "src_id", packet.SourceId) 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 +94,16 @@ func (k *Keeper) recvPacket( proof []byte, proofHeight exported.Height, ) error { - channel, ok := k.GetChannel(ctx, packet.DestinationId) - 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.DestinationId) - if !ok { - return errorsmod.Wrap(types.ErrChannelNotFound, packet.DestinationId) - } + // lookup counterparty and clientid from packet identifiers + clientID, counterparty, err := k.resolveV2Identifiers(ctx, packet.Payloads[0].SourcePort, packet.DestinationId) + if err != nil { + return err } - if channel.CounterpartyChannelId != packet.SourceId { - return errorsmod.Wrapf(types.ErrInvalidChannelIdentifier, "counterparty channel id (%s) does not match packet source channel id (%s)", channel.CounterpartyChannelId, packet.SourceId) + if counterparty.ClientId != packet.SourceId { + return errorsmod.Wrapf(types.ErrInvalidChannelIdentifier, "counterparty id (%s) does not match packet source id (%s)", &counterparty.ClientId, packet.SourceId) } - 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()) @@ -133,7 +122,8 @@ func (k *Keeper) recvPacket( } path := hostv2.PacketCommitmentKey(packet.SourceId, packet.Sequence) - merklePath := types.BuildMerklePath(channel.MerklePathPrefix, path) + merklePrefix := commitmenttypes.NewMerklePath(counterparty.MerklePrefix...) + merklePath := types.BuildMerklePath(merklePrefix, path) commitment := types.CommitPacket(packet) @@ -166,23 +156,21 @@ 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.DestinationId) - if !ok { - return errorsmod.Wrapf(types.ErrChannelNotFound, "channel (%s) not found", packet.DestinationId) + // lookup counterparty and clientid from packet identifiers + _, counterparty, err := k.resolveV2Identifiers(ctx, packet.Payloads[0].SourcePort, packet.DestinationId) + if err != nil { + return err } - if channel.CounterpartyChannelId != packet.SourceId { - return errorsmod.Wrapf(types.ErrInvalidChannelIdentifier, "counterparty channel id (%s) does not match packet source channel id (%s)", channel.CounterpartyChannelId, packet.SourceId) + if counterparty.ClientId != packet.SourceId { + return errorsmod.Wrapf(types.ErrInvalidChannelIdentifier, "counterparty id (%s) does not match packet source id (%s)", &counterparty.ClientId, packet.SourceId) } // 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.DestinationId, packet.Sequence) { - return errorsmod.Wrapf(types.ErrAcknowledgementExists, "acknowledgement for channel %s, sequence %d already exists", packet.DestinationId, packet.Sequence) + return errorsmod.Wrapf(types.ErrAcknowledgementExists, "acknowledgement for id %s, sequence %d already exists", packet.DestinationId, packet.Sequence) } if _, found := k.GetPacketReceipt(ctx, packet.DestinationId, packet.Sequence); !found { @@ -205,19 +193,16 @@ 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.SourceId) - if !ok { - return errorsmod.Wrap(types.ErrChannelNotFound, packet.SourceId) + // lookup counterparty and clientid from packet identifiers + clientID, counterparty, err := k.resolveV2Identifiers(ctx, packet.Payloads[0].SourcePort, packet.DestinationId) + if err != nil { + return err } - if channel.CounterpartyChannelId != packet.DestinationId { - return errorsmod.Wrapf(types.ErrInvalidChannelIdentifier, "counterparty channel id (%s) does not match packet destination id (%s)", channel.CounterpartyChannelId, packet.DestinationId) + if counterparty.ClientId != packet.DestinationId { + return errorsmod.Wrapf(types.ErrInvalidChannelIdentifier, "counterparty id (%s) does not match packet destination id (%s)", counterparty.ClientId, packet.DestinationId) } - clientID := channel.ClientId - commitment := k.GetPacketCommitment(ctx, packet.SourceId, packet.Sequence) if len(commitment) == 0 { // This error indicates that the acknowledgement has already been relayed @@ -235,7 +220,8 @@ func (k *Keeper) acknowledgePacket(ctx context.Context, packet types.Packet, ack } path := hostv2.PacketAcknowledgementKey(packet.DestinationId, packet.Sequence) - merklePath := types.BuildMerklePath(channel.MerklePathPrefix, path) + merklePrefix := commitmenttypes.NewMerklePath(counterparty.MerklePrefix...) + merklePath := types.BuildMerklePath(merklePrefix, path) if err := k.ClientKeeper.VerifyMembership( ctx, @@ -271,17 +257,16 @@ func (k *Keeper) timeoutPacket( proof []byte, proofHeight exported.Height, ) error { - channel, ok := k.GetChannel(ctx, packet.SourceId) - if !ok { - return errorsmod.Wrap(types.ErrChannelNotFound, packet.SourceId) + // lookup counterparty and clientid from packet identifiers + clientID, counterparty, err := k.resolveV2Identifiers(ctx, packet.Payloads[0].SourcePort, packet.DestinationId) + if err != nil { + return err } - if channel.CounterpartyChannelId != packet.DestinationId { - return errorsmod.Wrapf(types.ErrInvalidChannelIdentifier, "counterparty channel id (%s) does not match packet destination id (%s)", channel.CounterpartyChannelId, packet.DestinationId) + if counterparty.ClientId != packet.DestinationId { + return errorsmod.Wrapf(types.ErrInvalidChannelIdentifier, "counterparty id (%s) does not match packet destination id (%s)", &counterparty.ClientId, packet.DestinationId) } - clientID := channel.ClientId - // check that timeout height or timeout timestamp has passed on the other end proofTimestamp, err := k.ClientKeeper.GetClientTimestampAtHeight(ctx, clientID, proofHeight) if err != nil { @@ -311,7 +296,8 @@ func (k *Keeper) timeoutPacket( // verify packet receipt absence path := hostv2.PacketReceiptKey(packet.DestinationId, packet.Sequence) - merklePath := types.BuildMerklePath(channel.MerklePathPrefix, path) + merklePrefix := commitmenttypes.NewMerklePath(counterparty.MerklePrefix...) + merklePath := types.BuildMerklePath(merklePrefix, path) if err := k.ClientKeeper.VerifyNonMembership( ctx, @@ -327,7 +313,7 @@ func (k *Keeper) timeoutPacket( // delete packet commitment to prevent replay k.DeletePacketCommitment(ctx, packet.SourceId, packet.Sequence) - k.Logger(ctx).Info("packet timed out", "sequence", strconv.FormatUint(packet.Sequence, 10), "src_channel_id", packet.SourceId, "dst_channel_id", packet.DestinationId) + k.Logger(ctx).Info("packet timed out", "sequence", strconv.FormatUint(packet.Sequence, 10), "src_id", packet.SourceId, "dst_id", packet.DestinationId) emitTimeoutPacketEvents(ctx, packet) From 480ba8eca3b70eb42dc0e073095cd4c210939fce Mon Sep 17 00:00:00 2001 From: Aditya Sripal <14364734+AdityaSripal@users.noreply.github.com> Date: Wed, 15 Jan 2025 14:32:00 +0100 Subject: [PATCH 06/18] naming suggestions --- .../transfer/v2/keeper/msg_server_test.go | 8 +- .../core/02-client/types/counterparty.pb.go | 53 +++---- modules/core/02-client/types/msgs.go | 10 +- modules/core/04-channel/v2/keeper/events.go | 20 +-- .../core/04-channel/v2/keeper/msg_server.go | 40 ++--- .../04-channel/v2/keeper/msg_server_test.go | 26 ++-- modules/core/04-channel/v2/keeper/packet.go | 74 ++++----- .../core/04-channel/v2/keeper/packet_test.go | 66 ++++---- .../core/04-channel/v2/types/commitment.go | 4 +- .../04-channel/v2/types/commitment_test.go | 8 +- modules/core/04-channel/v2/types/msgs.go | 6 +- modules/core/04-channel/v2/types/msgs_test.go | 2 +- modules/core/04-channel/v2/types/packet.go | 16 +- modules/core/04-channel/v2/types/packet.pb.go | 120 +++++++-------- .../core/04-channel/v2/types/packet_test.go | 4 +- modules/core/04-channel/v2/types/tx.pb.go | 144 +++++++++--------- modules/core/ante/ante_test.go | 6 +- modules/core/internal/v2/telemetry/packet.go | 12 +- modules/core/keeper/msg_server.go | 2 +- proto/ibc/core/channel/v2/packet.proto | 8 +- proto/ibc/core/channel/v2/tx.proto | 2 +- proto/ibc/core/client/v2/counterparty.proto | 2 +- 22 files changed, 317 insertions(+), 316 deletions(-) diff --git a/modules/apps/transfer/v2/keeper/msg_server_test.go b/modules/apps/transfer/v2/keeper/msg_server_test.go index 9a86492b04a..cb88eef16cf 100644 --- a/modules/apps/transfer/v2/keeper/msg_server_test.go +++ b/modules/apps/transfer/v2/keeper/msg_server_test.go @@ -268,7 +268,7 @@ func (suite *KeeperTestSuite) TestMsgRecvPacketTransfer() { "failure: invalid destination channel on received packet", func() {}, func() { - packet.DestinationId = ibctesting.InvalidID + packet.DestinationClient = ibctesting.InvalidID }, channeltypesv2.ErrChannelNotFound, }, @@ -276,7 +276,7 @@ func (suite *KeeperTestSuite) TestMsgRecvPacketTransfer() { "failure: counter party channel does not match source channel", func() {}, func() { - packet.SourceId = ibctesting.InvalidID + packet.SourceClient = ibctesting.InvalidID }, channeltypes.ErrInvalidChannelIdentifier, }, @@ -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.DestinationId, 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.DestinationId), + transfertypes.NewHop(sendPayload.DestinationPort, packet.DestinationClient), }, } diff --git a/modules/core/02-client/types/counterparty.pb.go b/modules/core/02-client/types/counterparty.pb.go index 11d7b5c220f..f20ce5e466e 100644 --- a/modules/core/02-client/types/counterparty.pb.go +++ b/modules/core/02-client/types/counterparty.pb.go @@ -89,7 +89,7 @@ type MsgRegisterCounterparty struct { // client identifier ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` // counterparty merkle prefix - MerklePrefix [][]byte `protobuf:"bytes,2,rep,name=merkle_prefix,json=merklePrefix,proto3" json:"merkle_prefix,omitempty"` + 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 @@ -177,7 +177,7 @@ func init() { } var fileDescriptor_bc4a81c3d2196cf1 = []byte{ - // 376 bytes of a gzipped FileDescriptorProto + // 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, @@ -187,21 +187,22 @@ var fileDescriptor_bc4a81c3d2196cf1 = []byte{ 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, 0xda, 0xc5, 0xc8, + 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, 0x98, 0x56, 0x33, 0x61, 0xb1, 0xda, 0x84, 0x4b, 0x0c, 0x39, 0x30, 0xe2, - 0x11, 0x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 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. @@ -359,11 +360,11 @@ func (m *MsgRegisterCounterparty) MarshalToSizedBuffer(dAtA []byte) (int, error) i-- dAtA[i] = 0x1a } - 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]))) + 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 } @@ -441,8 +442,8 @@ func (m *MsgRegisterCounterparty) Size() (n int) { if l > 0 { n += 1 + l + sovCounterparty(uint64(l)) } - if len(m.MerklePrefix) > 0 { - for _, b := range m.MerklePrefix { + if len(m.CounterpartyMerklePrefix) > 0 { + for _, b := range m.CounterpartyMerklePrefix { l = len(b) n += 1 + l + sovCounterparty(uint64(l)) } @@ -650,7 +651,7 @@ func (m *MsgRegisterCounterparty) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MerklePrefix", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CounterpartyMerklePrefix", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -677,8 +678,8 @@ func (m *MsgRegisterCounterparty) Unmarshal(dAtA []byte) error { 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]) + 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 { diff --git a/modules/core/02-client/types/msgs.go b/modules/core/02-client/types/msgs.go index 179ca2bc43a..b21d6b11101 100644 --- a/modules/core/02-client/types/msgs.go +++ b/modules/core/02-client/types/msgs.go @@ -327,10 +327,10 @@ func (msg *MsgUpdateParams) ValidateBasic() error { // NewMsgRegisterCounterparty creates a new instance of MsgRegisterCounterparty. func NewMsgRegisterCounterparty(clientId string, merklePrefix [][]byte, counterpartyClientId string, signer string) *MsgRegisterCounterparty { return &MsgRegisterCounterparty{ - ClientId: clientId, - MerklePrefix: merklePrefix, - CounterpartyClientId: counterpartyClientId, - Signer: signer, + ClientId: clientId, + CounterpartyMerklePrefix: merklePrefix, + CounterpartyClientId: counterpartyClientId, + Signer: signer, } } @@ -339,7 +339,7 @@ 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.MerklePrefix) == 0 { + if len(msg.CounterpartyMerklePrefix) == 0 { return errorsmod.Wrap(ErrInvalidCounterparty, "counterparty messaging key cannot be empty") } if err := host.ClientIdentifierValidator(msg.ClientId); err != nil { diff --git a/modules/core/04-channel/v2/keeper/events.go b/modules/core/04-channel/v2/keeper/events.go index 52177e643ca..32eee429456 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.SourceId), - sdk.NewAttribute(types.AttributeKeyDstChannel, packet.DestinationId), + 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.SourceId), - sdk.NewAttribute(types.AttributeKeyDstChannel, packet.DestinationId), + 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.SourceId), - sdk.NewAttribute(types.AttributeKeyDstChannel, packet.DestinationId), + 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.SourceId), - sdk.NewAttribute(types.AttributeKeyDstChannel, packet.DestinationId), + 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.SourceId), - sdk.NewAttribute(types.AttributeKeyDstChannel, packet.DestinationId), + 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)), diff --git a/modules/core/04-channel/v2/keeper/msg_server.go b/modules/core/04-channel/v2/keeper/msg_server.go index d4d19e5c1eb..1459b0b8fbb 100644 --- a/modules/core/04-channel/v2/keeper/msg_server.go +++ b/modules/core/04-channel/v2/keeper/msg_server.go @@ -83,15 +83,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 +122,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.SourceId) + 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.SourceId, "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 +139,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.SourceId, msg.Packet.DestinationId, 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 +169,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.SourceId, "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.SourceId) + 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 +189,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.SourceId, "dest-channel", msg.Packet.DestinationId, "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 +209,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.SourceId) + 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.SourceId, "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.SourceId, msg.Packet.DestinationId, 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.SourceId, msg.Packet.DestinationId) + 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 +242,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.SourceId, "destination-channel", timeout.Packet.DestinationId, "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.SourceId, timeout.Packet.DestinationId) + 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.SourceId) + 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.SourceId, "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.SourceId, timeout.Packet.DestinationId, 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.SourceId, timeout.Packet.DestinationId) + 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 0bb8706b386..4789308e614 100644 --- a/modules/core/04-channel/v2/keeper/msg_server_test.go +++ b/modules/core/04-channel/v2/keeper/msg_server_test.go @@ -269,7 +269,7 @@ func (suite *KeeperTestSuite) TestMsgRecvPacket() { { name: "success: NoOp", malleate: func() { - suite.chainB.App.GetIBCKeeper().ChannelKeeperV2.SetPacketReceipt(suite.chainB.GetContext(), packet.DestinationId, packet.Sequence) + suite.chainB.App.GetIBCKeeper().ChannelKeeperV2.SetPacketReceipt(suite.chainB.GetContext(), packet.DestinationClient, packet.Sequence) }, expError: nil, expAckWritten: false, @@ -278,7 +278,7 @@ func (suite *KeeperTestSuite) TestMsgRecvPacket() { name: "failure: counterparty not found", malleate: func() { // change the destination id to a non-existent channel. - packet.DestinationId = ibctesting.InvalidID + packet.DestinationClient = ibctesting.InvalidID }, expError: types.ErrChannelNotFound, }, @@ -339,10 +339,10 @@ func (suite *KeeperTestSuite) TestMsgRecvPacket() { suite.Require().NoError(err) // packet receipt should be written - _, ok := ck.GetPacketReceipt(path.EndpointB.Chain.GetContext(), packet.DestinationId, 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.DestinationId, 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 +352,13 @@ func (suite *KeeperTestSuite) TestMsgRecvPacket() { suite.Require().True(ackWritten) expectedBz := types.CommitAcknowledgement(expectedAck) - actualAckBz := ck.GetPacketAcknowledgement(path.EndpointB.Chain.GetContext(), packet.DestinationId, 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.SourceId, packet.Sequence) + _, ok := ck.GetPacketReceipt(path.EndpointB.Chain.GetContext(), packet.SourceClient, packet.Sequence) suite.Require().False(ok) } }) @@ -383,7 +383,7 @@ func (suite *KeeperTestSuite) TestMsgAcknowledgement() { { name: "success: NoOp", malleate: func() { - suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.DeletePacketCommitment(suite.chainA.GetContext(), packet.SourceId, 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 +405,14 @@ func (suite *KeeperTestSuite) TestMsgAcknowledgement() { name: "failure: counterparty not found", malleate: func() { // change the source id to a non-existent channel. - packet.SourceId = "not-existent-channel" + packet.SourceClient = "not-existent-channel" }, expError: types.ErrChannelNotFound, }, { name: "failure: invalid commitment", malleate: func() { - suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetPacketCommitment(suite.chainA.GetContext(), packet.SourceId, packet.Sequence, []byte("foo")) + suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetPacketCommitment(suite.chainA.GetContext(), packet.SourceClient, packet.Sequence, []byte("foo")) }, expError: types.ErrInvalidPacket, }, @@ -477,7 +477,7 @@ func (suite *KeeperTestSuite) TestMsgTimeout() { { name: "failure: no-op", malleate: func() { - suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.DeletePacketCommitment(suite.chainA.GetContext(), packet.SourceId, 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. @@ -500,21 +500,21 @@ func (suite *KeeperTestSuite) TestMsgTimeout() { name: "failure: channel not found", malleate: func() { // change the source id to a non-existent channel. - packet.SourceId = "not-existent-channel" + packet.SourceClient = "not-existent-channel" }, expError: types.ErrChannelNotFound, }, { name: "failure: invalid commitment", malleate: func() { - suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SetPacketCommitment(suite.chainA.GetContext(), packet.SourceId, 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.DestinationId, 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 d2eec72ac6d..9980dfe4611 100644 --- a/modules/core/04-channel/v2/keeper/packet.go +++ b/modules/core/04-channel/v2/keeper/packet.go @@ -20,26 +20,26 @@ import ( // in order for the packet to be sent to the counterparty. func (k *Keeper) sendPacket( ctx context.Context, - sourceId string, + sourceClient string, timeoutTimestamp uint64, payloads []types.Payload, ) (uint64, string, error) { // lookup counterparty and clientid from packet identifiers - clientID, counterparty, err := k.resolveV2Identifiers(ctx, payloads[0].SourcePort, sourceId) + clientID, counterparty, err := k.resolveV2Identifiers(ctx, payloads[0].SourcePort, sourceClient) if err != nil { return 0, "", err } - sequence, found := k.GetNextSequenceSend(ctx, sourceId) + sequence, found := k.GetNextSequenceSend(ctx, sourceClient) if !found { return 0, "", errorsmod.Wrapf( types.ErrSequenceSendNotFound, - "source id: %s", sourceId, + "source id: %s", sourceClient, ) } // construct packet from given fields and channel state - packet := types.NewPacket(sequence, sourceId, counterparty.ClientId, 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) @@ -71,10 +71,10 @@ 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, sourceId, sequence+1) - k.SetPacketCommitment(ctx, sourceId, 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_id", packet.DestinationId, "src_id", packet.SourceId) + 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) @@ -95,13 +95,13 @@ func (k *Keeper) recvPacket( proofHeight exported.Height, ) error { // lookup counterparty and clientid from packet identifiers - clientID, counterparty, err := k.resolveV2Identifiers(ctx, packet.Payloads[0].SourcePort, packet.DestinationId) + clientID, counterparty, err := k.resolveV2Identifiers(ctx, packet.Payloads[0].SourcePort, packet.DestinationClient) if err != nil { return err } - if counterparty.ClientId != packet.SourceId { - return errorsmod.Wrapf(types.ErrInvalidChannelIdentifier, "counterparty id (%s) does not match packet source id (%s)", &counterparty.ClientId, packet.SourceId) + if counterparty.ClientId != packet.SourceClient { + return errorsmod.Wrapf(types.ErrInvalidChannelIdentifier, "counterparty id (%s) does not match packet source id (%s)", &counterparty.ClientId, packet.SourceClient) } // check if packet timed out by comparing it with the latest height of the chain @@ -114,14 +114,14 @@ 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 // by the increase of the recvStartSequence. - if k.HasPacketReceipt(ctx, packet.DestinationId, 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.SourceId, packet.Sequence) + path := hostv2.PacketCommitmentKey(packet.SourceClient, packet.Sequence) merklePrefix := commitmenttypes.NewMerklePath(counterparty.MerklePrefix...) merklePath := types.BuildMerklePath(merklePrefix, path) @@ -140,9 +140,9 @@ func (k *Keeper) recvPacket( } // Set Packet Receipt to prevent timeout from occurring on counterparty - k.SetPacketReceipt(ctx, packet.DestinationId, packet.Sequence) + k.SetPacketReceipt(ctx, packet.DestinationClient, packet.Sequence) - k.Logger(ctx).Info("packet received", "sequence", strconv.FormatUint(packet.Sequence, 10), "src_id", packet.SourceId, "dst_id", packet.DestinationId) + 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) @@ -157,33 +157,33 @@ func (k Keeper) WriteAcknowledgement( ack types.Acknowledgement, ) error { // lookup counterparty and clientid from packet identifiers - _, counterparty, err := k.resolveV2Identifiers(ctx, packet.Payloads[0].SourcePort, packet.DestinationId) + _, counterparty, err := k.resolveV2Identifiers(ctx, packet.Payloads[0].SourcePort, packet.DestinationClient) if err != nil { return err } - if counterparty.ClientId != packet.SourceId { - return errorsmod.Wrapf(types.ErrInvalidChannelIdentifier, "counterparty id (%s) does not match packet source id (%s)", &counterparty.ClientId, packet.SourceId) + if counterparty.ClientId != packet.SourceClient { + return errorsmod.Wrapf(types.ErrInvalidChannelIdentifier, "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.DestinationId, packet.Sequence) { - return errorsmod.Wrapf(types.ErrAcknowledgementExists, "acknowledgement for id %s, sequence %d already exists", packet.DestinationId, 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.DestinationId, 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.DestinationId, packet.Sequence, + ctx, packet.DestinationClient, packet.Sequence, types.CommitAcknowledgement(ack), ) - k.Logger(ctx).Info("acknowledgement written", "sequence", strconv.FormatUint(packet.Sequence, 10), "dest-id", packet.DestinationId) + k.Logger(ctx).Info("acknowledgement written", "sequence", strconv.FormatUint(packet.Sequence, 10), "dst_client_id", packet.DestinationClient) emitWriteAcknowledgementEvents(ctx, packet, ack) @@ -194,16 +194,16 @@ 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 and clientid from packet identifiers - clientID, counterparty, err := k.resolveV2Identifiers(ctx, packet.Payloads[0].SourcePort, packet.DestinationId) + clientID, counterparty, err := k.resolveV2Identifiers(ctx, packet.Payloads[0].SourcePort, packet.DestinationClient) if err != nil { return err } - if counterparty.ClientId != packet.DestinationId { - return errorsmod.Wrapf(types.ErrInvalidChannelIdentifier, "counterparty id (%s) does not match packet destination id (%s)", counterparty.ClientId, packet.DestinationId) + if counterparty.ClientId != packet.DestinationClient { + return errorsmod.Wrapf(types.ErrInvalidChannelIdentifier, "counterparty id (%s) does not match packet destination id (%s)", counterparty.ClientId, packet.DestinationClient) } - commitment := k.GetPacketCommitment(ctx, packet.SourceId, 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 @@ -219,7 +219,7 @@ 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.DestinationId, packet.Sequence) + path := hostv2.PacketAcknowledgementKey(packet.DestinationClient, packet.Sequence) merklePrefix := commitmenttypes.NewMerklePath(counterparty.MerklePrefix...) merklePath := types.BuildMerklePath(merklePrefix, path) @@ -235,9 +235,9 @@ func (k *Keeper) acknowledgePacket(ctx context.Context, packet types.Packet, ack return errorsmod.Wrapf(err, "failed packet acknowledgement verification for client (%s)", clientID) } - k.DeletePacketCommitment(ctx, packet.SourceId, packet.Sequence) + k.DeletePacketCommitment(ctx, packet.SourceClient, packet.Sequence) - k.Logger(ctx).Info("packet acknowledged", "sequence", strconv.FormatUint(packet.GetSequence(), 10), "source_id", packet.GetSourceId(), "destination_id", packet.GetDestinationId()) + 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) @@ -258,13 +258,13 @@ func (k *Keeper) timeoutPacket( proofHeight exported.Height, ) error { // lookup counterparty and clientid from packet identifiers - clientID, counterparty, err := k.resolveV2Identifiers(ctx, packet.Payloads[0].SourcePort, packet.DestinationId) + clientID, counterparty, err := k.resolveV2Identifiers(ctx, packet.Payloads[0].SourcePort, packet.DestinationClient) if err != nil { return err } - if counterparty.ClientId != packet.DestinationId { - return errorsmod.Wrapf(types.ErrInvalidChannelIdentifier, "counterparty id (%s) does not match packet destination id (%s)", &counterparty.ClientId, packet.DestinationId) + if counterparty.ClientId != packet.DestinationClient { + return errorsmod.Wrapf(types.ErrInvalidChannelIdentifier, "counterparty id (%s) does not match packet destination id (%s)", &counterparty.ClientId, packet.DestinationClient) } // check that timeout height or timeout timestamp has passed on the other end @@ -279,7 +279,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.SourceId, 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 @@ -295,7 +295,7 @@ func (k *Keeper) timeoutPacket( } // verify packet receipt absence - path := hostv2.PacketReceiptKey(packet.DestinationId, packet.Sequence) + path := hostv2.PacketReceiptKey(packet.DestinationClient, packet.Sequence) merklePrefix := commitmenttypes.NewMerklePath(counterparty.MerklePrefix...) merklePath := types.BuildMerklePath(merklePrefix, path) @@ -311,9 +311,9 @@ func (k *Keeper) timeoutPacket( } // delete packet commitment to prevent replay - k.DeletePacketCommitment(ctx, packet.SourceId, packet.Sequence) + k.DeletePacketCommitment(ctx, packet.SourceClient, packet.Sequence) - k.Logger(ctx).Info("packet timed out", "sequence", strconv.FormatUint(packet.Sequence, 10), "src_id", packet.SourceId, "dst_id", packet.DestinationId) + 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 c6bcc50f3ea..157562216e6 100644 --- a/modules/core/04-channel/v2/keeper/packet_test.go +++ b/modules/core/04-channel/v2/keeper/packet_test.go @@ -36,7 +36,7 @@ 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.SourceId, 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 }, @@ -45,7 +45,7 @@ func (suite *KeeperTestSuite) TestSendPacket() { { "channel not found", func() { - packet.SourceId = ibctesting.InvalidID + packet.SourceClient = ibctesting.InvalidID }, types.ErrChannelNotFound, }, @@ -109,7 +109,7 @@ func (suite *KeeperTestSuite) TestSendPacket() { tc.malleate() // send packet - seq, destChannel, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceId, packet.TimeoutTimestamp, packet.Payloads) + seq, destChannel, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceClient, packet.TimeoutTimestamp, packet.Payloads) expPass := tc.expError == nil if expPass { @@ -119,12 +119,12 @@ func (suite *KeeperTestSuite) TestSendPacket() { suite.Require().Equal(path.EndpointB.ChannelID, destChannel) // 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.SourceId, 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.SourceId, seq)) + suite.Require().Nil(suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.GetPacketCommitment(suite.chainA.GetContext(), packet.SourceClient, seq)) } }) @@ -151,7 +151,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { { "failure: channel not found", func() { - packet.DestinationId = ibctesting.InvalidID + packet.DestinationClient = ibctesting.InvalidID }, types.ErrChannelNotFound, }, @@ -165,7 +165,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { { "failure: counterparty channel identifier different than source channel", func() { - packet.SourceId = unusedChannel + packet.SourceClient = unusedChannel }, types.ErrInvalidChannelIdentifier, }, @@ -179,14 +179,14 @@ func (suite *KeeperTestSuite) TestRecvPacket() { { "failure: packet already received", func() { - suite.chainB.App.GetIBCKeeper().ChannelKeeperV2.SetPacketReceipt(suite.chainB.GetContext(), packet.DestinationId, 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.SourceId, 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.GetSourceId(), 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.DestinationId, 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) @@ -252,14 +252,14 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgement() { { "failure: channel not found", func() { - packet.DestinationId = ibctesting.InvalidID + packet.DestinationClient = ibctesting.InvalidID }, types.ErrChannelNotFound, }, { "failure: counterparty channel identifier different than source channel", func() { - packet.SourceId = unusedChannel + packet.SourceClient = unusedChannel }, types.ErrInvalidChannelIdentifier, }, @@ -267,7 +267,7 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgement() { "failure: ack already exists", func() { ackBz := types.CommitAcknowledgement(ack) - suite.chainB.App.GetIBCKeeper().ChannelKeeperV2.SetPacketAcknowledgement(suite.chainB.GetContext(), packet.DestinationId, packet.Sequence, ackBz) + suite.chainB.App.GetIBCKeeper().ChannelKeeperV2.SetPacketAcknowledgement(suite.chainB.GetContext(), packet.DestinationClient, packet.Sequence, ackBz) }, types.ErrAcknowledgementExists, }, @@ -301,7 +301,7 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgement() { AppAcknowledgements: [][]byte{mockv2.MockRecvPacketResult.Acknowledgement}, } - suite.chainB.App.GetIBCKeeper().ChannelKeeperV2.SetPacketReceipt(suite.chainB.GetContext(), packet.DestinationId, 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.DestinationId, 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) @@ -344,21 +344,21 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { { "failure: channel not found", func() { - packet.SourceId = ibctesting.InvalidID + packet.SourceClient = ibctesting.InvalidID }, types.ErrChannelNotFound, }, { "failure: counterparty channel identifier different than source channel", func() { - packet.DestinationId = unusedChannel + packet.DestinationClient = unusedChannel }, types.ErrInvalidChannelIdentifier, }, { "failure: packet commitment doesn't exist.", func() { - suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.DeletePacketCommitment(suite.chainA.GetContext(), packet.SourceId, 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.DestinationId, 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.SourceId, 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,7 +448,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { "success", func() { // send packet - _, _, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceId, + _, _, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceClient, packet.TimeoutTimestamp, packet.Payloads) suite.Require().NoError(err, "send packet failed") }, @@ -458,11 +458,11 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { "failure: channel not found", func() { // send packet - _, _, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceId, + _, _, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceClient, packet.TimeoutTimestamp, packet.Payloads) suite.Require().NoError(err, "send packet failed") - packet.SourceId = ibctesting.InvalidID + packet.SourceClient = ibctesting.InvalidID }, types.ErrChannelNotFound, }, @@ -470,11 +470,11 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { "failure: counterparty channel identifier different than source channel", func() { // send packet - _, _, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceId, + _, _, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceClient, packet.TimeoutTimestamp, packet.Payloads) suite.Require().NoError(err, "send packet failed") - packet.DestinationId = unusedChannel + packet.DestinationClient = unusedChannel }, types.ErrInvalidChannelIdentifier, }, @@ -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.SourceId, + _, _, 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.SourceId, + _, _, 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.SourceId, + _, _, 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.SourceId, + _, _, 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.DestinationId, packet.Sequence) + suite.chainB.App.GetIBCKeeper().ChannelKeeperV2.SetPacketReceipt(suite.chainB.GetContext(), packet.DestinationClient, packet.Sequence) }, commitmenttypes.ErrInvalidProof, }, @@ -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.DestinationId, 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.DestinationId, 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/commitment.go b/modules/core/04-channel/v2/types/commitment.go index 70f4e11fcb4..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(destinationId) + 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.DestinationId)) + 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 264faf73b50..54b9890ef0b 100644 --- a/modules/core/04-channel/v2/types/commitment_test.go +++ b/modules/core/04-channel/v2/types/commitment_test.go @@ -57,10 +57,10 @@ func TestCommitPacket(t *testing.T) { }) require.NoError(t, err) packet = types.Packet{ - Sequence: 1, - SourceId: "channel-0", - DestinationId: "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/msgs.go b/modules/core/04-channel/v2/types/msgs.go index 8c9d3609be3..ead580b1742 100644 --- a/modules/core/04-channel/v2/types/msgs.go +++ b/modules/core/04-channel/v2/types/msgs.go @@ -89,9 +89,9 @@ func (msg *MsgRegisterCounterparty) ValidateBasic() error { } // 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 +100,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..74d968339dd 100644 --- a/modules/core/04-channel/v2/types/msgs_test.go +++ b/modules/core/04-channel/v2/types/msgs_test.go @@ -161,7 +161,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 935f98e7789..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, sourceId, destinationId string, timeoutTimestamp uint64, payloads ...Payload) Packet { +func NewPacket(sequence uint64, sourceClient, destinationClient string, timeoutTimestamp uint64, payloads ...Payload) Packet { return Packet{ - Sequence: sequence, - SourceId: sourceId, - DestinationId: destinationId, - TimeoutTimestamp: timeoutTimestamp, - Payloads: payloads, + Sequence: sequence, + SourceClient: sourceClient, + DestinationClient: destinationClient, + TimeoutTimestamp: timeoutTimestamp, + Payloads: payloads, } } @@ -43,10 +43,10 @@ func (p Packet) ValidateBasic() error { } } - if err := host.ChannelIdentifierValidator(p.SourceId); err != nil { + if err := host.ChannelIdentifierValidator(p.SourceClient); err != nil { return errorsmod.Wrap(err, "invalid source ID") } - if err := host.ChannelIdentifierValidator(p.DestinationId); err != nil { + if err := host.ChannelIdentifierValidator(p.DestinationClient); err != nil { return errorsmod.Wrap(err, "invalid destination ID") } diff --git a/modules/core/04-channel/v2/types/packet.pb.go b/modules/core/04-channel/v2/types/packet.pb.go index e3772a5a84f..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. - SourceId string `protobuf:"bytes,2,opt,name=source_id,json=sourceId,proto3" json:"source_id,omitempty"` - // identifies the receiving chain. - DestinationId string `protobuf:"bytes,3,opt,name=destination_id,json=destinationId,proto3" json:"destination_id,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) GetSourceId() string { +func (m *Packet) GetSourceClient() string { if m != nil { - return m.SourceId + return m.SourceClient } return "" } -func (m *Packet) GetDestinationId() string { +func (m *Packet) GetDestinationClient() string { if m != nil { - return m.DestinationId + 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{ - // 589 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x93, 0xc1, 0x6e, 0xd3, 0x4c, - 0x14, 0x85, 0x33, 0x4d, 0xd2, 0x26, 0xd3, 0xfc, 0xad, 0xff, 0x69, 0x91, 0x4c, 0x40, 0xa9, 0x89, - 0x04, 0x04, 0x50, 0x6d, 0x08, 0x6c, 0x2a, 0x21, 0xa4, 0x34, 0x4d, 0xa5, 0x08, 0x14, 0xa2, 0x71, - 0x82, 0x04, 0x9b, 0x68, 0x32, 0x1e, 0xb9, 0x56, 0x6d, 0x8f, 0xf1, 0x8c, 0x5d, 0xf5, 0x15, 0xba, - 0xe2, 0x05, 0xba, 0x60, 0xcd, 0x8b, 0x74, 0xd9, 0x0d, 0x12, 0x2b, 0x84, 0xda, 0x17, 0x41, 0x1e, - 0xbb, 0x55, 0x5a, 0x60, 0x65, 0xdf, 0x73, 0xbf, 0xe3, 0xf1, 0xb9, 0xa3, 0x0b, 0x0d, 0x6f, 0x4e, - 0x2d, 0xca, 0x63, 0x66, 0xd1, 0x03, 0x12, 0x86, 0xcc, 0xb7, 0xd2, 0xae, 0x15, 0x11, 0x7a, 0xc8, - 0xa4, 0x19, 0xc5, 0x5c, 0x72, 0xb4, 0xe1, 0xcd, 0xa9, 0x99, 0x11, 0x66, 0x41, 0x98, 0x69, 0xb7, - 0xb9, 0xe9, 0x72, 0x97, 0xab, 0xbe, 0x95, 0xbd, 0xe5, 0x68, 0xfb, 0x3b, 0x80, 0xcb, 0x63, 0xe5, - 0x45, 0x4d, 0x58, 0x13, 0xec, 0x73, 0xc2, 0x42, 0xca, 0x74, 0x60, 0x80, 0x4e, 0x05, 0x5f, 0xd7, - 0xe8, 0x1e, 0xac, 0x0b, 0x9e, 0xc4, 0x94, 0xcd, 0x3c, 0x47, 0x5f, 0x32, 0x40, 0xa7, 0x8e, 0x6b, - 0xb9, 0x30, 0x74, 0xd0, 0x43, 0xb8, 0xe6, 0x30, 0x21, 0xbd, 0x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xdd, 0xb1, 0x02, 0xee, 0x24, 0x3e, 0x13, 0xf9, 0xbe, - 0x3d, 0x7f, 0xb5, 0xbd, 0xb0, 0x72, 0xf2, 0x38, 0x62, 0x62, 0xbe, 0xac, 0xf6, 0xe8, 0xe5, 0xef, - 0x00, 0x00, 0x00, 0xff, 0xff, 0x11, 0xd0, 0xf5, 0x38, 0x96, 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, 0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, 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.DestinationId) > 0 { - i -= len(m.DestinationId) - copy(dAtA[i:], m.DestinationId) - i = encodeVarintPacket(dAtA, i, uint64(len(m.DestinationId))) + 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.SourceId) > 0 { - i -= len(m.SourceId) - copy(dAtA[i:], m.SourceId) - i = encodeVarintPacket(dAtA, i, uint64(len(m.SourceId))) + 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.SourceId) + l = len(m.SourceClient) if l > 0 { n += 1 + l + sovPacket(uint64(l)) } - l = len(m.DestinationId) + 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 SourceId", 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.SourceId = 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 DestinationId", 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.DestinationId = 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 1d476b11474..ec5d5776160 100644 --- a/modules/core/04-channel/v2/types/packet_test.go +++ b/modules/core/04-channel/v2/types/packet_test.go @@ -57,14 +57,14 @@ func TestValidateBasic(t *testing.T) { { "failure: invalid source ID", func() { - packet.SourceId = "" + packet.SourceClient = "" }, host.ErrInvalidID, }, { "failure: invalid dest ID", func() { - packet.DestinationId = "" + packet.DestinationClient = "" }, host.ErrInvalidID, }, diff --git a/modules/core/04-channel/v2/types/tx.pb.go b/modules/core/04-channel/v2/types/tx.pb.go index b40a86332a0..7f8de660dd8 100644 --- a/modules/core/04-channel/v2/types/tx.pb.go +++ b/modules/core/04-channel/v2/types/tx.pb.go @@ -232,7 +232,7 @@ 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"` @@ -566,70 +566,70 @@ 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, 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, 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, + // 995 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x96, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xc7, 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27, 0xc5, + 0xd4, 0xd3, 0x93, 0x62, 0xea, 0xd9, 0x49, 0x31, 0xf5, 0xcd, 0xe7, 0xa6, 0x15, 0xf4, 0x87, 0xdd, + 0xf0, 0xc1, 0x27, 0xf1, 0x17, 0xad, 0xd5, 0x35, 0x36, 0x4d, 0x57, 0x1a, 0x6d, 0x49, 0xb6, 0xdb, + 0x1b, 0x0e, 0x30, 0x61, 0x4f, 0xd1, 0x8f, 0x6f, 0x6d, 0xc6, 0x9f, 0xcc, 0xfb, 0x1e, 0x26, 0xdd, + 0x79, 0xfa, 0x0c, 0xfd, 0xe4, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x10, 0x9a, 0x56, 0xa7, 0x56, + 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1094,10 +1094,10 @@ func (m *MsgSendPacket) MarshalToSizedBuffer(dAtA []byte) (int, error) { 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))) + 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 } @@ -1476,7 +1476,7 @@ func (m *MsgSendPacket) Size() (n int) { } var l int _ = l - l = len(m.SourceChannel) + l = len(m.SourceClient) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -2071,7 +2071,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 +2099,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 b22d8edb64c..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.SourceId, 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.DestinationId, 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.SourceId, 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 b508e12b8f4..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.SourceId), + telemetry.NewLabel(ibcmetrics.LabelSourceChannel, packet.SourceClient), telemetry.NewLabel(ibcmetrics.LabelDestinationPort, payload.DestinationPort), - telemetry.NewLabel(ibcmetrics.LabelDestinationChannel, packet.DestinationId), + 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.SourceId), + telemetry.NewLabel(ibcmetrics.LabelSourceChannel, packet.SourceClient), telemetry.NewLabel(ibcmetrics.LabelDestinationPort, payload.DestinationPort), - telemetry.NewLabel(ibcmetrics.LabelDestinationChannel, packet.DestinationId), + 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.SourceId), + telemetry.NewLabel(ibcmetrics.LabelSourceChannel, packet.SourceClient), telemetry.NewLabel(ibcmetrics.LabelDestinationPort, payload.DestinationPort), - telemetry.NewLabel(ibcmetrics.LabelDestinationChannel, packet.DestinationId), + telemetry.NewLabel(ibcmetrics.LabelDestinationChannel, packet.DestinationClient), }, ) } diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index f4af9cde1cf..1f175e2d8ab 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -55,7 +55,7 @@ func (k *Keeper) RegisterCounterparty(ctx context.Context, msg *clienttypes.MsgR } counterpartyInfo := clienttypes.CounterpartyInfo{ - MerklePrefix: msg.MerklePrefix, + MerklePrefix: msg.CounterpartyMerklePrefix, ClientId: msg.CounterpartyClientId, } k.ClientKeeper.SetClientCounterparty(ctx, msg.ClientId, counterpartyInfo) diff --git a/proto/ibc/core/channel/v2/packet.proto b/proto/ibc/core/channel/v2/packet.proto index 56f5ed3a798..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_id = 2; - // identifies the receiving chain. - string destination_id = 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/tx.proto b/proto/ibc/core/channel/v2/tx.proto index 27eaa08c805..75ec4d45e39 100644 --- a/proto/ibc/core/channel/v2/tx.proto +++ b/proto/ibc/core/channel/v2/tx.proto @@ -78,7 +78,7 @@ 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 index 042fa63adc7..4ed4f6e03ed 100644 --- a/proto/ibc/core/client/v2/counterparty.proto +++ b/proto/ibc/core/client/v2/counterparty.proto @@ -32,7 +32,7 @@ message MsgRegisterCounterparty { // client identifier string client_id = 1; // counterparty merkle prefix - repeated bytes merkle_prefix = 2; + repeated bytes counterparty_merkle_prefix = 2; // counterparty client identifier string counterparty_client_id = 3; // signer address From 63bed6b19541470e2669ccb88f795cba057ab880 Mon Sep 17 00:00:00 2001 From: Aditya Sripal <14364734+AdityaSripal@users.noreply.github.com> Date: Wed, 15 Jan 2025 14:33:13 +0100 Subject: [PATCH 07/18] fix test file --- testing/endpoint_v2.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/testing/endpoint_v2.go b/testing/endpoint_v2.go index 3442e66f27a..0d4d6f03c40 100644 --- a/testing/endpoint_v2.go +++ b/testing/endpoint_v2.go @@ -82,7 +82,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.SourceId, 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 +96,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.DestinationId, 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 +110,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.DestinationId, 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()) From 249c17014321eace6b3016c00bae1ebabfc2d0bc Mon Sep 17 00:00:00 2001 From: Aditya Sripal <14364734+AdityaSripal@users.noreply.github.com> Date: Wed, 15 Jan 2025 19:00:00 +0100 Subject: [PATCH 08/18] start to fix tests --- modules/core/02-client/types/codec.go | 1 + modules/core/04-channel/v2/keeper/keeper.go | 81 ++++++++++--------- .../04-channel/v2/keeper/msg_server_test.go | 14 ++-- modules/core/04-channel/v2/keeper/packet.go | 14 ++-- .../core/04-channel/v2/keeper/packet_test.go | 40 ++++----- modules/core/keeper/msg_server.go | 7 +- modules/core/module.go | 1 + testing/endpoint_v2.go | 7 +- testing/path.go | 2 +- 9 files changed, 88 insertions(+), 79 deletions(-) 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/04-channel/v2/keeper/keeper.go b/modules/core/04-channel/v2/keeper/keeper.go index 5f71e05b392..98d98a3b4fe 100644 --- a/modules/core/04-channel/v2/keeper/keeper.go +++ b/modules/core/04-channel/v2/keeper/keeper.go @@ -75,15 +75,15 @@ func (k Keeper) creatorStore(ctx context.Context) storetypes.KVStore { } // SetChannel sets the Channel for a given channel identifier. -func (k *Keeper) SetChannel(ctx context.Context, channelID string, channel types.Channel) { +func (k *Keeper) SetChannel(ctx context.Context, clientID string, channel types.Channel) { bz := k.cdc.MustMarshal(&channel) - k.channelStore(ctx).Set([]byte(channelID), bz) + k.channelStore(ctx).Set([]byte(clientID), bz) } // GetChannel gets the Channel for a given channel identifier. -func (k *Keeper) GetChannel(ctx context.Context, channelID string) (types.Channel, bool) { +func (k *Keeper) GetChannel(ctx context.Context, clientID string) (types.Channel, bool) { store := k.channelStore(ctx) - bz := store.Get([]byte(channelID)) + bz := store.Get([]byte(clientID)) if len(bz) == 0 { return types.Channel{}, false } @@ -94,14 +94,14 @@ func (k *Keeper) GetChannel(ctx context.Context, channelID string) (types.Channe } // HasChannel returns true if a Channel exists for a given channel identifier, otherwise false. -func (k *Keeper) HasChannel(ctx context.Context, channelID string) bool { +func (k *Keeper) HasChannel(ctx context.Context, clientID string) bool { store := k.channelStore(ctx) - return store.Has([]byte(channelID)) + return store.Has([]byte(clientID)) } // 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)) +func (k *Keeper) GetCreator(ctx context.Context, clientID string) (string, bool) { + bz := k.creatorStore(ctx).Get([]byte(clientID)) if len(bz) == 0 { return "", false } @@ -110,19 +110,19 @@ func (k *Keeper) GetCreator(ctx context.Context, channelID string) (string, bool } // 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)) +func (k *Keeper) SetCreator(ctx context.Context, clientID, creator string) { + k.creatorStore(ctx).Set([]byte(clientID), []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)) +func (k *Keeper) DeleteCreator(ctx context.Context, clientID string) { + k.creatorStore(ctx).Delete([]byte(clientID)) } -// 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) } @@ -133,9 +133,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) } @@ -145,17 +145,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) } @@ -164,22 +164,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) } @@ -190,47 +190,49 @@ 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) } + // initialize sequence to 1 if it does not exist if len(bz) == 0 { - return 0, false + k.SetNextSequenceSend(ctx, clientID, 1) + return 1, true } return sdk.BigEndianToUint64(bz), true } // 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) +func (k *Keeper) aliasV1Channel(ctx context.Context, portID, clientID string) (types.Channel, bool) { + channel, ok := k.channelKeeperV1.GetChannel(ctx, portID, clientID) if !ok { return types.Channel{}, false } @@ -272,6 +274,9 @@ func (k *Keeper) resolveV2Identifiers(ctx context.Context, portId string, packet // this is because we want to preserve the original identifiers that are used to write provable paths to each other counterpartyInfo = clienttypes.NewCounterpartyInfo(merklePrefix, channel.Counterparty.ChannelId) return connection.ClientId, counterpartyInfo, nil + } else { + // neither client nor channel exists so return client not found error + return "", clienttypes.CounterpartyInfo{}, clienttypes.ErrClientNotFound } } return packetId, counterpartyInfo, nil 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 4789308e614..d6f1805eb92 100644 --- a/modules/core/04-channel/v2/keeper/msg_server_test.go +++ b/modules/core/04-channel/v2/keeper/msg_server_test.go @@ -122,7 +122,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 +167,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.ErrClientNotFound, }, { name: "failure: route to non existing app", @@ -194,7 +194,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 +207,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") diff --git a/modules/core/04-channel/v2/keeper/packet.go b/modules/core/04-channel/v2/keeper/packet.go index 9980dfe4611..5f2a63b74e6 100644 --- a/modules/core/04-channel/v2/keeper/packet.go +++ b/modules/core/04-channel/v2/keeper/packet.go @@ -95,13 +95,13 @@ func (k *Keeper) recvPacket( proofHeight exported.Height, ) error { // lookup counterparty and clientid from packet identifiers - clientID, counterparty, err := k.resolveV2Identifiers(ctx, packet.Payloads[0].SourcePort, packet.DestinationClient) + clientID, counterparty, err := k.resolveV2Identifiers(ctx, packet.Payloads[0].DestinationPort, packet.DestinationClient) if err != nil { return err } if counterparty.ClientId != packet.SourceClient { - return errorsmod.Wrapf(types.ErrInvalidChannelIdentifier, "counterparty id (%s) does not match packet source id (%s)", &counterparty.ClientId, packet.SourceClient) + return errorsmod.Wrapf(types.ErrInvalidChannelIdentifier, "counterparty id (%s) does not match packet source id (%s)", counterparty.ClientId, packet.SourceClient) } // check if packet timed out by comparing it with the latest height of the chain @@ -157,13 +157,13 @@ func (k Keeper) WriteAcknowledgement( ack types.Acknowledgement, ) error { // lookup counterparty and clientid from packet identifiers - _, counterparty, err := k.resolveV2Identifiers(ctx, packet.Payloads[0].SourcePort, packet.DestinationClient) + _, counterparty, err := k.resolveV2Identifiers(ctx, packet.Payloads[0].DestinationPort, packet.DestinationClient) if err != nil { return err } if counterparty.ClientId != packet.SourceClient { - return errorsmod.Wrapf(types.ErrInvalidChannelIdentifier, "counterparty id (%s) does not match packet source id (%s)", &counterparty.ClientId, packet.SourceClient) + return errorsmod.Wrapf(types.ErrInvalidChannelIdentifier, "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 @@ -194,7 +194,7 @@ 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 and clientid from packet identifiers - clientID, counterparty, err := k.resolveV2Identifiers(ctx, packet.Payloads[0].SourcePort, packet.DestinationClient) + clientID, counterparty, err := k.resolveV2Identifiers(ctx, packet.Payloads[0].SourcePort, packet.SourceClient) if err != nil { return err } @@ -258,13 +258,13 @@ func (k *Keeper) timeoutPacket( proofHeight exported.Height, ) error { // lookup counterparty and clientid from packet identifiers - clientID, counterparty, err := k.resolveV2Identifiers(ctx, packet.Payloads[0].SourcePort, packet.DestinationClient) + clientID, counterparty, err := k.resolveV2Identifiers(ctx, packet.Payloads[0].SourcePort, packet.SourceClient) if err != nil { return err } if counterparty.ClientId != packet.DestinationClient { - return errorsmod.Wrapf(types.ErrInvalidChannelIdentifier, "counterparty id (%s) does not match packet destination id (%s)", &counterparty.ClientId, packet.DestinationClient) + return errorsmod.Wrapf(types.ErrInvalidChannelIdentifier, "counterparty id (%s) does not match packet destination id (%s)", counterparty.ClientId, packet.DestinationClient) } // check that timeout height or timeout timestamp has passed on the other end diff --git a/modules/core/04-channel/v2/keeper/packet_test.go b/modules/core/04-channel/v2/keeper/packet_test.go index 157562216e6..b75d661db41 100644 --- a/modules/core/04-channel/v2/keeper/packet_test.go +++ b/modules/core/04-channel/v2/keeper/packet_test.go @@ -43,17 +43,17 @@ func (suite *KeeperTestSuite) TestSendPacket() { nil, }, { - "channel not found", + "client not found", func() { packet.SourceClient = ibctesting.InvalidID }, - types.ErrChannelNotFound, + clienttypes.ErrClientNotFound, }, { "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,14 +109,14 @@ func (suite *KeeperTestSuite) TestSendPacket() { tc.malleate() // send packet - seq, destChannel, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceClient, 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.SourceClient, seq)) @@ -149,11 +149,11 @@ func (suite *KeeperTestSuite) TestRecvPacket() { nil, }, { - "failure: channel not found", + "failure: client not found", func() { packet.DestinationClient = ibctesting.InvalidID }, - types.ErrChannelNotFound, + clienttypes.ErrClientNotFound, }, { "failure: client is not active", @@ -163,7 +163,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { clienttypes.ErrClientNotActive, }, { - "failure: counterparty channel identifier different than source channel", + "failure: counterparty client identifier different than source client", func() { packet.SourceClient = unusedChannel }, @@ -250,14 +250,14 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgement() { nil, }, { - "failure: channel not found", + "failure: client not found", func() { packet.DestinationClient = ibctesting.InvalidID }, - types.ErrChannelNotFound, + clienttypes.ErrClientNotFound, }, { - "failure: counterparty channel identifier different than source channel", + "failure: counterparty client identifier different than source client", func() { packet.SourceClient = unusedChannel }, @@ -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 @@ -342,14 +342,14 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { nil, }, { - "failure: channel not found", + "failure: client not found", func() { packet.SourceClient = ibctesting.InvalidID }, - types.ErrChannelNotFound, + clienttypes.ErrClientNotFound, }, { - "failure: counterparty channel identifier different than source channel", + "failure: counterparty client identifier different than destination client", func() { packet.DestinationClient = unusedChannel }, @@ -455,7 +455,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { nil, }, { - "failure: channel not found", + "failure: client not found", func() { // send packet _, _, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceClient, @@ -464,10 +464,10 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { packet.SourceClient = ibctesting.InvalidID }, - types.ErrChannelNotFound, + clienttypes.ErrClientNotFound, }, { - "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.SourceClient, @@ -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() diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index 1f175e2d8ab..3030014944e 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. 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/testing/endpoint_v2.go b/testing/endpoint_v2.go index 0d4d6f03c40..3e9671dff9b 100644 --- a/testing/endpoint_v2.go +++ b/testing/endpoint_v2.go @@ -5,6 +5,7 @@ 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" ) @@ -30,7 +31,7 @@ func (endpoint *Endpoint) CreateChannel() (err error) { // 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 +51,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 +75,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 } diff --git a/testing/path.go b/testing/path.go index 862b03d3691..823c4999839 100644 --- a/testing/path.go +++ b/testing/path.go @@ -160,7 +160,7 @@ func (path *Path) Setup() { func (path *Path) SetupV2() { path.SetupClients() - path.CreateChannelsV2() + // path.CreateChannelsV2() path.SetupCounterparties() } From be89aafba8e50ca4f082c7bc05beabba7e5a3d54 Mon Sep 17 00:00:00 2001 From: Aditya Sripal <14364734+AdityaSripal@users.noreply.github.com> Date: Thu, 16 Jan 2025 09:32:30 +0100 Subject: [PATCH 09/18] fix v2/keeper tests --- .../core/04-channel/v2/client/cli/query.go | 80 +- .../core/04-channel/v2/keeper/grpc_query.go | 70 +- .../04-channel/v2/keeper/grpc_query_test.go | 763 ++++++++---------- modules/core/04-channel/v2/keeper/keeper.go | 4 +- .../04-channel/v2/keeper/msg_server_test.go | 12 +- modules/core/04-channel/v2/keeper/packet.go | 6 +- modules/core/04-channel/v2/types/genesis.go | 22 +- .../core/04-channel/v2/types/genesis.pb.go | 98 +-- modules/core/04-channel/v2/types/query.go | 26 +- modules/core/04-channel/v2/types/query.pb.go | 401 ++++----- .../core/04-channel/v2/types/query.pb.gw.go | 166 ++-- proto/ibc/core/channel/v2/genesis.proto | 8 +- proto/ibc/core/channel/v2/query.proto | 53 +- 13 files changed, 768 insertions(+), 941 deletions(-) diff --git a/modules/core/04-channel/v2/client/cli/query.go b/modules/core/04-channel/v2/client/cli/query.go index 04f9f91e5c7..dcfe9b64751 100644 --- a/modules/core/04-channel/v2/client/cli/query.go +++ b/modules/core/04-channel/v2/client/cli/query.go @@ -80,14 +80,14 @@ func getCmdQueryChannelClientState() *cobra.Command { 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 +95,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 +111,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 +128,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 +141,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 +153,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 +162,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 +179,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 +197,7 @@ func getCmdQueryPacketCommitments() *cobra.Command { } req := &types.QueryPacketCommitmentsRequest{ - ChannelId: args[0], + ClientId: args[0], Pagination: pageReq, } @@ -211,18 +211,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 +231,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 +243,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 +252,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 +269,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 +282,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 +294,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 +303,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 +322,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 +335,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 +347,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 +365,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 +392,7 @@ The return value represents: } req := &types.QueryUnreceivedAcksRequest{ - ChannelId: args[0], + ClientId: args[0], PacketAckSequences: seqs, } diff --git a/modules/core/04-channel/v2/keeper/grpc_query.go b/modules/core/04-channel/v2/keeper/grpc_query.go index 709781e4a4d..41dbbbca4ca 100644 --- a/modules/core/04-channel/v2/keeper/grpc_query.go +++ b/modules/core/04-channel/v2/keeper/grpc_query.go @@ -116,15 +116,15 @@ func (q *queryServer) NextSequenceSend(ctx context.Context, req *types.QueryNext 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 +136,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 +144,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 +158,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 +173,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 +195,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 +203,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 +217,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 +253,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 +275,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 +283,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 +309,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 +321,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 +355,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 +368,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..d81fda80d5e 100644 --- a/modules/core/04-channel/v2/keeper/grpc_query_test.go +++ b/modules/core/04-channel/v2/keeper/grpc_query_test.go @@ -8,295 +8,292 @@ 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) 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 ( @@ -317,11 +314,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 +334,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 +344,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 +357,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 +408,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 +432,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 +441,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 +459,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 +512,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 +529,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 +542,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 +555,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 +607,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 +617,7 @@ func (suite *KeeperTestSuite) TestQueryPacketAcknowledgements() { } req = &types.QueryPacketAcknowledgementsRequest{ - ChannelId: path.EndpointA.ChannelID, + ClientId: path.EndpointA.ClientID, PacketCommitmentSequences: commitments, Pagination: nil, } @@ -665,13 +633,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 +660,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 +709,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 +727,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 +741,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 +754,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 +805,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 +818,7 @@ func (suite *KeeperTestSuite) TestQueryNextSequenceSend() { status.Error(codes.InvalidArgument, "empty request"), }, { - "invalid channel ID", + "invalid client ID", func() { req = types.NewQueryNextSequenceSendRequest("") }, @@ -878,9 +827,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 +878,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 +893,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 +907,7 @@ func (suite *KeeperTestSuite) TestQueryUnreceivedPackets() { expSeq = []uint64(nil) req = &types.QueryUnreceivedPacketsRequest{ - ChannelId: path.EndpointA.ChannelID, + ClientId: path.EndpointA.ClientID, Sequences: []uint64{}, } }, @@ -983,7 +923,7 @@ func (suite *KeeperTestSuite) TestQueryUnreceivedPackets() { expSeq = []uint64{1} req = &types.QueryUnreceivedPacketsRequest{ - ChannelId: path.EndpointA.ChannelID, + ClientId: path.EndpointA.ClientID, Sequences: []uint64{1}, } }, @@ -995,11 +935,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 +958,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 +1015,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 +1024,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 +1045,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 +1065,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 98d98a3b4fe..54a04b575d4 100644 --- a/modules/core/04-channel/v2/keeper/keeper.go +++ b/modules/core/04-channel/v2/keeper/keeper.go @@ -212,10 +212,8 @@ func (k *Keeper) GetNextSequenceSend(ctx context.Context, clientID string) (uint if err != nil { panic(err) } - // initialize sequence to 1 if it does not exist if len(bz) == 0 { - k.SetNextSequenceSend(ctx, clientID, 1) - return 1, true + return 0, false } return sdk.BigEndianToUint64(bz), true } 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 d6f1805eb92..7164d583f6d 100644 --- a/modules/core/04-channel/v2/keeper/msg_server_test.go +++ b/modules/core/04-channel/v2/keeper/msg_server_test.go @@ -280,7 +280,7 @@ func (suite *KeeperTestSuite) TestMsgRecvPacket() { // change the destination id to a non-existent channel. packet.DestinationClient = ibctesting.InvalidID }, - expError: types.ErrChannelNotFound, + expError: clienttypes.ErrClientNotFound, }, { name: "failure: invalid proof", @@ -407,7 +407,7 @@ func (suite *KeeperTestSuite) TestMsgAcknowledgement() { // change the source id to a non-existent channel. packet.SourceClient = "not-existent-channel" }, - expError: types.ErrChannelNotFound, + expError: clienttypes.ErrClientNotFound, }, { name: "failure: invalid commitment", @@ -497,12 +497,12 @@ 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.SourceClient = "not-existent-channel" + // change the source id to a non-existent client. + packet.SourceClient = "not-existent-client" }, - expError: types.ErrChannelNotFound, + expError: clienttypes.ErrClientNotFound, }, { name: "failure: invalid commitment", diff --git a/modules/core/04-channel/v2/keeper/packet.go b/modules/core/04-channel/v2/keeper/packet.go index 5f2a63b74e6..4657503ece4 100644 --- a/modules/core/04-channel/v2/keeper/packet.go +++ b/modules/core/04-channel/v2/keeper/packet.go @@ -32,10 +32,8 @@ func (k *Keeper) sendPacket( sequence, found := k.GetNextSequenceSend(ctx, sourceClient) if !found { - return 0, "", errorsmod.Wrapf( - types.ErrSequenceSendNotFound, - "source id: %s", sourceClient, - ) + // initialize sequnce to 1 if it does not exist + sequence = 1 } // construct packet from given fields and channel state diff --git a/modules/core/04-channel/v2/types/genesis.go b/modules/core/04-channel/v2/types/genesis.go index 3b567f97c87..fb06476bb41 100644 --- a/modules/core/04-channel/v2/types/genesis.go +++ b/modules/core/04-channel/v2/types/genesis.go @@ -9,11 +9,11 @@ import ( ) // 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,20 +22,20 @@ 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. @@ -123,8 +123,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..079aaa7ac8c 100644 --- a/modules/core/04-channel/v2/types/genesis.pb.go +++ b/modules/core/04-channel/v2/types/genesis.pb.go @@ -114,8 +114,8 @@ func (m *GenesisState) GetNextChannelSequence() uint64 { // 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 +157,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 +196,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 +219,35 @@ 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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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, + // 439 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0x41, 0x8b, 0xd3, 0x40, + 0x14, 0xc7, 0x33, 0xdb, 0xb8, 0x74, 0xa7, 0xeb, 0xa2, 0xb3, 0x0a, 0xb1, 0x42, 0x1a, 0x2b, 0x48, + 0x2f, 0x9b, 0x91, 0xe8, 0x45, 0xf1, 0x14, 0x0f, 0xda, 0xdb, 0x12, 0xc1, 0x83, 0x20, 0x35, 0x99, + 0x79, 0x66, 0x87, 0x4d, 0x66, 0x6a, 0x67, 0x5a, 0xf5, 0x1b, 0x78, 0xf4, 0x23, 0xf8, 0x71, 0xf6, + 0xb8, 0x17, 0xc1, 0xd3, 0x22, 0xed, 0xb7, 0xf0, 0x24, 0x99, 0xa4, 0xa1, 0xb2, 0x45, 0xd8, 0xbd, + 0xbd, 0x79, 0xef, 0xff, 0xff, 0xfd, 0x1f, 0xc3, 0xc3, 0x0f, 0x44, 0xc6, 0x28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xa7, 0x49, 0x84, 0xef, 0x4a, 0xf8, 0x62, 0x26, 0x8d, 0xad, 0x25, 0x7b, + 0xbb, 0x01, 0x1a, 0xb9, 0xc9, 0x61, 0x35, 0x6c, 0x7e, 0x7a, 0x6d, 0x1a, 0x7e, 0xc0, 0xbd, 0x8d, + 0x25, 0xc9, 0x7d, 0xbc, 0xc7, 0x0a, 0x01, 0xd2, 0x4c, 0x04, 0xf7, 0x50, 0x80, 0x46, 0x7b, 0x49, + 0xb7, 0x6e, 0x8c, 0x39, 0xe9, 0xe3, 0x6e, 0x8b, 0xdc, 0xb1, 0xc8, 0xf6, 0x4d, 0x08, 0x76, 0x79, + 0x6a, 0x52, 0xaf, 0x13, 0xa0, 0xd1, 0x7e, 0x62, 0xeb, 0xe7, 0xee, 0xb7, 0x1f, 0x03, 0x67, 0x38, + 0xc6, 0x07, 0xff, 0x2e, 0x7f, 0xed, 0x90, 0xf8, 0xed, 0xd9, 0xd2, 0x47, 0xe7, 0x4b, 0x1f, 0xfd, + 0x5e, 0xfa, 0xe8, 0xfb, 0xca, 0x77, 0xce, 0x57, 0xbe, 0xf3, 0x6b, 0xe5, 0x3b, 0xef, 0x5e, 0xe4, + 0xc2, 0x9c, 0xcc, 0xb3, 0x90, 0xa9, 0x92, 0x32, 0xa5, 0x4b, 0xa5, 0xa9, 0xc8, 0xd8, 0x51, 0xae, + 0xe8, 0xe2, 0x19, 0x2d, 0x15, 0x9f, 0x17, 0xa0, 0xeb, 0x0b, 0x7f, 0xfc, 0xf4, 0x68, 0xe3, 0xc8, + 0xcd, 0xd7, 0x29, 0xe8, 0x6c, 0xd7, 0xde, 0xf8, 0x93, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x70, + 0xe9, 0xcf, 0xef, 0x56, 0x03, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -380,10 +380,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 +415,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 } @@ -484,7 +484,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 +504,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)) } @@ -790,7 +790,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 +818,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 +925,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 +953,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/query.go b/modules/core/04-channel/v2/types/query.go index 92913c0ae19..deec70333ef 100644 --- a/modules/core/04-channel/v2/types/query.go +++ b/modules/core/04-channel/v2/types/query.go @@ -47,9 +47,9 @@ func NewQueryChannelConsensusStateResponse(clientID string, anyConsensusState *c } // 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 +65,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 +82,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 +99,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 +116,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 c6db77defa7..a22ff923532 100644 --- a/modules/core/04-channel/v2/types/query.pb.go +++ b/modules/core/04-channel/v2/types/query.pb.go @@ -376,8 +376,8 @@ func (m *QueryChannelConsensusStateResponse) GetProofHeight() 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{} } @@ -413,9 +413,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 "" } @@ -486,8 +486,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"` } @@ -525,9 +525,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 "" } @@ -605,8 +605,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"` } @@ -644,9 +644,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 "" } @@ -724,8 +724,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"` } @@ -763,9 +763,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 "" } @@ -844,8 +844,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 @@ -885,9 +885,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 "" } @@ -972,12 +972,10 @@ 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{} } @@ -1013,16 +1011,9 @@ func (m *QueryPacketReceiptRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryPacketReceiptRequest proto.InternalMessageInfo -func (m *QueryPacketReceiptRequest) GetPortId() string { +func (m *QueryPacketReceiptRequest) GetClientId() string { if m != nil { - return m.PortId - } - return "" -} - -func (m *QueryPacketReceiptRequest) GetChannelId() string { - if m != nil { - return m.ChannelId + return m.ClientId } return "" } @@ -1100,8 +1091,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"` } @@ -1139,9 +1130,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 "" } @@ -1211,8 +1202,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"` } @@ -1250,9 +1241,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 "" } @@ -1348,91 +1339,90 @@ 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,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x18, 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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 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, + // 1328 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0x51, 0x6f, 0xdb, 0x54, + 0x14, 0xee, 0x6d, 0xbb, 0xad, 0x3d, 0x1d, 0x5b, 0x77, 0xd7, 0x41, 0xeb, 0x76, 0x69, 0x67, 0x24, + 0x96, 0x4d, 0x9b, 0x6f, 0x9b, 0x56, 0x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x69, 0xf6, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8d, 0x64, 0x80, 0x86, 0x13, 0x16, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2165,10 +2155,10 @@ func (m *QueryNextSequenceSendRequest) MarshalToSizedBuffer(dAtA []byte) (int, e _ = 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 } @@ -2245,10 +2235,10 @@ func (m *QueryPacketCommitmentRequest) MarshalToSizedBuffer(dAtA []byte) (int, e 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 } @@ -2334,10 +2324,10 @@ func (m *QueryPacketCommitmentsRequest) MarshalToSizedBuffer(dAtA []byte) (int, 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 } @@ -2428,10 +2418,10 @@ 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 } @@ -2535,10 +2525,10 @@ func (m *QueryPacketAcknowledgementsRequest) MarshalToSizedBuffer(dAtA []byte) ( 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 } @@ -2627,19 +2617,12 @@ func (m *QueryPacketReceiptRequest) MarshalToSizedBuffer(dAtA []byte) (int, erro 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))) - i-- - dAtA[i] = 0x12 + dAtA[i] = 0x10 } - 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 } @@ -2734,10 +2717,10 @@ func (m *QueryUnreceivedPacketsRequest) MarshalToSizedBuffer(dAtA []byte) (int, 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 } @@ -2833,10 +2816,10 @@ func (m *QueryUnreceivedAcksRequest) MarshalToSizedBuffer(dAtA []byte) (int, err 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 } @@ -3009,7 +2992,7 @@ func (m *QueryNextSequenceSendRequest) Size() (n int) { } var l int _ = l - l = len(m.ChannelId) + l = len(m.ClientId) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -3040,7 +3023,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 +3058,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 +3096,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 +3131,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 +3176,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 +3210,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)) } @@ -3269,7 +3248,7 @@ func (m *QueryUnreceivedAcksRequest) Size() (n int) { } var l int _ = l - l = len(m.ChannelId) + l = len(m.ClientId) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -4043,7 +4022,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 +4050,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 +4240,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 +4268,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 +4492,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 +4520,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 +4763,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 +4791,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 +5015,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 +5043,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 +5362,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 +5390,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 +5600,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 +5628,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 +5917,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 +5945,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..e6585d7bee1 100644 --- a/modules/core/04-channel/v2/types/query.pb.gw.go +++ b/modules/core/04-channel/v2/types/query.pb.gw.go @@ -224,15 +224,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 +251,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 +278,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 +316,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 +344,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 +358,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 +392,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 +426,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 +464,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 +492,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 +506,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 +540,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 +563,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 +574,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 +596,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 +612,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 +634,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 +650,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 +688,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 +726,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 +764,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"] @@ -1339,21 +1321,21 @@ var ( 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", "channels", "channel_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", "clients", "client_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", "channels", "channel_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", "clients", "client_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", "channels", "channel_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", "clients", "client_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", "channels", "channel_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", "clients", "client_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", "channels", "channel_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", "clients", "client_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", "channels", "channel_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", "clients", "client_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", "channels", "channel_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", "clients", "client_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 ( diff --git a/proto/ibc/core/channel/v2/genesis.proto b/proto/ibc/core/channel/v2/genesis.proto index a4c54a91977..f127481951d 100644 --- a/proto/ibc/core/channel/v2/genesis.proto +++ b/proto/ibc/core/channel/v2/genesis.proto @@ -25,8 +25,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 +35,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/query.proto b/proto/ibc/core/channel/v2/query.proto index 9d16a457a9e..01f83d8bf6f 100644 --- a/proto/ibc/core/channel/v2/query.proto +++ b/proto/ibc/core/channel/v2/query.proto @@ -33,44 +33,44 @@ service Query { // 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"; } } @@ -129,8 +129,8 @@ message QueryChannelConsensusStateResponse { // 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 +145,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 +163,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 +181,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 +200,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 +220,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 +238,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 +251,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; } From b632f4cdeae91a97379670b52f2d664d25332468 Mon Sep 17 00:00:00 2001 From: Aditya Sripal <14364734+AdityaSripal@users.noreply.github.com> Date: Thu, 16 Jan 2025 10:02:33 +0100 Subject: [PATCH 10/18] fix tests --- modules/apps/transfer/v2/keeper/msg_server_test.go | 8 ++++---- modules/core/04-channel/v2/types/commitment_test.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/apps/transfer/v2/keeper/msg_server_test.go b/modules/apps/transfer/v2/keeper/msg_server_test.go index cb88eef16cf..80150121695 100644 --- a/modules/apps/transfer/v2/keeper/msg_server_test.go +++ b/modules/apps/transfer/v2/keeper/msg_server_test.go @@ -265,15 +265,15 @@ func (suite *KeeperTestSuite) TestMsgRecvPacketTransfer() { nil, }, { - "failure: invalid destination channel on received packet", + "failure: invalid destination client on received packet", func() {}, func() { packet.DestinationClient = ibctesting.InvalidID }, - channeltypesv2.ErrChannelNotFound, + clienttypes.ErrClientNotFound, }, { - "failure: counter party channel does not match source channel", + "failure: counter party client does not match source client", func() {}, func() { packet.SourceClient = ibctesting.InvalidID @@ -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/04-channel/v2/types/commitment_test.go b/modules/core/04-channel/v2/types/commitment_test.go index 54b9890ef0b..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", }, } From 0ba8de707ea223a7192f8497dff2cacad52643d3 Mon Sep 17 00:00:00 2001 From: Aditya Sripal <14364734+AdityaSripal@users.noreply.github.com> Date: Thu, 16 Jan 2025 10:32:53 +0100 Subject: [PATCH 11/18] DELETE channel from v2 --- .../transfer/v2/keeper/msg_server_test.go | 2 +- modules/core/04-channel/v2/client/cli/cli.go | 8 +- .../core/04-channel/v2/client/cli/query.go | 62 - modules/core/04-channel/v2/client/cli/tx.go | 93 - modules/core/04-channel/v2/keeper/events.go | 35 - .../core/04-channel/v2/keeper/export_test.go | 12 - .../core/04-channel/v2/keeper/grpc_query.go | 76 - modules/core/04-channel/v2/keeper/keeper.go | 102 +- .../core/04-channel/v2/keeper/keeper_test.go | 122 -- .../core/04-channel/v2/keeper/msg_server.go | 46 - .../04-channel/v2/keeper/msg_server_test.go | 83 - modules/core/04-channel/v2/keeper/packet.go | 8 +- .../core/04-channel/v2/keeper/packet_test.go | 8 +- modules/core/04-channel/v2/types/channel.go | 51 - .../core/04-channel/v2/types/channel.pb.go | 658 ------ .../core/04-channel/v2/types/channel_test.go | 58 - modules/core/04-channel/v2/types/codec.go | 2 - modules/core/04-channel/v2/types/errors.go | 25 +- modules/core/04-channel/v2/types/genesis.go | 48 +- .../core/04-channel/v2/types/genesis.pb.go | 160 +- .../core/04-channel/v2/types/genesis_test.go | 28 - modules/core/04-channel/v2/types/keys.go | 10 - modules/core/04-channel/v2/types/msgs.go | 59 - modules/core/04-channel/v2/types/msgs_test.go | 112 -- modules/core/04-channel/v2/types/query.go | 42 - modules/core/04-channel/v2/types/query.pb.go | 1786 ++--------------- .../core/04-channel/v2/types/query.pb.gw.go | 321 --- modules/core/04-channel/v2/types/tx.pb.go | 1171 ++--------- proto/ibc/core/channel/v2/channel.proto | 37 - proto/ibc/core/channel/v2/genesis.proto | 12 +- proto/ibc/core/channel/v2/query.proto | 72 - proto/ibc/core/channel/v2/tx.proto | 47 - testing/endpoint_v2.go | 19 - testing/path.go | 15 - 34 files changed, 335 insertions(+), 5055 deletions(-) delete mode 100644 modules/core/04-channel/v2/client/cli/tx.go delete mode 100644 modules/core/04-channel/v2/types/channel.go delete mode 100644 modules/core/04-channel/v2/types/channel.pb.go delete mode 100644 modules/core/04-channel/v2/types/channel_test.go delete mode 100644 proto/ibc/core/channel/v2/channel.proto diff --git a/modules/apps/transfer/v2/keeper/msg_server_test.go b/modules/apps/transfer/v2/keeper/msg_server_test.go index 80150121695..4a234871811 100644 --- a/modules/apps/transfer/v2/keeper/msg_server_test.go +++ b/modules/apps/transfer/v2/keeper/msg_server_test.go @@ -278,7 +278,7 @@ func (suite *KeeperTestSuite) TestMsgRecvPacketTransfer() { func() { packet.SourceClient = ibctesting.InvalidID }, - channeltypes.ErrInvalidChannelIdentifier, + clienttypes.ErrInvalidCounterparty, }, { "failure: receive is disabled", diff --git a/modules/core/04-channel/v2/client/cli/cli.go b/modules/core/04-channel/v2/client/cli/cli.go index 5fdde6a87dc..3dd8d3c451b 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 + 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 dcfe9b64751..0f7949d3504 100644 --- a/modules/core/04-channel/v2/client/cli/query.go +++ b/modules/core/04-channel/v2/client/cli/query.go @@ -18,68 +18,6 @@ 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 client func getCmdQueryNextSequenceSend() *cobra.Command { cmd := &cobra.Command{ 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 32eee429456..33b3f3bc275 100644 --- a/modules/core/04-channel/v2/keeper/events.go +++ b/modules/core/04-channel/v2/keeper/events.go @@ -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 41dbbbca4ca..0eea059e9ca 100644 --- a/modules/core/04-channel/v2/keeper/grpc_query.go +++ b/modules/core/04-channel/v2/keeper/grpc_query.go @@ -34,82 +34,6 @@ 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 { diff --git a/modules/core/04-channel/v2/keeper/keeper.go b/modules/core/04-channel/v2/keeper/keeper.go index 54a04b575d4..e114ef57477 100644 --- a/modules/core/04-channel/v2/keeper/keeper.go +++ b/modules/core/04-channel/v2/keeper/keeper.go @@ -2,15 +2,11 @@ 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" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" @@ -18,7 +14,6 @@ import ( 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" @@ -62,63 +57,6 @@ 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, clientID string, channel types.Channel) { - bz := k.cdc.MustMarshal(&channel) - k.channelStore(ctx).Set([]byte(clientID), bz) -} - -// GetChannel gets the Channel for a given channel identifier. -func (k *Keeper) GetChannel(ctx context.Context, clientID string) (types.Channel, bool) { - store := k.channelStore(ctx) - bz := store.Get([]byte(clientID)) - 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, clientID string) bool { - store := k.channelStore(ctx) - return store.Has([]byte(clientID)) -} - -// GetCreator returns the creator of the channel. -func (k *Keeper) GetCreator(ctx context.Context, clientID string) (string, bool) { - bz := k.creatorStore(ctx).Get([]byte(clientID)) - if len(bz) == 0 { - return "", false - } - - return string(bz), true -} - -// SetCreator sets the creator of the channel. -func (k *Keeper) SetCreator(ctx context.Context, clientID, creator string) { - k.creatorStore(ctx).Set([]byte(clientID), []byte(creator)) -} - -// DeleteCreator deletes the creator associated with the channel. -func (k *Keeper) DeleteCreator(ctx context.Context, clientID string) { - k.creatorStore(ctx).Delete([]byte(clientID)) -} - // 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) @@ -227,32 +165,6 @@ func (k *Keeper) SetNextSequenceSend(ctx context.Context, clientID string, seque } } -// 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, clientID string) (types.Channel, bool) { - channel, ok := k.channelKeeperV1.GetChannel(ctx, portID, clientID) - 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 -} - // resolveV2Identifiers returns the client identifier and the counterpartyInfo for the client given the packetId // Note: For fresh eureka channels, the client identifier and packet identifier are the same. // For aliased channels, the packet identifier will be the original channel ID and the counterpartyInfo will be constructed from the channel @@ -264,7 +176,7 @@ func (k *Keeper) resolveV2Identifiers(ctx context.Context, portId string, packet connection, ok := k.connectionKeeper.GetConnection(ctx, channel.ConnectionHops[0]) if !ok { // should never happen since the connection should exist if the channel exists - return "", clienttypes.CounterpartyInfo{}, types.ErrInvalidChannel + return "", clienttypes.CounterpartyInfo{}, channeltypesv1.ErrChannelNotFound } // convert v1 merkle prefix into the v2 path format merklePrefix := [][]byte{connection.Counterparty.Prefix.KeyPrefix, []byte("")} @@ -279,15 +191,3 @@ func (k *Keeper) resolveV2Identifiers(ctx context.Context, portId string, packet } return packetId, counterpartyInfo, nil } - -// 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 1459b0b8fbb..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) 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 7164d583f6d..83583fa7932 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 diff --git a/modules/core/04-channel/v2/keeper/packet.go b/modules/core/04-channel/v2/keeper/packet.go index 4657503ece4..136b5b01940 100644 --- a/modules/core/04-channel/v2/keeper/packet.go +++ b/modules/core/04-channel/v2/keeper/packet.go @@ -99,7 +99,7 @@ func (k *Keeper) recvPacket( } if counterparty.ClientId != packet.SourceClient { - return errorsmod.Wrapf(types.ErrInvalidChannelIdentifier, "counterparty id (%s) does not match packet source id (%s)", counterparty.ClientId, packet.SourceClient) + return errorsmod.Wrapf(clienttypes.ErrInvalidCounterparty, "counterparty id (%s) does not match packet source id (%s)", counterparty.ClientId, packet.SourceClient) } // check if packet timed out by comparing it with the latest height of the chain @@ -161,7 +161,7 @@ func (k Keeper) WriteAcknowledgement( } if counterparty.ClientId != packet.SourceClient { - return errorsmod.Wrapf(types.ErrInvalidChannelIdentifier, "counterparty id (%s) does not match packet source id (%s)", 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 @@ -198,7 +198,7 @@ func (k *Keeper) acknowledgePacket(ctx context.Context, packet types.Packet, ack } if counterparty.ClientId != packet.DestinationClient { - return errorsmod.Wrapf(types.ErrInvalidChannelIdentifier, "counterparty id (%s) does not match packet destination id (%s)", counterparty.ClientId, packet.DestinationClient) + return errorsmod.Wrapf(clienttypes.ErrInvalidCounterparty, "counterparty id (%s) does not match packet destination id (%s)", counterparty.ClientId, packet.DestinationClient) } commitment := k.GetPacketCommitment(ctx, packet.SourceClient, packet.Sequence) @@ -262,7 +262,7 @@ func (k *Keeper) timeoutPacket( } if counterparty.ClientId != packet.DestinationClient { - return errorsmod.Wrapf(types.ErrInvalidChannelIdentifier, "counterparty id (%s) does not match packet destination id (%s)", counterparty.ClientId, packet.DestinationClient) + return errorsmod.Wrapf(clienttypes.ErrInvalidCounterparty, "counterparty id (%s) does not match packet destination id (%s)", counterparty.ClientId, packet.DestinationClient) } // check that timeout height or timeout timestamp has passed on the other end diff --git a/modules/core/04-channel/v2/keeper/packet_test.go b/modules/core/04-channel/v2/keeper/packet_test.go index b75d661db41..9afb07a2cc7 100644 --- a/modules/core/04-channel/v2/keeper/packet_test.go +++ b/modules/core/04-channel/v2/keeper/packet_test.go @@ -167,7 +167,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { func() { packet.SourceClient = unusedChannel }, - types.ErrInvalidChannelIdentifier, + clienttypes.ErrInvalidCounterparty, }, { "failure: packet has timed out", @@ -261,7 +261,7 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgement() { func() { packet.SourceClient = unusedChannel }, - types.ErrInvalidChannelIdentifier, + clienttypes.ErrInvalidCounterparty, }, { "failure: ack already exists", @@ -353,7 +353,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { func() { packet.DestinationClient = unusedChannel }, - types.ErrInvalidChannelIdentifier, + clienttypes.ErrInvalidCounterparty, }, { "failure: packet commitment doesn't exist.", @@ -476,7 +476,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { packet.DestinationClient = unusedChannel }, - types.ErrInvalidChannelIdentifier, + clienttypes.ErrInvalidCounterparty, }, { "failure: packet has not timed out yet", 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, 0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 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/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/genesis.go b/modules/core/04-channel/v2/types/genesis.go index fb06476bb41..d94365b15de 100644 --- a/modules/core/04-channel/v2/types/genesis.go +++ b/modules/core/04-channel/v2/types/genesis.go @@ -4,7 +4,6 @@ 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" ) @@ -40,56 +39,29 @@ func (ps PacketSequence) Validate() error { // 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) diff --git a/modules/core/04-channel/v2/types/genesis.pb.go b/modules/core/04-channel/v2/types/genesis.pb.go index 079aaa7ac8c..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,13 +92,6 @@ 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 @@ -219,35 +202,31 @@ func init() { func init() { proto.RegisterFile("ibc/core/channel/v2/genesis.proto", fileDescriptor_b5d374f126f051c3) } var fileDescriptor_b5d374f126f051c3 = []byte{ - // 439 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0x41, 0x8b, 0xd3, 0x40, - 0x14, 0xc7, 0x33, 0xdb, 0xb8, 0x74, 0xa7, 0xeb, 0xa2, 0xb3, 0x0a, 0xb1, 0x42, 0x1a, 0x2b, 0x48, - 0x2f, 0x9b, 0x91, 0xe8, 0x45, 0xf1, 0x14, 0x0f, 0xda, 0xdb, 0x12, 0xc1, 0x83, 0x20, 0x35, 0x99, - 0x79, 0x66, 0x87, 0x4d, 0x66, 0x6a, 0x67, 0x5a, 0xf5, 0x1b, 0x78, 0xf4, 0x23, 0xf8, 0x71, 0xf6, - 0xb8, 0x17, 0xc1, 0xd3, 0x22, 0xed, 0xb7, 0xf0, 0x24, 0x99, 0xa4, 0xa1, 0xb2, 0x45, 0xd8, 0xbd, - 0xbd, 0x79, 0xef, 0xff, 0xff, 0xfd, 0x1f, 0xc3, 0xc3, 0x0f, 0x44, 0xc6, 0x28, 0x53, 0x33, 0xa0, - 0xec, 0x24, 0x95, 0x12, 0x0a, 0xba, 0x88, 0x68, 0x0e, 0x12, 0xb4, 0xd0, 0xe1, 0x74, 0xa6, 0x8c, - 0x22, 0x87, 0x22, 0x63, 0x61, 0x25, 0x09, 0x1b, 0x49, 0xb8, 0x88, 0xfa, 0x77, 0x72, 0x95, 0x2b, - 0x3b, 0xa7, 0x55, 0x55, 0x4b, 0xfb, 0x5b, 0x69, 0x6b, 0x97, 0x95, 0x0c,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e, 0x8c, 0x39, 0xe9, 0xe3, 0x6e, 0x8b, 0xdc, 0xb1, 0xc8, 0xf6, 0x4d, 0x08, 0x76, 0x79, - 0x6a, 0x52, 0xaf, 0x13, 0xa0, 0xd1, 0x7e, 0x62, 0xeb, 0xe7, 0xee, 0xb7, 0x1f, 0x03, 0x67, 0x38, - 0xc6, 0x07, 0xff, 0x2e, 0x7f, 0xed, 0x90, 0xf8, 0xed, 0xd9, 0xd2, 0x47, 0xe7, 0x4b, 0x1f, 0xfd, - 0x5e, 0xfa, 0xe8, 0xfb, 0xca, 0x77, 0xce, 0x57, 0xbe, 0xf3, 0x6b, 0xe5, 0x3b, 0xef, 0x5e, 0xe4, - 0xc2, 0x9c, 0xcc, 0xb3, 0x90, 0xa9, 0x92, 0x32, 0xa5, 0x4b, 0xa5, 0xa9, 0xc8, 0xd8, 0x51, 0xae, - 0xe8, 0xe2, 0x19, 0x2d, 0x15, 0x9f, 0x17, 0xa0, 0xeb, 0x0b, 0x7f, 0xfc, 0xf4, 0x68, 0xe3, 0xc8, - 0xcd, 0xd7, 0x29, 0xe8, 0x6c, 0xd7, 0xde, 0xf8, 0x93, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x70, - 0xe9, 0xcf, 0xef, 0x56, 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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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 } @@ -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 } @@ -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:]) 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 ead580b1742..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,58 +29,6 @@ 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(sourceClient string, timeoutTimestamp uint64, signer string, payloads ...Payload) *MsgSendPacket { return &MsgSendPacket{ diff --git a/modules/core/04-channel/v2/types/msgs_test.go b/modules/core/04-channel/v2/types/msgs_test.go index 74d968339dd..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 { diff --git a/modules/core/04-channel/v2/types/query.go b/modules/core/04-channel/v2/types/query.go index deec70333ef..fdc87dccb39 100644 --- a/modules/core/04-channel/v2/types/query.go +++ b/modules/core/04-channel/v2/types/query.go @@ -1,51 +1,9 @@ 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(clientID string) *QueryNextSequenceSendRequest { return &QueryNextSequenceSendRequest{ diff --git a/modules/core/04-channel/v2/types/query.pb.go b/modules/core/04-channel/v2/types/query.pb.go index a22ff923532..4f230d4757a 100644 --- a/modules/core/04-channel/v2/types/query.pb.go +++ b/modules/core/04-channel/v2/types/query.pb.go @@ -10,7 +10,6 @@ import ( _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" - any "github.com/cosmos/gogoproto/types/any" types "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" @@ -32,348 +31,6 @@ 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 *any.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() *any.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 { // client unique identifier @@ -384,7 +41,7 @@ func (m *QueryNextSequenceSendRequest) Reset() { *m = QueryNextSequenceS 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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -982,7 +639,7 @@ func (m *QueryPacketReceiptRequest) Reset() { *m = QueryPacketReceiptReq 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) @@ -1039,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) @@ -1101,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) @@ -1156,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) @@ -1212,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) @@ -1268,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) @@ -1312,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") @@ -1339,90 +990,72 @@ func init() { func init() { proto.RegisterFile("ibc/core/channel/v2/query.proto", fileDescriptor_a328cba4986edcab) } var fileDescriptor_a328cba4986edcab = []byte{ - // 1328 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0x51, 0x6f, 0xdb, 0x54, - 0x14, 0xee, 0x6d, 0xbb, 0xad, 0x3d, 0x1d, 0x5b, 0x77, 0xd7, 0x41, 0xeb, 0x76, 0x69, 0x67, 0x24, - 0x96, 0x4d, 0x9b, 0x6f, 0x9b, 0x56, 0x6c, 0x63, 0x1d, 0xa5, 0x8d, 0xd8, 0x5a, 0x81, 0xaa, 0xe1, - 0x0e, 0x90, 0xaa, 0x49, 0x91, 0xe3, 0xdc, 0xa6, 0x26, 0xcd, 0x75, 0x96, 0xeb, 0x84, 0x56, 0x53, - 0x5f, 0x10, 0x3f, 0x00, 0x31, 0x9e, 0xf8, 0x05, 0xf0, 0xc6, 0x1f, 0x00, 0xc1, 0xdb, 0x26, 0xf1, - 0x30, 0x84, 0x90, 0x90, 0x90, 0xd8, 0xd4, 0x22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0x3a, 0x74, 0x44, 0xd4, - 0xbc, 0x74, 0x13, 0x34, 0x51, 0xf3, 0xd2, 0x55, 0xa8, 0xa8, 0x79, 0xc1, 0xe5, 0x3e, 0x5e, 0x7f, - 0x29, 0xe3, 0xcf, 0x77, 0x49, 0xad, 0xb9, 0x54, 0xae, 0x22, 0xc9, 0x3c, 0x43, 0x70, 0x2a, 0xa8, - 0x21, 0x30, 0x89, 0x83, 0xd5, 0x27, 0x6d, 0x94, 0xe9, 0xf8, 0x01, 0x92, 0xd9, 0x27, 0x82, 0x59, - 0x01, 0xe7, 0x5f, 0x88, 0x59, 0x98, 0x64, 0x0a, 0x90, 0x6c, 0xcc, 0xd9, 0xd2, 0x47, 0x8f, 0xf7, - 0x52, 0xe8, 0xe9, 0x5e, 0x0a, 0x3d, 0xdf, 0x4b, 0xa1, 0x2f, 0xf6, 0x53, 0x3d, 0x4f, 0xf7, 0x53, - 0x3d, 0xbf, 0xef, 0xa7, 0x7a, 0xd6, 0xe7, 0x8b, 0x96, 0xb3, 0x59, 0xcb, 0x6b, 0xa6, 0x5d, 0x26, - 0xf2, 0x1f, 0x5a, 0x2b, 0x6f, 0x5e, 0x2d, 0xda, 0xa4, 0x7e, 0x83, 0x94, 0xed, 0x42, 0x6d, 0x8b, - 0x72, 0x17, 0xdc, 0xf4, 0xdc, 0x55, 0x1f, 0x3e, 0x67, 0xa7, 0x42, 0x79, 0xfe, 0xb8, 0xf8, 0x93, - 0x69, 0xf6, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8d, 0x64, 0x80, 0x86, 0x13, 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, 0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xcd, 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. @@ -1437,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. @@ -1471,33 +1096,6 @@ 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...) - 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...) @@ -1572,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. @@ -1602,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") } @@ -1640,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 { @@ -1842,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, @@ -1891,250 +1406,6 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Metadata: "ibc/core/channel/v2/query.proto", } -func (m *QueryChannelRequest) 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 *QueryChannelRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryChannelRequest) 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))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryChannelResponse) 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 *QueryChannelResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryChannelResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Channel.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 *QueryChannelClientStateRequest) 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 *QueryChannelClientStateRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryChannelClientStateRequest) 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))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryChannelClientStateResponse) 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 *QueryChannelClientStateResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryChannelClientStateResponse) 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 m.IdentifiedClientState != nil { - { - size, err := m.IdentifiedClientState.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 *QueryChannelConsensusStateRequest) 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 *QueryChannelConsensusStateRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryChannelConsensusStateRequest) 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)) - 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))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryChannelConsensusStateResponse) 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 *QueryChannelConsensusStateResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryChannelConsensusStateResponse) 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] = 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 { - { - size, err := m.ConsensusState.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) { size := m.Size() dAtA = make([]byte, size) @@ -2496,20 +1767,20 @@ func (m *QueryPacketAcknowledgementsRequest) MarshalToSizedBuffer(dAtA []byte) ( var l int _ = l if len(m.PacketCommitmentSequences) > 0 { - dAtA13 := make([]byte, len(m.PacketCommitmentSequences)*10) - var j12 int + dAtA8 := make([]byte, len(m.PacketCommitmentSequences)*10) + var j7 int for _, num := range m.PacketCommitmentSequences { for num >= 1<<7 { - dAtA13[j12] = uint8(uint64(num)&0x7f | 0x80) + dAtA8[j7] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j12++ + j7++ } - dAtA13[j12] = uint8(num) - j12++ + dAtA8[j7] = uint8(num) + j7++ } - i -= j12 - copy(dAtA[i:], dAtA13[:j12]) - i = encodeVarintQuery(dAtA, i, uint64(j12)) + i -= j7 + copy(dAtA[i:], dAtA8[:j7]) + i = encodeVarintQuery(dAtA, i, uint64(j7)) i-- dAtA[i] = 0x1a } @@ -2700,20 +1971,20 @@ func (m *QueryUnreceivedPacketsRequest) MarshalToSizedBuffer(dAtA []byte) (int, var l int _ = l if len(m.Sequences) > 0 { - dAtA19 := make([]byte, len(m.Sequences)*10) - var j18 int + dAtA14 := make([]byte, len(m.Sequences)*10) + var j13 int for _, num := range m.Sequences { for num >= 1<<7 { - dAtA19[j18] = uint8(uint64(num)&0x7f | 0x80) + dAtA14[j13] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j18++ + j13++ } - dAtA19[j18] = uint8(num) - j18++ + dAtA14[j13] = uint8(num) + j13++ } - i -= j18 - copy(dAtA[i:], dAtA19[:j18]) - i = encodeVarintQuery(dAtA, i, uint64(j18)) + i -= j13 + copy(dAtA[i:], dAtA14[:j13]) + i = encodeVarintQuery(dAtA, i, uint64(j13)) i-- dAtA[i] = 0x12 } @@ -2758,20 +2029,20 @@ func (m *QueryUnreceivedPacketsResponse) MarshalToSizedBuffer(dAtA []byte) (int, i-- dAtA[i] = 0x12 if len(m.Sequences) > 0 { - dAtA22 := make([]byte, len(m.Sequences)*10) - var j21 int + dAtA17 := make([]byte, len(m.Sequences)*10) + var j16 int for _, num := range m.Sequences { for num >= 1<<7 { - dAtA22[j21] = uint8(uint64(num)&0x7f | 0x80) + dAtA17[j16] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j21++ + j16++ } - dAtA22[j21] = uint8(num) - j21++ + dAtA17[j16] = uint8(num) + j16++ } - i -= j21 - copy(dAtA[i:], dAtA22[:j21]) - i = encodeVarintQuery(dAtA, i, uint64(j21)) + i -= j16 + copy(dAtA[i:], dAtA17[:j16]) + i = encodeVarintQuery(dAtA, i, uint64(j16)) i-- dAtA[i] = 0xa } @@ -2799,20 +2070,20 @@ func (m *QueryUnreceivedAcksRequest) MarshalToSizedBuffer(dAtA []byte) (int, err var l int _ = l if len(m.PacketAckSequences) > 0 { - dAtA24 := make([]byte, len(m.PacketAckSequences)*10) - var j23 int + dAtA19 := make([]byte, len(m.PacketAckSequences)*10) + var j18 int for _, num := range m.PacketAckSequences { for num >= 1<<7 { - dAtA24[j23] = uint8(uint64(num)&0x7f | 0x80) + dAtA19[j18] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j23++ + j18++ } - dAtA24[j23] = uint8(num) - j23++ + dAtA19[j18] = uint8(num) + j18++ } - i -= j23 - copy(dAtA[i:], dAtA24[:j23]) - i = encodeVarintQuery(dAtA, i, uint64(j23)) + i -= j18 + copy(dAtA[i:], dAtA19[:j18]) + i = encodeVarintQuery(dAtA, i, uint64(j18)) i-- dAtA[i] = 0x12 } @@ -2857,20 +2128,20 @@ func (m *QueryUnreceivedAcksResponse) MarshalToSizedBuffer(dAtA []byte) (int, er i-- dAtA[i] = 0x12 if len(m.Sequences) > 0 { - dAtA27 := make([]byte, len(m.Sequences)*10) - var j26 int + dAtA22 := make([]byte, len(m.Sequences)*10) + var j21 int for _, num := range m.Sequences { for num >= 1<<7 { - dAtA27[j26] = uint8(uint64(num)&0x7f | 0x80) + dAtA22[j21] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j26++ + j21++ } - dAtA27[j26] = uint8(num) - j26++ + dAtA22[j21] = uint8(num) + j21++ } - i -= j26 - copy(dAtA[i:], dAtA27[:j26]) - i = encodeVarintQuery(dAtA, i, uint64(j26)) + i -= j21 + copy(dAtA[i:], dAtA22[:j21]) + i = encodeVarintQuery(dAtA, i, uint64(j21)) i-- dAtA[i] = 0xa } @@ -2888,104 +2159,6 @@ 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 @@ -3286,711 +2459,6 @@ func sovQuery(x uint64) (n int) { 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 - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - 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 = &any.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 - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *QueryNextSequenceSendRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 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 e6585d7bee1..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 @@ -797,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() @@ -1091,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() @@ -1315,12 +1006,6 @@ 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_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))) @@ -1339,12 +1024,6 @@ var ( ) 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 7f8de660dd8..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,169 +66,6 @@ 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 { SourceClient string `protobuf:"bytes,1,opt,name=source_client,json=sourceClient,proto3" json:"source_client,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{ - // 995 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x96, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xc7, 0xbd, 0xb1, 0x9b, 0x26, 0xcf, 0x09, 0x36, 0x43, 0x4b, 0xcc, 0x36, 0xd8, 0xc6, 0x80, - 0x12, 0x02, 0xf1, 0xd2, 0xa5, 0x20, 0xa5, 0x42, 0x54, 0xe9, 0xe2, 0x0a, 0x4b, 0x75, 0x62, 0xad, - 0xed, 0x4a, 0xfc, 0x10, 0xab, 0xf5, 0x7a, 0xba, 0x5e, 0xc5, 0xfb, 0x83, 0x9d, 0xb5, 0x69, 0x38, - 0x21, 0x4e, 0x55, 0x4e, 0x5c, 0x39, 0x44, 0x42, 0xe2, 0x1f, 0xc8, 0x81, 0x3f, 0xa2, 0xe2, 0xd4, - 0x63, 0x4f, 0xa8, 0x4a, 0x0e, 0x3d, 0xf1, 0x3f, 0xa0, 0x9d, 0x19, 0xaf, 0x37, 0xce, 0xba, 0x09, - 0x22, 0x3d, 0x79, 0xe7, 0xcd, 0xe7, 0xbd, 0x37, 0xef, 0xfb, 0xc6, 0x33, 0x03, 0xab, 0x56, 0xd7, - 0x90, 0x0c, 0xd7, 0xc7, 0x92, 0xd1, 0xd7, 0x1d, 0x07, 0x0f, 0xa4, 0x91, 0x2c, 0x05, 0x8f, 0xaa, - 0x9e, 0xef, 0x06, 0x2e, 0x7a, 0xc3, 0xea, 0x1a, 0xd5, 0x70, 0xb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99, 0xbd, 0xc2, 0x31, 0x33, 0x3b, 0x7a, 0xc2, 0x21, 0xdd, 0x82, 0xab, 0xe3, 0x93, 0xb5, - 0x34, 0xcb, 0x8d, 0x03, 0xe2, 0xda, 0x39, 0x40, 0x14, 0x74, 0x0f, 0x72, 0xd3, 0xc7, 0xcd, 0x4c, - 0xdf, 0x29, 0x50, 0x94, 0x2e, 0x08, 0x8e, 0x93, 0x89, 0x57, 0x7e, 0x7e, 0x71, 0xb4, 0x21, 0xdc, - 0x7d, 0xf0, 0xe4, 0xb8, 0x28, 0x3c, 0x3d, 0x2e, 0x0a, 0xcf, 0x8f, 0x8b, 0xc2, 0xaf, 0x27, 0xc5, - 0xd4, 0xd3, 0x93, 0x62, 0xea, 0xd9, 0x49, 0x31, 0xf5, 0xcd, 0xe7, 0xa6, 0x15, 0xf4, 0x87, 0xdd, - 0xf0, 0xc1, 0x27, 0xf1, 0x17, 0xad, 0xd5, 0x35, 0x36, 0x4d, 0x57, 0x1a, 0x6d, 0x49, 0xb6, 0xdb, - 0x1b, 0x0e, 0x30, 0x61, 0x4f, 0xd1, 0x8f, 0x6f, 0x6d, 0xc6, 0x9f, 0xcc, 0xfb, 0x1e, 0x26, 0xdd, - 0x79, 0xfa, 0x0c, 0xfd, 0xe4, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x10, 0x9a, 0x56, 0xa7, 0x56, - 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, 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19, 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,191 +842,22 @@ 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] = 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 *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] = 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 } @@ -1408,68 +1008,6 @@ 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 @@ -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 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 f127481951d..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 diff --git a/proto/ibc/core/channel/v2/query.proto b/proto/ibc/core/channel/v2/query.proto index 01f83d8bf6f..3efb9fcfe7d 100644 --- a/proto/ibc/core/channel/v2/query.proto +++ b/proto/ibc/core/channel/v2/query.proto @@ -5,32 +5,13 @@ 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/clients/{client_id}/next_sequence_send"; @@ -74,59 +55,6 @@ service Query { } } -// 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 { // client unique identifier diff --git a/proto/ibc/core/channel/v2/tx.proto b/proto/ibc/core/channel/v2/tx.proto index 75ec4d45e39..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,46 +26,6 @@ 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"; diff --git a/testing/endpoint_v2.go b/testing/endpoint_v2.go index 3e9671dff9b..cbde15f925c 100644 --- a/testing/endpoint_v2.go +++ b/testing/endpoint_v2.go @@ -10,25 +10,6 @@ import ( 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 := clienttypes.NewMsgRegisterCounterparty(endpoint.ClientID, endpoint.Counterparty.MerklePathPrefix.KeyPath, endpoint.Counterparty.ClientID, endpoint.Chain.SenderAccount.GetAddress().String()) diff --git a/testing/path.go b/testing/path.go index 823c4999839..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 From a5aa5ff620a99532578a10002c984a5a1b186332 Mon Sep 17 00:00:00 2001 From: Aditya Sripal <14364734+AdityaSripal@users.noreply.github.com> Date: Thu, 16 Jan 2025 10:52:45 +0100 Subject: [PATCH 12/18] rm commented code --- .../04-channel/v2/keeper/grpc_query_test.go | 282 ------------------ 1 file changed, 282 deletions(-) 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 d81fda80d5e..8d8a07d73ac 100644 --- a/modules/core/04-channel/v2/keeper/grpc_query_test.go +++ b/modules/core/04-channel/v2/keeper/grpc_query_test.go @@ -13,288 +13,6 @@ import ( 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 From adcb8477b41cbd51a5920c47ba24c03a16e1298a Mon Sep 17 00:00:00 2001 From: Aditya Sripal <14364734+AdityaSripal@users.noreply.github.com> Date: Thu, 16 Jan 2025 11:00:41 +0100 Subject: [PATCH 13/18] move nextSeqSend to a better place --- modules/core/04-channel/v2/keeper/packet.go | 3 +-- modules/core/keeper/msg_server.go | 3 +++ modules/core/keeper/msg_server_test.go | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/core/04-channel/v2/keeper/packet.go b/modules/core/04-channel/v2/keeper/packet.go index 136b5b01940..85594a745cc 100644 --- a/modules/core/04-channel/v2/keeper/packet.go +++ b/modules/core/04-channel/v2/keeper/packet.go @@ -32,8 +32,7 @@ func (k *Keeper) sendPacket( sequence, found := k.GetNextSequenceSend(ctx, sourceClient) if !found { - // initialize sequnce to 1 if it does not exist - sequence = 1 + return 0, "", errorsmod.Wrapf(types.ErrSequenceSendNotFound, "source client: %s", sourceClient) } // construct packet from given fields and channel state diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index 3030014944e..5bb96f2dff4 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -61,6 +61,9 @@ func (k *Keeper) RegisterCounterparty(ctx context.Context, msg *clienttypes.MsgR } 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 } diff --git a/modules/core/keeper/msg_server_test.go b/modules/core/keeper/msg_server_test.go index f913b9eb9d2..480c06a5d73 100644 --- a/modules/core/keeper/msg_server_test.go +++ b/modules/core/keeper/msg_server_test.go @@ -79,6 +79,9 @@ func (suite *KeeperTestSuite) TestRegisterCounterparty() { 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) } From 25b8bb63e323051260a1653e5df3eee69e7c3512 Mon Sep 17 00:00:00 2001 From: Aditya Sripal <14364734+AdityaSripal@users.noreply.github.com> Date: Thu, 16 Jan 2025 12:38:47 +0100 Subject: [PATCH 14/18] remove resolveV2Identifiers for now --- .../transfer/v2/keeper/msg_server_test.go | 2 +- modules/core/02-client/types/errors.go | 1 + modules/core/04-channel/v2/keeper/keeper.go | 29 --------- .../04-channel/v2/keeper/msg_server_test.go | 8 +-- modules/core/04-channel/v2/keeper/packet.go | 64 +++++++++---------- .../core/04-channel/v2/keeper/packet_test.go | 10 +-- 6 files changed, 43 insertions(+), 71 deletions(-) diff --git a/modules/apps/transfer/v2/keeper/msg_server_test.go b/modules/apps/transfer/v2/keeper/msg_server_test.go index 4a234871811..b4ab8e61016 100644 --- a/modules/apps/transfer/v2/keeper/msg_server_test.go +++ b/modules/apps/transfer/v2/keeper/msg_server_test.go @@ -270,7 +270,7 @@ func (suite *KeeperTestSuite) TestMsgRecvPacketTransfer() { func() { packet.DestinationClient = ibctesting.InvalidID }, - clienttypes.ErrClientNotFound, + clienttypes.ErrCounterpartyNotFound, }, { "failure: counter party client does not match source client", diff --git a/modules/core/02-client/types/errors.go b/modules/core/02-client/types/errors.go index 116e322ac6d..f663019ab0f 100644 --- a/modules/core/02-client/types/errors.go +++ b/modules/core/02-client/types/errors.go @@ -39,4 +39,5 @@ var ( 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/04-channel/v2/keeper/keeper.go b/modules/core/04-channel/v2/keeper/keeper.go index e114ef57477..a63e644f83e 100644 --- a/modules/core/04-channel/v2/keeper/keeper.go +++ b/modules/core/04-channel/v2/keeper/keeper.go @@ -9,10 +9,8 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/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" hostv2 "github.com/cosmos/ibc-go/v9/modules/core/24-host/v2" "github.com/cosmos/ibc-go/v9/modules/core/api" @@ -164,30 +162,3 @@ func (k *Keeper) SetNextSequenceSend(ctx context.Context, clientID string, seque panic(err) } } - -// resolveV2Identifiers returns the client identifier and the counterpartyInfo for the client given the packetId -// Note: For fresh eureka channels, the client identifier and packet identifier are the same. -// For aliased channels, the packet identifier will be the original channel ID and the counterpartyInfo will be constructed from the channel -func (k *Keeper) resolveV2Identifiers(ctx context.Context, portId string, packetId string) (string, clienttypes.CounterpartyInfo, error) { - counterpartyInfo, ok := k.ClientKeeper.GetClientCounterparty(ctx, packetId) - if !ok { - channel, ok := k.channelKeeperV1.GetChannel(ctx, portId, packetId) - if ok { - connection, ok := k.connectionKeeper.GetConnection(ctx, channel.ConnectionHops[0]) - if !ok { - // should never happen since the connection should exist if the channel exists - return "", clienttypes.CounterpartyInfo{}, channeltypesv1.ErrChannelNotFound - } - // convert v1 merkle prefix into the v2 path format - merklePrefix := [][]byte{connection.Counterparty.Prefix.KeyPrefix, []byte("")} - // create the counterparty info, here we set the counterparty client Id to the the counterparty channel id - // this is because we want to preserve the original identifiers that are used to write provable paths to each other - counterpartyInfo = clienttypes.NewCounterpartyInfo(merklePrefix, channel.Counterparty.ChannelId) - return connection.ClientId, counterpartyInfo, nil - } else { - // neither client nor channel exists so return client not found error - return "", clienttypes.CounterpartyInfo{}, clienttypes.ErrClientNotFound - } - } - return packetId, counterpartyInfo, nil -} 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 83583fa7932..6e02db44f75 100644 --- a/modules/core/04-channel/v2/keeper/msg_server_test.go +++ b/modules/core/04-channel/v2/keeper/msg_server_test.go @@ -88,7 +88,7 @@ func (suite *KeeperTestSuite) TestMsgSendPacket() { malleate: func() { path.EndpointA.ClientID = ibctesting.InvalidID }, - expError: clienttypes.ErrClientNotFound, + expError: clienttypes.ErrCounterpartyNotFound, }, { name: "failure: route to non existing app", @@ -197,7 +197,7 @@ func (suite *KeeperTestSuite) TestMsgRecvPacket() { // change the destination id to a non-existent channel. packet.DestinationClient = ibctesting.InvalidID }, - expError: clienttypes.ErrClientNotFound, + expError: clienttypes.ErrCounterpartyNotFound, }, { name: "failure: invalid proof", @@ -324,7 +324,7 @@ func (suite *KeeperTestSuite) TestMsgAcknowledgement() { // change the source id to a non-existent channel. packet.SourceClient = "not-existent-channel" }, - expError: clienttypes.ErrClientNotFound, + expError: clienttypes.ErrCounterpartyNotFound, }, { name: "failure: invalid commitment", @@ -419,7 +419,7 @@ func (suite *KeeperTestSuite) TestMsgTimeout() { // change the source id to a non-existent client. packet.SourceClient = "not-existent-client" }, - expError: clienttypes.ErrClientNotFound, + expError: clienttypes.ErrCounterpartyNotFound, }, { name: "failure: invalid commitment", diff --git a/modules/core/04-channel/v2/keeper/packet.go b/modules/core/04-channel/v2/keeper/packet.go index 85594a745cc..17d723b08b5 100644 --- a/modules/core/04-channel/v2/keeper/packet.go +++ b/modules/core/04-channel/v2/keeper/packet.go @@ -24,10 +24,10 @@ func (k *Keeper) sendPacket( timeoutTimestamp uint64, payloads []types.Payload, ) (uint64, string, error) { - // lookup counterparty and clientid from packet identifiers - clientID, counterparty, err := k.resolveV2Identifiers(ctx, payloads[0].SourcePort, sourceClient) - if err != nil { - return 0, "", err + // lookup counterparty from packet identifiers + counterparty, ok := k.ClientKeeper.GetClientCounterparty(ctx, sourceClient) + if !ok { + return 0, "", errorsmod.Wrapf(clienttypes.ErrCounterpartyNotFound, "counterparty not found for client: %s", sourceClient) } sequence, found := k.GetNextSequenceSend(ctx, sourceClient) @@ -43,17 +43,17 @@ func (k *Keeper) sendPacket( } // 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 } @@ -91,10 +91,10 @@ func (k *Keeper) recvPacket( proof []byte, proofHeight exported.Height, ) error { - // lookup counterparty and clientid from packet identifiers - clientID, counterparty, err := k.resolveV2Identifiers(ctx, packet.Payloads[0].DestinationPort, packet.DestinationClient) - if err != nil { - return err + // lookup counterparty from packet identifiers + counterparty, ok := k.ClientKeeper.GetClientCounterparty(ctx, packet.DestinationClient) + if !ok { + return errorsmod.Wrapf(clienttypes.ErrCounterpartyNotFound, "counterparty not found for client: %s", packet.DestinationClient) } if counterparty.ClientId != packet.SourceClient { @@ -126,14 +126,14 @@ func (k *Keeper) recvPacket( 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 @@ -153,10 +153,10 @@ func (k Keeper) WriteAcknowledgement( packet types.Packet, ack types.Acknowledgement, ) error { - // lookup counterparty and clientid from packet identifiers - _, counterparty, err := k.resolveV2Identifiers(ctx, packet.Payloads[0].DestinationPort, packet.DestinationClient) - if err != nil { - return err + // lookup counterparty from packet identifiers + counterparty, ok := k.ClientKeeper.GetClientCounterparty(ctx, packet.DestinationClient) + if !ok { + return errorsmod.Wrapf(clienttypes.ErrCounterpartyNotFound, "counterparty not found for client: %s", packet.DestinationClient) } if counterparty.ClientId != packet.SourceClient { @@ -190,10 +190,10 @@ 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 and clientid from packet identifiers - clientID, counterparty, err := k.resolveV2Identifiers(ctx, packet.Payloads[0].SourcePort, packet.SourceClient) - if err != nil { - return err + // lookup counterparty from packet identifiers + counterparty, ok := k.ClientKeeper.GetClientCounterparty(ctx, packet.SourceClient) + if !ok { + return errorsmod.Wrapf(clienttypes.ErrCounterpartyNotFound, "counterparty not found for client: %s", packet.SourceClient) } if counterparty.ClientId != packet.DestinationClient { @@ -222,14 +222,14 @@ func (k *Keeper) acknowledgePacket(ctx context.Context, packet types.Packet, ack 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.SourceClient, packet.Sequence) @@ -254,10 +254,10 @@ func (k *Keeper) timeoutPacket( proof []byte, proofHeight exported.Height, ) error { - // lookup counterparty and clientid from packet identifiers - clientID, counterparty, err := k.resolveV2Identifiers(ctx, packet.Payloads[0].SourcePort, packet.SourceClient) - if err != nil { - return err + // lookup counterparty from packet identifiers + counterparty, ok := k.ClientKeeper.GetClientCounterparty(ctx, packet.SourceClient) + if !ok { + return errorsmod.Wrapf(clienttypes.ErrCounterpartyNotFound, "counterparty not found for client: %s", packet.SourceClient) } if counterparty.ClientId != packet.DestinationClient { @@ -265,7 +265,7 @@ func (k *Keeper) timeoutPacket( } // 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 } @@ -298,13 +298,13 @@ func (k *Keeper) timeoutPacket( 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 diff --git a/modules/core/04-channel/v2/keeper/packet_test.go b/modules/core/04-channel/v2/keeper/packet_test.go index 9afb07a2cc7..4c988d2ee69 100644 --- a/modules/core/04-channel/v2/keeper/packet_test.go +++ b/modules/core/04-channel/v2/keeper/packet_test.go @@ -47,7 +47,7 @@ func (suite *KeeperTestSuite) TestSendPacket() { func() { packet.SourceClient = ibctesting.InvalidID }, - clienttypes.ErrClientNotFound, + clienttypes.ErrCounterpartyNotFound, }, { "packet failed basic validation", @@ -153,7 +153,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() { func() { packet.DestinationClient = ibctesting.InvalidID }, - clienttypes.ErrClientNotFound, + clienttypes.ErrCounterpartyNotFound, }, { "failure: client is not active", @@ -254,7 +254,7 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgement() { func() { packet.DestinationClient = ibctesting.InvalidID }, - clienttypes.ErrClientNotFound, + clienttypes.ErrCounterpartyNotFound, }, { "failure: counterparty client identifier different than source client", @@ -346,7 +346,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { func() { packet.SourceClient = ibctesting.InvalidID }, - clienttypes.ErrClientNotFound, + clienttypes.ErrCounterpartyNotFound, }, { "failure: counterparty client identifier different than destination client", @@ -464,7 +464,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { packet.SourceClient = ibctesting.InvalidID }, - clienttypes.ErrClientNotFound, + clienttypes.ErrCounterpartyNotFound, }, { "failure: counterparty client identifier different than destination client", From a0eb482812b5c6b33aec518832b16b640b4b4da9 Mon Sep 17 00:00:00 2001 From: Aditya Sripal <14364734+AdityaSripal@users.noreply.github.com> Date: Thu, 16 Jan 2025 12:47:14 +0100 Subject: [PATCH 15/18] lint --- modules/core/02-client/types/counterparty.go | 4 ++-- modules/core/02-client/types/msgs.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/core/02-client/types/counterparty.go b/modules/core/02-client/types/counterparty.go index 7d591152be0..2b3dd142384 100644 --- a/modules/core/02-client/types/counterparty.go +++ b/modules/core/02-client/types/counterparty.go @@ -1,8 +1,8 @@ package types -func NewCounterpartyInfo(merklePrefix [][]byte, clientId string) CounterpartyInfo { +func NewCounterpartyInfo(merklePrefix [][]byte, clientID string) CounterpartyInfo { return CounterpartyInfo{ MerklePrefix: merklePrefix, - ClientId: clientId, + ClientId: clientID, } } diff --git a/modules/core/02-client/types/msgs.go b/modules/core/02-client/types/msgs.go index b21d6b11101..81fd0c21cac 100644 --- a/modules/core/02-client/types/msgs.go +++ b/modules/core/02-client/types/msgs.go @@ -325,11 +325,11 @@ func (msg *MsgUpdateParams) ValidateBasic() error { } // NewMsgRegisterCounterparty creates a new instance of MsgRegisterCounterparty. -func NewMsgRegisterCounterparty(clientId string, merklePrefix [][]byte, counterpartyClientId string, signer string) *MsgRegisterCounterparty { +func NewMsgRegisterCounterparty(clientID string, merklePrefix [][]byte, counterpartyClientID string, signer string) *MsgRegisterCounterparty { return &MsgRegisterCounterparty{ - ClientId: clientId, + ClientId: clientID, CounterpartyMerklePrefix: merklePrefix, - CounterpartyClientId: counterpartyClientId, + CounterpartyClientId: counterpartyClientID, Signer: signer, } } From b0c1f22e60dafb4cdcd29f30de903a4d2a00cff6 Mon Sep 17 00:00:00 2001 From: Aditya Sripal <14364734+AdityaSripal@users.noreply.github.com> Date: Thu, 16 Jan 2025 13:38:31 +0100 Subject: [PATCH 16/18] lint --- modules/core/keeper/msg_server_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/core/keeper/msg_server_test.go b/modules/core/keeper/msg_server_test.go index 480c06a5d73..fc76dff18a0 100644 --- a/modules/core/keeper/msg_server_test.go +++ b/modules/core/keeper/msg_server_test.go @@ -87,7 +87,6 @@ func (suite *KeeperTestSuite) TestRegisterCounterparty() { } }) } - } // tests the IBC handler receiving a packet on ordered and unordered channels. From b759f29bdd4df3228629ba32460deba70f2bc980 Mon Sep 17 00:00:00 2001 From: Aditya Sripal <14364734+AdityaSripal@users.noreply.github.com> Date: Fri, 17 Jan 2025 15:26:19 +0100 Subject: [PATCH 17/18] review suggestions --- modules/core/02-client/keeper/keeper.go | 2 ++ modules/core/02-client/types/counterparty.go | 1 + modules/core/02-client/types/keys.go | 4 ++++ modules/core/04-channel/v2/keeper/packet.go | 12 ++++++------ 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/modules/core/02-client/keeper/keeper.go b/modules/core/02-client/keeper/keeper.go index f3a7102a0e6..e618a54913f 100644 --- a/modules/core/02-client/keeper/keeper.go +++ b/modules/core/02-client/keeper/keeper.go @@ -137,11 +137,13 @@ func (k *Keeper) DeleteClientCreator(ctx context.Context, clientID string) { 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()) diff --git a/modules/core/02-client/types/counterparty.go b/modules/core/02-client/types/counterparty.go index 2b3dd142384..b057a590002 100644 --- a/modules/core/02-client/types/counterparty.go +++ b/modules/core/02-client/types/counterparty.go @@ -1,5 +1,6 @@ package types +// NewCounterpartyInfo creates a new counterparty info instance from merlePrefix and clientID func NewCounterpartyInfo(merklePrefix [][]byte, clientID string) CounterpartyInfo { return CounterpartyInfo{ MerklePrefix: merklePrefix, diff --git a/modules/core/02-client/types/keys.go b/modules/core/02-client/types/keys.go index f286b28523d..d0ea7ca9c7f 100644 --- a/modules/core/02-client/types/keys.go +++ b/modules/core/02-client/types/keys.go @@ -29,8 +29,10 @@ 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 @@ -96,10 +98,12 @@ 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/04-channel/v2/keeper/packet.go b/modules/core/04-channel/v2/keeper/packet.go index 17d723b08b5..ce00443cfe9 100644 --- a/modules/core/04-channel/v2/keeper/packet.go +++ b/modules/core/04-channel/v2/keeper/packet.go @@ -24,7 +24,7 @@ func (k *Keeper) sendPacket( timeoutTimestamp uint64, payloads []types.Payload, ) (uint64, string, error) { - // lookup counterparty from packet identifiers + // lookup counterparty from client identifiers counterparty, ok := k.ClientKeeper.GetClientCounterparty(ctx, sourceClient) if !ok { return 0, "", errorsmod.Wrapf(clienttypes.ErrCounterpartyNotFound, "counterparty not found for client: %s", sourceClient) @@ -91,7 +91,7 @@ func (k *Keeper) recvPacket( proof []byte, proofHeight exported.Height, ) error { - // lookup counterparty from packet identifiers + // lookup counterparty from client identifiers counterparty, ok := k.ClientKeeper.GetClientCounterparty(ctx, packet.DestinationClient) if !ok { return errorsmod.Wrapf(clienttypes.ErrCounterpartyNotFound, "counterparty not found for client: %s", packet.DestinationClient) @@ -109,7 +109,7 @@ 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.DestinationClient, packet.Sequence) { // This error indicates that the packet has already been relayed. Core IBC will @@ -153,7 +153,7 @@ func (k Keeper) WriteAcknowledgement( packet types.Packet, ack types.Acknowledgement, ) error { - // lookup counterparty from packet identifiers + // lookup counterparty from client identifiers counterparty, ok := k.ClientKeeper.GetClientCounterparty(ctx, packet.DestinationClient) if !ok { return errorsmod.Wrapf(clienttypes.ErrCounterpartyNotFound, "counterparty not found for client: %s", packet.DestinationClient) @@ -190,7 +190,7 @@ 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 from packet identifiers + // lookup counterparty from client identifiers counterparty, ok := k.ClientKeeper.GetClientCounterparty(ctx, packet.SourceClient) if !ok { return errorsmod.Wrapf(clienttypes.ErrCounterpartyNotFound, "counterparty not found for client: %s", packet.SourceClient) @@ -254,7 +254,7 @@ func (k *Keeper) timeoutPacket( proof []byte, proofHeight exported.Height, ) error { - // lookup counterparty from packet identifiers + // lookup counterparty from client identifiers counterparty, ok := k.ClientKeeper.GetClientCounterparty(ctx, packet.SourceClient) if !ok { return errorsmod.Wrapf(clienttypes.ErrCounterpartyNotFound, "counterparty not found for client: %s", packet.SourceClient) From 09a4ac851623083ecfa7b77e7d4a51727b32a220 Mon Sep 17 00:00:00 2001 From: Aditya <14364734+AdityaSripal@users.noreply.github.com> Date: Fri, 17 Jan 2025 16:31:02 +0100 Subject: [PATCH 18/18] Update cli.go --- modules/core/04-channel/v2/client/cli/cli.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/core/04-channel/v2/client/cli/cli.go b/modules/core/04-channel/v2/client/cli/cli.go index 3dd8d3c451b..cf8f883f46d 100644 --- a/modules/core/04-channel/v2/client/cli/cli.go +++ b/modules/core/04-channel/v2/client/cli/cli.go @@ -41,7 +41,7 @@ func NewTxCmd() *cobra.Command { RunE: client.ValidateCmd, } - // TODO: Add v2 packet commands + // TODO: Add v2 packet commands: https://github.com/cosmos/ibc-go/issues/7853 txCmd.AddCommand() return txCmd