From 6ad6131c96578cef8de131e5fd667210dc0b556e Mon Sep 17 00:00:00 2001 From: bznein Date: Tue, 17 Sep 2024 15:10:19 +0100 Subject: [PATCH 01/27] chore: add MsgSendPacket and SendPacket RPC proto definitions --- go.mod | 3 +- go.sum | 6 +- modules/core/04-channel/types/tx.pb.go | 779 +++++++++++++++++++++---- proto/ibc/core/channel/v1/tx.proto | 22 + 4 files changed, 682 insertions(+), 128 deletions(-) diff --git a/go.mod b/go.mod index 7737ee796b0..08b5227b6e5 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,6 @@ require ( github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/cosmos-sdk v0.50.10-0.20240808075341-156231be8aef github.com/cosmos/gogoproto v1.7.0 - github.com/cosmos/ibc-go/modules/capability v1.0.1 github.com/cosmos/ics23/go v0.11.0 github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 @@ -114,6 +113,7 @@ require ( github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-plugin v1.6.1 // indirect github.com/hashicorp/go-safetemp v1.0.0 // indirect + github.com/hashicorp/go-uuid v1.0.2 // indirect github.com/hashicorp/go-version v1.6.0 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect @@ -143,6 +143,7 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect github.com/oklog/run v1.1.0 // indirect + github.com/onsi/ginkgo v1.16.4 // indirect github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/petermattis/goid v0.0.0-20240607163614-bb94eb51e7a7 // indirect github.com/pkg/errors v0.9.1 // indirect diff --git a/go.sum b/go.sum index 5edbbed702e..fc5995828a5 100644 --- a/go.sum +++ b/go.sum @@ -354,8 +354,6 @@ github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fr github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= -github.com/cosmos/ibc-go/modules/capability v1.0.1 h1:ibwhrpJ3SftEEZRxCRkH0fQZ9svjthrX2+oXdZvzgGI= -github.com/cosmos/ibc-go/modules/capability v1.0.1/go.mod h1:rquyOV262nGJplkumH+/LeYs04P3eV8oB7ZM4Ygqk4E= github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= @@ -462,6 +460,7 @@ github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+ github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= @@ -791,6 +790,7 @@ github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxzi github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY= github.com/nxadm/tail v1.4.11/go.mod h1:OTaG3NK980DZzxbRq6lEuzgU+mug70nY11sMd4JXXHc= github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a h1:dlRvE5fWabOchtH7znfiFCcOvmIYgOeAS5ifBXBlh9Q= @@ -1236,6 +1236,7 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1356,6 +1357,7 @@ golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82u golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= diff --git a/modules/core/04-channel/types/tx.pb.go b/modules/core/04-channel/types/tx.pb.go index 87a92a47a61..ab959bbe69d 100644 --- a/modules/core/04-channel/types/tx.pb.go +++ b/modules/core/04-channel/types/tx.pb.go @@ -1630,6 +1630,86 @@ func (m *MsgPruneAcknowledgementsResponse) GetTotalRemainingSequences() uint64 { return 0 } +// MsgSendPacket sends an outgoing IBC packet. +type MsgSendPacket struct { + SourceId string `protobuf:"bytes,1,opt,name=source_id,json=sourceId,proto3" json:"source_id,omitempty"` + DestinationId string `protobuf:"bytes,2,opt,name=destination_id,json=destinationId,proto3" json:"destination_id,omitempty"` + TimeoutTimestamp uint64 `protobuf:"varint,3,opt,name=timeout_timestamp,json=timeoutTimestamp,proto3" json:"timeout_timestamp,omitempty"` + PacketData []PacketData `protobuf:"bytes,4,rep,name=packet_data,json=packetData,proto3" json:"packet_data"` + Signer string `protobuf:"bytes,5,opt,name=signer,proto3" json:"signer,omitempty"` +} + +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_bc4637e0ac3fc7b7, []int{38} +} +func (m *MsgSendPacket) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSendPacket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSendPacket.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 *MsgSendPacket) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSendPacket.Merge(m, src) +} +func (m *MsgSendPacket) XXX_Size() int { + return m.Size() +} +func (m *MsgSendPacket) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSendPacket.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSendPacket proto.InternalMessageInfo + +// MsgSendPacketResponse defines the Msg/SendPacket response type. +type MsgSendPacketResponse struct { + Sequence uint64 `protobuf:"varint,1,opt,name=sequence,proto3" json:"sequence,omitempty"` +} + +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_bc4637e0ac3fc7b7, []int{39} +} +func (m *MsgSendPacketResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSendPacketResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSendPacketResponse.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 *MsgSendPacketResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSendPacketResponse.Merge(m, src) +} +func (m *MsgSendPacketResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSendPacketResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSendPacketResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSendPacketResponse proto.InternalMessageInfo + func init() { proto.RegisterEnum("ibc.core.channel.v1.ResponseResultType", ResponseResultType_name, ResponseResultType_value) proto.RegisterType((*MsgChannelOpenInit)(nil), "ibc.core.channel.v1.MsgChannelOpenInit") @@ -1670,136 +1750,146 @@ func init() { proto.RegisterType((*MsgUpdateParamsResponse)(nil), "ibc.core.channel.v1.MsgUpdateParamsResponse") proto.RegisterType((*MsgPruneAcknowledgements)(nil), "ibc.core.channel.v1.MsgPruneAcknowledgements") proto.RegisterType((*MsgPruneAcknowledgementsResponse)(nil), "ibc.core.channel.v1.MsgPruneAcknowledgementsResponse") + proto.RegisterType((*MsgSendPacket)(nil), "ibc.core.channel.v1.MsgSendPacket") + proto.RegisterType((*MsgSendPacketResponse)(nil), "ibc.core.channel.v1.MsgSendPacketResponse") } func init() { proto.RegisterFile("ibc/core/channel/v1/tx.proto", fileDescriptor_bc4637e0ac3fc7b7) } var fileDescriptor_bc4637e0ac3fc7b7 = []byte{ - // 1983 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x5a, 0xcd, 0x6f, 0xdb, 0xc8, - 0x15, 0x37, 0xf5, 0x19, 0x3d, 0x27, 0x91, 0x43, 0x39, 0xb1, 0x4c, 0xdb, 0x92, 0xa2, 0x16, 0x8d, - 0xd7, 0x4d, 0xa4, 0xb5, 0x37, 0x5b, 0x20, 0xc1, 0x02, 0xad, 0xa3, 0x2a, 0x5d, 0x03, 0x71, 0x6c, - 0x50, 0x56, 0xd1, 0xee, 0x16, 0x15, 0x64, 0x6a, 0x42, 0x11, 0x92, 0x48, 0x2e, 0x49, 0x69, 0xd7, - 0x05, 0x5a, 0x2c, 0x7a, 0x0a, 0x72, 0x58, 0xb4, 0xc0, 0x5e, 0x03, 0xb4, 0xe8, 0x3f, 0xb0, 0xe8, - 0xb1, 0x1f, 0x87, 0xde, 0xf6, 0x50, 0x14, 0x7b, 0x5c, 0x14, 0xe8, 0xa2, 0x48, 0x0e, 0xfb, 0x3f, - 0x14, 0x28, 0x50, 0x70, 0x66, 0x48, 0x51, 0xe4, 0x50, 0xa2, 0x2d, 0xd5, 0xd8, 0x9b, 0x38, 0xf3, - 0x9b, 0x37, 0xf3, 0x7e, 0xbf, 0x37, 0x6f, 0xbe, 0x04, 0x9b, 0xca, 0xa9, 0x54, 0x95, 0x34, 0x03, - 0x55, 0xa5, 0x6e, 0x5b, 0x55, 0x51, 0xbf, 0x3a, 0xda, 0xad, 0x5a, 0x1f, 0x55, 0x74, 0x43, 0xb3, - 0x34, 0x3e, 0xa7, 0x9c, 0x4a, 0x15, 0xbb, 0xb6, 0x42, 0x6b, 0x2b, 0xa3, 0x5d, 0x61, 0x55, 0xd6, - 0x64, 0x0d, 0xd7, 0x57, 0xed, 0x5f, 0x04, 0x2a, 0xac, 0x49, 0x9a, 0x39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c, - 0x98, 0x77, 0xa3, 0x22, 0xdc, 0x8d, 0x82, 0xf2, 0xb2, 0xcc, 0xde, 0xca, 0x84, 0xb2, 0xcc, 0x84, - 0x87, 0xb3, 0x3c, 0x75, 0x53, 0x22, 0x24, 0x3f, 0xfe, 0xfa, 0xb3, 0x1d, 0x6e, 0xef, 0x8f, 0x31, - 0xc8, 0x90, 0xfb, 0x79, 0x7b, 0x51, 0xfd, 0x19, 0x80, 0xe7, 0xdd, 0xb1, 0x1c, 0x66, 0x79, 0x8c, - 0x11, 0x76, 0x66, 0x63, 0x5c, 0x8f, 0x1b, 0x90, 0x76, 0x22, 0xa9, 0x38, 0x23, 0xc7, 0x09, 0x77, - 0x66, 0x00, 0x5c, 0xa3, 0x3d, 0xc8, 0xfa, 0x5f, 0x25, 0x42, 0xdb, 0xfa, 0x80, 0xe1, 0xfb, 0x80, - 0x90, 0xdb, 0x7d, 0x4a, 0xda, 0xa3, 0xc6, 0xe7, 0xaf, 0x0a, 0xdc, 0x17, 0xaf, 0x0a, 0xdc, 0xbf, - 0x5f, 0x15, 0xb8, 0xdf, 0xbc, 0x2e, 0x2c, 0x7d, 0xf1, 0xba, 0xb0, 0xf4, 0xe5, 0xeb, 0xc2, 0xd2, - 0x7b, 0x0f, 0x64, 0xc5, 0xea, 0x0e, 0x4f, 0x2b, 0x92, 0x36, 0xa8, 0xd2, 0x3f, 0x4d, 0x29, 0xa7, - 0xd2, 0x3d, 0x59, 0xab, 0x8e, 0x1e, 0x54, 0x07, 0x5a, 0x67, 0xd8, 0x47, 0x26, 0xf9, 0xb3, 0xd3, - 0x9b, 0xf7, 0xef, 0x39, 0xff, 0x77, 0xb2, 0xce, 0x74, 0x64, 0x9e, 0xa6, 0xf0, 0x7f, 0x9d, 0xde, - 0xfa, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x5b, 0xdf, 0x5a, 0xd6, 0xb6, 0x25, 0x00, 0x00, + // 2112 bytes of a gzipped FileDescriptorProto + 0x1f, 0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 0x24, 0x7b, 0x33, 0x97, 0xe4, 0x53, 0x4c, 0xab, 0x3b, 0x73, 0xc7, 0x73, 0xc1, 0x99, 0xa7, + 0x26, 0x9b, 0x79, 0x7a, 0xf4, 0xcc, 0x4b, 0xb0, 0xc6, 0x9c, 0x9b, 0x37, 0xfb, 0x3e, 0x14, 0x06, + 0x80, 0x7a, 0x47, 0xb7, 0xd0, 0xe8, 0x78, 0x38, 0x66, 0xea, 0xb1, 0x03, 0xde, 0x1a, 0xac, 0x30, + 0xfa, 0xf5, 0x86, 0xf5, 0xdb, 0x04, 0xdc, 0x0a, 0xd4, 0x4f, 0xea, 0x95, 0xe1, 0x88, 0x91, 0x1c, + 0x17, 0x31, 0xa6, 0xe9, 0x17, 0xfe, 0x11, 0xac, 0x0d, 0x2d, 0x1f, 0xba, 0x27, 0xb5, 0x2c, 0xf4, + 0x61, 0x0f, 0x69, 0x32, 0xc2, 0xfa, 0x4f, 0x89, 0x2b, 0x7e, 0xd0, 0x11, 0xc1, 0x34, 0x29, 0x24, + 0x4c, 0x61, 0x19, 0xd6, 0xd9, 0x14, 0x79, 0x2c, 0x9e, 0x73, 0x70, 0x7d, 0xcf, 0x6a, 0x8b, 0x48, + 0xee, 0x1f, 0x48, 0xf2, 0x29, 0xb2, 0xf9, 0x07, 0x90, 0x31, 0xf0, 0x7f, 0x98, 0xbb, 0xb9, 0xed, + 0x15, 0x66, 0x98, 0x26, 0x60, 0x3a, 0x41, 0xda, 0x80, 0x7f, 0x0d, 0xe6, 0x09, 0x41, 0xb2, 0xde, + 0xed, 0xaa, 0x76, 0x17, 0x69, 0x36, 0x26, 0xf9, 0x9a, 0x98, 0xc7, 0xe5, 0x75, 0xaf, 0x38, 0xc4, + 0x65, 0x72, 0x32, 0x2e, 0x53, 0xa3, 0xa5, 0xf4, 0x53, 0xbc, 0x7e, 0x07, 0x93, 0xf4, 0x22, 0xef, + 0xf7, 0x21, 0x63, 0x22, 0xab, 0xd7, 0x21, 0x93, 0xbd, 0x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x90, 0x0f, 0x3e, 0x11, 0x45, 0xb6, 0x0d, 0x00, 0xa3, 0x4f, + 0x19, 0x11, 0x4f, 0x2d, 0x94, 0xb4, 0x47, 0xcd, 0x2f, 0x5e, 0xad, 0x73, 0x5f, 0xbe, 0x5a, 0xe7, + 0xfe, 0xf9, 0x6a, 0x9d, 0xfb, 0xd5, 0xf9, 0xfa, 0xcc, 0x97, 0xe7, 0xeb, 0x33, 0x5f, 0x9d, 0xaf, + 0xcf, 0xbc, 0xf7, 0xa0, 0xad, 0xda, 0x27, 0xbd, 0xe3, 0xaa, 0xac, 0x77, 0x6b, 0xf4, 0x17, 0x6c, + 0xea, 0xb1, 0x7c, 0xaf, 0xad, 0xd7, 0xfa, 0x0f, 0x6a, 0x5d, 0x5d, 0xe9, 0x75, 0x90, 0x45, 0x7e, + 0x79, 0xf6, 0xc6, 0xfd, 0x7b, 0xee, 0x8f, 0xcf, 0xec, 0x33, 0x03, 0x59, 0xc7, 0x19, 0xfc, 0xc3, + 0xb3, 0x37, 0xff, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x91, 0x07, 0x8d, 0xf8, 0x43, 0x27, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1822,6 +1912,8 @@ type MsgClient interface { ChannelOpenAck(ctx context.Context, in *MsgChannelOpenAck, opts ...grpc.CallOption) (*MsgChannelOpenAckResponse, error) // ChannelOpenConfirm defines a rpc handler method for MsgChannelOpenConfirm. ChannelOpenConfirm(ctx context.Context, in *MsgChannelOpenConfirm, opts ...grpc.CallOption) (*MsgChannelOpenConfirmResponse, error) + // SendPacket defines a rpc handler method for MsgSendPacket. + SendPacket(ctx context.Context, in *MsgSendPacket, opts ...grpc.CallOption) (*MsgSendPacketResponse, error) // ChannelCloseInit defines a rpc handler method for MsgChannelCloseInit. ChannelCloseInit(ctx context.Context, in *MsgChannelCloseInit, opts ...grpc.CallOption) (*MsgChannelCloseInitResponse, error) // ChannelCloseConfirm defines a rpc handler method for @@ -1893,6 +1985,15 @@ func (c *msgClient) ChannelOpenConfirm(ctx context.Context, in *MsgChannelOpenCo 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.v1.Msg/SendPacket", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *msgClient) ChannelCloseInit(ctx context.Context, in *MsgChannelCloseInit, opts ...grpc.CallOption) (*MsgChannelCloseInitResponse, error) { out := new(MsgChannelCloseInitResponse) err := c.cc.Invoke(ctx, "/ibc.core.channel.v1.Msg/ChannelCloseInit", in, out, opts...) @@ -2011,6 +2112,8 @@ type MsgServer interface { ChannelOpenAck(context.Context, *MsgChannelOpenAck) (*MsgChannelOpenAckResponse, error) // ChannelOpenConfirm defines a rpc handler method for MsgChannelOpenConfirm. ChannelOpenConfirm(context.Context, *MsgChannelOpenConfirm) (*MsgChannelOpenConfirmResponse, error) + // SendPacket defines a rpc handler method for MsgSendPacket. + SendPacket(context.Context, *MsgSendPacket) (*MsgSendPacketResponse, error) // ChannelCloseInit defines a rpc handler method for MsgChannelCloseInit. ChannelCloseInit(context.Context, *MsgChannelCloseInit) (*MsgChannelCloseInitResponse, error) // ChannelCloseConfirm defines a rpc handler method for @@ -2054,6 +2157,9 @@ func (*UnimplementedMsgServer) ChannelOpenAck(ctx context.Context, req *MsgChann func (*UnimplementedMsgServer) ChannelOpenConfirm(ctx context.Context, req *MsgChannelOpenConfirm) (*MsgChannelOpenConfirmResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ChannelOpenConfirm not implemented") } +func (*UnimplementedMsgServer) SendPacket(ctx context.Context, req *MsgSendPacket) (*MsgSendPacketResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SendPacket not implemented") +} func (*UnimplementedMsgServer) ChannelCloseInit(ctx context.Context, req *MsgChannelCloseInit) (*MsgChannelCloseInitResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ChannelCloseInit not implemented") } @@ -2167,6 +2273,24 @@ func _Msg_ChannelOpenConfirm_Handler(srv interface{}, ctx context.Context, dec f 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 { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SendPacket(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ibc.core.channel.v1.Msg/SendPacket", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SendPacket(ctx, req.(*MsgSendPacket)) + } + return interceptor(ctx, in, info, handler) +} + func _Msg_ChannelCloseInit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgChannelCloseInit) if err := dec(in); err != nil { @@ -2403,6 +2527,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "ChannelOpenConfirm", Handler: _Msg_ChannelOpenConfirm_Handler, }, + { + MethodName: "SendPacket", + Handler: _Msg_SendPacket_Handler, + }, { MethodName: "ChannelCloseInit", Handler: _Msg_ChannelCloseInit_Handler, @@ -4383,6 +4511,97 @@ func (m *MsgPruneAcknowledgementsResponse) MarshalToSizedBuffer(dAtA []byte) (in return len(dAtA) - i, nil } +func (m *MsgSendPacket) 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 *MsgSendPacket) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSendPacket) 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 + } + if len(m.PacketData) > 0 { + for iNdEx := len(m.PacketData) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.PacketData[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if m.TimeoutTimestamp != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.TimeoutTimestamp)) + i-- + dAtA[i] = 0x18 + } + if len(m.DestinationId) > 0 { + i -= len(m.DestinationId) + copy(dAtA[i:], m.DestinationId) + i = encodeVarintTx(dAtA, i, uint64(len(m.DestinationId))) + i-- + dAtA[i] = 0x12 + } + if len(m.SourceId) > 0 { + i -= len(m.SourceId) + copy(dAtA[i:], m.SourceId) + i = encodeVarintTx(dAtA, i, uint64(len(m.SourceId))) + 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 encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -5148,6 +5367,48 @@ func (m *MsgPruneAcknowledgementsResponse) Size() (n int) { return n } +func (m *MsgSendPacket) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SourceId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.DestinationId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.TimeoutTimestamp != 0 { + n += 1 + sovTx(uint64(m.TimeoutTimestamp)) + } + if len(m.PacketData) > 0 { + for _, e := range m.PacketData { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSendPacketResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Sequence != 0 { + n += 1 + sovTx(uint64(m.Sequence)) + } + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -10765,6 +11026,274 @@ func (m *MsgPruneAcknowledgementsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgSendPacket) 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: MsgSendPacket: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSendPacket: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SourceId", 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.SourceId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DestinationId", 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.DestinationId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TimeoutTimestamp", wireType) + } + m.TimeoutTimestamp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TimeoutTimestamp |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PacketData", 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 + } + m.PacketData = append(m.PacketData, PacketData{}) + if err := m.PacketData[len(m.PacketData)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + 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 *MsgSendPacketResponse) 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: MsgSendPacketResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSendPacketResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Sequence", wireType) + } + m.Sequence = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Sequence |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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 skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/proto/ibc/core/channel/v1/tx.proto b/proto/ibc/core/channel/v1/tx.proto index 729ffd09b28..c242d88dfb0 100644 --- a/proto/ibc/core/channel/v1/tx.proto +++ b/proto/ibc/core/channel/v1/tx.proto @@ -26,6 +26,9 @@ service Msg { // ChannelOpenConfirm defines a rpc handler method for MsgChannelOpenConfirm. rpc ChannelOpenConfirm(MsgChannelOpenConfirm) returns (MsgChannelOpenConfirmResponse); + // SendPacket defines a rpc handler method for MsgSendPacket. + rpc SendPacket(MsgSendPacket) returns (MsgSendPacketResponse); + // ChannelCloseInit defines a rpc handler method for MsgChannelCloseInit. rpc ChannelCloseInit(MsgChannelCloseInit) returns (MsgChannelCloseInitResponse); @@ -472,3 +475,22 @@ message MsgPruneAcknowledgementsResponse { // Number of sequences left after pruning. uint64 total_remaining_sequences = 2; } + +// MsgSendPacket sends an outgoing IBC packet. +message MsgSendPacket { + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; + string source_id = 1; + string destination_id = 2; + uint64 timeout_timestamp = 3; + repeated PacketData packet_data = 4 [(gogoproto.nullable) = false]; + string signer = 5; + // string dest_port = 6; +} + +// MsgSendPacketResponse defines the Msg/SendPacket response type. +message MsgSendPacketResponse { + option (gogoproto.goproto_getters) = false; + + uint64 sequence = 1; +} From 030098cff94444619715348edebc65231552f6d2 Mon Sep 17 00:00:00 2001 From: bznein Date: Tue, 17 Sep 2024 15:25:45 +0100 Subject: [PATCH 02/27] create proto file for msg server v2 --- modules/core/04-channel/types/tx.pb.go | 779 ++----- modules/core/04-channel/v2/types/tx.pb.go | 2293 +++++++++++++++++++++ proto/ibc/core/channel/v1/tx.proto | 22 - proto/ibc/core/channel/v2/tx.proto | 106 + 4 files changed, 2524 insertions(+), 676 deletions(-) create mode 100644 modules/core/04-channel/v2/types/tx.pb.go create mode 100644 proto/ibc/core/channel/v2/tx.proto diff --git a/modules/core/04-channel/types/tx.pb.go b/modules/core/04-channel/types/tx.pb.go index ab959bbe69d..87a92a47a61 100644 --- a/modules/core/04-channel/types/tx.pb.go +++ b/modules/core/04-channel/types/tx.pb.go @@ -1630,86 +1630,6 @@ func (m *MsgPruneAcknowledgementsResponse) GetTotalRemainingSequences() uint64 { return 0 } -// MsgSendPacket sends an outgoing IBC packet. -type MsgSendPacket struct { - SourceId string `protobuf:"bytes,1,opt,name=source_id,json=sourceId,proto3" json:"source_id,omitempty"` - DestinationId string `protobuf:"bytes,2,opt,name=destination_id,json=destinationId,proto3" json:"destination_id,omitempty"` - TimeoutTimestamp uint64 `protobuf:"varint,3,opt,name=timeout_timestamp,json=timeoutTimestamp,proto3" json:"timeout_timestamp,omitempty"` - PacketData []PacketData `protobuf:"bytes,4,rep,name=packet_data,json=packetData,proto3" json:"packet_data"` - Signer string `protobuf:"bytes,5,opt,name=signer,proto3" json:"signer,omitempty"` -} - -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_bc4637e0ac3fc7b7, []int{38} -} -func (m *MsgSendPacket) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgSendPacket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgSendPacket.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 *MsgSendPacket) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSendPacket.Merge(m, src) -} -func (m *MsgSendPacket) XXX_Size() int { - return m.Size() -} -func (m *MsgSendPacket) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSendPacket.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgSendPacket proto.InternalMessageInfo - -// MsgSendPacketResponse defines the Msg/SendPacket response type. -type MsgSendPacketResponse struct { - Sequence uint64 `protobuf:"varint,1,opt,name=sequence,proto3" json:"sequence,omitempty"` -} - -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_bc4637e0ac3fc7b7, []int{39} -} -func (m *MsgSendPacketResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgSendPacketResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgSendPacketResponse.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 *MsgSendPacketResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSendPacketResponse.Merge(m, src) -} -func (m *MsgSendPacketResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgSendPacketResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSendPacketResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgSendPacketResponse proto.InternalMessageInfo - func init() { proto.RegisterEnum("ibc.core.channel.v1.ResponseResultType", ResponseResultType_name, ResponseResultType_value) proto.RegisterType((*MsgChannelOpenInit)(nil), "ibc.core.channel.v1.MsgChannelOpenInit") @@ -1750,146 +1670,136 @@ func init() { proto.RegisterType((*MsgUpdateParamsResponse)(nil), "ibc.core.channel.v1.MsgUpdateParamsResponse") proto.RegisterType((*MsgPruneAcknowledgements)(nil), "ibc.core.channel.v1.MsgPruneAcknowledgements") proto.RegisterType((*MsgPruneAcknowledgementsResponse)(nil), "ibc.core.channel.v1.MsgPruneAcknowledgementsResponse") - proto.RegisterType((*MsgSendPacket)(nil), "ibc.core.channel.v1.MsgSendPacket") - proto.RegisterType((*MsgSendPacketResponse)(nil), "ibc.core.channel.v1.MsgSendPacketResponse") } func init() { proto.RegisterFile("ibc/core/channel/v1/tx.proto", fileDescriptor_bc4637e0ac3fc7b7) } var fileDescriptor_bc4637e0ac3fc7b7 = []byte{ - // 2112 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x5a, 0x4d, 0x6c, 0xe3, 0xc6, - 0x15, 0x36, 0xf5, 0x6b, 0x3d, 0xef, 0xae, 0x6c, 0xca, 0xbb, 0x96, 0xe9, 0x1f, 0x69, 0xd5, 0x9f, - 0x75, 0x9c, 0x5d, 0x29, 0x76, 0x36, 0x05, 0x76, 0x11, 0xa0, 0xf5, 0x2a, 0xda, 0xc6, 0xc0, 0x7a, - 0x6d, 0x50, 0x76, 0xd1, 0x26, 0x41, 0x05, 0x9a, 0x9c, 0x95, 0x09, 0x4b, 0x24, 0x43, 0x52, 0x4a, - 0x5c, 0xa0, 0x45, 0xd0, 0xd3, 0x62, 0x0f, 0x41, 0x0b, 0xe4, 0xba, 0x40, 0x8b, 0xde, 0x7a, 0x0a, - 0x7a, 0xec, 0xcf, 0xa1, 0xb7, 0x9c, 0x8a, 0x1c, 0x83, 0x02, 0x0d, 0x8a, 0xf5, 0x21, 0xe7, 0x5e, - 0x0b, 0x14, 0x28, 0x38, 0x33, 0xa4, 0x28, 0x72, 0x28, 0xd1, 0x96, 0x6a, 0xf4, 0x64, 0x73, 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x8b, 0x48, - 0xee, 0x1f, 0x48, 0xf2, 0x29, 0xb2, 0xf9, 0x07, 0x90, 0x31, 0xf0, 0x7f, 0x98, 0xbb, 0xb9, 0xed, - 0x15, 0x66, 0x98, 0x26, 0x60, 0x3a, 0x41, 0xda, 0x80, 0x7f, 0x0d, 0xe6, 0x09, 0x41, 0xb2, 0xde, - 0xed, 0xaa, 0x76, 0x17, 0x69, 0x36, 0x26, 0xf9, 0x9a, 0x98, 0xc7, 0xe5, 0x75, 0xaf, 0x38, 0xc4, - 0x65, 0x72, 0x32, 0x2e, 0x53, 0xa3, 0xa5, 0xf4, 0x53, 0xbc, 0x7e, 0x07, 0x93, 0xf4, 0x22, 0xef, - 0xf7, 0x21, 0x63, 0x22, 0xab, 0xd7, 0x21, 0x93, 0xbd, 0xb1, 0x7d, 0x87, 0x39, 0x59, 0x17, 0x2e, - 0x62, 0xe8, 0xe1, 0x99, 0x81, 0x44, 0xda, 0x8c, 0x46, 0xe0, 0x4f, 0x13, 0x00, 0x7b, 0x56, 0xfb, - 0x50, 0xed, 0x22, 0xbd, 0x37, 0x1d, 0x0a, 0x7b, 0x9a, 0x89, 0x64, 0xa4, 0xf6, 0x91, 0x32, 0x44, - 0xe1, 0x91, 0x57, 0x3c, 0x1d, 0x0a, 0xef, 0x02, 0xaf, 0xa1, 0x8f, 0x6d, 0x4f, 0x66, 0x2d, 0x13, - 0xc9, 0x7d, 0x4c, 0x67, 0x4a, 0x9c, 0x77, 0x6a, 0x5c, 0x71, 0x39, 0xe4, 0xc5, 0x0f, 0x2a, 0xef, - 0xe3, 0x23, 0x14, 0xe5, 0x63, 0xda, 0x6c, 0xff, 0x9b, 0xec, 0x77, 0xd4, 0xfa, 0xbe, 0x86, 0x85, - 0x7d, 0x45, 0xa4, 0x97, 0x60, 0x8e, 0x4a, 0xdc, 0xe9, 0x94, 0xc6, 0x08, 0x12, 0x35, 0xc8, 0x30, - 0xa6, 0x12, 0x24, 0xd8, 0x5e, 0x49, 0x8f, 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ped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x5a, 0xcd, 0x6f, 0xdb, 0xc8, + 0x15, 0x37, 0xf5, 0x19, 0x3d, 0x27, 0x91, 0x43, 0x39, 0xb1, 0x4c, 0xdb, 0x92, 0xa2, 0x16, 0x8d, + 0xd7, 0x4d, 0xa4, 0xb5, 0x37, 0x5b, 0x20, 0xc1, 0x02, 0xad, 0xa3, 0x2a, 0x5d, 0x03, 0x71, 0x6c, + 0x50, 0x56, 0xd1, 0xee, 0x16, 0x15, 0x64, 0x6a, 0x42, 0x11, 0x92, 0x48, 0x2e, 0x49, 0x69, 0xd7, + 0x05, 0x5a, 0x2c, 0x7a, 0x0a, 0x72, 0x58, 0xb4, 0xc0, 0x5e, 0x03, 0xb4, 0xe8, 0x3f, 0xb0, 0xe8, + 0xb1, 0x1f, 0x87, 0xde, 0xf6, 0x50, 0x14, 0x7b, 0x5c, 0x14, 0xe8, 0xa2, 0x48, 0x0e, 0xfb, 0x3f, + 0x14, 0x28, 0x50, 0x70, 0x66, 0x48, 0x51, 0xe4, 0x50, 0xa2, 0x2d, 0xd5, 0xd8, 0x9b, 0x38, 0xf3, + 0x9b, 0x37, 0xf3, 0x7e, 0xbf, 0x37, 0x6f, 0xbe, 0x04, 0x9b, 0xca, 0xa9, 0x54, 0x95, 0x34, 0x03, + 0x55, 0xa5, 0x6e, 0x5b, 0x55, 0x51, 0xbf, 0x3a, 0xda, 0xad, 0x5a, 0x1f, 0x55, 0x74, 0x43, 0xb3, + 0x34, 0x3e, 0xa7, 0x9c, 0x4a, 0x15, 0xbb, 0xb6, 0x42, 0x6b, 0x2b, 0xa3, 0x5d, 0x61, 0x55, 0xd6, + 0x64, 0x0d, 0xd7, 0x57, 0xed, 0x5f, 0x04, 0x2a, 0xac, 0x49, 0x9a, 0x39, 0xd0, 0xcc, 0xea, 0xc0, + 0x94, 0x6d, 0x13, 0x03, 0x53, 0x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0xcc, 0xde, 0xca, 0x84, 0xb2, 0xcc, 0x84, + 0x87, 0xb3, 0x3c, 0x75, 0x53, 0x22, 0x24, 0x3f, 0xfe, 0xfa, 0xb3, 0x1d, 0x6e, 0xef, 0x8f, 0x31, + 0xc8, 0x90, 0xfb, 0x79, 0x7b, 0x51, 0xfd, 0x19, 0x80, 0xe7, 0xdd, 0xb1, 0x1c, 0x66, 0x79, 0x8c, + 0x11, 0x76, 0x66, 0x63, 0x5c, 0x8f, 0x1b, 0x90, 0x76, 0x22, 0xa9, 0x38, 0x23, 0xc7, 0x09, 0x77, + 0x66, 0x00, 0x5c, 0xa3, 0x3d, 0xc8, 0xfa, 0x5f, 0x25, 0x42, 0xdb, 0xfa, 0x80, 0xe1, 0xfb, 0x80, + 0x90, 0xdb, 0x7d, 0x4a, 0xda, 0xa3, 0xc6, 0xe7, 0xaf, 0x0a, 0xdc, 0x17, 0xaf, 0x0a, 0xdc, 0xbf, + 0x5f, 0x15, 0xb8, 0xdf, 0xbc, 0x2e, 0x2c, 0x7d, 0xf1, 0xba, 0xb0, 0xf4, 0xe5, 0xeb, 0xc2, 0xd2, + 0x7b, 0x0f, 0x64, 0xc5, 0xea, 0x0e, 0x4f, 0x2b, 0x92, 0x36, 0xa8, 0xd2, 0x3f, 0x4d, 0x29, 0xa7, + 0xd2, 0x3d, 0x59, 0xab, 0x8e, 0x1e, 0x54, 0x07, 0x5a, 0x67, 0xd8, 0x47, 0x26, 0xf9, 0xb3, 0xd3, + 0x9b, 0xf7, 0xef, 0x39, 0xff, 0x77, 0xb2, 0xce, 0x74, 0x64, 0x9e, 0xa6, 0xf0, 0x7f, 0x9d, 0xde, + 0xfa, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x5b, 0xdf, 0x5a, 0xd6, 0xb6, 0x25, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1912,8 +1822,6 @@ type MsgClient interface { ChannelOpenAck(ctx context.Context, in *MsgChannelOpenAck, opts ...grpc.CallOption) (*MsgChannelOpenAckResponse, error) // ChannelOpenConfirm defines a rpc handler method for MsgChannelOpenConfirm. ChannelOpenConfirm(ctx context.Context, in *MsgChannelOpenConfirm, opts ...grpc.CallOption) (*MsgChannelOpenConfirmResponse, error) - // SendPacket defines a rpc handler method for MsgSendPacket. - SendPacket(ctx context.Context, in *MsgSendPacket, opts ...grpc.CallOption) (*MsgSendPacketResponse, error) // ChannelCloseInit defines a rpc handler method for MsgChannelCloseInit. ChannelCloseInit(ctx context.Context, in *MsgChannelCloseInit, opts ...grpc.CallOption) (*MsgChannelCloseInitResponse, error) // ChannelCloseConfirm defines a rpc handler method for @@ -1985,15 +1893,6 @@ func (c *msgClient) ChannelOpenConfirm(ctx context.Context, in *MsgChannelOpenCo 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.v1.Msg/SendPacket", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *msgClient) ChannelCloseInit(ctx context.Context, in *MsgChannelCloseInit, opts ...grpc.CallOption) (*MsgChannelCloseInitResponse, error) { out := new(MsgChannelCloseInitResponse) err := c.cc.Invoke(ctx, "/ibc.core.channel.v1.Msg/ChannelCloseInit", in, out, opts...) @@ -2112,8 +2011,6 @@ type MsgServer interface { ChannelOpenAck(context.Context, *MsgChannelOpenAck) (*MsgChannelOpenAckResponse, error) // ChannelOpenConfirm defines a rpc handler method for MsgChannelOpenConfirm. ChannelOpenConfirm(context.Context, *MsgChannelOpenConfirm) (*MsgChannelOpenConfirmResponse, error) - // SendPacket defines a rpc handler method for MsgSendPacket. - SendPacket(context.Context, *MsgSendPacket) (*MsgSendPacketResponse, error) // ChannelCloseInit defines a rpc handler method for MsgChannelCloseInit. ChannelCloseInit(context.Context, *MsgChannelCloseInit) (*MsgChannelCloseInitResponse, error) // ChannelCloseConfirm defines a rpc handler method for @@ -2157,9 +2054,6 @@ func (*UnimplementedMsgServer) ChannelOpenAck(ctx context.Context, req *MsgChann func (*UnimplementedMsgServer) ChannelOpenConfirm(ctx context.Context, req *MsgChannelOpenConfirm) (*MsgChannelOpenConfirmResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ChannelOpenConfirm not implemented") } -func (*UnimplementedMsgServer) SendPacket(ctx context.Context, req *MsgSendPacket) (*MsgSendPacketResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SendPacket not implemented") -} func (*UnimplementedMsgServer) ChannelCloseInit(ctx context.Context, req *MsgChannelCloseInit) (*MsgChannelCloseInitResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ChannelCloseInit not implemented") } @@ -2273,24 +2167,6 @@ func _Msg_ChannelOpenConfirm_Handler(srv interface{}, ctx context.Context, dec f 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 { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).SendPacket(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ibc.core.channel.v1.Msg/SendPacket", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).SendPacket(ctx, req.(*MsgSendPacket)) - } - return interceptor(ctx, in, info, handler) -} - func _Msg_ChannelCloseInit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgChannelCloseInit) if err := dec(in); err != nil { @@ -2527,10 +2403,6 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "ChannelOpenConfirm", Handler: _Msg_ChannelOpenConfirm_Handler, }, - { - MethodName: "SendPacket", - Handler: _Msg_SendPacket_Handler, - }, { MethodName: "ChannelCloseInit", Handler: _Msg_ChannelCloseInit_Handler, @@ -4511,97 +4383,6 @@ func (m *MsgPruneAcknowledgementsResponse) MarshalToSizedBuffer(dAtA []byte) (in return len(dAtA) - i, nil } -func (m *MsgSendPacket) 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 *MsgSendPacket) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgSendPacket) 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 - } - if len(m.PacketData) > 0 { - for iNdEx := len(m.PacketData) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.PacketData[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - if m.TimeoutTimestamp != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.TimeoutTimestamp)) - i-- - dAtA[i] = 0x18 - } - if len(m.DestinationId) > 0 { - i -= len(m.DestinationId) - copy(dAtA[i:], m.DestinationId) - i = encodeVarintTx(dAtA, i, uint64(len(m.DestinationId))) - i-- - dAtA[i] = 0x12 - } - if len(m.SourceId) > 0 { - i -= len(m.SourceId) - copy(dAtA[i:], m.SourceId) - i = encodeVarintTx(dAtA, i, uint64(len(m.SourceId))) - 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 encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -5367,48 +5148,6 @@ func (m *MsgPruneAcknowledgementsResponse) Size() (n int) { return n } -func (m *MsgSendPacket) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.SourceId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.DestinationId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.TimeoutTimestamp != 0 { - n += 1 + sovTx(uint64(m.TimeoutTimestamp)) - } - if len(m.PacketData) > 0 { - for _, e := range m.PacketData { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - l = len(m.Signer) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgSendPacketResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Sequence != 0 { - n += 1 + sovTx(uint64(m.Sequence)) - } - return n -} - func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -11026,274 +10765,6 @@ func (m *MsgPruneAcknowledgementsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgSendPacket) 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: MsgSendPacket: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSendPacket: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SourceId", 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.SourceId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DestinationId", 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.DestinationId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TimeoutTimestamp", wireType) - } - m.TimeoutTimestamp = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TimeoutTimestamp |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PacketData", 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 - } - m.PacketData = append(m.PacketData, PacketData{}) - if err := m.PacketData[len(m.PacketData)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - 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 *MsgSendPacketResponse) 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: MsgSendPacketResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSendPacketResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Sequence", wireType) - } - m.Sequence = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Sequence |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - 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 skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/modules/core/04-channel/v2/types/tx.pb.go b/modules/core/04-channel/v2/types/tx.pb.go new file mode 100644 index 00000000000..828134f3cf2 --- /dev/null +++ b/modules/core/04-channel/v2/types/tx.pb.go @@ -0,0 +1,2293 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: ibc/core/channel/v2/tx.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" + types1 "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" + types "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" + 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 + +// MsgRecvPacket receives incoming IBC packet +type MsgRecvPacket struct { + Packet types.PacketV2 `protobuf:"bytes,1,opt,name=packet,proto3" json:"packet"` + ProofCommitment []byte `protobuf:"bytes,2,opt,name=proof_commitment,json=proofCommitment,proto3" json:"proof_commitment,omitempty"` + ProofHeight types1.Height `protobuf:"bytes,3,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height"` + Signer string `protobuf:"bytes,4,opt,name=signer,proto3" json:"signer,omitempty"` +} + +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{0} +} +func (m *MsgRecvPacket) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRecvPacket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRecvPacket.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 *MsgRecvPacket) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRecvPacket.Merge(m, src) +} +func (m *MsgRecvPacket) XXX_Size() int { + return m.Size() +} +func (m *MsgRecvPacket) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRecvPacket.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRecvPacket proto.InternalMessageInfo + +// MsgRecvPacketResponse defines the Msg/RecvPacket response type. +type MsgRecvPacketResponse struct { + Result types.ResponseResultType `protobuf:"varint,1,opt,name=result,proto3,enum=ibc.core.channel.v1.ResponseResultType" json:"result,omitempty"` +} + +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{1} +} +func (m *MsgRecvPacketResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRecvPacketResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRecvPacketResponse.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 *MsgRecvPacketResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRecvPacketResponse.Merge(m, src) +} +func (m *MsgRecvPacketResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRecvPacketResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRecvPacketResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRecvPacketResponse proto.InternalMessageInfo + +// MsgTimeout receives timed-out packet +type MsgTimeout struct { + Packet types.PacketV2 `protobuf:"bytes,1,opt,name=packet,proto3" json:"packet"` + ProofUnreceived []byte `protobuf:"bytes,2,opt,name=proof_unreceived,json=proofUnreceived,proto3" json:"proof_unreceived,omitempty"` + ProofHeight types1.Height `protobuf:"bytes,3,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height"` + NextSequenceRecv uint64 `protobuf:"varint,4,opt,name=next_sequence_recv,json=nextSequenceRecv,proto3" json:"next_sequence_recv,omitempty"` + Signer string `protobuf:"bytes,5,opt,name=signer,proto3" json:"signer,omitempty"` +} + +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{2} +} +func (m *MsgTimeout) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgTimeout) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgTimeout.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 *MsgTimeout) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgTimeout.Merge(m, src) +} +func (m *MsgTimeout) XXX_Size() int { + return m.Size() +} +func (m *MsgTimeout) XXX_DiscardUnknown() { + xxx_messageInfo_MsgTimeout.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgTimeout proto.InternalMessageInfo + +// MsgTimeoutResponse defines the Msg/Timeout response type. +type MsgTimeoutResponse struct { + Result types.ResponseResultType `protobuf:"varint,1,opt,name=result,proto3,enum=ibc.core.channel.v1.ResponseResultType" json:"result,omitempty"` +} + +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{3} +} +func (m *MsgTimeoutResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgTimeoutResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgTimeoutResponse.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 *MsgTimeoutResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgTimeoutResponse.Merge(m, src) +} +func (m *MsgTimeoutResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgTimeoutResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgTimeoutResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgTimeoutResponse proto.InternalMessageInfo + +// MsgAcknowledgement receives incoming IBC acknowledgement +type MsgAcknowledgement struct { + Packet types.PacketV2 `protobuf:"bytes,1,opt,name=packet,proto3" json:"packet"` + Acknowledgement []byte `protobuf:"bytes,2,opt,name=acknowledgement,proto3" json:"acknowledgement,omitempty"` + ProofAcked []byte `protobuf:"bytes,3,opt,name=proof_acked,json=proofAcked,proto3" json:"proof_acked,omitempty"` + ProofHeight types1.Height `protobuf:"bytes,4,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height"` + Signer string `protobuf:"bytes,5,opt,name=signer,proto3" json:"signer,omitempty"` +} + +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{4} +} +func (m *MsgAcknowledgement) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAcknowledgement) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAcknowledgement.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 *MsgAcknowledgement) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAcknowledgement.Merge(m, src) +} +func (m *MsgAcknowledgement) XXX_Size() int { + return m.Size() +} +func (m *MsgAcknowledgement) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAcknowledgement.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAcknowledgement proto.InternalMessageInfo + +// MsgAcknowledgementResponse defines the Msg/Acknowledgement response type. +type MsgAcknowledgementResponse struct { + Result types.ResponseResultType `protobuf:"varint,1,opt,name=result,proto3,enum=ibc.core.channel.v1.ResponseResultType" json:"result,omitempty"` +} + +func (m *MsgAcknowledgementResponse) Reset() { *m = MsgAcknowledgementResponse{} } +func (m *MsgAcknowledgementResponse) String() string { return proto.CompactTextString(m) } +func (*MsgAcknowledgementResponse) ProtoMessage() {} +func (*MsgAcknowledgementResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d421c7119e969b99, []int{5} +} +func (m *MsgAcknowledgementResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAcknowledgementResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAcknowledgementResponse.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 *MsgAcknowledgementResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAcknowledgementResponse.Merge(m, src) +} +func (m *MsgAcknowledgementResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgAcknowledgementResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAcknowledgementResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAcknowledgementResponse proto.InternalMessageInfo + +// MsgSendPacket sends an outgoing IBC packet. +type MsgSendPacket struct { + SourceId string `protobuf:"bytes,1,opt,name=source_id,json=sourceId,proto3" json:"source_id,omitempty"` + DestinationId string `protobuf:"bytes,2,opt,name=destination_id,json=destinationId,proto3" json:"destination_id,omitempty"` + TimeoutTimestamp uint64 `protobuf:"varint,3,opt,name=timeout_timestamp,json=timeoutTimestamp,proto3" json:"timeout_timestamp,omitempty"` + PacketData []types.PacketData `protobuf:"bytes,4,rep,name=packet_data,json=packetData,proto3" json:"packet_data"` + Signer string `protobuf:"bytes,5,opt,name=signer,proto3" json:"signer,omitempty"` +} + +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{6} +} +func (m *MsgSendPacket) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSendPacket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSendPacket.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 *MsgSendPacket) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSendPacket.Merge(m, src) +} +func (m *MsgSendPacket) XXX_Size() int { + return m.Size() +} +func (m *MsgSendPacket) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSendPacket.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSendPacket proto.InternalMessageInfo + +// MsgSendPacketResponse defines the Msg/SendPacket response type. +type MsgSendPacketResponse struct { + Sequence uint64 `protobuf:"varint,1,opt,name=sequence,proto3" json:"sequence,omitempty"` +} + +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{7} +} +func (m *MsgSendPacketResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSendPacketResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSendPacketResponse.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 *MsgSendPacketResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSendPacketResponse.Merge(m, src) +} +func (m *MsgSendPacketResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSendPacketResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSendPacketResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSendPacketResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgRecvPacket)(nil), "ibc.core.channel.v2.MsgRecvPacket") + proto.RegisterType((*MsgRecvPacketResponse)(nil), "ibc.core.channel.v2.MsgRecvPacketResponse") + proto.RegisterType((*MsgTimeout)(nil), "ibc.core.channel.v2.MsgTimeout") + proto.RegisterType((*MsgTimeoutResponse)(nil), "ibc.core.channel.v2.MsgTimeoutResponse") + proto.RegisterType((*MsgAcknowledgement)(nil), "ibc.core.channel.v2.MsgAcknowledgement") + proto.RegisterType((*MsgAcknowledgementResponse)(nil), "ibc.core.channel.v2.MsgAcknowledgementResponse") + proto.RegisterType((*MsgSendPacket)(nil), "ibc.core.channel.v2.MsgSendPacket") + proto.RegisterType((*MsgSendPacketResponse)(nil), "ibc.core.channel.v2.MsgSendPacketResponse") +} + +func init() { proto.RegisterFile("ibc/core/channel/v2/tx.proto", fileDescriptor_d421c7119e969b99) } + +var fileDescriptor_d421c7119e969b99 = []byte{ + // 741 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x95, 0xcd, 0x4e, 0xdb, 0x4a, + 0x14, 0xc7, 0xe3, 0x60, 0x72, 0xc9, 0x04, 0x08, 0xd7, 0xf7, 0x2b, 0xf2, 0xa5, 0x49, 0x1a, 0xa9, + 0x22, 0xa5, 0xc5, 0x6e, 0xdc, 0x6e, 0xa0, 0x95, 0x2a, 0xa0, 0xaa, 0xca, 0x02, 0xa9, 0x32, 0x94, + 0x45, 0x8b, 0x1a, 0x39, 0xe3, 0xa9, 0x63, 0x11, 0x7b, 0x5c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 0x74, 0x56, + 0xb3, 0x0b, 0x40, 0xcf, 0x01, 0x3e, 0x72, 0xf6, 0xae, 0x67, 0xf4, 0xec, 0x43, 0x4e, 0xc8, 0x2d, + 0xf0, 0x47, 0x72, 0xac, 0x95, 0x46, 0xa5, 0x09, 0x83, 0xba, 0x70, 0x85, 0xa1, 0x33, 0xe9, 0x1e, + 0xc8, 0x5f, 0xfc, 0x77, 0x47, 0xe6, 0x5e, 0x30, 0xaa, 0xfa, 0x35, 0x8d, 0x49, 0x31, 0x75, 0xf2, + 0xe3, 0xf9, 0xd1, 0xa2, 0xb4, 0xb6, 0x73, 0x7c, 0x5a, 0x94, 0x4e, 0x4e, 0x8b, 0xd2, 0x8f, 0xd3, + 0xa2, 0x74, 0x78, 0x56, 0x4c, 0x9d, 0x9c, 0x15, 0x53, 0xdf, 0xce, 0x8a, 0xa9, 0xd7, 0x4f, 0x1c, + 0x97, 0x36, 0xdb, 0x0d, 0x0d, 0x62, 0x4f, 0x17, 0x77, 0xb1, 0xdb, 0x80, 0x4b, 0x0e, 0xd6, 0xa3, + 0x65, 0xdd, 0xc3, 0x76, 0xbb, 0x85, 0x08, 0xbf, 0x43, 0x1f, 0x3c, 0x5a, 0xea, 0xbd, 0xec, 0x0f, + 0x02, 0x44, 0x1a, 0x19, 0x76, 0x95, 0x3e, 0xfc, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x74, 0xcb, 0x58, + 0xa3, 0x10, 0x08, 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 + +// PacketMsgClient is the client API for PacketMsg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type PacketMsgClient interface { + // 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. + RecvPacket(ctx context.Context, in *MsgRecvPacket, opts ...grpc.CallOption) (*MsgRecvPacketResponse, error) + // Timeout defines a rpc handler method for MsgTimeout. + Timeout(ctx context.Context, in *MsgTimeout, opts ...grpc.CallOption) (*MsgTimeoutResponse, error) + // Acknowledgement defines a rpc handler method for MsgAcknowledgement. + Acknowledgement(ctx context.Context, in *MsgAcknowledgement, opts ...grpc.CallOption) (*MsgAcknowledgementResponse, error) +} + +type packetMsgClient struct { + cc grpc1.ClientConn +} + +func NewPacketMsgClient(cc grpc1.ClientConn) PacketMsgClient { + return &packetMsgClient{cc} +} + +func (c *packetMsgClient) SendPacket(ctx context.Context, in *MsgSendPacket, opts ...grpc.CallOption) (*MsgSendPacketResponse, error) { + out := new(MsgSendPacketResponse) + err := c.cc.Invoke(ctx, "/ibc.core.channel.v2.PacketMsg/SendPacket", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *packetMsgClient) RecvPacket(ctx context.Context, in *MsgRecvPacket, opts ...grpc.CallOption) (*MsgRecvPacketResponse, error) { + out := new(MsgRecvPacketResponse) + err := c.cc.Invoke(ctx, "/ibc.core.channel.v2.PacketMsg/RecvPacket", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *packetMsgClient) Timeout(ctx context.Context, in *MsgTimeout, opts ...grpc.CallOption) (*MsgTimeoutResponse, error) { + out := new(MsgTimeoutResponse) + err := c.cc.Invoke(ctx, "/ibc.core.channel.v2.PacketMsg/Timeout", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *packetMsgClient) Acknowledgement(ctx context.Context, in *MsgAcknowledgement, opts ...grpc.CallOption) (*MsgAcknowledgementResponse, error) { + out := new(MsgAcknowledgementResponse) + err := c.cc.Invoke(ctx, "/ibc.core.channel.v2.PacketMsg/Acknowledgement", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// PacketMsgServer is the server API for PacketMsg service. +type PacketMsgServer interface { + // SendPacket defines a rpc handler method for MsgSendPacket. + SendPacket(context.Context, *MsgSendPacket) (*MsgSendPacketResponse, error) + // RecvPacket defines a rpc handler method for MsgRecvPacket. + RecvPacket(context.Context, *MsgRecvPacket) (*MsgRecvPacketResponse, error) + // Timeout defines a rpc handler method for MsgTimeout. + Timeout(context.Context, *MsgTimeout) (*MsgTimeoutResponse, error) + // Acknowledgement defines a rpc handler method for MsgAcknowledgement. + Acknowledgement(context.Context, *MsgAcknowledgement) (*MsgAcknowledgementResponse, error) +} + +// UnimplementedPacketMsgServer can be embedded to have forward compatible implementations. +type UnimplementedPacketMsgServer struct { +} + +func (*UnimplementedPacketMsgServer) SendPacket(ctx context.Context, req *MsgSendPacket) (*MsgSendPacketResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SendPacket not implemented") +} +func (*UnimplementedPacketMsgServer) RecvPacket(ctx context.Context, req *MsgRecvPacket) (*MsgRecvPacketResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RecvPacket not implemented") +} +func (*UnimplementedPacketMsgServer) Timeout(ctx context.Context, req *MsgTimeout) (*MsgTimeoutResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Timeout not implemented") +} +func (*UnimplementedPacketMsgServer) Acknowledgement(ctx context.Context, req *MsgAcknowledgement) (*MsgAcknowledgementResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Acknowledgement not implemented") +} + +func RegisterPacketMsgServer(s grpc1.Server, srv PacketMsgServer) { + s.RegisterService(&_PacketMsg_serviceDesc, srv) +} + +func _PacketMsg_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 { + return nil, err + } + if interceptor == nil { + return srv.(PacketMsgServer).SendPacket(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ibc.core.channel.v2.PacketMsg/SendPacket", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PacketMsgServer).SendPacket(ctx, req.(*MsgSendPacket)) + } + return interceptor(ctx, in, info, handler) +} + +func _PacketMsg_RecvPacket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRecvPacket) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PacketMsgServer).RecvPacket(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ibc.core.channel.v2.PacketMsg/RecvPacket", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PacketMsgServer).RecvPacket(ctx, req.(*MsgRecvPacket)) + } + return interceptor(ctx, in, info, handler) +} + +func _PacketMsg_Timeout_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgTimeout) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PacketMsgServer).Timeout(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ibc.core.channel.v2.PacketMsg/Timeout", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PacketMsgServer).Timeout(ctx, req.(*MsgTimeout)) + } + return interceptor(ctx, in, info, handler) +} + +func _PacketMsg_Acknowledgement_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgAcknowledgement) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PacketMsgServer).Acknowledgement(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ibc.core.channel.v2.PacketMsg/Acknowledgement", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PacketMsgServer).Acknowledgement(ctx, req.(*MsgAcknowledgement)) + } + return interceptor(ctx, in, info, handler) +} + +var _PacketMsg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "ibc.core.channel.v2.PacketMsg", + HandlerType: (*PacketMsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SendPacket", + Handler: _PacketMsg_SendPacket_Handler, + }, + { + MethodName: "RecvPacket", + Handler: _PacketMsg_RecvPacket_Handler, + }, + { + MethodName: "Timeout", + Handler: _PacketMsg_Timeout_Handler, + }, + { + MethodName: "Acknowledgement", + Handler: _PacketMsg_Acknowledgement_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "ibc/core/channel/v2/tx.proto", +} + +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 + } + if m.NextSequenceRecv != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.NextSequenceRecv)) + i-- + dAtA[i] = 0x20 + } + { + size, err := m.ProofHeight.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.ProofUnreceived) > 0 { + i -= len(m.ProofUnreceived) + copy(dAtA[i:], m.ProofUnreceived) + i = encodeVarintTx(dAtA, i, uint64(len(m.ProofUnreceived))) + i-- + dAtA[i] = 0x12 + } + { + 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 *MsgTimeoutResponse) 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 *MsgTimeoutResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgTimeoutResponse) 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 *MsgAcknowledgement) 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 *MsgAcknowledgement) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAcknowledgement) 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] = 0x22 + if len(m.ProofAcked) > 0 { + i -= len(m.ProofAcked) + copy(dAtA[i:], m.ProofAcked) + i = encodeVarintTx(dAtA, i, uint64(len(m.ProofAcked))) + i-- + dAtA[i] = 0x1a + } + if len(m.Acknowledgement) > 0 { + i -= len(m.Acknowledgement) + copy(dAtA[i:], m.Acknowledgement) + i = encodeVarintTx(dAtA, i, uint64(len(m.Acknowledgement))) + 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 *MsgAcknowledgementResponse) 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 *MsgAcknowledgementResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAcknowledgementResponse) 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) { + 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 *MsgSendPacket) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSendPacket) 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 + } + if len(m.PacketData) > 0 { + for iNdEx := len(m.PacketData) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.PacketData[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if m.TimeoutTimestamp != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.TimeoutTimestamp)) + i-- + dAtA[i] = 0x18 + } + if len(m.DestinationId) > 0 { + i -= len(m.DestinationId) + copy(dAtA[i:], m.DestinationId) + i = encodeVarintTx(dAtA, i, uint64(len(m.DestinationId))) + i-- + dAtA[i] = 0x12 + } + if len(m.SourceId) > 0 { + i -= len(m.SourceId) + copy(dAtA[i:], m.SourceId) + i = encodeVarintTx(dAtA, i, uint64(len(m.SourceId))) + 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 encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgRecvPacket) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Packet.Size() + n += 1 + l + sovTx(uint64(l)) + l = len(m.ProofCommitment) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.ProofHeight.Size() + n += 1 + l + sovTx(uint64(l)) + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgRecvPacketResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Result != 0 { + n += 1 + sovTx(uint64(m.Result)) + } + return n +} + +func (m *MsgTimeout) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Packet.Size() + n += 1 + l + sovTx(uint64(l)) + l = len(m.ProofUnreceived) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.ProofHeight.Size() + n += 1 + l + sovTx(uint64(l)) + if m.NextSequenceRecv != 0 { + n += 1 + sovTx(uint64(m.NextSequenceRecv)) + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgTimeoutResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Result != 0 { + n += 1 + sovTx(uint64(m.Result)) + } + return n +} + +func (m *MsgAcknowledgement) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Packet.Size() + n += 1 + l + sovTx(uint64(l)) + l = len(m.Acknowledgement) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ProofAcked) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.ProofHeight.Size() + n += 1 + l + sovTx(uint64(l)) + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgAcknowledgementResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Result != 0 { + n += 1 + sovTx(uint64(m.Result)) + } + return n +} + +func (m *MsgSendPacket) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SourceId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.DestinationId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.TimeoutTimestamp != 0 { + n += 1 + sovTx(uint64(m.TimeoutTimestamp)) + } + if len(m.PacketData) > 0 { + for _, e := range m.PacketData { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSendPacketResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Sequence != 0 { + n += 1 + sovTx(uint64(m.Sequence)) + } + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgRecvPacket) 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: MsgRecvPacket: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRecvPacket: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Packet", 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.Packet.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProofCommitment", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProofCommitment = append(m.ProofCommitment[:0], dAtA[iNdEx:postIndex]...) + if m.ProofCommitment == nil { + m.ProofCommitment = []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 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.ProofHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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 *MsgRecvPacketResponse) 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: MsgRecvPacketResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRecvPacketResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) + } + m.Result = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Result |= types.ResponseResultType(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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 *MsgTimeout) 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: MsgTimeout: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgTimeout: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Packet", 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.Packet.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProofUnreceived", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProofUnreceived = append(m.ProofUnreceived[:0], dAtA[iNdEx:postIndex]...) + if m.ProofUnreceived == nil { + m.ProofUnreceived = []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 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.ProofHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NextSequenceRecv", wireType) + } + m.NextSequenceRecv = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NextSequenceRecv |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + 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 *MsgTimeoutResponse) 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: MsgTimeoutResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgTimeoutResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) + } + m.Result = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Result |= types.ResponseResultType(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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 *MsgAcknowledgement) 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: MsgAcknowledgement: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAcknowledgement: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Packet", 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.Packet.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Acknowledgement", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Acknowledgement = append(m.Acknowledgement[:0], dAtA[iNdEx:postIndex]...) + if m.Acknowledgement == nil { + m.Acknowledgement = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProofAcked", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProofAcked = append(m.ProofAcked[:0], dAtA[iNdEx:postIndex]...) + if m.ProofAcked == nil { + m.ProofAcked = []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 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.ProofHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + 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 *MsgAcknowledgementResponse) 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: MsgAcknowledgementResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAcknowledgementResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) + } + m.Result = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Result |= types.ResponseResultType(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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 + 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: MsgSendPacket: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSendPacket: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SourceId", 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.SourceId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DestinationId", 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.DestinationId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TimeoutTimestamp", wireType) + } + m.TimeoutTimestamp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TimeoutTimestamp |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PacketData", 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 + } + m.PacketData = append(m.PacketData, types.PacketData{}) + if err := m.PacketData[len(m.PacketData)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + 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 *MsgSendPacketResponse) 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: MsgSendPacketResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSendPacketResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Sequence", wireType) + } + m.Sequence = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Sequence |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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 skipTx(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, ErrIntOverflowTx + } + 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, ErrIntOverflowTx + } + 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, ErrIntOverflowTx + } + 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, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) diff --git a/proto/ibc/core/channel/v1/tx.proto b/proto/ibc/core/channel/v1/tx.proto index c242d88dfb0..729ffd09b28 100644 --- a/proto/ibc/core/channel/v1/tx.proto +++ b/proto/ibc/core/channel/v1/tx.proto @@ -26,9 +26,6 @@ service Msg { // ChannelOpenConfirm defines a rpc handler method for MsgChannelOpenConfirm. rpc ChannelOpenConfirm(MsgChannelOpenConfirm) returns (MsgChannelOpenConfirmResponse); - // SendPacket defines a rpc handler method for MsgSendPacket. - rpc SendPacket(MsgSendPacket) returns (MsgSendPacketResponse); - // ChannelCloseInit defines a rpc handler method for MsgChannelCloseInit. rpc ChannelCloseInit(MsgChannelCloseInit) returns (MsgChannelCloseInitResponse); @@ -475,22 +472,3 @@ message MsgPruneAcknowledgementsResponse { // Number of sequences left after pruning. uint64 total_remaining_sequences = 2; } - -// MsgSendPacket sends an outgoing IBC packet. -message MsgSendPacket { - option (cosmos.msg.v1.signer) = "signer"; - option (gogoproto.goproto_getters) = false; - string source_id = 1; - string destination_id = 2; - uint64 timeout_timestamp = 3; - repeated PacketData packet_data = 4 [(gogoproto.nullable) = false]; - string signer = 5; - // string dest_port = 6; -} - -// MsgSendPacketResponse defines the Msg/SendPacket response type. -message MsgSendPacketResponse { - option (gogoproto.goproto_getters) = false; - - uint64 sequence = 1; -} diff --git a/proto/ibc/core/channel/v2/tx.proto b/proto/ibc/core/channel/v2/tx.proto new file mode 100644 index 00000000000..dcf265b023f --- /dev/null +++ b/proto/ibc/core/channel/v2/tx.proto @@ -0,0 +1,106 @@ +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 "cosmos/msg/v1/msg.proto"; +import "ibc/core/client/v1/client.proto"; +import "ibc/core/channel/v1/channel.proto"; +import "ibc/core/channel/v1/tx.proto"; + +// PacketMsg defines the ibc/channel PacketMsg service. +service PacketMsg { + option (cosmos.msg.v1.service) = true; + + // SendPacket defines a rpc handler method for MsgSendPacket. + rpc SendPacket(MsgSendPacket) returns (MsgSendPacketResponse); + + // RecvPacket defines a rpc handler method for MsgRecvPacket. + rpc RecvPacket(MsgRecvPacket) returns (MsgRecvPacketResponse); + + // Timeout defines a rpc handler method for MsgTimeout. + rpc Timeout(MsgTimeout) returns (MsgTimeoutResponse); + + // Acknowledgement defines a rpc handler method for MsgAcknowledgement. + rpc Acknowledgement(MsgAcknowledgement) returns (MsgAcknowledgementResponse); +} + +// MsgRecvPacket receives incoming IBC packet +message MsgRecvPacket { + option (cosmos.msg.v1.signer) = "signer"; + + option (gogoproto.goproto_getters) = false; + + ibc.core.channel.v1.PacketV2 packet = 1 [(gogoproto.nullable) = false]; + bytes proof_commitment = 2; + ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false]; + string signer = 4; +} + +// MsgRecvPacketResponse defines the Msg/RecvPacket response type. +message MsgRecvPacketResponse { + option (gogoproto.goproto_getters) = false; + + ibc.core.channel.v1.ResponseResultType result = 1; +} + +// MsgTimeout receives timed-out packet +message MsgTimeout { + option (cosmos.msg.v1.signer) = "signer"; + + option (gogoproto.goproto_getters) = false; + + ibc.core.channel.v1.PacketV2 packet = 1 [(gogoproto.nullable) = false]; + bytes proof_unreceived = 2; + ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false]; + uint64 next_sequence_recv = 4; + string signer = 5; +} + +// MsgTimeoutResponse defines the Msg/Timeout response type. +message MsgTimeoutResponse { + option (gogoproto.goproto_getters) = false; + + ibc.core.channel.v1.ResponseResultType result = 1; +} + +// MsgAcknowledgement receives incoming IBC acknowledgement +message MsgAcknowledgement { + option (cosmos.msg.v1.signer) = "signer"; + + option (gogoproto.goproto_getters) = false; + + ibc.core.channel.v1.PacketV2 packet = 1 [(gogoproto.nullable) = false]; + bytes acknowledgement = 2; + bytes proof_acked = 3; + ibc.core.client.v1.Height proof_height = 4 [(gogoproto.nullable) = false]; + string signer = 5; +} + +// MsgAcknowledgementResponse defines the Msg/Acknowledgement response type. +message MsgAcknowledgementResponse { + option (gogoproto.goproto_getters) = false; + + ibc.core.channel.v1.ResponseResultType result = 1; +} + +// MsgSendPacket sends an outgoing IBC packet. +message MsgSendPacket { + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; + string source_id = 1; + string destination_id = 2; + uint64 timeout_timestamp = 3; + repeated ibc.core.channel.v1.PacketData packet_data = 4 [(gogoproto.nullable) = false]; + string signer = 5; + // string dest_port = 6; +} + +// MsgSendPacketResponse defines the Msg/SendPacket response type. +message MsgSendPacketResponse { + option (gogoproto.goproto_getters) = false; + + uint64 sequence = 1; +} From 1b746c4bd9c7db13400da42cba8f4089b50e93cb Mon Sep 17 00:00:00 2001 From: bznein Date: Tue, 17 Sep 2024 15:47:44 +0100 Subject: [PATCH 03/27] add no-op PackMsh methods --- modules/core/04-channel/v2/types/tx.pb.go | 192 ++++++++++----------- modules/core/module.go | 2 + modules/core/packet-server/keeper/relay.go | 17 ++ proto/ibc/core/channel/v2/tx.proto | 8 +- 4 files changed, 119 insertions(+), 100 deletions(-) diff --git a/modules/core/04-channel/v2/types/tx.pb.go b/modules/core/04-channel/v2/types/tx.pb.go index 828134f3cf2..b60b4f50ded 100644 --- a/modules/core/04-channel/v2/types/tx.pb.go +++ b/modules/core/04-channel/v2/types/tx.pb.go @@ -364,54 +364,54 @@ func init() { func init() { proto.RegisterFile("ibc/core/channel/v2/tx.proto", fileDescriptor_d421c7119e969b99) } var fileDescriptor_d421c7119e969b99 = []byte{ - // 741 bytes of a gzipped F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d, 0x00, 0x00, 0xff, 0xff, 0x74, 0xcb, 0x58, - 0xa3, 0x10, 0x08, 0x00, 0x00, + // 748 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x95, 0x4f, 0x6f, 0xd3, 0x3e, + 0x18, 0xc7, 0x9b, 0x2e, 0xab, 0x56, 0xb7, 0xfb, 0xe7, 0xdf, 0x0f, 0xa8, 0xc2, 0x68, 0x4b, 0x25, + 0xb4, 0x32, 0x58, 0x42, 0x03, 0x97, 0x0d, 0x24, 0xb4, 0x0d, 0x21, 0x76, 0x98, 0x84, 0xb2, 0xad, + 0x07, 0x90, 0x56, 0xa5, 0x8e, 0x49, 0xa3, 0x35, 0x71, 0x88, 0xd3, 0xb0, 0xdd, 0x10, 0x27, 0xc4, + 0x69, 0x47, 0x8e, 0xbc, 0x84, 0xbd, 0x8c, 0x1d, 0x77, 0xe4, 0x84, 0xd0, 0x26, 0xb4, 0x33, 0xef, + 0x00, 0xc5, 0x76, 0xff, 0xad, 0xdd, 0x1f, 0x69, 0x3d, 0xc5, 0xf9, 0x3e, 0x5f, 0x3f, 0x8f, 0x9f, + 0x4f, 0x1c, 0x1b, 0xcc, 0x39, 0x75, 0xa4, 0x21, 0x12, 0x60, 0x0d, 0x35, 0x4c, 0xcf, 0xc3, 0x4d, + 0x2d, 0xd2, 0xb5, 0x70, 0x4f, 0xf5, 0x03, 0x12, 0x12, 0xf8, 0x9f, 0x53, 0x47, 0x6a, 0x1c, 0x55, + 0x45, 0x54, 0x8d, 0x74, 0xe5, 0x7f, 0x9b, 0xd8, 0x84, 0xc5, 0xb5, 0x78, 0xc4, 0xad, 0xca, 0x1d, + 0x44, 0xa8, 0x4b, 0xa8, 0xe6, 0x52, 0x5b, 0x8b, 0x2a, 0xf1, 0x43, 0x04, 0x0a, 0xdd, 0x0a, 0x4d, + 0x07, 0x7b, 0x61, 0x1c, 0xe5, 0x23, 0x61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 0xc7, 0xc5, + 0xa4, 0x35, 0x2a, 0x88, 0x2d, 0x2f, 0xc0, 0x08, 0x3b, 0x11, 0xb6, 0xfa, 0x20, 0x6e, 0x77, 0xe4, + 0xd1, 0x40, 0x7c, 0x0c, 0xa0, 0x87, 0xf7, 0xc2, 0x1a, 0xc5, 0x1f, 0x5b, 0xd8, 0x43, 0xb8, 0x16, + 0x60, 0x14, 0x31, 0xa0, 0xb2, 0x31, 0x13, 0x47, 0x36, 0x45, 0x20, 0xc6, 0xd7, 0x83, 0x7c, 0xfc, + 0x72, 0xe4, 0xef, 0x01, 0xec, 0x12, 0x19, 0x35, 0xef, 0x6f, 0x49, 0x96, 0x7d, 0x05, 0xed, 0x7a, + 0xe4, 0x53, 0x13, 0x5b, 0x36, 0x66, 0x9b, 0xea, 0x46, 0xdc, 0xcb, 0x60, 0xda, 0xec, 0xcf, 0xd7, + 0xc6, 0x7e, 0x4e, 0x86, 0x05, 0xc0, 0x01, 0xd6, 0xe2, 0x89, 0x16, 0xa3, 0x9e, 0x35, 0x00, 0x93, + 0x56, 0x62, 0x65, 0xe0, 0xbb, 0xc8, 0x37, 0xdb, 0xdc, 0x57, 0x90, 0x46, 0x40, 0x19, 0x64, 0x31, + 0x6a, 0xe2, 0x7f, 0xf9, 0x49, 0xb1, 0x89, 0x3d, 0x4b, 0x9c, 0x14, 0x77, 0x41, 0x9a, 0x92, 0x56, + 0x80, 0x70, 0xcd, 0xb1, 0x58, 0xee, 0xb4, 0x31, 0xc1, 0x85, 0x75, 0x0b, 0x3e, 0x00, 0x53, 0x16, + 0xa6, 0xa1, 0xe3, 0x99, 0xa1, 0x43, 0xbc, 0xd8, 0x91, 0x64, 0x8e, 0xc9, 0x1e, 0x75, 0xdd, 0x82, + 0x8f, 0xc0, 0x6c, 0xc8, 0x77, 0x48, 0x2d, 0x7e, 0xd2, 0xd0, 0x74, 0x7d, 0xc6, 0x53, 0x36, 0x66, + 0x44, 0x60, 0xab, 0xad, 0xc3, 0xd7, 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x5a, 0x4d, 0x4c, 0xf9, 0x5d, 0xfa, + 0xe4, 0xd9, 0x62, 0xef, 0xa5, 0xbf, 0xef, 0x63, 0x5a, 0x4f, 0xb1, 0x2b, 0xf5, 0xe9, 0xbf, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x9d, 0x9e, 0xa1, 0x72, 0x18, 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -427,13 +427,13 @@ 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 PacketMsgClient interface { // SendPacket defines a rpc handler method for MsgSendPacket. - SendPacket(ctx context.Context, in *MsgSendPacket, opts ...grpc.CallOption) (*MsgSendPacketResponse, error) + SendPacketV2(ctx context.Context, in *MsgSendPacket, opts ...grpc.CallOption) (*MsgSendPacketResponse, error) // RecvPacket defines a rpc handler method for MsgRecvPacket. - RecvPacket(ctx context.Context, in *MsgRecvPacket, opts ...grpc.CallOption) (*MsgRecvPacketResponse, error) + RecvPacketV2(ctx context.Context, in *MsgRecvPacket, opts ...grpc.CallOption) (*MsgRecvPacketResponse, error) // Timeout defines a rpc handler method for MsgTimeout. - Timeout(ctx context.Context, in *MsgTimeout, opts ...grpc.CallOption) (*MsgTimeoutResponse, error) + TimeoutV2(ctx context.Context, in *MsgTimeout, opts ...grpc.CallOption) (*MsgTimeoutResponse, error) // Acknowledgement defines a rpc handler method for MsgAcknowledgement. - Acknowledgement(ctx context.Context, in *MsgAcknowledgement, opts ...grpc.CallOption) (*MsgAcknowledgementResponse, error) + AcknowledgementV2(ctx context.Context, in *MsgAcknowledgement, opts ...grpc.CallOption) (*MsgAcknowledgementResponse, error) } type packetMsgClient struct { @@ -444,36 +444,36 @@ func NewPacketMsgClient(cc grpc1.ClientConn) PacketMsgClient { return &packetMsgClient{cc} } -func (c *packetMsgClient) SendPacket(ctx context.Context, in *MsgSendPacket, opts ...grpc.CallOption) (*MsgSendPacketResponse, error) { +func (c *packetMsgClient) SendPacketV2(ctx context.Context, in *MsgSendPacket, opts ...grpc.CallOption) (*MsgSendPacketResponse, error) { out := new(MsgSendPacketResponse) - err := c.cc.Invoke(ctx, "/ibc.core.channel.v2.PacketMsg/SendPacket", in, out, opts...) + err := c.cc.Invoke(ctx, "/ibc.core.channel.v2.PacketMsg/SendPacketV2", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *packetMsgClient) RecvPacket(ctx context.Context, in *MsgRecvPacket, opts ...grpc.CallOption) (*MsgRecvPacketResponse, error) { +func (c *packetMsgClient) RecvPacketV2(ctx context.Context, in *MsgRecvPacket, opts ...grpc.CallOption) (*MsgRecvPacketResponse, error) { out := new(MsgRecvPacketResponse) - err := c.cc.Invoke(ctx, "/ibc.core.channel.v2.PacketMsg/RecvPacket", in, out, opts...) + err := c.cc.Invoke(ctx, "/ibc.core.channel.v2.PacketMsg/RecvPacketV2", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *packetMsgClient) Timeout(ctx context.Context, in *MsgTimeout, opts ...grpc.CallOption) (*MsgTimeoutResponse, error) { +func (c *packetMsgClient) TimeoutV2(ctx context.Context, in *MsgTimeout, opts ...grpc.CallOption) (*MsgTimeoutResponse, error) { out := new(MsgTimeoutResponse) - err := c.cc.Invoke(ctx, "/ibc.core.channel.v2.PacketMsg/Timeout", in, out, opts...) + err := c.cc.Invoke(ctx, "/ibc.core.channel.v2.PacketMsg/TimeoutV2", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *packetMsgClient) Acknowledgement(ctx context.Context, in *MsgAcknowledgement, opts ...grpc.CallOption) (*MsgAcknowledgementResponse, error) { +func (c *packetMsgClient) AcknowledgementV2(ctx context.Context, in *MsgAcknowledgement, opts ...grpc.CallOption) (*MsgAcknowledgementResponse, error) { out := new(MsgAcknowledgementResponse) - err := c.cc.Invoke(ctx, "/ibc.core.channel.v2.PacketMsg/Acknowledgement", in, out, opts...) + err := c.cc.Invoke(ctx, "/ibc.core.channel.v2.PacketMsg/AcknowledgementV2", in, out, opts...) if err != nil { return nil, err } @@ -483,104 +483,104 @@ func (c *packetMsgClient) Acknowledgement(ctx context.Context, in *MsgAcknowledg // PacketMsgServer is the server API for PacketMsg service. type PacketMsgServer interface { // SendPacket defines a rpc handler method for MsgSendPacket. - SendPacket(context.Context, *MsgSendPacket) (*MsgSendPacketResponse, error) + SendPacketV2(context.Context, *MsgSendPacket) (*MsgSendPacketResponse, error) // RecvPacket defines a rpc handler method for MsgRecvPacket. - RecvPacket(context.Context, *MsgRecvPacket) (*MsgRecvPacketResponse, error) + RecvPacketV2(context.Context, *MsgRecvPacket) (*MsgRecvPacketResponse, error) // Timeout defines a rpc handler method for MsgTimeout. - Timeout(context.Context, *MsgTimeout) (*MsgTimeoutResponse, error) + TimeoutV2(context.Context, *MsgTimeout) (*MsgTimeoutResponse, error) // Acknowledgement defines a rpc handler method for MsgAcknowledgement. - Acknowledgement(context.Context, *MsgAcknowledgement) (*MsgAcknowledgementResponse, error) + AcknowledgementV2(context.Context, *MsgAcknowledgement) (*MsgAcknowledgementResponse, error) } // UnimplementedPacketMsgServer can be embedded to have forward compatible implementations. type UnimplementedPacketMsgServer struct { } -func (*UnimplementedPacketMsgServer) SendPacket(ctx context.Context, req *MsgSendPacket) (*MsgSendPacketResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SendPacket not implemented") +func (*UnimplementedPacketMsgServer) SendPacketV2(ctx context.Context, req *MsgSendPacket) (*MsgSendPacketResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SendPacketV2 not implemented") } -func (*UnimplementedPacketMsgServer) RecvPacket(ctx context.Context, req *MsgRecvPacket) (*MsgRecvPacketResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RecvPacket not implemented") +func (*UnimplementedPacketMsgServer) RecvPacketV2(ctx context.Context, req *MsgRecvPacket) (*MsgRecvPacketResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RecvPacketV2 not implemented") } -func (*UnimplementedPacketMsgServer) Timeout(ctx context.Context, req *MsgTimeout) (*MsgTimeoutResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Timeout not implemented") +func (*UnimplementedPacketMsgServer) TimeoutV2(ctx context.Context, req *MsgTimeout) (*MsgTimeoutResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TimeoutV2 not implemented") } -func (*UnimplementedPacketMsgServer) Acknowledgement(ctx context.Context, req *MsgAcknowledgement) (*MsgAcknowledgementResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Acknowledgement not implemented") +func (*UnimplementedPacketMsgServer) AcknowledgementV2(ctx context.Context, req *MsgAcknowledgement) (*MsgAcknowledgementResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AcknowledgementV2 not implemented") } func RegisterPacketMsgServer(s grpc1.Server, srv PacketMsgServer) { s.RegisterService(&_PacketMsg_serviceDesc, srv) } -func _PacketMsg_SendPacket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _PacketMsg_SendPacketV2_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgSendPacket) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(PacketMsgServer).SendPacket(ctx, in) + return srv.(PacketMsgServer).SendPacketV2(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/ibc.core.channel.v2.PacketMsg/SendPacket", + FullMethod: "/ibc.core.channel.v2.PacketMsg/SendPacketV2", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PacketMsgServer).SendPacket(ctx, req.(*MsgSendPacket)) + return srv.(PacketMsgServer).SendPacketV2(ctx, req.(*MsgSendPacket)) } return interceptor(ctx, in, info, handler) } -func _PacketMsg_RecvPacket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _PacketMsg_RecvPacketV2_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgRecvPacket) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(PacketMsgServer).RecvPacket(ctx, in) + return srv.(PacketMsgServer).RecvPacketV2(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/ibc.core.channel.v2.PacketMsg/RecvPacket", + FullMethod: "/ibc.core.channel.v2.PacketMsg/RecvPacketV2", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PacketMsgServer).RecvPacket(ctx, req.(*MsgRecvPacket)) + return srv.(PacketMsgServer).RecvPacketV2(ctx, req.(*MsgRecvPacket)) } return interceptor(ctx, in, info, handler) } -func _PacketMsg_Timeout_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _PacketMsg_TimeoutV2_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgTimeout) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(PacketMsgServer).Timeout(ctx, in) + return srv.(PacketMsgServer).TimeoutV2(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/ibc.core.channel.v2.PacketMsg/Timeout", + FullMethod: "/ibc.core.channel.v2.PacketMsg/TimeoutV2", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PacketMsgServer).Timeout(ctx, req.(*MsgTimeout)) + return srv.(PacketMsgServer).TimeoutV2(ctx, req.(*MsgTimeout)) } return interceptor(ctx, in, info, handler) } -func _PacketMsg_Acknowledgement_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _PacketMsg_AcknowledgementV2_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgAcknowledgement) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(PacketMsgServer).Acknowledgement(ctx, in) + return srv.(PacketMsgServer).AcknowledgementV2(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/ibc.core.channel.v2.PacketMsg/Acknowledgement", + FullMethod: "/ibc.core.channel.v2.PacketMsg/AcknowledgementV2", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PacketMsgServer).Acknowledgement(ctx, req.(*MsgAcknowledgement)) + return srv.(PacketMsgServer).AcknowledgementV2(ctx, req.(*MsgAcknowledgement)) } return interceptor(ctx, in, info, handler) } @@ -590,20 +590,20 @@ var _PacketMsg_serviceDesc = grpc.ServiceDesc{ HandlerType: (*PacketMsgServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "SendPacket", - Handler: _PacketMsg_SendPacket_Handler, + MethodName: "SendPacketV2", + Handler: _PacketMsg_SendPacketV2_Handler, }, { - MethodName: "RecvPacket", - Handler: _PacketMsg_RecvPacket_Handler, + MethodName: "RecvPacketV2", + Handler: _PacketMsg_RecvPacketV2_Handler, }, { - MethodName: "Timeout", - Handler: _PacketMsg_Timeout_Handler, + MethodName: "TimeoutV2", + Handler: _PacketMsg_TimeoutV2_Handler, }, { - MethodName: "Acknowledgement", - Handler: _PacketMsg_Acknowledgement_Handler, + MethodName: "AcknowledgementV2", + Handler: _PacketMsg_AcknowledgementV2_Handler, }, }, Streams: []grpc.StreamDesc{}, diff --git a/modules/core/module.go b/modules/core/module.go index e0b7baf4a67..1337cb7c8f3 100644 --- a/modules/core/module.go +++ b/modules/core/module.go @@ -24,6 +24,7 @@ import ( connectiontypes "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types" channelkeeper "github.com/cosmos/ibc-go/v9/modules/core/04-channel/keeper" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" + channeltypesv2 "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types" "github.com/cosmos/ibc-go/v9/modules/core/client/cli" "github.com/cosmos/ibc-go/v9/modules/core/exported" "github.com/cosmos/ibc-go/v9/modules/core/keeper" @@ -138,6 +139,7 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { connectiontypes.RegisterMsgServer(cfg.MsgServer(), am.keeper) channeltypes.RegisterMsgServer(cfg.MsgServer(), am.keeper) channeltypes.RegisterPacketMsgServer(cfg.MsgServer(), am.keeper) + channeltypesv2.RegisterPacketMsgServer(cfg.MsgServer(), am.keeper) packetservertypes.RegisterMsgServer(cfg.MsgServer(), am.keeper) clienttypes.RegisterQueryServer(cfg.QueryServer(), clientkeeper.NewQueryServer(am.keeper.ClientKeeper)) diff --git a/modules/core/packet-server/keeper/relay.go b/modules/core/packet-server/keeper/relay.go index c9af870a1e2..0bd0539d3f9 100644 --- a/modules/core/packet-server/keeper/relay.go +++ b/modules/core/packet-server/keeper/relay.go @@ -12,11 +12,28 @@ import ( clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" channelkeeper "github.com/cosmos/ibc-go/v9/modules/core/04-channel/keeper" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" + channeltypesv2 "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types" host "github.com/cosmos/ibc-go/v9/modules/core/24-host" "github.com/cosmos/ibc-go/v9/modules/core/exported" "github.com/cosmos/ibc-go/v9/modules/core/packet-server/types" ) +func (k *Keeper) SendPacketV2(ctx context.Context, msg *channeltypesv2.MsgSendPacket) (*channeltypesv2.MsgSendPacketResponse, error) { + return nil, nil +} + +func (k *Keeper) RecvPacketV2(ctx context.Context, msg *channeltypesv2.MsgRecvPacket) (*channeltypesv2.MsgRecvPacketResponse, error) { + return nil, nil +} + +func (k *Keeper) TimeoutV2(ctx context.Context, msg *channeltypesv2.MsgTimeout) (*channeltypesv2.MsgTimeoutResponse, error) { + return nil, nil +} + +// func (k *Keeper) AcknowledgementV2(ctx context.Context, msg *channeltypesv2.MsgAcknowledgement) (*channeltypesv2.MsgAcknowledgementResponse, error) { +// return nil, nil +// } + // SendPacket implements the packet sending logic required by a packet handler. // It will generate a packet and store the commitment hash if all arguments provided are valid. // The destination channel will be filled in using the counterparty information. diff --git a/proto/ibc/core/channel/v2/tx.proto b/proto/ibc/core/channel/v2/tx.proto index dcf265b023f..de6a68ac078 100644 --- a/proto/ibc/core/channel/v2/tx.proto +++ b/proto/ibc/core/channel/v2/tx.proto @@ -15,16 +15,16 @@ service PacketMsg { option (cosmos.msg.v1.service) = true; // SendPacket defines a rpc handler method for MsgSendPacket. - rpc SendPacket(MsgSendPacket) returns (MsgSendPacketResponse); + rpc SendPacketV2(MsgSendPacket) returns (MsgSendPacketResponse); // RecvPacket defines a rpc handler method for MsgRecvPacket. - rpc RecvPacket(MsgRecvPacket) returns (MsgRecvPacketResponse); + rpc RecvPacketV2(MsgRecvPacket) returns (MsgRecvPacketResponse); // Timeout defines a rpc handler method for MsgTimeout. - rpc Timeout(MsgTimeout) returns (MsgTimeoutResponse); + rpc TimeoutV2(MsgTimeout) returns (MsgTimeoutResponse); // Acknowledgement defines a rpc handler method for MsgAcknowledgement. - rpc Acknowledgement(MsgAcknowledgement) returns (MsgAcknowledgementResponse); + rpc AcknowledgementV2(MsgAcknowledgement) returns (MsgAcknowledgementResponse); } // MsgRecvPacket receives incoming IBC packet From 65633e4be5614390f62176f2cc201c5060075069 Mon Sep 17 00:00:00 2001 From: chatton Date: Tue, 17 Sep 2024 16:01:33 +0100 Subject: [PATCH 04/27] chore: adding wiring for new message types --- modules/core/04-channel/v2/types/codec.go | 18 ++++++++++++++++++ modules/core/keeper/msg_server.go | 19 ++++++++++++++++++- modules/core/packet-server/keeper/relay.go | 17 ----------------- modules/core/types/codec.go | 2 ++ 4 files changed, 38 insertions(+), 18 deletions(-) create mode 100644 modules/core/04-channel/v2/types/codec.go diff --git a/modules/core/04-channel/v2/types/codec.go b/modules/core/04-channel/v2/types/codec.go new file mode 100644 index 00000000000..3e474fdb2cc --- /dev/null +++ b/modules/core/04-channel/v2/types/codec.go @@ -0,0 +1,18 @@ +package types + +import ( + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" +) + +func RegisterInterfaces(registry codectypes.InterfaceRegistry) { + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgSendPacket{}, + &MsgRecvPacket{}, + &MsgAcknowledgement{}, + &MsgTimeout{}, + ) + msgservice.RegisterMsgServiceDesc(registry, &_PacketMsg_serviceDesc) +} diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index 46c711277ee..7bdbf7a702f 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -2,9 +2,10 @@ package keeper import ( "context" + errorsmod "cosmossdk.io/errors" "errors" "fmt" - errorsmod "cosmossdk.io/errors" + channeltypesv2 "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -1034,6 +1035,22 @@ func (k *Keeper) UpdateChannelParams(goCtx context.Context, msg *channeltypes.Ms return &channeltypes.MsgUpdateParamsResponse{}, nil } +func (k *Keeper) SendPacketV2(ctx context.Context, msg *channeltypesv2.MsgSendPacket) (*channeltypesv2.MsgSendPacketResponse, error) { + return nil, nil +} + +func (k *Keeper) RecvPacketV2(ctx context.Context, msg *channeltypesv2.MsgRecvPacket) (*channeltypesv2.MsgRecvPacketResponse, error) { + return nil, nil +} + +func (k *Keeper) TimeoutV2(ctx context.Context, msg *channeltypesv2.MsgTimeout) (*channeltypesv2.MsgTimeoutResponse, error) { + return nil, nil +} + +func (k *Keeper) AcknowledgementV2(ctx context.Context, msg *channeltypesv2.MsgAcknowledgement) (*channeltypesv2.MsgAcknowledgementResponse, error) { + return nil, nil +} + // convertToErrorEvents converts all events to error events by appending the // error attribute prefix to each event's attribute key. func convertToErrorEvents(events sdk.Events) sdk.Events { diff --git a/modules/core/packet-server/keeper/relay.go b/modules/core/packet-server/keeper/relay.go index 0bd0539d3f9..c9af870a1e2 100644 --- a/modules/core/packet-server/keeper/relay.go +++ b/modules/core/packet-server/keeper/relay.go @@ -12,28 +12,11 @@ import ( clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" channelkeeper "github.com/cosmos/ibc-go/v9/modules/core/04-channel/keeper" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" - channeltypesv2 "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types" host "github.com/cosmos/ibc-go/v9/modules/core/24-host" "github.com/cosmos/ibc-go/v9/modules/core/exported" "github.com/cosmos/ibc-go/v9/modules/core/packet-server/types" ) -func (k *Keeper) SendPacketV2(ctx context.Context, msg *channeltypesv2.MsgSendPacket) (*channeltypesv2.MsgSendPacketResponse, error) { - return nil, nil -} - -func (k *Keeper) RecvPacketV2(ctx context.Context, msg *channeltypesv2.MsgRecvPacket) (*channeltypesv2.MsgRecvPacketResponse, error) { - return nil, nil -} - -func (k *Keeper) TimeoutV2(ctx context.Context, msg *channeltypesv2.MsgTimeout) (*channeltypesv2.MsgTimeoutResponse, error) { - return nil, nil -} - -// func (k *Keeper) AcknowledgementV2(ctx context.Context, msg *channeltypesv2.MsgAcknowledgement) (*channeltypesv2.MsgAcknowledgementResponse, error) { -// return nil, nil -// } - // SendPacket implements the packet sending logic required by a packet handler. // It will generate a packet and store the commitment hash if all arguments provided are valid. // The destination channel will be filled in using the counterparty information. diff --git a/modules/core/types/codec.go b/modules/core/types/codec.go index 28b008ce3f6..cb802a9245e 100644 --- a/modules/core/types/codec.go +++ b/modules/core/types/codec.go @@ -2,6 +2,7 @@ package types import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" + channeltypesv2 "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" connectiontypes "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types" @@ -16,6 +17,7 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { clienttypes.RegisterInterfaces(registry) connectiontypes.RegisterInterfaces(registry) channeltypes.RegisterInterfaces(registry) + channeltypesv2.RegisterInterfaces(registry) packetservertypes.RegisterInterfaces(registry) commitmenttypes.RegisterInterfaces(registry) } From e0cce2274157ff58ff87edf12b4b003d1de657e6 Mon Sep 17 00:00:00 2001 From: bznein Date: Tue, 17 Sep 2024 16:43:17 +0100 Subject: [PATCH 05/27] added SendPacketV2 to packet-server --- modules/core/04-channel/v2/types/packet.go | 20 ++++++++ modules/core/keeper/msg_server.go | 19 ++++++- modules/core/packet-server/keeper/relay.go | 59 ++++++++++++++++++++++ 3 files changed, 96 insertions(+), 2 deletions(-) create mode 100644 modules/core/04-channel/v2/types/packet.go diff --git a/modules/core/04-channel/v2/types/packet.go b/modules/core/04-channel/v2/types/packet.go new file mode 100644 index 00000000000..ca4cafacb44 --- /dev/null +++ b/modules/core/04-channel/v2/types/packet.go @@ -0,0 +1,20 @@ +package types + +import ( + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" +) + +func NewPacketV2( + sequence uint64, sourceId, + destinationId string, + timeoutTimestamp uint64, + data ...channeltypes.PacketData, +) channeltypes.PacketV2 { + return channeltypes.PacketV2{ + Sequence: sequence, + SourceId: sourceId, + DestinationId: destinationId, + TimeoutTimestamp: timeoutTimestamp, + Data: data, + } +} diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index 7bdbf7a702f..98f88411717 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -2,9 +2,10 @@ package keeper import ( "context" - errorsmod "cosmossdk.io/errors" "errors" "fmt" + + errorsmod "cosmossdk.io/errors" channeltypesv2 "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -1036,7 +1037,21 @@ func (k *Keeper) UpdateChannelParams(goCtx context.Context, msg *channeltypes.Ms } func (k *Keeper) SendPacketV2(ctx context.Context, msg *channeltypesv2.MsgSendPacket) (*channeltypesv2.MsgSendPacketResponse, error) { - return nil, nil + sequence, err := k.PacketServerKeeper.SendPacketV2(ctx, msg.SourceId, msg.TimeoutTimestamp, msg.PacketData) + if err != nil { + // ctx.Logger().Error("send packet failed", "port-id", msg.PortId, "channel-id", msg.ChannelId, "error", errorsmod.Wrap(err, "send packet failed")) + return nil, errorsmod.Wrapf(err, "send packet failed for source id: %s", msg.SourceId) + } + + // for _, pd := range msg.PacketData { + // cbs := k.PortKeeper.AppRouter.Route(pd.AppName) + // err := cbs.OnSendPacketV2(ctx, msg.PortId, msg.ChannelId, sequence, msg.TimeoutHeight, msg.TimeoutTimestamp, pd.Payload, sdk.AccAddress(msg.Signer)) + // if err != nil { + // return nil, err + // } + // } + + return &channeltypesv2.MsgSendPacketResponse{Sequence: sequence}, nil } func (k *Keeper) RecvPacketV2(ctx context.Context, msg *channeltypesv2.MsgRecvPacket) (*channeltypesv2.MsgRecvPacketResponse, error) { diff --git a/modules/core/packet-server/keeper/relay.go b/modules/core/packet-server/keeper/relay.go index c9af870a1e2..019eac64bfc 100644 --- a/modules/core/packet-server/keeper/relay.go +++ b/modules/core/packet-server/keeper/relay.go @@ -12,11 +12,70 @@ import ( clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" channelkeeper "github.com/cosmos/ibc-go/v9/modules/core/04-channel/keeper" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" + channeltypesv2 "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types" host "github.com/cosmos/ibc-go/v9/modules/core/24-host" "github.com/cosmos/ibc-go/v9/modules/core/exported" "github.com/cosmos/ibc-go/v9/modules/core/packet-server/types" ) +const packetV2SourcePort = "v2port" + +func (k Keeper) SendPacketV2( + ctx context.Context, + sourceID string, + timeoutTimestamp uint64, + data []channeltypes.PacketData, +) (uint64, error) { + // Lookup counterparty associated with our source channel to retrieve the destination channel + counterparty, ok := k.GetCounterparty(ctx, sourceID) + if !ok { + return 0, errorsmod.Wrap(types.ErrCounterpartyNotFound, sourceID) + } + destChannel := counterparty.ClientId + // retrieve the sequence send for this channel + // if no packets have been sent yet, initialize the sequence to 1. + sequence, found := k.ChannelKeeper.GetNextSequenceSend(ctx, packetV2SourcePort, sourceID) + if !found { + sequence = 1 + } + + // construct packet from given fields and channel state + packet := channeltypesv2.NewPacketV2(sequence, sourceID, destChannel, timeoutTimestamp, data...) + + if err := packet.ValidateBasic(); err != nil { + return 0, errorsmod.Wrapf(channeltypes.ErrInvalidPacket, "constructed packet failed basic validation: %v", err) + } + + // check that the client of counterparty chain is still active + if status := k.ClientKeeper.GetClientStatus(ctx, sourceID); status != exported.Active { + return 0, errorsmod.Wrapf(clienttypes.ErrClientNotActive, "client (%s) status is %s", sourceID, status) + } + + // retrieve latest height and timestamp of the client of counterparty chain + latestHeight := k.ClientKeeper.GetClientLatestHeight(ctx, sourceID) + if latestHeight.IsZero() { + return 0, errorsmod.Wrapf(clienttypes.ErrInvalidHeight, "cannot send packet using client (%s) with zero height", sourceID) + } + latestTimestamp, err := k.ClientKeeper.GetClientTimestampAtHeight(ctx, sourceID, latestHeight) + if err != nil { + return 0, err + } + // check if packet is timed out on the receiving chain + timeout := channeltypes.NewTimeoutWithTimestamp(timeoutTimestamp) + if timeout.Elapsed(clienttypes.ZeroHeight(), latestTimestamp) { + return 0, errorsmod.Wrap(timeout.ErrTimeoutElapsed(latestHeight, latestTimestamp), "invalid packet timeout") + } + commitment := channeltypes.CommitPacketV2(packet) + + // bump the sequence and set the packet commitment so it is provable by the counterparty + k.ChannelKeeper.SetNextSequenceSend(ctx, packetV2SourcePort, sourceID, sequence+1) + k.ChannelKeeper.SetPacketCommitment(ctx, packetV2SourcePort, sourceID, packet.GetSequence(), commitment) + // k.Logger(ctx).Info("packet sent", "sequence", strconv.FormatUint(packet.Sequence, 10), "src_port", packetV2SourcePort, "src_channel", packet.SourceChannel, "dst_port", packet.DestinationPort, "dst_channel", packet.DestinationChannel) + + // channelkeeper.EmitSendPacketEventV2(ctx, packet, sentinelChannel(sourceID), timeoutHeight) + return sequence, nil +} + // SendPacket implements the packet sending logic required by a packet handler. // It will generate a packet and store the commitment hash if all arguments provided are valid. // The destination channel will be filled in using the counterparty information. From 373028a91eac592edc3221237d7c24d05e4bcbb9 Mon Sep 17 00:00:00 2001 From: bznein Date: Wed, 18 Sep 2024 09:28:32 +0100 Subject: [PATCH 06/27] Added AppRouterV2 --- modules/core/05-port/types/module.go | 33 +++++++++++++++ modules/core/05-port/types/router_v2.go | 55 +++++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 modules/core/05-port/types/router_v2.go diff --git a/modules/core/05-port/types/module.go b/modules/core/05-port/types/module.go index cc7915bb6b0..68d3b56fedd 100644 --- a/modules/core/05-port/types/module.go +++ b/modules/core/05-port/types/module.go @@ -108,6 +108,39 @@ type IBCModule interface { ) error } +type IBCModuleV2 interface { + OnSendPacketV2( + ctx context.Context, + sourceID string, + sequence uint64, + timeoutTimestamp uint64, + payload channeltypes.Payload, + signer sdk.AccAddress, + ) error + + OnRecvPacketV2( + ctx context.Context, + packet channeltypes.PacketV2, + payload channeltypes.Payload, + relayer sdk.AccAddress, + ) channeltypes.RecvPacketResult + + OnAcknowledgementPacketV2( + ctx context.Context, + packet channeltypes.PacketV2, + payload channeltypes.Payload, + recvPacketResult channeltypes.RecvPacketResult, + relayer sdk.AccAddress, + ) error + + OnTimeoutPacketV2( + ctx context.Context, + packet channeltypes.PacketV2, + payload channeltypes.Payload, + relayer sdk.AccAddress, + ) error +} + // UpgradableModule defines the callbacks required to perform a channel upgrade. // Note: applications must ensure that state related to packet processing remains unmodified until the OnChanUpgradeOpen callback is executed. // This guarantees that in-flight packets are correctly flushed using the existing channel parameters. diff --git a/modules/core/05-port/types/router_v2.go b/modules/core/05-port/types/router_v2.go new file mode 100644 index 00000000000..3f4e37f6252 --- /dev/null +++ b/modules/core/05-port/types/router_v2.go @@ -0,0 +1,55 @@ +package types + +import ( + "errors" + "fmt" + "strings" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// AppRouterV2 contains all the module-defined callbacks required by ICS-26 +type AppRouterV2 struct { + routes map[string]IBCModuleV2 +} + +func NewAppRouter() *AppRouterV2 { + return &AppRouterV2{ + routes: make(map[string]IBCModuleV2), + } +} + +func (rtr *AppRouterV2) AddRoute(module string, cbs IBCModuleV2) *AppRouterV2 { + if !sdk.IsAlphaNumeric(module) { + panic(errors.New("route expressions can only contain alphanumeric characters")) + } + + rtr.routes[module] = cbs + + return rtr +} + +func (rtr *AppRouterV2) Route(appName string) IBCModuleV2 { + route, ok := rtr.route(appName) + if !ok { + panic(fmt.Sprintf("no route for %s", appName)) + } + + return route +} + +func (rtr *AppRouterV2) route(appName string) (IBCModuleV2, bool) { + route, ok := rtr.routes[appName] + if ok { + return route, true + } + + // it's possible that some routes have been dynamically added e.g. with interchain accounts. + // in this case, we need to check if the module has the specified prefix. + for prefix := range rtr.routes { + if strings.HasPrefix(appName, prefix) { + return rtr.routes[prefix], true + } + } + return nil, false +} From 0c1c80c34941c11ac7cf9f64a1d64472cfd82e59 Mon Sep 17 00:00:00 2001 From: bznein Date: Wed, 18 Sep 2024 09:38:45 +0100 Subject: [PATCH 07/27] Added ibc_module_v2 and ibc_app_v2 --- testing/mock/ibc_app_v2.go | 48 +++++++++++++++++++++ testing/mock/ibc_module_v2.go | 79 +++++++++++++++++++++++++++++++++++ 2 files changed, 127 insertions(+) create mode 100644 testing/mock/ibc_app_v2.go create mode 100644 testing/mock/ibc_module_v2.go diff --git a/testing/mock/ibc_app_v2.go b/testing/mock/ibc_app_v2.go new file mode 100644 index 00000000000..f3630a5d9a4 --- /dev/null +++ b/testing/mock/ibc_app_v2.go @@ -0,0 +1,48 @@ +package mock + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" +) + +// IBCAppV2 contains IBCModuleV2 application module callbacks as defined in 05-port. +type IBCAppV2 struct { + OnSendPacketV2 func( + ctx context.Context, + sourceID string, + sequence uint64, + timeoutTimestamp uint64, + payload channeltypes.Payload, + signer sdk.AccAddress, + ) error + + OnRecvPacketV2 func( + ctx context.Context, + packet channeltypes.PacketV2, + payload channeltypes.Payload, + relayer sdk.AccAddress, + ) channeltypes.RecvPacketResult + + OnAcknowledgementPacketV2 func( + ctx context.Context, + packet channeltypes.PacketV2, + payload channeltypes.Payload, + recvPacketResult channeltypes.RecvPacketResult, + relayer sdk.AccAddress, + ) error + + OnTimeoutPacketV2 func( + ctx context.Context, + packet channeltypes.PacketV2, + payload channeltypes.Payload, + relayer sdk.AccAddress, + ) error +} + +// NewIBCV2App returns a IBCAppV2. +func NewIBCV2App() *IBCAppV2 { + return &IBCAppV2{} +} diff --git a/testing/mock/ibc_module_v2.go b/testing/mock/ibc_module_v2.go new file mode 100644 index 00000000000..37886b988e6 --- /dev/null +++ b/testing/mock/ibc_module_v2.go @@ -0,0 +1,79 @@ +package mock + +import ( + "bytes" + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" + porttypes "github.com/cosmos/ibc-go/v9/modules/core/05-port/types" +) + +var _ porttypes.IBCModuleV2 = (*IBCModuleV2)(nil) + +// IBCModuleV2 implements the IBCModuleV2 interface for testing v2 of the IBC module. +type IBCModuleV2 struct { + IBCApp *IBCAppV2 // base application of an IBC middleware stack +} + +func (im IBCModuleV2) OnSendPacketV2(ctx context.Context, sourceID string, sequence uint64, timeoutTimestamp uint64, payload channeltypes.Payload, signer sdk.AccAddress) error { + if im.IBCApp.OnSendPacketV2 != nil { + return im.IBCApp.OnSendPacketV2(ctx, sourceID, sequence, timeoutTimestamp, payload, signer) + } + + return nil +} + +func (im IBCModuleV2) OnRecvPacketV2(ctx context.Context, packet channeltypes.PacketV2, payload channeltypes.Payload, relayer sdk.AccAddress) channeltypes.RecvPacketResult { + if im.IBCApp.OnRecvPacketV2 != nil { + return im.IBCApp.OnRecvPacketV2(ctx, packet, payload, relayer) + } + + sdkCtx := sdk.UnwrapSDKContext(ctx) + sdkCtx.EventManager().EmitEvent(NewMockRecvPacketEvent()) + + status := channeltypes.PacketStatus_Success + ack := MockAcknowledgement.Acknowledgement() + + if bytes.Equal(payload.Value, MockFailPacketData) { + status = channeltypes.PacketStatus_Failure + ack = MockFailAcknowledgement.Acknowledgement() + } else if bytes.Equal(payload.Value, MockAsyncPacketData) { + status = channeltypes.PacketStatus_Async + ack = nil + } + + return channeltypes.RecvPacketResult{ + Status: status, + Acknowledgement: ack, + } +} + +func (im IBCModuleV2) OnAcknowledgementPacketV2(ctx context.Context, packet channeltypes.PacketV2, payload channeltypes.Payload, recvPacketResult channeltypes.RecvPacketResult, relayer sdk.AccAddress) error { + if im.IBCApp.OnAcknowledgementPacketV2 != nil { + return im.IBCApp.OnAcknowledgementPacketV2(ctx, packet, payload, recvPacketResult, relayer) + } + + sdkCtx := sdk.UnwrapSDKContext(ctx) + sdkCtx.EventManager().EmitEvent(NewMockAckPacketEvent()) + return nil +} + +func (im IBCModuleV2) OnTimeoutPacketV2(ctx context.Context, packet channeltypes.PacketV2, payload channeltypes.Payload, relayer sdk.AccAddress) error { + if im.IBCApp.OnTimeoutPacketV2 != nil { + return im.IBCApp.OnTimeoutPacketV2(ctx, packet, payload, relayer) + } + + sdkCtx := sdk.UnwrapSDKContext(ctx) + sdkCtx.EventManager().EmitEvent(NewMockTimeoutPacketEvent()) + + return nil +} + +// NewIBCModuleV2 creates a new IBCModule given the underlying mock IBC application and scopedKeeper. +func NewIBCModuleV2(app *IBCAppV2) IBCModuleV2 { + return IBCModuleV2{ + IBCApp: app, + } +} From c420214ea067db29d93029271bc9fab06047af76 Mon Sep 17 00:00:00 2001 From: bznein Date: Wed, 18 Sep 2024 09:47:02 +0100 Subject: [PATCH 08/27] Wiring of routerV2 --- modules/core/05-port/keeper/keeper.go | 3 ++- modules/core/keeper/keeper.go | 10 ++++++++++ testing/mock/mock.go | 4 +++- testing/simapp/app.go | 13 +++++++++++++ 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/modules/core/05-port/keeper/keeper.go b/modules/core/05-port/keeper/keeper.go index a35288a48c1..4716107ccaa 100644 --- a/modules/core/05-port/keeper/keeper.go +++ b/modules/core/05-port/keeper/keeper.go @@ -14,7 +14,8 @@ import ( // Keeper defines the IBC connection keeper type Keeper struct { - Router *types.Router + Router *types.Router + AppRouter *types.AppRouterV2 } // NewKeeper creates a new IBC connection Keeper instance diff --git a/modules/core/keeper/keeper.go b/modules/core/keeper/keeper.go index 665a43ee096..0237a74880d 100644 --- a/modules/core/keeper/keeper.go +++ b/modules/core/keeper/keeper.go @@ -79,6 +79,16 @@ func (k *Keeper) SetRouter(rtr *porttypes.Router) { k.PortKeeper.Router.Seal() } +// SetRouterV2 sets the Router in IBC Keeper. The method panics if +// there is an existing router that's already sealed. +func (k *Keeper) SetRouterV2(rtr *porttypes.AppRouterV2) { + if k.PortKeeper.AppRouter != nil { + panic(errors.New("cannot reset an already set router")) + } + + k.PortKeeper.AppRouter = rtr +} + // GetAuthority returns the ibc module's authority. func (k *Keeper) GetAuthority() string { return k.authority diff --git a/testing/mock/mock.go b/testing/mock/mock.go index 0fe029ad64f..d38bf2df252 100644 --- a/testing/mock/mock.go +++ b/testing/mock/mock.go @@ -25,7 +25,9 @@ import ( ) const ( - ModuleName = "mock" + ModuleName = "mock" + ModuleNameV2A = "mockv2A" + ModuleNameV2B = "mockv2B" MemStoreKey = "memory:mock" diff --git a/testing/simapp/app.go b/testing/simapp/app.go index 77d9de44f57..397ef8e4fa8 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -181,6 +181,9 @@ type SimApp struct { ICAAuthModule ibcmock.IBCModule FeeMockModule ibcmock.IBCModule + IBCMockModuleV2A ibcmock.IBCModuleV2 + IBCMockModuleV2B ibcmock.IBCModuleV2 + // the module manager ModuleManager *module.Manager BasicModuleManager module.BasicManager @@ -385,7 +388,16 @@ func NewSimApp( // Create IBC Router ibcRouter := porttypes.NewRouter() + ibcRouterV2 := porttypes.NewAppRouter() + + // add multiple a mock IBCModuleV2 modules whose functionality can be overridden in tests. + mockModuleV2A := ibcmock.NewIBCModuleV2(ibcmock.NewIBCV2App()) + ibcRouterV2.AddRoute(ibcmock.ModuleNameV2A, mockModuleV2A) + app.IBCMockModuleV2A = mockModuleV2A + mockModuleV2B := ibcmock.NewIBCModuleV2(ibcmock.NewIBCV2App()) + ibcRouterV2.AddRoute(ibcmock.ModuleNameV2B, mockModuleV2B) + app.IBCMockModuleV2B = mockModuleV2B // Middleware Stacks // Create Transfer Keeper and pass IBCFeeKeeper as expected Channel and PortKeeper @@ -481,6 +493,7 @@ func NewSimApp( // Seal the IBC Router app.IBCKeeper.SetRouter(ibcRouter) + app.IBCKeeper.SetRouterV2(ibcRouterV2) clientKeeper := app.IBCKeeper.ClientKeeper storeProvider := app.IBCKeeper.ClientKeeper.GetStoreProvider() From caaf32455aceaad52dc1426e2b1779761ba4a29d Mon Sep 17 00:00:00 2001 From: bznein Date: Wed, 18 Sep 2024 10:03:42 +0100 Subject: [PATCH 09/27] Added TimeoutPacketV2 function --- modules/core/keeper/msg_server.go | 51 +++++++++++--- modules/core/packet-server/keeper/relay.go | 80 ++++++++++++++++++++++ 2 files changed, 123 insertions(+), 8 deletions(-) diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index 98f88411717..5862e23ffef 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -1043,13 +1043,13 @@ func (k *Keeper) SendPacketV2(ctx context.Context, msg *channeltypesv2.MsgSendPa return nil, errorsmod.Wrapf(err, "send packet failed for source id: %s", msg.SourceId) } - // for _, pd := range msg.PacketData { - // cbs := k.PortKeeper.AppRouter.Route(pd.AppName) - // err := cbs.OnSendPacketV2(ctx, msg.PortId, msg.ChannelId, sequence, msg.TimeoutHeight, msg.TimeoutTimestamp, pd.Payload, sdk.AccAddress(msg.Signer)) - // if err != nil { - // return nil, err - // } - // } + for _, pd := range msg.PacketData { + cbs := k.PortKeeper.AppRouter.Route(pd.SourcePort) + err := cbs.OnSendPacketV2(ctx, msg.SourceId, sequence, msg.TimeoutTimestamp, pd.Payload, sdk.AccAddress(msg.Signer)) + if err != nil { + return nil, err + } + } return &channeltypesv2.MsgSendPacketResponse{Sequence: sequence}, nil } @@ -1059,7 +1059,42 @@ func (k *Keeper) RecvPacketV2(ctx context.Context, msg *channeltypesv2.MsgRecvPa } func (k *Keeper) TimeoutV2(ctx context.Context, msg *channeltypesv2.MsgTimeout) (*channeltypesv2.MsgTimeoutResponse, error) { - return nil, nil + sdkCtx := sdk.UnwrapSDKContext(ctx) + + relayer, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + sdkCtx.Logger().Error("timeout failed", "error", errorsmod.Wrap(err, "Invalid address for msg Signer")) + return nil, errorsmod.Wrap(err, "Invalid address for msg Signer") + } + + // Perform TAO verification + // + // If the timeout was already received, perform a no-op + // Use a cached context to prevent accidental state changes + cacheCtx, writeFn := sdkCtx.CacheContext() + err = k.PacketServerKeeper.TimeoutPacketV2(cacheCtx, msg.Packet, msg.ProofUnreceived, msg.ProofHeight) + + switch err { + case nil: + writeFn() + case channeltypes.ErrNoOpMsg: + // no-ops do not need event emission as they will be ignored + sdkCtx.Logger().Debug("no-op on redundant relay", "source-id", msg.Packet.SourceId) + return &channeltypesv2.MsgTimeoutResponse{Result: channeltypes.NOOP}, nil + default: + sdkCtx.Logger().Error("timeout failed", "source-id", msg.Packet.SourceId, "error", errorsmod.Wrap(err, "timeout packet verification failed")) + return nil, errorsmod.Wrap(err, "timeout packet verification failed") + } + + for _, pd := range msg.Packet.Data { + cb := k.PortKeeper.AppRouter.Route(pd.SourcePort) + err := cb.OnTimeoutPacketV2(ctx, msg.Packet, pd.Payload, relayer) + if err != nil { + return nil, err + } + } + + return &channeltypesv2.MsgTimeoutResponse{Result: channeltypes.SUCCESS}, nil } func (k *Keeper) AcknowledgementV2(ctx context.Context, msg *channeltypesv2.MsgAcknowledgement) (*channeltypesv2.MsgAcknowledgementResponse, error) { diff --git a/modules/core/packet-server/keeper/relay.go b/modules/core/packet-server/keeper/relay.go index 019eac64bfc..2d02ef061a8 100644 --- a/modules/core/packet-server/keeper/relay.go +++ b/modules/core/packet-server/keeper/relay.go @@ -446,3 +446,83 @@ func (k Keeper) TimeoutPacket( return packet.AppVersion, nil } + +// TimeoutPacketV2 implements the timeout logic required by a packet handler. +// The packet is checked for correctness including asserting that the packet was +// sent and received on clients which are counterparties for one another. +// If no packet commitment exists, a no-op error is returned, otherwise +// an absence proof of the packet receipt is performed to ensure that the packet +// was never delivered to the counterparty. If successful, the packet commitment +// is deleted and the packet has completed its lifecycle. +func (k Keeper) TimeoutPacketV2( + ctx context.Context, + packet channeltypes.PacketV2, + proof []byte, + proofHeight exported.Height, +) error { + // Lookup counterparty associated with our channel and ensure + // that the packet was indeed sent by our counterparty. + counterparty, ok := k.GetCounterparty(ctx, packet.SourceId) + if !ok { + return errorsmod.Wrap(types.ErrCounterpartyNotFound, packet.SourceId) + } + + if counterparty.ClientId != packet.DestinationId { + return channeltypes.ErrInvalidChannelIdentifier + } + + // check that timeout height or timeout timestamp has passed on the other end + proofTimestamp, err := k.ClientKeeper.GetClientTimestampAtHeight(ctx, packet.SourceId, proofHeight) + if err != nil { + return err + } + + timeout := channeltypes.NewTimeoutWithTimestamp(packet.GetTimeoutTimestamp()) + if !timeout.Elapsed(clienttypes.ZeroHeight(), proofTimestamp) { + return errorsmod.Wrap(timeout.ErrTimeoutNotReached(proofHeight.(clienttypes.Height), proofTimestamp), "packet timeout not reached") + } + + // check that the commitment has not been cleared and that it matches the packet sent by relayer + commitment := k.ChannelKeeper.GetPacketCommitment(ctx, packetV2SourcePort, packet.SourceId, packet.Sequence) + + if len(commitment) == 0 { + // TODO: pending decision on event structure for V2. + // channelkeeper.EmitTimeoutPacketEvent(ctx, packet, nil) + // This error indicates that the timeout has already been relayed + // or there is a misconfigured relayer attempting to prove a timeout + // for a packet never sent. 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 channeltypes.ErrNoOpMsg + } + + packetCommitment := channeltypes.CommitPacketV2(packet) + // verify we sent the packet and haven't cleared it out yet + if !bytes.Equal(commitment, packetCommitment) { + return errorsmod.Wrapf(channeltypes.ErrInvalidPacket, "packet commitment bytes are not equal: got (%v), expected (%v)", commitment, packetCommitment) + } + + // verify packet receipt absence + path := host.PacketReceiptKey(packetV2SourcePort, packet.DestinationId, packet.Sequence) + merklePath := types.BuildMerklePath(counterparty.MerklePathPrefix, path) + + if err := k.ClientKeeper.VerifyNonMembership( + ctx, + packet.SourceId, + proofHeight, + 0, 0, + proof, + merklePath, + ); err != nil { + return errorsmod.Wrapf(err, "failed packet receipt absence verification for client (%s)", packet.SourceId) + } + + // delete packet commitment to prevent replay + k.ChannelKeeper.DeletePacketCommitment(ctx, packetV2SourcePort, packet.SourceId, packet.Sequence) + + k.Logger(ctx).Info("packet timed out", "sequence", strconv.FormatUint(packet.Sequence, 10), "src_port", packet.Data[0].SourcePort, "src_channel", packet.SourceId, "dst_port", packet.Data[0].DestinationPort, "dst_channel", packet.DestinationId) + + // TODO: pending decision on event structure for V2. + // channelkeeper.EmitTimeoutPacketEvent(ctx, packet, nil) + + return nil +} From 877fd5b6e6b8a52ad18e81f8fd59e883d92efc13 Mon Sep 17 00:00:00 2001 From: chatton Date: Wed, 18 Sep 2024 10:29:00 +0100 Subject: [PATCH 10/27] chore: adding RecvPacketV2 --- modules/core/04-channel/keeper/keeper.go | 25 ++++ modules/core/24-host/packet_keys.go | 6 + modules/core/keeper/msg_server.go | 83 +++++++++++++- modules/core/packet-server/keeper/relay.go | 127 +++++++++++++++++++-- 4 files changed, 230 insertions(+), 11 deletions(-) diff --git a/modules/core/04-channel/keeper/keeper.go b/modules/core/04-channel/keeper/keeper.go index 1dddc74e126..8e3c96eb40a 100644 --- a/modules/core/04-channel/keeper/keeper.go +++ b/modules/core/04-channel/keeper/keeper.go @@ -315,6 +315,31 @@ func (k *Keeper) deletePacketAcknowledgement(ctx context.Context, portID, channe } } +func (k *Keeper) SetMultiAcknowledgement(ctx context.Context, portID, channelID string, sequence uint64, multiAck types.MultiAcknowledgement) { + store := k.storeService.OpenKVStore(ctx) + bz := k.cdc.MustMarshal(&multiAck) + if err := store.Set(host.MultiAckKey(portID, channelID, sequence), bz); err != nil { + panic(err) + } +} + +// GetMultiAcknowledgement gets the multi ack result +func (k *Keeper) GetMultiAcknowledgement(ctx context.Context, portID, channelID string, sequence uint64) (types.MultiAcknowledgement, bool) { + store := k.storeService.OpenKVStore(ctx) + bz, err := store.Get(host.MultiAckKey(portID, channelID, sequence)) + if err != nil { + panic(err) + } + + if len(bz) == 0 { + return types.MultiAcknowledgement{}, false + } + + var res types.MultiAcknowledgement + k.cdc.MustUnmarshal(bz, &res) + return res, true +} + // IteratePacketSequence provides an iterator over all send, receive or ack sequences. // For each sequence, cb will be called. If the cb returns true, the iterator // will close and stop. diff --git a/modules/core/24-host/packet_keys.go b/modules/core/24-host/packet_keys.go index 4451e2b143c..aaf33b5479f 100644 --- a/modules/core/24-host/packet_keys.go +++ b/modules/core/24-host/packet_keys.go @@ -15,6 +15,8 @@ const ( KeyMultiAck = "multiAck" ) +const SentinelV2PortID = "v2port" + // ICS04 // The following paths are the keys to the store as defined in https://github.com/cosmos/ibc/tree/master/spec/core/ics-004-channel-and-packet-semantics#store-paths @@ -74,6 +76,10 @@ func RecvStartSequenceKey(portID, channelID string) []byte { return []byte(fmt.Sprintf("%s/%s", KeyRecvStartSequence, channelPath(portID, channelID))) } +func MultiAckKey(portID, channelID string, sequence uint64) []byte { + return []byte(fmt.Sprintf("%s/%s/%s", KeyMultiAck, channelPath(portID, channelID), sequencePath(sequence))) +} + func sequencePath(sequence uint64) string { return fmt.Sprintf("%s/%d", KeySequencePrefix, sequence) } diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index 5862e23ffef..c27eba437cb 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -4,6 +4,8 @@ import ( "context" "errors" "fmt" + host "github.com/cosmos/ibc-go/v9/modules/core/24-host" + "golang.org/x/exp/slices" errorsmod "cosmossdk.io/errors" channeltypesv2 "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types" @@ -1037,9 +1039,10 @@ func (k *Keeper) UpdateChannelParams(goCtx context.Context, msg *channeltypes.Ms } func (k *Keeper) SendPacketV2(ctx context.Context, msg *channeltypesv2.MsgSendPacket) (*channeltypesv2.MsgSendPacketResponse, error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) sequence, err := k.PacketServerKeeper.SendPacketV2(ctx, msg.SourceId, msg.TimeoutTimestamp, msg.PacketData) if err != nil { - // ctx.Logger().Error("send packet failed", "port-id", msg.PortId, "channel-id", msg.ChannelId, "error", errorsmod.Wrap(err, "send packet failed")) + sdkCtx.Logger().Error("send packet failed", "source-id", msg.SourceId, "error", errorsmod.Wrap(err, "send packet failed")) return nil, errorsmod.Wrapf(err, "send packet failed for source id: %s", msg.SourceId) } @@ -1055,7 +1058,83 @@ func (k *Keeper) SendPacketV2(ctx context.Context, msg *channeltypesv2.MsgSendPa } func (k *Keeper) RecvPacketV2(ctx context.Context, msg *channeltypesv2.MsgRecvPacket) (*channeltypesv2.MsgRecvPacketResponse, error) { - return nil, nil + sdkCtx := sdk.UnwrapSDKContext(ctx) + + relayer, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + sdkCtx.Logger().Error("receive packet failed", "error", errorsmod.Wrap(err, "Invalid address for msg Signer")) + return nil, errorsmod.Wrap(err, "Invalid address for msg Signer") + } + + // Perform TAO verification + // + // If the packet was already received, perform a no-op + // Use a cached context to prevent accidental state changes + cacheCtx, writeFn := sdkCtx.CacheContext() + err = k.PacketServerKeeper.RecvPacketV2(cacheCtx, msg.Packet, msg.ProofCommitment, msg.ProofHeight) + + switch err { + case nil: + writeFn() + case channeltypes.ErrNoOpMsg: + // no-ops do not need event emission as they will be ignored + sdkCtx.Logger().Debug("no-op on redundant relay", "source-id", msg.Packet.SourceId) + return &channeltypesv2.MsgRecvPacketResponse{Result: channeltypes.NOOP}, nil + default: + sdkCtx.Logger().Error("receive packet failed", "source-id", msg.Packet.SourceId, "error", errorsmod.Wrap(err, "receive packet verification failed")) + return nil, errorsmod.Wrap(err, "receive packet verification failed") + } + + // Perform application logic callback + // + // Cache context so that we may discard state changes from callback if the acknowledgement is unsuccessful. + + multiAck := channeltypes.MultiAcknowledgement{ + AcknowledgementResults: []channeltypes.AcknowledgementResult{}, + } + + for _, pd := range msg.Packet.Data { + cacheCtx, writeFn = sdkCtx.CacheContext() + cb := k.PortKeeper.AppRouter.Route(pd.DestinationPort) + res := cb.OnRecvPacketV2(cacheCtx, msg.Packet, pd.Payload, relayer) + + if res.Status != channeltypes.PacketStatus_Failure { + // write application state changes for asynchronous and successful acknowledgements + writeFn() + } else { + // Modify events in cached context to reflect unsuccessful acknowledgement + sdkCtx.EventManager().EmitEvents(convertToErrorEvents(cacheCtx.EventManager().Events())) + } + + multiAck.AcknowledgementResults = append(multiAck.AcknowledgementResults, channeltypes.AcknowledgementResult{ + AppName: pd.DestinationPort, + RecvPacketResult: res, + }) + } + + // Set packet acknowledgement only if the acknowledgement is not nil. + // NOTE: IBC applications modules may call the WriteAcknowledgement asynchronously if the + // acknowledgement is nil. + + isAsync := slices.ContainsFunc(multiAck.AcknowledgementResults, func(ackResult channeltypes.AcknowledgementResult) bool { + return ackResult.RecvPacketResult.Status == channeltypes.PacketStatus_Async + }) + + if !isAsync { + if err := k.PacketServerKeeper.WriteAcknowledgementV2(ctx, msg.Packet, multiAck); err != nil { + return nil, err + } + // TODO: log line + return &channeltypesv2.MsgRecvPacketResponse{Result: channeltypes.SUCCESS}, nil + } + + k.ChannelKeeper.SetMultiAcknowledgement(ctx, host.SentinelV2PortID, msg.Packet.DestinationId, msg.Packet.Sequence, multiAck) + + // defer telemetry.ReportRecvPacket(msg.Packet) + + // ctx.Logger().Info("receive packet callback succeeded", "port-id", msg.Packet.SourcePort, "channel-id", msg.Packet.SourceChannel, "result", channeltypes.SUCCESS.String()) + + return &channeltypesv2.MsgRecvPacketResponse{Result: channeltypes.SUCCESS}, nil } func (k *Keeper) TimeoutV2(ctx context.Context, msg *channeltypesv2.MsgTimeout) (*channeltypesv2.MsgTimeoutResponse, error) { diff --git a/modules/core/packet-server/keeper/relay.go b/modules/core/packet-server/keeper/relay.go index 2d02ef061a8..19adeacb3a4 100644 --- a/modules/core/packet-server/keeper/relay.go +++ b/modules/core/packet-server/keeper/relay.go @@ -18,8 +18,6 @@ import ( "github.com/cosmos/ibc-go/v9/modules/core/packet-server/types" ) -const packetV2SourcePort = "v2port" - func (k Keeper) SendPacketV2( ctx context.Context, sourceID string, @@ -34,7 +32,7 @@ func (k Keeper) SendPacketV2( destChannel := counterparty.ClientId // retrieve the sequence send for this channel // if no packets have been sent yet, initialize the sequence to 1. - sequence, found := k.ChannelKeeper.GetNextSequenceSend(ctx, packetV2SourcePort, sourceID) + sequence, found := k.ChannelKeeper.GetNextSequenceSend(ctx, host.SentinelV2PortID, sourceID) if !found { sequence = 1 } @@ -68,9 +66,9 @@ func (k Keeper) SendPacketV2( commitment := channeltypes.CommitPacketV2(packet) // bump the sequence and set the packet commitment so it is provable by the counterparty - k.ChannelKeeper.SetNextSequenceSend(ctx, packetV2SourcePort, sourceID, sequence+1) - k.ChannelKeeper.SetPacketCommitment(ctx, packetV2SourcePort, sourceID, packet.GetSequence(), commitment) - // k.Logger(ctx).Info("packet sent", "sequence", strconv.FormatUint(packet.Sequence, 10), "src_port", packetV2SourcePort, "src_channel", packet.SourceChannel, "dst_port", packet.DestinationPort, "dst_channel", packet.DestinationChannel) + k.ChannelKeeper.SetNextSequenceSend(ctx, host.SentinelV2PortID, sourceID, sequence+1) + k.ChannelKeeper.SetPacketCommitment(ctx, host.SentinelV2PortID, sourceID, packet.GetSequence(), commitment) + // k.Logger(ctx).Info("packet sent", "sequence", strconv.FormatUint(packet.Sequence, 10), "src_port", packetV2SentinelPort, "src_channel", packet.SourceChannel, "dst_port", packet.DestinationPort, "dst_channel", packet.DestinationChannel) // channelkeeper.EmitSendPacketEventV2(ctx, packet, sentinelChannel(sourceID), timeoutHeight) return sequence, nil @@ -231,6 +229,71 @@ func (k Keeper) RecvPacket( return packetV2.Data[0].Payload.Version, nil } +func (k Keeper) RecvPacketV2( + ctx context.Context, + packet channeltypes.PacketV2, + proof []byte, + proofHeight exported.Height, +) error { + // Lookup counterparty associated with our channel and ensure + // that the packet was indeed sent by our counterparty. + counterparty, ok := k.GetCounterparty(ctx, packet.DestinationId) + if !ok { + return errorsmod.Wrap(types.ErrCounterpartyNotFound, packet.DestinationId) + } + if counterparty.ClientId != packet.SourceId { + return channeltypes.ErrInvalidChannelIdentifier + } + + sdkCtx := sdk.UnwrapSDKContext(ctx) + // check if packet timed out by comparing it with the latest height of the chain + selfTimestamp := uint64(sdkCtx.BlockTime().UnixNano()) + timeout := channeltypes.NewTimeoutWithTimestamp(packet.GetTimeoutTimestamp()) + if timeout.Elapsed(clienttypes.ZeroHeight(), selfTimestamp) { + return errorsmod.Wrap(timeout.ErrTimeoutElapsed(clienttypes.ZeroHeight(), selfTimestamp), "packet timeout elapsed") + } + + // 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. + _, found := k.ChannelKeeper.GetPacketReceipt(ctx, host.SentinelV2PortID, packet.DestinationId, packet.Sequence) + if found { + // TODO: figure out events + //channelkeeper.EmitRecvPacketEventV2(ctx, packet, sentinelChannel(packet.DestinationChannel)) + // 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 channeltypes.ErrNoOpMsg + } + + path := host.PacketCommitmentKey(host.SentinelV2PortID, packet.SourceId, packet.Sequence) + merklePath := types.BuildMerklePath(counterparty.MerklePathPrefix, path) + + commitment := channeltypes.CommitPacketV2(packet) + + if err := k.ClientKeeper.VerifyMembership( + ctx, + packet.DestinationId, + proofHeight, + 0, 0, + proof, + merklePath, + commitment, + ); err != nil { + return errorsmod.Wrapf(err, "failed packet commitment verification for client (%s)", packet.DestinationId) + } + + // Set Packet Receipt to prevent timeout from occurring on counterparty + k.ChannelKeeper.SetPacketReceipt(ctx, host.SentinelV2PortID, packet.DestinationId, packet.Sequence) + + k.Logger(ctx).Info("packet received", "sequence", strconv.FormatUint(packet.Sequence, 10), "source-id", packet.SourceId, "dst-id", packet.DestinationId) + + // TODO: figure out events + //channelkeeper.EmitRecvPacketEvent(ctx, packet, sentinelChannel(packet.DestinationChannel)) + + return nil +} + // WriteAcknowledgement implements the async acknowledgement writing logic required by a packet handler. // The packet is checked for correctness including asserting that the packet was // sent and received on clients which are counterparties for one another. @@ -288,6 +351,52 @@ func (k Keeper) WriteAcknowledgement( return nil } +// WriteAcknowledgementV2 writes the multi acknowledgement to the store. In the synchronous case, this is done +// in the core IBC handler. Async applications should call WriteAcknowledgementAsyncV2 to update +// the RecvPacketResult of the relevant application's recvResult. +func (k Keeper) WriteAcknowledgementV2( + ctx context.Context, + packet channeltypes.PacketV2, + multiAck channeltypes.MultiAcknowledgement, +) error { + // TODO: this should probably error out if any of the acks are async. + // Lookup counterparty associated with our channel and ensure + // that the packet was indeed sent by our counterparty. + counterparty, ok := k.GetCounterparty(ctx, packet.DestinationId) + if !ok { + return errorsmod.Wrap(types.ErrCounterpartyNotFound, packet.DestinationId) + } + + if counterparty.ClientId != packet.SourceId { + return channeltypes.ErrInvalidChannelIdentifier + } + + // 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.ChannelKeeper.HasPacketAcknowledgement(ctx, host.SentinelV2PortID, packet.DestinationId, packet.Sequence) { + return channeltypes.ErrAcknowledgementExists + } + + if _, found := k.ChannelKeeper.GetPacketReceipt(ctx, host.SentinelV2PortID, packet.DestinationId, packet.Sequence); !found { + return errorsmod.Wrap(channeltypes.ErrInvalidPacket, "receipt not found for packet") + } + + multiAckBz := k.cdc.MustMarshal(&multiAck) + // set the acknowledgement so that it can be verified on the other side + k.ChannelKeeper.SetPacketAcknowledgement( + ctx, host.SentinelV2PortID, packet.DestinationId, packet.GetSequence(), + channeltypes.CommitAcknowledgement(multiAckBz), + ) + + k.Logger(ctx).Info("acknowledgement written", "sequence", strconv.FormatUint(packet.Sequence, 10), "dst_id", packet.DestinationId) + + // TODO: figure out events, we MUST emit the MultiAck structure here + // channelkeeper.EmitWriteAcknowledgementEventV2(ctx, packet, sentinelChannel(packet.DestinationChannel), multiAck) + + return nil +} + // AcknowledgePacket implements the acknowledgement processing logic required by a packet handler. // The packet is checked for correctness including asserting that the packet was // sent and received on clients which are counterparties for one another. @@ -483,7 +592,7 @@ func (k Keeper) TimeoutPacketV2( } // check that the commitment has not been cleared and that it matches the packet sent by relayer - commitment := k.ChannelKeeper.GetPacketCommitment(ctx, packetV2SourcePort, packet.SourceId, packet.Sequence) + commitment := k.ChannelKeeper.GetPacketCommitment(ctx, host.SentinelV2PortID, packet.SourceId, packet.Sequence) if len(commitment) == 0 { // TODO: pending decision on event structure for V2. @@ -502,7 +611,7 @@ func (k Keeper) TimeoutPacketV2( } // verify packet receipt absence - path := host.PacketReceiptKey(packetV2SourcePort, packet.DestinationId, packet.Sequence) + path := host.PacketReceiptKey(host.SentinelV2PortID, packet.DestinationId, packet.Sequence) merklePath := types.BuildMerklePath(counterparty.MerklePathPrefix, path) if err := k.ClientKeeper.VerifyNonMembership( @@ -517,7 +626,7 @@ func (k Keeper) TimeoutPacketV2( } // delete packet commitment to prevent replay - k.ChannelKeeper.DeletePacketCommitment(ctx, packetV2SourcePort, packet.SourceId, packet.Sequence) + k.ChannelKeeper.DeletePacketCommitment(ctx, host.SentinelV2PortID, packet.SourceId, packet.Sequence) k.Logger(ctx).Info("packet timed out", "sequence", strconv.FormatUint(packet.Sequence, 10), "src_port", packet.Data[0].SourcePort, "src_channel", packet.SourceId, "dst_port", packet.Data[0].DestinationPort, "dst_channel", packet.DestinationId) From 833cbcd8518cf18e900b6942486211c2efc996f2 Mon Sep 17 00:00:00 2001 From: chatton Date: Wed, 18 Sep 2024 10:51:29 +0100 Subject: [PATCH 11/27] chore: added AcknowledgementV2 and WriteAsyncV2 functions --- go.mod | 2 +- modules/apps/callbacks/go.mod | 1 - modules/apps/callbacks/go.sum | 2 - modules/core/04-channel/v2/types/tx.pb.go | 144 +++++++++--------- modules/core/keeper/msg_server.go | 56 ++++++- modules/core/keeper/msg_server_test.go | 1 + modules/core/packet-server/keeper/relay.go | 118 +++++++++++++- .../core/packet-server/keeper/relay_test.go | 1 + .../packet-server/types/expected_keepers.go | 6 + modules/core/types/codec.go | 2 +- modules/light-clients/08-wasm/go.mod | 1 - modules/light-clients/08-wasm/go.sum | 2 - proto/ibc/core/channel/v2/tx.proto | 10 +- simapp/go.mod | 1 - simapp/go.sum | 2 - 15 files changed, 257 insertions(+), 92 deletions(-) diff --git a/go.mod b/go.mod index 08b5227b6e5..4bced585f09 100644 --- a/go.mod +++ b/go.mod @@ -26,6 +26,7 @@ require ( github.com/spf13/cast v1.7.0 github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 + golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 google.golang.org/grpc v1.66.2 google.golang.org/protobuf v1.34.2 @@ -179,7 +180,6 @@ require ( go.opentelemetry.io/otel/trace v1.24.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.27.0 // indirect - golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/oauth2 v0.21.0 // indirect golang.org/x/sync v0.8.0 // indirect diff --git a/modules/apps/callbacks/go.mod b/modules/apps/callbacks/go.mod index c86dccbdeff..5087189c209 100644 --- a/modules/apps/callbacks/go.mod +++ b/modules/apps/callbacks/go.mod @@ -68,7 +68,6 @@ require ( github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v1.2.0 // indirect - github.com/cosmos/ibc-go/modules/capability v1.0.1 // indirect github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/creachadair/atomicfile v0.3.1 // indirect diff --git a/modules/apps/callbacks/go.sum b/modules/apps/callbacks/go.sum index 892ba031de1..03146a0f627 100644 --- a/modules/apps/callbacks/go.sum +++ b/modules/apps/callbacks/go.sum @@ -362,8 +362,6 @@ github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fr github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= -github.com/cosmos/ibc-go/modules/capability v1.0.1 h1:ibwhrpJ3SftEEZRxCRkH0fQZ9svjthrX2+oXdZvzgGI= -github.com/cosmos/ibc-go/modules/capability v1.0.1/go.mod h1:rquyOV262nGJplkumH+/LeYs04P3eV8oB7ZM4Ygqk4E= github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= diff --git a/modules/core/04-channel/v2/types/tx.pb.go b/modules/core/04-channel/v2/types/tx.pb.go index b60b4f50ded..06a40916545 100644 --- a/modules/core/04-channel/v2/types/tx.pb.go +++ b/modules/core/04-channel/v2/types/tx.pb.go @@ -192,11 +192,11 @@ var xxx_messageInfo_MsgTimeoutResponse proto.InternalMessageInfo // MsgAcknowledgement receives incoming IBC acknowledgement type MsgAcknowledgement struct { - Packet types.PacketV2 `protobuf:"bytes,1,opt,name=packet,proto3" json:"packet"` - Acknowledgement []byte `protobuf:"bytes,2,opt,name=acknowledgement,proto3" json:"acknowledgement,omitempty"` - ProofAcked []byte `protobuf:"bytes,3,opt,name=proof_acked,json=proofAcked,proto3" json:"proof_acked,omitempty"` - ProofHeight types1.Height `protobuf:"bytes,4,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height"` - Signer string `protobuf:"bytes,5,opt,name=signer,proto3" json:"signer,omitempty"` + Packet types.PacketV2 `protobuf:"bytes,1,opt,name=packet,proto3" json:"packet"` + MultiAcknowledgement types.MultiAcknowledgement `protobuf:"bytes,2,opt,name=multi_acknowledgement,json=multiAcknowledgement,proto3" json:"multi_acknowledgement"` + ProofAcked []byte `protobuf:"bytes,3,opt,name=proof_acked,json=proofAcked,proto3" json:"proof_acked,omitempty"` + ProofHeight types1.Height `protobuf:"bytes,4,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height"` + Signer string `protobuf:"bytes,5,opt,name=signer,proto3" json:"signer,omitempty"` } func (m *MsgAcknowledgement) Reset() { *m = MsgAcknowledgement{} } @@ -364,54 +364,56 @@ func init() { func init() { proto.RegisterFile("ibc/core/channel/v2/tx.proto", fileDescriptor_d421c7119e969b99) } var fileDescriptor_d421c7119e969b99 = []byte{ - // 748 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x95, 0x4f, 0x6f, 0xd3, 0x3e, - 0x18, 0xc7, 0x9b, 0x2e, 0xab, 0x56, 0xb7, 0xfb, 0xe7, 0xdf, 0x0f, 0xa8, 0xc2, 0x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 0xc6, 0xd7, 0x83, 0x7c, 0xfc, - 0x72, 0xe4, 0xef, 0x01, 0xec, 0x12, 0x19, 0x35, 0xef, 0x6f, 0x49, 0x96, 0x7d, 0x05, 0xed, 0x7a, - 0xe4, 0x53, 0x13, 0x5b, 0x36, 0x66, 0x9b, 0xea, 0x46, 0xdc, 0xcb, 0x60, 0xda, 0xec, 0xcf, 0xd7, - 0xc6, 0x7e, 0x4e, 0x86, 0x05, 0xc0, 0x01, 0xd6, 0xe2, 0x89, 0x16, 0xa3, 0x9e, 0x35, 0x00, 0x93, - 0x56, 0x62, 0x65, 0xe0, 0xbb, 0xc8, 0x37, 0xdb, 0xdc, 0x57, 0x90, 0x46, 0x40, 0x19, 0x64, 0x31, - 0x6a, 0xe2, 0x7f, 0xf9, 0x49, 0xb1, 0x89, 0x3d, 0x4b, 0x9c, 0x14, 0x77, 0x41, 0x9a, 0x92, 0x56, - 0x80, 0x70, 0xcd, 0xb1, 0x58, 0xee, 0xb4, 0x31, 0xc1, 0x85, 0x75, 0x0b, 0x3e, 0x00, 0x53, 0x16, - 0xa6, 0xa1, 0xe3, 0x99, 0xa1, 0x43, 0xbc, 0xd8, 0x91, 0x64, 0x8e, 0xc9, 0x1e, 0x75, 0xdd, 0x82, - 0x8f, 0xc0, 0x6c, 0xc8, 0x77, 0x48, 0x2d, 0x7e, 0xd2, 0xd0, 0x74, 0x7d, 0xc6, 0x53, 0x36, 0x66, - 0x44, 0x60, 0xab, 0xad, 0xc3, 0xd7, 0x20, 0xc3, 0x3f, 0x55, 0xcd, 0x32, 0x43, 0x33, 0x27, 0x17, - 0xc7, 0xca, 0x19, 0xbd, 0x70, 0xc9, 0x27, 0x7e, 0x65, 0x86, 0xa6, 0x20, 0x0b, 0xfc, 0x8e, 0x72, - 0x7d, 0xb0, 0x4b, 0xec, 0xd4, 0xe8, 0xb6, 0xdc, 0x61, 0xaa, 0x80, 0x89, 0xf6, 0xdf, 0xc2, 0x3a, - 0x97, 0x8d, 0xce, 0x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x97, 0x58, + 0x61, 0x07, 0xd3, 0xe4, 0x1e, 0xfe, 0xf5, 0xf7, 0x8d, 0xc1, 0x1f, 0x86, 0x53, 0x1f, 0xd3, 0x56, + 0x86, 0x5f, 0xc7, 0xbf, 0x7d, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xc1, 0x3c, 0x1a, 0x3b, 0x54, 0x08, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -829,13 +831,16 @@ func (m *MsgAcknowledgement) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x1a } - if len(m.Acknowledgement) > 0 { - i -= len(m.Acknowledgement) - copy(dAtA[i:], m.Acknowledgement) - i = encodeVarintTx(dAtA, i, uint64(len(m.Acknowledgement))) - i-- - dAtA[i] = 0x12 + { + size, err := m.MultiAcknowledgement.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 { size, err := m.Packet.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -1056,10 +1061,8 @@ func (m *MsgAcknowledgement) Size() (n int) { _ = l l = m.Packet.Size() n += 1 + l + sovTx(uint64(l)) - l = len(m.Acknowledgement) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } + l = m.MultiAcknowledgement.Size() + n += 1 + l + sovTx(uint64(l)) l = len(m.ProofAcked) if l > 0 { n += 1 + l + sovTx(uint64(l)) @@ -1718,9 +1721,9 @@ func (m *MsgAcknowledgement) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Acknowledgement", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MultiAcknowledgement", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1730,24 +1733,23 @@ func (m *MsgAcknowledgement) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Acknowledgement = append(m.Acknowledgement[:0], dAtA[iNdEx:postIndex]...) - if m.Acknowledgement == nil { - m.Acknowledgement = []byte{} + if err := m.MultiAcknowledgement.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 3: diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index c27eba437cb..d561983b7d7 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -4,11 +4,11 @@ import ( "context" "errors" "fmt" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" + + "golang.org/x/exp/slices" errorsmod "cosmossdk.io/errors" - channeltypesv2 "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -16,7 +16,9 @@ import ( connectiontypes "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types" "github.com/cosmos/ibc-go/v9/modules/core/04-channel/keeper" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" + channeltypesv2 "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types" porttypes "github.com/cosmos/ibc-go/v9/modules/core/05-port/types" + host "github.com/cosmos/ibc-go/v9/modules/core/24-host" ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors" "github.com/cosmos/ibc-go/v9/modules/core/internal/telemetry" "github.com/cosmos/ibc-go/v9/modules/core/legacy" @@ -1177,7 +1179,55 @@ func (k *Keeper) TimeoutV2(ctx context.Context, msg *channeltypesv2.MsgTimeout) } func (k *Keeper) AcknowledgementV2(ctx context.Context, msg *channeltypesv2.MsgAcknowledgement) (*channeltypesv2.MsgAcknowledgementResponse, error) { - return nil, nil + sdkCtx := sdk.UnwrapSDKContext(ctx) + + relayer, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + sdkCtx.Logger().Error("acknowledgement failed", "error", errorsmod.Wrap(err, "Invalid address for msg Signer")) + return nil, errorsmod.Wrap(err, "Invalid address for msg Signer") + } + + // Perform TAO verification + // + // If the acknowledgement was already received, perform a no-op + // Use a cached context to prevent accidental state changes + cacheCtx, writeFn := sdkCtx.CacheContext() + err = k.PacketServerKeeper.AcknowledgePacketV2(cacheCtx, msg.Packet, msg.MultiAcknowledgement, msg.ProofAcked, msg.ProofHeight) + + switch err { + case nil: + writeFn() + case channeltypes.ErrNoOpMsg: + // no-ops do not need event emission as they will be ignored + sdkCtx.Logger().Debug("no-op on redundant relay", "source-id", msg.Packet.SourceId) + return &channeltypesv2.MsgAcknowledgementResponse{Result: channeltypes.NOOP}, nil + default: + sdkCtx.Logger().Error("acknowledgement failed", "source-id", msg.Packet.SourceId, "error", errorsmod.Wrap(err, "acknowledge packet verification failed")) + return nil, errorsmod.Wrap(err, "acknowledge packet verification failed") + } + + // construct mapping of app name to recvPacketResult + // TODO: helper fn to do this. + recvResults := make(map[string]channeltypes.RecvPacketResult) + for _, r := range msg.MultiAcknowledgement.AcknowledgementResults { + recvResults[r.AppName] = r.RecvPacketResult + } + + // Perform application logic callback + for _, pd := range msg.Packet.Data { + cb := k.PortKeeper.AppRouter.Route(pd.SourcePort) + err = cb.OnAcknowledgementPacketV2(ctx, msg.Packet, pd.Payload, recvResults[pd.DestinationPort], relayer) + if err != nil { + sdkCtx.Logger().Error("acknowledgement failed", "src_id", msg.Packet.SourceId, "src_port", pd.SourcePort, "dst_port", pd.DestinationPort, "error", errorsmod.Wrap(err, "acknowledge packet callback failed")) + return nil, errorsmod.Wrap(err, "acknowledge packet callback failed") + } + } + + // defer telemetry.ReportAcknowledgePacket(msg.PacketV2) + + sdkCtx.Logger().Info("acknowledgement succeeded", "src_id", msg.Packet.SourceId, "result", channeltypes.SUCCESS.String()) + + return &channeltypesv2.MsgAcknowledgementResponse{Result: channeltypes.SUCCESS}, nil } // convertToErrorEvents converts all events to error events by appending the diff --git a/modules/core/keeper/msg_server_test.go b/modules/core/keeper/msg_server_test.go index b13aea06cb8..15787973685 100644 --- a/modules/core/keeper/msg_server_test.go +++ b/modules/core/keeper/msg_server_test.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + upgradetypes "cosmossdk.io/x/upgrade/types" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/modules/core/packet-server/keeper/relay.go b/modules/core/packet-server/keeper/relay.go index 19adeacb3a4..2e4898224ce 100644 --- a/modules/core/packet-server/keeper/relay.go +++ b/modules/core/packet-server/keeper/relay.go @@ -5,6 +5,9 @@ import ( "context" "strconv" + + "golang.org/x/exp/slices" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" @@ -259,7 +262,7 @@ func (k Keeper) RecvPacketV2( _, found := k.ChannelKeeper.GetPacketReceipt(ctx, host.SentinelV2PortID, packet.DestinationId, packet.Sequence) if found { // TODO: figure out events - //channelkeeper.EmitRecvPacketEventV2(ctx, packet, sentinelChannel(packet.DestinationChannel)) + // channelkeeper.EmitRecvPacketEventV2(ctx, packet, sentinelChannel(packet.DestinationChannel)) // 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. @@ -289,7 +292,7 @@ func (k Keeper) RecvPacketV2( k.Logger(ctx).Info("packet received", "sequence", strconv.FormatUint(packet.Sequence, 10), "source-id", packet.SourceId, "dst-id", packet.DestinationId) // TODO: figure out events - //channelkeeper.EmitRecvPacketEvent(ctx, packet, sentinelChannel(packet.DestinationChannel)) + // channelkeeper.EmitRecvPacketEvent(ctx, packet, sentinelChannel(packet.DestinationChannel)) return nil } @@ -470,6 +473,117 @@ func (k Keeper) AcknowledgePacket( return packetV2.Data[0].Payload.Version, nil } +func (k Keeper) AcknowledgePacketV2( + ctx context.Context, + packet channeltypes.PacketV2, + multiAck channeltypes.MultiAcknowledgement, + proofAcked []byte, + proofHeight exported.Height, +) error { + // Lookup counterparty associated with our channel and ensure + // that the packet was indeed sent by our counterparty. + counterparty, ok := k.GetCounterparty(ctx, packet.SourceId) + if !ok { + return errorsmod.Wrap(types.ErrCounterpartyNotFound, packet.SourceId) + } + + if counterparty.ClientId != packet.DestinationId { + return channeltypes.ErrInvalidChannelIdentifier + } + + commitment := k.ChannelKeeper.GetPacketCommitment(ctx, host.SentinelV2PortID, packet.SourceId, packet.Sequence) + if len(commitment) == 0 { + // TODO: figure out events + // channelkeeper.EmitAcknowledgePacketEventV2(ctx, packet, sentinelChannel(packet.SourceChannel)) + + // This error indicates that the acknowledgement has already been relayed + // or there is a misconfigured relayer attempting to prove an acknowledgement + // for a packet never sent. 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 channeltypes.ErrNoOpMsg + } + + packetCommitment := channeltypes.CommitPacketV2(packet) + + // verify we sent the packet and haven't cleared it out yet + if !bytes.Equal(commitment, packetCommitment) { + return errorsmod.Wrapf(channeltypes.ErrInvalidPacket, "commitment bytes are not equal: got (%v), expected (%v)", packetCommitment, commitment) + } + + path := host.PacketAcknowledgementKey(host.SentinelV2PortID, packet.DestinationId, packet.Sequence) + merklePath := types.BuildMerklePath(counterparty.MerklePathPrefix, path) + + bz := k.cdc.MustMarshal(&multiAck) + if err := k.ClientKeeper.VerifyMembership( + ctx, + packet.SourceId, + proofHeight, + 0, 0, + proofAcked, + merklePath, + channeltypes.CommitAcknowledgement(bz), + ); err != nil { + return errorsmod.Wrapf(err, "failed packet acknowledgement verification for client (%s)", packet.SourceId) + } + + k.ChannelKeeper.DeletePacketCommitment(ctx, host.SentinelV2PortID, packet.SourceId, packet.Sequence) + + k.Logger(ctx).Info("packet acknowledged", "sequence", strconv.FormatUint(packet.GetSequence(), 10), "src_id", packet.SourceId, "dst_id", packet.DestinationId) + + // TODO: figure out events + // channelkeeper.EmitAcknowledgePacketEventV2(ctx, packet, sentinelChannel(packet.SourceChannel)) + + return nil +} + +// WriteAcknowledgementAsyncV2 updates the recv packet result for the given app name in the multi acknowledgement. +// If all acknowledgements are now either success or failed acks, it writes the final multi ack. +func (k *Keeper) WriteAcknowledgementAsyncV2( + ctx context.Context, + packet channeltypes.PacketV2, + appName string, + recvResult channeltypes.RecvPacketResult, +) error { + // we should have stored the multi ack structure in OnRecvPacket + ackResults, found := k.ChannelKeeper.GetMultiAcknowledgement(ctx, host.SentinelV2PortID, packet.DestinationId, packet.GetSequence()) + if !found { + return errorsmod.Wrapf(channeltypes.ErrInvalidAcknowledgement, "multi-acknowledgement not found for %s", appName) + } + + // find the index that corresponds to the app. + index := slices.IndexFunc(ackResults.AcknowledgementResults, func(result channeltypes.AcknowledgementResult) bool { + return result.AppName == appName + }) + + if index == -1 { + return errorsmod.Wrapf(channeltypes.ErrInvalidAcknowledgement, "acknowledgement not found for %s", appName) + } + + existingResult := ackResults.AcknowledgementResults[index] + + // ensure that the existing status is async. + if existingResult.RecvPacketResult.Status != channeltypes.PacketStatus_Async { + return errorsmod.Wrapf(channeltypes.ErrInvalidAcknowledgement, "acknowledgement for %s is not async", appName) + } + + // modify the result and set it back. + ackResults.AcknowledgementResults[index].RecvPacketResult = recvResult + k.ChannelKeeper.SetMultiAcknowledgement(ctx, host.SentinelV2PortID, packet.DestinationId, packet.GetSequence(), ackResults) + + // check if all acknowledgements are now sync. + isAsync := slices.ContainsFunc(ackResults.AcknowledgementResults, func(ackResult channeltypes.AcknowledgementResult) bool { + return ackResult.RecvPacketResult.Status == channeltypes.PacketStatus_Async + }) + + if !isAsync { + // if there are no more async acks, we can write the final multi ack. + return k.WriteAcknowledgementV2(ctx, packet, ackResults) + } + + // we have updated one app's result, but there are still async results pending acknowledgement. + return nil +} + // TimeoutPacket implements the timeout logic required by a packet handler. // The packet is checked for correctness including asserting that the packet was // sent and received on clients which are counterparties for one another. diff --git a/modules/core/packet-server/keeper/relay_test.go b/modules/core/packet-server/keeper/relay_test.go index f3fd1d8ef11..a5397cb1936 100644 --- a/modules/core/packet-server/keeper/relay_test.go +++ b/modules/core/packet-server/keeper/relay_test.go @@ -3,6 +3,7 @@ package keeper_test import ( "fmt" "testing" + testifysuite "github.com/stretchr/testify/suite" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" diff --git a/modules/core/packet-server/types/expected_keepers.go b/modules/core/packet-server/types/expected_keepers.go index 969005c4b7f..9bd93fa871b 100644 --- a/modules/core/packet-server/types/expected_keepers.go +++ b/modules/core/packet-server/types/expected_keepers.go @@ -4,6 +4,7 @@ import ( "context" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" + "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" "github.com/cosmos/ibc-go/v9/modules/core/exported" ) @@ -38,6 +39,11 @@ type ChannelKeeper interface { // SetPacketAcknowledgement writes the acknowledgement hash under the acknowledgement path // This is a public path that is standardized by the IBC specification SetPacketAcknowledgement(ctx context.Context, portID, channelID string, sequence uint64, ackHash []byte) + + // GetMultiAcknowledgement returns the multi ack from the store. + GetMultiAcknowledgement(ctx context.Context, portID, channelID string, sequence uint64) (types.MultiAcknowledgement, bool) + // SetMultiAcknowledgement writes the multi ack under the multi ack path. + SetMultiAcknowledgement(ctx context.Context, portID, channelID string, sequence uint64, recvResults types.MultiAcknowledgement) } type ClientKeeper interface { diff --git a/modules/core/types/codec.go b/modules/core/types/codec.go index cb802a9245e..6cdbb27e056 100644 --- a/modules/core/types/codec.go +++ b/modules/core/types/codec.go @@ -2,11 +2,11 @@ package types import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" - channeltypesv2 "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" connectiontypes "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" + channeltypesv2 "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types" commitmenttypes "github.com/cosmos/ibc-go/v9/modules/core/23-commitment/types" packetservertypes "github.com/cosmos/ibc-go/v9/modules/core/packet-server/types" ) diff --git a/modules/light-clients/08-wasm/go.mod b/modules/light-clients/08-wasm/go.mod index 72b8df1f04d..afa17bc3bfe 100644 --- a/modules/light-clients/08-wasm/go.mod +++ b/modules/light-clients/08-wasm/go.mod @@ -75,7 +75,6 @@ require ( github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v1.2.0 // indirect - github.com/cosmos/ibc-go/modules/capability v1.0.1 // indirect github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/creachadair/atomicfile v0.3.1 // indirect diff --git a/modules/light-clients/08-wasm/go.sum b/modules/light-clients/08-wasm/go.sum index fbd65828cd4..96e6c639c53 100644 --- a/modules/light-clients/08-wasm/go.sum +++ b/modules/light-clients/08-wasm/go.sum @@ -364,8 +364,6 @@ github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fr github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= -github.com/cosmos/ibc-go/modules/capability v1.0.1 h1:ibwhrpJ3SftEEZRxCRkH0fQZ9svjthrX2+oXdZvzgGI= -github.com/cosmos/ibc-go/modules/capability v1.0.1/go.mod h1:rquyOV262nGJplkumH+/LeYs04P3eV8oB7ZM4Ygqk4E= github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= diff --git a/proto/ibc/core/channel/v2/tx.proto b/proto/ibc/core/channel/v2/tx.proto index de6a68ac078..baed83915da 100644 --- a/proto/ibc/core/channel/v2/tx.proto +++ b/proto/ibc/core/channel/v2/tx.proto @@ -72,11 +72,11 @@ message MsgAcknowledgement { option (gogoproto.goproto_getters) = false; - ibc.core.channel.v1.PacketV2 packet = 1 [(gogoproto.nullable) = false]; - bytes acknowledgement = 2; - bytes proof_acked = 3; - ibc.core.client.v1.Height proof_height = 4 [(gogoproto.nullable) = false]; - string signer = 5; + ibc.core.channel.v1.PacketV2 packet = 1 [(gogoproto.nullable) = false]; + ibc.core.channel.v1.MultiAcknowledgement multi_acknowledgement = 2 [(gogoproto.nullable) = false]; + bytes proof_acked = 3; + ibc.core.client.v1.Height proof_height = 4 [(gogoproto.nullable) = false]; + string signer = 5; } // MsgAcknowledgementResponse defines the Msg/Acknowledgement response type. diff --git a/simapp/go.mod b/simapp/go.mod index 0e27d1f8ac0..7d7dc600163 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -68,7 +68,6 @@ require ( github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v1.2.0 // indirect - github.com/cosmos/ibc-go/modules/capability v1.0.1 // indirect github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/creachadair/atomicfile v0.3.1 // indirect diff --git a/simapp/go.sum b/simapp/go.sum index 2c87428eded..27146ecb732 100644 --- a/simapp/go.sum +++ b/simapp/go.sum @@ -362,8 +362,6 @@ github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fr github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= -github.com/cosmos/ibc-go/modules/capability v1.0.1 h1:ibwhrpJ3SftEEZRxCRkH0fQZ9svjthrX2+oXdZvzgGI= -github.com/cosmos/ibc-go/modules/capability v1.0.1/go.mod h1:rquyOV262nGJplkumH+/LeYs04P3eV8oB7ZM4Ygqk4E= github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= From cda2efab7996dd99c24e31f970e4c3f3ef4420d6 Mon Sep 17 00:00:00 2001 From: chatton Date: Wed, 18 Sep 2024 10:59:10 +0100 Subject: [PATCH 12/27] chore: moved new handlers and functions into new files --- go.mod | 2 +- modules/core/keeper/msg_server.go | 195 --------- modules/core/keeper/msg_server_v2.go | 208 ++++++++++ modules/core/packet-server/keeper/relay.go | 362 ----------------- modules/core/packet-server/keeper/relay_v2.go | 378 ++++++++++++++++++ 5 files changed, 587 insertions(+), 558 deletions(-) create mode 100644 modules/core/keeper/msg_server_v2.go create mode 100644 modules/core/packet-server/keeper/relay_v2.go diff --git a/go.mod b/go.mod index 4bced585f09..08b5227b6e5 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,6 @@ require ( github.com/spf13/cast v1.7.0 github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 - golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 google.golang.org/grpc v1.66.2 google.golang.org/protobuf v1.34.2 @@ -180,6 +179,7 @@ require ( go.opentelemetry.io/otel/trace v1.24.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.27.0 // indirect + golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/oauth2 v0.21.0 // indirect golang.org/x/sync v0.8.0 // indirect diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index d561983b7d7..a27385eb0c8 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -5,9 +5,6 @@ import ( "errors" "fmt" - - "golang.org/x/exp/slices" - errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" @@ -16,9 +13,7 @@ import ( connectiontypes "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types" "github.com/cosmos/ibc-go/v9/modules/core/04-channel/keeper" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" - channeltypesv2 "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types" porttypes "github.com/cosmos/ibc-go/v9/modules/core/05-port/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors" "github.com/cosmos/ibc-go/v9/modules/core/internal/telemetry" "github.com/cosmos/ibc-go/v9/modules/core/legacy" @@ -1040,196 +1035,6 @@ func (k *Keeper) UpdateChannelParams(goCtx context.Context, msg *channeltypes.Ms return &channeltypes.MsgUpdateParamsResponse{}, nil } -func (k *Keeper) SendPacketV2(ctx context.Context, msg *channeltypesv2.MsgSendPacket) (*channeltypesv2.MsgSendPacketResponse, error) { - sdkCtx := sdk.UnwrapSDKContext(ctx) - sequence, err := k.PacketServerKeeper.SendPacketV2(ctx, msg.SourceId, msg.TimeoutTimestamp, msg.PacketData) - if err != nil { - sdkCtx.Logger().Error("send packet failed", "source-id", msg.SourceId, "error", errorsmod.Wrap(err, "send packet failed")) - return nil, errorsmod.Wrapf(err, "send packet failed for source id: %s", msg.SourceId) - } - - for _, pd := range msg.PacketData { - cbs := k.PortKeeper.AppRouter.Route(pd.SourcePort) - err := cbs.OnSendPacketV2(ctx, msg.SourceId, sequence, msg.TimeoutTimestamp, pd.Payload, sdk.AccAddress(msg.Signer)) - if err != nil { - return nil, err - } - } - - return &channeltypesv2.MsgSendPacketResponse{Sequence: sequence}, nil -} - -func (k *Keeper) RecvPacketV2(ctx context.Context, msg *channeltypesv2.MsgRecvPacket) (*channeltypesv2.MsgRecvPacketResponse, error) { - sdkCtx := sdk.UnwrapSDKContext(ctx) - - relayer, err := sdk.AccAddressFromBech32(msg.Signer) - if err != nil { - sdkCtx.Logger().Error("receive packet failed", "error", errorsmod.Wrap(err, "Invalid address for msg Signer")) - return nil, errorsmod.Wrap(err, "Invalid address for msg Signer") - } - - // Perform TAO verification - // - // If the packet was already received, perform a no-op - // Use a cached context to prevent accidental state changes - cacheCtx, writeFn := sdkCtx.CacheContext() - err = k.PacketServerKeeper.RecvPacketV2(cacheCtx, msg.Packet, msg.ProofCommitment, msg.ProofHeight) - - switch err { - case nil: - writeFn() - case channeltypes.ErrNoOpMsg: - // no-ops do not need event emission as they will be ignored - sdkCtx.Logger().Debug("no-op on redundant relay", "source-id", msg.Packet.SourceId) - return &channeltypesv2.MsgRecvPacketResponse{Result: channeltypes.NOOP}, nil - default: - sdkCtx.Logger().Error("receive packet failed", "source-id", msg.Packet.SourceId, "error", errorsmod.Wrap(err, "receive packet verification failed")) - return nil, errorsmod.Wrap(err, "receive packet verification failed") - } - - // Perform application logic callback - // - // Cache context so that we may discard state changes from callback if the acknowledgement is unsuccessful. - - multiAck := channeltypes.MultiAcknowledgement{ - AcknowledgementResults: []channeltypes.AcknowledgementResult{}, - } - - for _, pd := range msg.Packet.Data { - cacheCtx, writeFn = sdkCtx.CacheContext() - cb := k.PortKeeper.AppRouter.Route(pd.DestinationPort) - res := cb.OnRecvPacketV2(cacheCtx, msg.Packet, pd.Payload, relayer) - - if res.Status != channeltypes.PacketStatus_Failure { - // write application state changes for asynchronous and successful acknowledgements - writeFn() - } else { - // Modify events in cached context to reflect unsuccessful acknowledgement - sdkCtx.EventManager().EmitEvents(convertToErrorEvents(cacheCtx.EventManager().Events())) - } - - multiAck.AcknowledgementResults = append(multiAck.AcknowledgementResults, channeltypes.AcknowledgementResult{ - AppName: pd.DestinationPort, - RecvPacketResult: res, - }) - } - - // Set packet acknowledgement only if the acknowledgement is not nil. - // NOTE: IBC applications modules may call the WriteAcknowledgement asynchronously if the - // acknowledgement is nil. - - isAsync := slices.ContainsFunc(multiAck.AcknowledgementResults, func(ackResult channeltypes.AcknowledgementResult) bool { - return ackResult.RecvPacketResult.Status == channeltypes.PacketStatus_Async - }) - - if !isAsync { - if err := k.PacketServerKeeper.WriteAcknowledgementV2(ctx, msg.Packet, multiAck); err != nil { - return nil, err - } - // TODO: log line - return &channeltypesv2.MsgRecvPacketResponse{Result: channeltypes.SUCCESS}, nil - } - - k.ChannelKeeper.SetMultiAcknowledgement(ctx, host.SentinelV2PortID, msg.Packet.DestinationId, msg.Packet.Sequence, multiAck) - - // defer telemetry.ReportRecvPacket(msg.Packet) - - // ctx.Logger().Info("receive packet callback succeeded", "port-id", msg.Packet.SourcePort, "channel-id", msg.Packet.SourceChannel, "result", channeltypes.SUCCESS.String()) - - return &channeltypesv2.MsgRecvPacketResponse{Result: channeltypes.SUCCESS}, nil -} - -func (k *Keeper) TimeoutV2(ctx context.Context, msg *channeltypesv2.MsgTimeout) (*channeltypesv2.MsgTimeoutResponse, error) { - sdkCtx := sdk.UnwrapSDKContext(ctx) - - relayer, err := sdk.AccAddressFromBech32(msg.Signer) - if err != nil { - sdkCtx.Logger().Error("timeout failed", "error", errorsmod.Wrap(err, "Invalid address for msg Signer")) - return nil, errorsmod.Wrap(err, "Invalid address for msg Signer") - } - - // Perform TAO verification - // - // If the timeout was already received, perform a no-op - // Use a cached context to prevent accidental state changes - cacheCtx, writeFn := sdkCtx.CacheContext() - err = k.PacketServerKeeper.TimeoutPacketV2(cacheCtx, msg.Packet, msg.ProofUnreceived, msg.ProofHeight) - - switch err { - case nil: - writeFn() - case channeltypes.ErrNoOpMsg: - // no-ops do not need event emission as they will be ignored - sdkCtx.Logger().Debug("no-op on redundant relay", "source-id", msg.Packet.SourceId) - return &channeltypesv2.MsgTimeoutResponse{Result: channeltypes.NOOP}, nil - default: - sdkCtx.Logger().Error("timeout failed", "source-id", msg.Packet.SourceId, "error", errorsmod.Wrap(err, "timeout packet verification failed")) - return nil, errorsmod.Wrap(err, "timeout packet verification failed") - } - - for _, pd := range msg.Packet.Data { - cb := k.PortKeeper.AppRouter.Route(pd.SourcePort) - err := cb.OnTimeoutPacketV2(ctx, msg.Packet, pd.Payload, relayer) - if err != nil { - return nil, err - } - } - - return &channeltypesv2.MsgTimeoutResponse{Result: channeltypes.SUCCESS}, nil -} - -func (k *Keeper) AcknowledgementV2(ctx context.Context, msg *channeltypesv2.MsgAcknowledgement) (*channeltypesv2.MsgAcknowledgementResponse, error) { - sdkCtx := sdk.UnwrapSDKContext(ctx) - - relayer, err := sdk.AccAddressFromBech32(msg.Signer) - if err != nil { - sdkCtx.Logger().Error("acknowledgement failed", "error", errorsmod.Wrap(err, "Invalid address for msg Signer")) - return nil, errorsmod.Wrap(err, "Invalid address for msg Signer") - } - - // Perform TAO verification - // - // If the acknowledgement was already received, perform a no-op - // Use a cached context to prevent accidental state changes - cacheCtx, writeFn := sdkCtx.CacheContext() - err = k.PacketServerKeeper.AcknowledgePacketV2(cacheCtx, msg.Packet, msg.MultiAcknowledgement, msg.ProofAcked, msg.ProofHeight) - - switch err { - case nil: - writeFn() - case channeltypes.ErrNoOpMsg: - // no-ops do not need event emission as they will be ignored - sdkCtx.Logger().Debug("no-op on redundant relay", "source-id", msg.Packet.SourceId) - return &channeltypesv2.MsgAcknowledgementResponse{Result: channeltypes.NOOP}, nil - default: - sdkCtx.Logger().Error("acknowledgement failed", "source-id", msg.Packet.SourceId, "error", errorsmod.Wrap(err, "acknowledge packet verification failed")) - return nil, errorsmod.Wrap(err, "acknowledge packet verification failed") - } - - // construct mapping of app name to recvPacketResult - // TODO: helper fn to do this. - recvResults := make(map[string]channeltypes.RecvPacketResult) - for _, r := range msg.MultiAcknowledgement.AcknowledgementResults { - recvResults[r.AppName] = r.RecvPacketResult - } - - // Perform application logic callback - for _, pd := range msg.Packet.Data { - cb := k.PortKeeper.AppRouter.Route(pd.SourcePort) - err = cb.OnAcknowledgementPacketV2(ctx, msg.Packet, pd.Payload, recvResults[pd.DestinationPort], relayer) - if err != nil { - sdkCtx.Logger().Error("acknowledgement failed", "src_id", msg.Packet.SourceId, "src_port", pd.SourcePort, "dst_port", pd.DestinationPort, "error", errorsmod.Wrap(err, "acknowledge packet callback failed")) - return nil, errorsmod.Wrap(err, "acknowledge packet callback failed") - } - } - - // defer telemetry.ReportAcknowledgePacket(msg.PacketV2) - - sdkCtx.Logger().Info("acknowledgement succeeded", "src_id", msg.Packet.SourceId, "result", channeltypes.SUCCESS.String()) - - return &channeltypesv2.MsgAcknowledgementResponse{Result: channeltypes.SUCCESS}, nil -} - // convertToErrorEvents converts all events to error events by appending the // error attribute prefix to each event's attribute key. func convertToErrorEvents(events sdk.Events) sdk.Events { diff --git a/modules/core/keeper/msg_server_v2.go b/modules/core/keeper/msg_server_v2.go new file mode 100644 index 00000000000..adb710241ab --- /dev/null +++ b/modules/core/keeper/msg_server_v2.go @@ -0,0 +1,208 @@ +package keeper + +import ( + "context" + "slices" + + errorsmod "cosmossdk.io/errors" + + sdk "github.com/cosmos/cosmos-sdk/types" + + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" + channeltypesv2 "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types" + host "github.com/cosmos/ibc-go/v9/modules/core/24-host" +) + +var ( + _ channeltypesv2.PacketMsgServer = (*Keeper)(nil) +) + +func (k *Keeper) SendPacketV2(ctx context.Context, msg *channeltypesv2.MsgSendPacket) (*channeltypesv2.MsgSendPacketResponse, error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + sequence, err := k.PacketServerKeeper.SendPacketV2(ctx, msg.SourceId, msg.TimeoutTimestamp, msg.PacketData) + if err != nil { + sdkCtx.Logger().Error("send packet failed", "source-id", msg.SourceId, "error", errorsmod.Wrap(err, "send packet failed")) + return nil, errorsmod.Wrapf(err, "send packet failed for source id: %s", msg.SourceId) + } + + for _, pd := range msg.PacketData { + cbs := k.PortKeeper.AppRouter.Route(pd.SourcePort) + err := cbs.OnSendPacketV2(ctx, msg.SourceId, sequence, msg.TimeoutTimestamp, pd.Payload, sdk.AccAddress(msg.Signer)) + if err != nil { + return nil, err + } + } + + return &channeltypesv2.MsgSendPacketResponse{Sequence: sequence}, nil +} + +func (k *Keeper) RecvPacketV2(ctx context.Context, msg *channeltypesv2.MsgRecvPacket) (*channeltypesv2.MsgRecvPacketResponse, error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + + relayer, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + sdkCtx.Logger().Error("receive packet failed", "error", errorsmod.Wrap(err, "Invalid address for msg Signer")) + return nil, errorsmod.Wrap(err, "Invalid address for msg Signer") + } + + // Perform TAO verification + // + // If the packet was already received, perform a no-op + // Use a cached context to prevent accidental state changes + cacheCtx, writeFn := sdkCtx.CacheContext() + err = k.PacketServerKeeper.RecvPacketV2(cacheCtx, msg.Packet, msg.ProofCommitment, msg.ProofHeight) + + switch err { + case nil: + writeFn() + case channeltypes.ErrNoOpMsg: + // no-ops do not need event emission as they will be ignored + sdkCtx.Logger().Debug("no-op on redundant relay", "source-id", msg.Packet.SourceId) + return &channeltypesv2.MsgRecvPacketResponse{Result: channeltypes.NOOP}, nil + default: + sdkCtx.Logger().Error("receive packet failed", "source-id", msg.Packet.SourceId, "error", errorsmod.Wrap(err, "receive packet verification failed")) + return nil, errorsmod.Wrap(err, "receive packet verification failed") + } + + // Perform application logic callback + // + // Cache context so that we may discard state changes from callback if the acknowledgement is unsuccessful. + + multiAck := channeltypes.MultiAcknowledgement{ + AcknowledgementResults: []channeltypes.AcknowledgementResult{}, + } + + for _, pd := range msg.Packet.Data { + cacheCtx, writeFn = sdkCtx.CacheContext() + cb := k.PortKeeper.AppRouter.Route(pd.DestinationPort) + res := cb.OnRecvPacketV2(cacheCtx, msg.Packet, pd.Payload, relayer) + + if res.Status != channeltypes.PacketStatus_Failure { + // write application state changes for asynchronous and successful acknowledgements + writeFn() + } else { + // Modify events in cached context to reflect unsuccessful acknowledgement + sdkCtx.EventManager().EmitEvents(convertToErrorEvents(cacheCtx.EventManager().Events())) + } + + multiAck.AcknowledgementResults = append(multiAck.AcknowledgementResults, channeltypes.AcknowledgementResult{ + AppName: pd.DestinationPort, + RecvPacketResult: res, + }) + } + + // Set packet acknowledgement only if the acknowledgement is not nil. + // NOTE: IBC applications modules may call the WriteAcknowledgement asynchronously if the + // acknowledgement is nil. + + isAsync := slices.ContainsFunc(multiAck.AcknowledgementResults, func(ackResult channeltypes.AcknowledgementResult) bool { + return ackResult.RecvPacketResult.Status == channeltypes.PacketStatus_Async + }) + + if !isAsync { + if err := k.PacketServerKeeper.WriteAcknowledgementV2(ctx, msg.Packet, multiAck); err != nil { + return nil, err + } + // TODO: log line + return &channeltypesv2.MsgRecvPacketResponse{Result: channeltypes.SUCCESS}, nil + } + + k.ChannelKeeper.SetMultiAcknowledgement(ctx, host.SentinelV2PortID, msg.Packet.DestinationId, msg.Packet.Sequence, multiAck) + + // defer telemetry.ReportRecvPacket(msg.Packet) + + // ctx.Logger().Info("receive packet callback succeeded", "port-id", msg.Packet.SourcePort, "channel-id", msg.Packet.SourceChannel, "result", channeltypes.SUCCESS.String()) + + return &channeltypesv2.MsgRecvPacketResponse{Result: channeltypes.SUCCESS}, nil +} + +func (k *Keeper) TimeoutV2(ctx context.Context, msg *channeltypesv2.MsgTimeout) (*channeltypesv2.MsgTimeoutResponse, error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + + relayer, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + sdkCtx.Logger().Error("timeout failed", "error", errorsmod.Wrap(err, "Invalid address for msg Signer")) + return nil, errorsmod.Wrap(err, "Invalid address for msg Signer") + } + + // Perform TAO verification + // + // If the timeout was already received, perform a no-op + // Use a cached context to prevent accidental state changes + cacheCtx, writeFn := sdkCtx.CacheContext() + err = k.PacketServerKeeper.TimeoutPacketV2(cacheCtx, msg.Packet, msg.ProofUnreceived, msg.ProofHeight) + + switch err { + case nil: + writeFn() + case channeltypes.ErrNoOpMsg: + // no-ops do not need event emission as they will be ignored + sdkCtx.Logger().Debug("no-op on redundant relay", "source-id", msg.Packet.SourceId) + return &channeltypesv2.MsgTimeoutResponse{Result: channeltypes.NOOP}, nil + default: + sdkCtx.Logger().Error("timeout failed", "source-id", msg.Packet.SourceId, "error", errorsmod.Wrap(err, "timeout packet verification failed")) + return nil, errorsmod.Wrap(err, "timeout packet verification failed") + } + + for _, pd := range msg.Packet.Data { + cb := k.PortKeeper.AppRouter.Route(pd.SourcePort) + err := cb.OnTimeoutPacketV2(ctx, msg.Packet, pd.Payload, relayer) + if err != nil { + return nil, err + } + } + + return &channeltypesv2.MsgTimeoutResponse{Result: channeltypes.SUCCESS}, nil +} + +func (k *Keeper) AcknowledgementV2(ctx context.Context, msg *channeltypesv2.MsgAcknowledgement) (*channeltypesv2.MsgAcknowledgementResponse, error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + + relayer, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + sdkCtx.Logger().Error("acknowledgement failed", "error", errorsmod.Wrap(err, "Invalid address for msg Signer")) + return nil, errorsmod.Wrap(err, "Invalid address for msg Signer") + } + + // Perform TAO verification + // + // If the acknowledgement was already received, perform a no-op + // Use a cached context to prevent accidental state changes + cacheCtx, writeFn := sdkCtx.CacheContext() + err = k.PacketServerKeeper.AcknowledgePacketV2(cacheCtx, msg.Packet, msg.MultiAcknowledgement, msg.ProofAcked, msg.ProofHeight) + + switch err { + case nil: + writeFn() + case channeltypes.ErrNoOpMsg: + // no-ops do not need event emission as they will be ignored + sdkCtx.Logger().Debug("no-op on redundant relay", "source-id", msg.Packet.SourceId) + return &channeltypesv2.MsgAcknowledgementResponse{Result: channeltypes.NOOP}, nil + default: + sdkCtx.Logger().Error("acknowledgement failed", "source-id", msg.Packet.SourceId, "error", errorsmod.Wrap(err, "acknowledge packet verification failed")) + return nil, errorsmod.Wrap(err, "acknowledge packet verification failed") + } + + // construct mapping of app name to recvPacketResult + // TODO: helper fn to do this. + recvResults := make(map[string]channeltypes.RecvPacketResult) + for _, r := range msg.MultiAcknowledgement.AcknowledgementResults { + recvResults[r.AppName] = r.RecvPacketResult + } + + // Perform application logic callback + for _, pd := range msg.Packet.Data { + cb := k.PortKeeper.AppRouter.Route(pd.SourcePort) + err = cb.OnAcknowledgementPacketV2(ctx, msg.Packet, pd.Payload, recvResults[pd.DestinationPort], relayer) + if err != nil { + sdkCtx.Logger().Error("acknowledgement failed", "src_id", msg.Packet.SourceId, "src_port", pd.SourcePort, "dst_port", pd.DestinationPort, "error", errorsmod.Wrap(err, "acknowledge packet callback failed")) + return nil, errorsmod.Wrap(err, "acknowledge packet callback failed") + } + } + + // defer telemetry.ReportAcknowledgePacket(msg.PacketV2) + + sdkCtx.Logger().Info("acknowledgement succeeded", "src_id", msg.Packet.SourceId, "result", channeltypes.SUCCESS.String()) + + return &channeltypesv2.MsgAcknowledgementResponse{Result: channeltypes.SUCCESS}, nil +} diff --git a/modules/core/packet-server/keeper/relay.go b/modules/core/packet-server/keeper/relay.go index 2e4898224ce..c9af870a1e2 100644 --- a/modules/core/packet-server/keeper/relay.go +++ b/modules/core/packet-server/keeper/relay.go @@ -5,9 +5,6 @@ import ( "context" "strconv" - - "golang.org/x/exp/slices" - errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" @@ -15,68 +12,11 @@ import ( clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" channelkeeper "github.com/cosmos/ibc-go/v9/modules/core/04-channel/keeper" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" - channeltypesv2 "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types" host "github.com/cosmos/ibc-go/v9/modules/core/24-host" "github.com/cosmos/ibc-go/v9/modules/core/exported" "github.com/cosmos/ibc-go/v9/modules/core/packet-server/types" ) -func (k Keeper) SendPacketV2( - ctx context.Context, - sourceID string, - timeoutTimestamp uint64, - data []channeltypes.PacketData, -) (uint64, error) { - // Lookup counterparty associated with our source channel to retrieve the destination channel - counterparty, ok := k.GetCounterparty(ctx, sourceID) - if !ok { - return 0, errorsmod.Wrap(types.ErrCounterpartyNotFound, sourceID) - } - destChannel := counterparty.ClientId - // retrieve the sequence send for this channel - // if no packets have been sent yet, initialize the sequence to 1. - sequence, found := k.ChannelKeeper.GetNextSequenceSend(ctx, host.SentinelV2PortID, sourceID) - if !found { - sequence = 1 - } - - // construct packet from given fields and channel state - packet := channeltypesv2.NewPacketV2(sequence, sourceID, destChannel, timeoutTimestamp, data...) - - if err := packet.ValidateBasic(); err != nil { - return 0, errorsmod.Wrapf(channeltypes.ErrInvalidPacket, "constructed packet failed basic validation: %v", err) - } - - // check that the client of counterparty chain is still active - if status := k.ClientKeeper.GetClientStatus(ctx, sourceID); status != exported.Active { - return 0, errorsmod.Wrapf(clienttypes.ErrClientNotActive, "client (%s) status is %s", sourceID, status) - } - - // retrieve latest height and timestamp of the client of counterparty chain - latestHeight := k.ClientKeeper.GetClientLatestHeight(ctx, sourceID) - if latestHeight.IsZero() { - return 0, errorsmod.Wrapf(clienttypes.ErrInvalidHeight, "cannot send packet using client (%s) with zero height", sourceID) - } - latestTimestamp, err := k.ClientKeeper.GetClientTimestampAtHeight(ctx, sourceID, latestHeight) - if err != nil { - return 0, err - } - // check if packet is timed out on the receiving chain - timeout := channeltypes.NewTimeoutWithTimestamp(timeoutTimestamp) - if timeout.Elapsed(clienttypes.ZeroHeight(), latestTimestamp) { - return 0, errorsmod.Wrap(timeout.ErrTimeoutElapsed(latestHeight, latestTimestamp), "invalid packet timeout") - } - commitment := channeltypes.CommitPacketV2(packet) - - // bump the sequence and set the packet commitment so it is provable by the counterparty - k.ChannelKeeper.SetNextSequenceSend(ctx, host.SentinelV2PortID, sourceID, sequence+1) - k.ChannelKeeper.SetPacketCommitment(ctx, host.SentinelV2PortID, sourceID, packet.GetSequence(), commitment) - // k.Logger(ctx).Info("packet sent", "sequence", strconv.FormatUint(packet.Sequence, 10), "src_port", packetV2SentinelPort, "src_channel", packet.SourceChannel, "dst_port", packet.DestinationPort, "dst_channel", packet.DestinationChannel) - - // channelkeeper.EmitSendPacketEventV2(ctx, packet, sentinelChannel(sourceID), timeoutHeight) - return sequence, nil -} - // SendPacket implements the packet sending logic required by a packet handler. // It will generate a packet and store the commitment hash if all arguments provided are valid. // The destination channel will be filled in using the counterparty information. @@ -232,71 +172,6 @@ func (k Keeper) RecvPacket( return packetV2.Data[0].Payload.Version, nil } -func (k Keeper) RecvPacketV2( - ctx context.Context, - packet channeltypes.PacketV2, - proof []byte, - proofHeight exported.Height, -) error { - // Lookup counterparty associated with our channel and ensure - // that the packet was indeed sent by our counterparty. - counterparty, ok := k.GetCounterparty(ctx, packet.DestinationId) - if !ok { - return errorsmod.Wrap(types.ErrCounterpartyNotFound, packet.DestinationId) - } - if counterparty.ClientId != packet.SourceId { - return channeltypes.ErrInvalidChannelIdentifier - } - - sdkCtx := sdk.UnwrapSDKContext(ctx) - // check if packet timed out by comparing it with the latest height of the chain - selfTimestamp := uint64(sdkCtx.BlockTime().UnixNano()) - timeout := channeltypes.NewTimeoutWithTimestamp(packet.GetTimeoutTimestamp()) - if timeout.Elapsed(clienttypes.ZeroHeight(), selfTimestamp) { - return errorsmod.Wrap(timeout.ErrTimeoutElapsed(clienttypes.ZeroHeight(), selfTimestamp), "packet timeout elapsed") - } - - // 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. - _, found := k.ChannelKeeper.GetPacketReceipt(ctx, host.SentinelV2PortID, packet.DestinationId, packet.Sequence) - if found { - // TODO: figure out events - // channelkeeper.EmitRecvPacketEventV2(ctx, packet, sentinelChannel(packet.DestinationChannel)) - // 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 channeltypes.ErrNoOpMsg - } - - path := host.PacketCommitmentKey(host.SentinelV2PortID, packet.SourceId, packet.Sequence) - merklePath := types.BuildMerklePath(counterparty.MerklePathPrefix, path) - - commitment := channeltypes.CommitPacketV2(packet) - - if err := k.ClientKeeper.VerifyMembership( - ctx, - packet.DestinationId, - proofHeight, - 0, 0, - proof, - merklePath, - commitment, - ); err != nil { - return errorsmod.Wrapf(err, "failed packet commitment verification for client (%s)", packet.DestinationId) - } - - // Set Packet Receipt to prevent timeout from occurring on counterparty - k.ChannelKeeper.SetPacketReceipt(ctx, host.SentinelV2PortID, packet.DestinationId, packet.Sequence) - - k.Logger(ctx).Info("packet received", "sequence", strconv.FormatUint(packet.Sequence, 10), "source-id", packet.SourceId, "dst-id", packet.DestinationId) - - // TODO: figure out events - // channelkeeper.EmitRecvPacketEvent(ctx, packet, sentinelChannel(packet.DestinationChannel)) - - return nil -} - // WriteAcknowledgement implements the async acknowledgement writing logic required by a packet handler. // The packet is checked for correctness including asserting that the packet was // sent and received on clients which are counterparties for one another. @@ -354,52 +229,6 @@ func (k Keeper) WriteAcknowledgement( return nil } -// WriteAcknowledgementV2 writes the multi acknowledgement to the store. In the synchronous case, this is done -// in the core IBC handler. Async applications should call WriteAcknowledgementAsyncV2 to update -// the RecvPacketResult of the relevant application's recvResult. -func (k Keeper) WriteAcknowledgementV2( - ctx context.Context, - packet channeltypes.PacketV2, - multiAck channeltypes.MultiAcknowledgement, -) error { - // TODO: this should probably error out if any of the acks are async. - // Lookup counterparty associated with our channel and ensure - // that the packet was indeed sent by our counterparty. - counterparty, ok := k.GetCounterparty(ctx, packet.DestinationId) - if !ok { - return errorsmod.Wrap(types.ErrCounterpartyNotFound, packet.DestinationId) - } - - if counterparty.ClientId != packet.SourceId { - return channeltypes.ErrInvalidChannelIdentifier - } - - // 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.ChannelKeeper.HasPacketAcknowledgement(ctx, host.SentinelV2PortID, packet.DestinationId, packet.Sequence) { - return channeltypes.ErrAcknowledgementExists - } - - if _, found := k.ChannelKeeper.GetPacketReceipt(ctx, host.SentinelV2PortID, packet.DestinationId, packet.Sequence); !found { - return errorsmod.Wrap(channeltypes.ErrInvalidPacket, "receipt not found for packet") - } - - multiAckBz := k.cdc.MustMarshal(&multiAck) - // set the acknowledgement so that it can be verified on the other side - k.ChannelKeeper.SetPacketAcknowledgement( - ctx, host.SentinelV2PortID, packet.DestinationId, packet.GetSequence(), - channeltypes.CommitAcknowledgement(multiAckBz), - ) - - k.Logger(ctx).Info("acknowledgement written", "sequence", strconv.FormatUint(packet.Sequence, 10), "dst_id", packet.DestinationId) - - // TODO: figure out events, we MUST emit the MultiAck structure here - // channelkeeper.EmitWriteAcknowledgementEventV2(ctx, packet, sentinelChannel(packet.DestinationChannel), multiAck) - - return nil -} - // AcknowledgePacket implements the acknowledgement processing logic required by a packet handler. // The packet is checked for correctness including asserting that the packet was // sent and received on clients which are counterparties for one another. @@ -473,117 +302,6 @@ func (k Keeper) AcknowledgePacket( return packetV2.Data[0].Payload.Version, nil } -func (k Keeper) AcknowledgePacketV2( - ctx context.Context, - packet channeltypes.PacketV2, - multiAck channeltypes.MultiAcknowledgement, - proofAcked []byte, - proofHeight exported.Height, -) error { - // Lookup counterparty associated with our channel and ensure - // that the packet was indeed sent by our counterparty. - counterparty, ok := k.GetCounterparty(ctx, packet.SourceId) - if !ok { - return errorsmod.Wrap(types.ErrCounterpartyNotFound, packet.SourceId) - } - - if counterparty.ClientId != packet.DestinationId { - return channeltypes.ErrInvalidChannelIdentifier - } - - commitment := k.ChannelKeeper.GetPacketCommitment(ctx, host.SentinelV2PortID, packet.SourceId, packet.Sequence) - if len(commitment) == 0 { - // TODO: figure out events - // channelkeeper.EmitAcknowledgePacketEventV2(ctx, packet, sentinelChannel(packet.SourceChannel)) - - // This error indicates that the acknowledgement has already been relayed - // or there is a misconfigured relayer attempting to prove an acknowledgement - // for a packet never sent. 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 channeltypes.ErrNoOpMsg - } - - packetCommitment := channeltypes.CommitPacketV2(packet) - - // verify we sent the packet and haven't cleared it out yet - if !bytes.Equal(commitment, packetCommitment) { - return errorsmod.Wrapf(channeltypes.ErrInvalidPacket, "commitment bytes are not equal: got (%v), expected (%v)", packetCommitment, commitment) - } - - path := host.PacketAcknowledgementKey(host.SentinelV2PortID, packet.DestinationId, packet.Sequence) - merklePath := types.BuildMerklePath(counterparty.MerklePathPrefix, path) - - bz := k.cdc.MustMarshal(&multiAck) - if err := k.ClientKeeper.VerifyMembership( - ctx, - packet.SourceId, - proofHeight, - 0, 0, - proofAcked, - merklePath, - channeltypes.CommitAcknowledgement(bz), - ); err != nil { - return errorsmod.Wrapf(err, "failed packet acknowledgement verification for client (%s)", packet.SourceId) - } - - k.ChannelKeeper.DeletePacketCommitment(ctx, host.SentinelV2PortID, packet.SourceId, packet.Sequence) - - k.Logger(ctx).Info("packet acknowledged", "sequence", strconv.FormatUint(packet.GetSequence(), 10), "src_id", packet.SourceId, "dst_id", packet.DestinationId) - - // TODO: figure out events - // channelkeeper.EmitAcknowledgePacketEventV2(ctx, packet, sentinelChannel(packet.SourceChannel)) - - return nil -} - -// WriteAcknowledgementAsyncV2 updates the recv packet result for the given app name in the multi acknowledgement. -// If all acknowledgements are now either success or failed acks, it writes the final multi ack. -func (k *Keeper) WriteAcknowledgementAsyncV2( - ctx context.Context, - packet channeltypes.PacketV2, - appName string, - recvResult channeltypes.RecvPacketResult, -) error { - // we should have stored the multi ack structure in OnRecvPacket - ackResults, found := k.ChannelKeeper.GetMultiAcknowledgement(ctx, host.SentinelV2PortID, packet.DestinationId, packet.GetSequence()) - if !found { - return errorsmod.Wrapf(channeltypes.ErrInvalidAcknowledgement, "multi-acknowledgement not found for %s", appName) - } - - // find the index that corresponds to the app. - index := slices.IndexFunc(ackResults.AcknowledgementResults, func(result channeltypes.AcknowledgementResult) bool { - return result.AppName == appName - }) - - if index == -1 { - return errorsmod.Wrapf(channeltypes.ErrInvalidAcknowledgement, "acknowledgement not found for %s", appName) - } - - existingResult := ackResults.AcknowledgementResults[index] - - // ensure that the existing status is async. - if existingResult.RecvPacketResult.Status != channeltypes.PacketStatus_Async { - return errorsmod.Wrapf(channeltypes.ErrInvalidAcknowledgement, "acknowledgement for %s is not async", appName) - } - - // modify the result and set it back. - ackResults.AcknowledgementResults[index].RecvPacketResult = recvResult - k.ChannelKeeper.SetMultiAcknowledgement(ctx, host.SentinelV2PortID, packet.DestinationId, packet.GetSequence(), ackResults) - - // check if all acknowledgements are now sync. - isAsync := slices.ContainsFunc(ackResults.AcknowledgementResults, func(ackResult channeltypes.AcknowledgementResult) bool { - return ackResult.RecvPacketResult.Status == channeltypes.PacketStatus_Async - }) - - if !isAsync { - // if there are no more async acks, we can write the final multi ack. - return k.WriteAcknowledgementV2(ctx, packet, ackResults) - } - - // we have updated one app's result, but there are still async results pending acknowledgement. - return nil -} - // TimeoutPacket implements the timeout logic required by a packet handler. // The packet is checked for correctness including asserting that the packet was // sent and received on clients which are counterparties for one another. @@ -669,83 +387,3 @@ func (k Keeper) TimeoutPacket( return packet.AppVersion, nil } - -// TimeoutPacketV2 implements the timeout logic required by a packet handler. -// The packet is checked for correctness including asserting that the packet was -// sent and received on clients which are counterparties for one another. -// If no packet commitment exists, a no-op error is returned, otherwise -// an absence proof of the packet receipt is performed to ensure that the packet -// was never delivered to the counterparty. If successful, the packet commitment -// is deleted and the packet has completed its lifecycle. -func (k Keeper) TimeoutPacketV2( - ctx context.Context, - packet channeltypes.PacketV2, - proof []byte, - proofHeight exported.Height, -) error { - // Lookup counterparty associated with our channel and ensure - // that the packet was indeed sent by our counterparty. - counterparty, ok := k.GetCounterparty(ctx, packet.SourceId) - if !ok { - return errorsmod.Wrap(types.ErrCounterpartyNotFound, packet.SourceId) - } - - if counterparty.ClientId != packet.DestinationId { - return channeltypes.ErrInvalidChannelIdentifier - } - - // check that timeout height or timeout timestamp has passed on the other end - proofTimestamp, err := k.ClientKeeper.GetClientTimestampAtHeight(ctx, packet.SourceId, proofHeight) - if err != nil { - return err - } - - timeout := channeltypes.NewTimeoutWithTimestamp(packet.GetTimeoutTimestamp()) - if !timeout.Elapsed(clienttypes.ZeroHeight(), proofTimestamp) { - return errorsmod.Wrap(timeout.ErrTimeoutNotReached(proofHeight.(clienttypes.Height), proofTimestamp), "packet timeout not reached") - } - - // check that the commitment has not been cleared and that it matches the packet sent by relayer - commitment := k.ChannelKeeper.GetPacketCommitment(ctx, host.SentinelV2PortID, packet.SourceId, packet.Sequence) - - if len(commitment) == 0 { - // TODO: pending decision on event structure for V2. - // channelkeeper.EmitTimeoutPacketEvent(ctx, packet, nil) - // This error indicates that the timeout has already been relayed - // or there is a misconfigured relayer attempting to prove a timeout - // for a packet never sent. 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 channeltypes.ErrNoOpMsg - } - - packetCommitment := channeltypes.CommitPacketV2(packet) - // verify we sent the packet and haven't cleared it out yet - if !bytes.Equal(commitment, packetCommitment) { - return errorsmod.Wrapf(channeltypes.ErrInvalidPacket, "packet commitment bytes are not equal: got (%v), expected (%v)", commitment, packetCommitment) - } - - // verify packet receipt absence - path := host.PacketReceiptKey(host.SentinelV2PortID, packet.DestinationId, packet.Sequence) - merklePath := types.BuildMerklePath(counterparty.MerklePathPrefix, path) - - if err := k.ClientKeeper.VerifyNonMembership( - ctx, - packet.SourceId, - proofHeight, - 0, 0, - proof, - merklePath, - ); err != nil { - return errorsmod.Wrapf(err, "failed packet receipt absence verification for client (%s)", packet.SourceId) - } - - // delete packet commitment to prevent replay - k.ChannelKeeper.DeletePacketCommitment(ctx, host.SentinelV2PortID, packet.SourceId, packet.Sequence) - - k.Logger(ctx).Info("packet timed out", "sequence", strconv.FormatUint(packet.Sequence, 10), "src_port", packet.Data[0].SourcePort, "src_channel", packet.SourceId, "dst_port", packet.Data[0].DestinationPort, "dst_channel", packet.DestinationId) - - // TODO: pending decision on event structure for V2. - // channelkeeper.EmitTimeoutPacketEvent(ctx, packet, nil) - - return nil -} diff --git a/modules/core/packet-server/keeper/relay_v2.go b/modules/core/packet-server/keeper/relay_v2.go new file mode 100644 index 00000000000..9482a5d0d98 --- /dev/null +++ b/modules/core/packet-server/keeper/relay_v2.go @@ -0,0 +1,378 @@ +package keeper + +import ( + "bytes" + "context" + "strconv" + + "slices" + + errorsmod "cosmossdk.io/errors" + + sdk "github.com/cosmos/cosmos-sdk/types" + + clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" + channeltypesv2 "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types" + host "github.com/cosmos/ibc-go/v9/modules/core/24-host" + "github.com/cosmos/ibc-go/v9/modules/core/exported" + "github.com/cosmos/ibc-go/v9/modules/core/packet-server/types" +) + +func (k Keeper) SendPacketV2( + ctx context.Context, + sourceID string, + timeoutTimestamp uint64, + data []channeltypes.PacketData, +) (uint64, error) { + // Lookup counterparty associated with our source channel to retrieve the destination channel + counterparty, ok := k.GetCounterparty(ctx, sourceID) + if !ok { + return 0, errorsmod.Wrap(types.ErrCounterpartyNotFound, sourceID) + } + destChannel := counterparty.ClientId + // retrieve the sequence send for this channel + // if no packets have been sent yet, initialize the sequence to 1. + sequence, found := k.ChannelKeeper.GetNextSequenceSend(ctx, host.SentinelV2PortID, sourceID) + if !found { + sequence = 1 + } + + // construct packet from given fields and channel state + packet := channeltypesv2.NewPacketV2(sequence, sourceID, destChannel, timeoutTimestamp, data...) + + if err := packet.ValidateBasic(); err != nil { + return 0, errorsmod.Wrapf(channeltypes.ErrInvalidPacket, "constructed packet failed basic validation: %v", err) + } + + // check that the client of counterparty chain is still active + if status := k.ClientKeeper.GetClientStatus(ctx, sourceID); status != exported.Active { + return 0, errorsmod.Wrapf(clienttypes.ErrClientNotActive, "client (%s) status is %s", sourceID, status) + } + + // retrieve latest height and timestamp of the client of counterparty chain + latestHeight := k.ClientKeeper.GetClientLatestHeight(ctx, sourceID) + if latestHeight.IsZero() { + return 0, errorsmod.Wrapf(clienttypes.ErrInvalidHeight, "cannot send packet using client (%s) with zero height", sourceID) + } + latestTimestamp, err := k.ClientKeeper.GetClientTimestampAtHeight(ctx, sourceID, latestHeight) + if err != nil { + return 0, err + } + // check if packet is timed out on the receiving chain + timeout := channeltypes.NewTimeoutWithTimestamp(timeoutTimestamp) + if timeout.Elapsed(clienttypes.ZeroHeight(), latestTimestamp) { + return 0, errorsmod.Wrap(timeout.ErrTimeoutElapsed(latestHeight, latestTimestamp), "invalid packet timeout") + } + commitment := channeltypes.CommitPacketV2(packet) + + // bump the sequence and set the packet commitment so it is provable by the counterparty + k.ChannelKeeper.SetNextSequenceSend(ctx, host.SentinelV2PortID, sourceID, sequence+1) + k.ChannelKeeper.SetPacketCommitment(ctx, host.SentinelV2PortID, sourceID, packet.GetSequence(), commitment) + // k.Logger(ctx).Info("packet sent", "sequence", strconv.FormatUint(packet.Sequence, 10), "src_port", packetV2SentinelPort, "src_channel", packet.SourceChannel, "dst_port", packet.DestinationPort, "dst_channel", packet.DestinationChannel) + + // channelkeeper.EmitSendPacketEventV2(ctx, packet, sentinelChannel(sourceID), timeoutHeight) + return sequence, nil +} + +func (k Keeper) RecvPacketV2( + ctx context.Context, + packet channeltypes.PacketV2, + proof []byte, + proofHeight exported.Height, +) error { + // Lookup counterparty associated with our channel and ensure + // that the packet was indeed sent by our counterparty. + counterparty, ok := k.GetCounterparty(ctx, packet.DestinationId) + if !ok { + return errorsmod.Wrap(types.ErrCounterpartyNotFound, packet.DestinationId) + } + if counterparty.ClientId != packet.SourceId { + return channeltypes.ErrInvalidChannelIdentifier + } + + sdkCtx := sdk.UnwrapSDKContext(ctx) + // check if packet timed out by comparing it with the latest height of the chain + selfTimestamp := uint64(sdkCtx.BlockTime().UnixNano()) + timeout := channeltypes.NewTimeoutWithTimestamp(packet.GetTimeoutTimestamp()) + if timeout.Elapsed(clienttypes.ZeroHeight(), selfTimestamp) { + return errorsmod.Wrap(timeout.ErrTimeoutElapsed(clienttypes.ZeroHeight(), selfTimestamp), "packet timeout elapsed") + } + + // 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. + _, found := k.ChannelKeeper.GetPacketReceipt(ctx, host.SentinelV2PortID, packet.DestinationId, packet.Sequence) + if found { + // TODO: figure out events + // channelkeeper.EmitRecvPacketEventV2(ctx, packet, sentinelChannel(packet.DestinationChannel)) + // 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 channeltypes.ErrNoOpMsg + } + + path := host.PacketCommitmentKey(host.SentinelV2PortID, packet.SourceId, packet.Sequence) + merklePath := types.BuildMerklePath(counterparty.MerklePathPrefix, path) + + commitment := channeltypes.CommitPacketV2(packet) + + if err := k.ClientKeeper.VerifyMembership( + ctx, + packet.DestinationId, + proofHeight, + 0, 0, + proof, + merklePath, + commitment, + ); err != nil { + return errorsmod.Wrapf(err, "failed packet commitment verification for client (%s)", packet.DestinationId) + } + + // Set Packet Receipt to prevent timeout from occurring on counterparty + k.ChannelKeeper.SetPacketReceipt(ctx, host.SentinelV2PortID, packet.DestinationId, packet.Sequence) + + k.Logger(ctx).Info("packet received", "sequence", strconv.FormatUint(packet.Sequence, 10), "source-id", packet.SourceId, "dst-id", packet.DestinationId) + + // TODO: figure out events + // channelkeeper.EmitRecvPacketEvent(ctx, packet, sentinelChannel(packet.DestinationChannel)) + + return nil +} + +// WriteAcknowledgementV2 writes the multi acknowledgement to the store. In the synchronous case, this is done +// in the core IBC handler. Async applications should call WriteAcknowledgementAsyncV2 to update +// the RecvPacketResult of the relevant application's recvResult. +func (k Keeper) WriteAcknowledgementV2( + ctx context.Context, + packet channeltypes.PacketV2, + multiAck channeltypes.MultiAcknowledgement, +) error { + // TODO: this should probably error out if any of the acks are async. + // Lookup counterparty associated with our channel and ensure + // that the packet was indeed sent by our counterparty. + counterparty, ok := k.GetCounterparty(ctx, packet.DestinationId) + if !ok { + return errorsmod.Wrap(types.ErrCounterpartyNotFound, packet.DestinationId) + } + + if counterparty.ClientId != packet.SourceId { + return channeltypes.ErrInvalidChannelIdentifier + } + + // 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.ChannelKeeper.HasPacketAcknowledgement(ctx, host.SentinelV2PortID, packet.DestinationId, packet.Sequence) { + return channeltypes.ErrAcknowledgementExists + } + + if _, found := k.ChannelKeeper.GetPacketReceipt(ctx, host.SentinelV2PortID, packet.DestinationId, packet.Sequence); !found { + return errorsmod.Wrap(channeltypes.ErrInvalidPacket, "receipt not found for packet") + } + + multiAckBz := k.cdc.MustMarshal(&multiAck) + // set the acknowledgement so that it can be verified on the other side + k.ChannelKeeper.SetPacketAcknowledgement( + ctx, host.SentinelV2PortID, packet.DestinationId, packet.GetSequence(), + channeltypes.CommitAcknowledgement(multiAckBz), + ) + + k.Logger(ctx).Info("acknowledgement written", "sequence", strconv.FormatUint(packet.Sequence, 10), "dst_id", packet.DestinationId) + + // TODO: figure out events, we MUST emit the MultiAck structure here + // channelkeeper.EmitWriteAcknowledgementEventV2(ctx, packet, sentinelChannel(packet.DestinationChannel), multiAck) + + return nil +} + +func (k Keeper) AcknowledgePacketV2( + ctx context.Context, + packet channeltypes.PacketV2, + multiAck channeltypes.MultiAcknowledgement, + proofAcked []byte, + proofHeight exported.Height, +) error { + // Lookup counterparty associated with our channel and ensure + // that the packet was indeed sent by our counterparty. + counterparty, ok := k.GetCounterparty(ctx, packet.SourceId) + if !ok { + return errorsmod.Wrap(types.ErrCounterpartyNotFound, packet.SourceId) + } + + if counterparty.ClientId != packet.DestinationId { + return channeltypes.ErrInvalidChannelIdentifier + } + + commitment := k.ChannelKeeper.GetPacketCommitment(ctx, host.SentinelV2PortID, packet.SourceId, packet.Sequence) + if len(commitment) == 0 { + // TODO: figure out events + // channelkeeper.EmitAcknowledgePacketEventV2(ctx, packet, sentinelChannel(packet.SourceChannel)) + + // This error indicates that the acknowledgement has already been relayed + // or there is a misconfigured relayer attempting to prove an acknowledgement + // for a packet never sent. 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 channeltypes.ErrNoOpMsg + } + + packetCommitment := channeltypes.CommitPacketV2(packet) + + // verify we sent the packet and haven't cleared it out yet + if !bytes.Equal(commitment, packetCommitment) { + return errorsmod.Wrapf(channeltypes.ErrInvalidPacket, "commitment bytes are not equal: got (%v), expected (%v)", packetCommitment, commitment) + } + + path := host.PacketAcknowledgementKey(host.SentinelV2PortID, packet.DestinationId, packet.Sequence) + merklePath := types.BuildMerklePath(counterparty.MerklePathPrefix, path) + + bz := k.cdc.MustMarshal(&multiAck) + if err := k.ClientKeeper.VerifyMembership( + ctx, + packet.SourceId, + proofHeight, + 0, 0, + proofAcked, + merklePath, + channeltypes.CommitAcknowledgement(bz), + ); err != nil { + return errorsmod.Wrapf(err, "failed packet acknowledgement verification for client (%s)", packet.SourceId) + } + + k.ChannelKeeper.DeletePacketCommitment(ctx, host.SentinelV2PortID, packet.SourceId, packet.Sequence) + + k.Logger(ctx).Info("packet acknowledged", "sequence", strconv.FormatUint(packet.GetSequence(), 10), "src_id", packet.SourceId, "dst_id", packet.DestinationId) + + // TODO: figure out events + // channelkeeper.EmitAcknowledgePacketEventV2(ctx, packet, sentinelChannel(packet.SourceChannel)) + + return nil +} + +// WriteAcknowledgementAsyncV2 updates the recv packet result for the given app name in the multi acknowledgement. +// If all acknowledgements are now either success or failed acks, it writes the final multi ack. +func (k *Keeper) WriteAcknowledgementAsyncV2( + ctx context.Context, + packet channeltypes.PacketV2, + appName string, + recvResult channeltypes.RecvPacketResult, +) error { + // we should have stored the multi ack structure in OnRecvPacket + ackResults, found := k.ChannelKeeper.GetMultiAcknowledgement(ctx, host.SentinelV2PortID, packet.DestinationId, packet.GetSequence()) + if !found { + return errorsmod.Wrapf(channeltypes.ErrInvalidAcknowledgement, "multi-acknowledgement not found for %s", appName) + } + + // find the index that corresponds to the app. + index := slices.IndexFunc(ackResults.AcknowledgementResults, func(result channeltypes.AcknowledgementResult) bool { + return result.AppName == appName + }) + + if index == -1 { + return errorsmod.Wrapf(channeltypes.ErrInvalidAcknowledgement, "acknowledgement not found for %s", appName) + } + + existingResult := ackResults.AcknowledgementResults[index] + + // ensure that the existing status is async. + if existingResult.RecvPacketResult.Status != channeltypes.PacketStatus_Async { + return errorsmod.Wrapf(channeltypes.ErrInvalidAcknowledgement, "acknowledgement for %s is not async", appName) + } + + // modify the result and set it back. + ackResults.AcknowledgementResults[index].RecvPacketResult = recvResult + k.ChannelKeeper.SetMultiAcknowledgement(ctx, host.SentinelV2PortID, packet.DestinationId, packet.GetSequence(), ackResults) + + // check if all acknowledgements are now sync. + isAsync := slices.ContainsFunc(ackResults.AcknowledgementResults, func(ackResult channeltypes.AcknowledgementResult) bool { + return ackResult.RecvPacketResult.Status == channeltypes.PacketStatus_Async + }) + + if !isAsync { + // if there are no more async acks, we can write the final multi ack. + return k.WriteAcknowledgementV2(ctx, packet, ackResults) + } + + // we have updated one app's result, but there are still async results pending acknowledgement. + return nil +} + +// TimeoutPacketV2 implements the timeout logic required by a packet handler. +// The packet is checked for correctness including asserting that the packet was +// sent and received on clients which are counterparties for one another. +// If no packet commitment exists, a no-op error is returned, otherwise +// an absence proof of the packet receipt is performed to ensure that the packet +// was never delivered to the counterparty. If successful, the packet commitment +// is deleted and the packet has completed its lifecycle. +func (k Keeper) TimeoutPacketV2( + ctx context.Context, + packet channeltypes.PacketV2, + proof []byte, + proofHeight exported.Height, +) error { + // Lookup counterparty associated with our channel and ensure + // that the packet was indeed sent by our counterparty. + counterparty, ok := k.GetCounterparty(ctx, packet.SourceId) + if !ok { + return errorsmod.Wrap(types.ErrCounterpartyNotFound, packet.SourceId) + } + + if counterparty.ClientId != packet.DestinationId { + return channeltypes.ErrInvalidChannelIdentifier + } + + // check that timeout height or timeout timestamp has passed on the other end + proofTimestamp, err := k.ClientKeeper.GetClientTimestampAtHeight(ctx, packet.SourceId, proofHeight) + if err != nil { + return err + } + + timeout := channeltypes.NewTimeoutWithTimestamp(packet.GetTimeoutTimestamp()) + if !timeout.Elapsed(clienttypes.ZeroHeight(), proofTimestamp) { + return errorsmod.Wrap(timeout.ErrTimeoutNotReached(proofHeight.(clienttypes.Height), proofTimestamp), "packet timeout not reached") + } + + // check that the commitment has not been cleared and that it matches the packet sent by relayer + commitment := k.ChannelKeeper.GetPacketCommitment(ctx, host.SentinelV2PortID, packet.SourceId, packet.Sequence) + + if len(commitment) == 0 { + // TODO: pending decision on event structure for V2. + // channelkeeper.EmitTimeoutPacketEvent(ctx, packet, nil) + // This error indicates that the timeout has already been relayed + // or there is a misconfigured relayer attempting to prove a timeout + // for a packet never sent. 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 channeltypes.ErrNoOpMsg + } + + packetCommitment := channeltypes.CommitPacketV2(packet) + // verify we sent the packet and haven't cleared it out yet + if !bytes.Equal(commitment, packetCommitment) { + return errorsmod.Wrapf(channeltypes.ErrInvalidPacket, "packet commitment bytes are not equal: got (%v), expected (%v)", commitment, packetCommitment) + } + + // verify packet receipt absence + path := host.PacketReceiptKey(host.SentinelV2PortID, packet.DestinationId, packet.Sequence) + merklePath := types.BuildMerklePath(counterparty.MerklePathPrefix, path) + + if err := k.ClientKeeper.VerifyNonMembership( + ctx, + packet.SourceId, + proofHeight, + 0, 0, + proof, + merklePath, + ); err != nil { + return errorsmod.Wrapf(err, "failed packet receipt absence verification for client (%s)", packet.SourceId) + } + + // delete packet commitment to prevent replay + k.ChannelKeeper.DeletePacketCommitment(ctx, host.SentinelV2PortID, packet.SourceId, packet.Sequence) + + k.Logger(ctx).Info("packet timed out", "sequence", strconv.FormatUint(packet.Sequence, 10), "src_port", packet.Data[0].SourcePort, "src_channel", packet.SourceId, "dst_port", packet.Data[0].DestinationPort, "dst_channel", packet.DestinationId) + + // TODO: pending decision on event structure for V2. + // channelkeeper.EmitTimeoutPacketEvent(ctx, packet, nil) + + return nil +} From e5f20a5f826c68211c252086dd0ead8bf3dfa901 Mon Sep 17 00:00:00 2001 From: bznein Date: Wed, 18 Sep 2024 11:51:04 +0100 Subject: [PATCH 13/27] msg server v2 test WIP --- modules/core/keeper/msg_server_v2_test.go | 90 +++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 modules/core/keeper/msg_server_v2_test.go diff --git a/modules/core/keeper/msg_server_v2_test.go b/modules/core/keeper/msg_server_v2_test.go new file mode 100644 index 00000000000..89bc6356f46 --- /dev/null +++ b/modules/core/keeper/msg_server_v2_test.go @@ -0,0 +1,90 @@ +package keeper_test + +import ( + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" + channeltypesv2 "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" + "github.com/cosmos/ibc-go/v9/testing/mock" +) + +// TestV2PacketFlow sets up clients and counterparties and sends a V2 packet. +// It ensures that a V2 ack structure is used and that the ack is correctly written to state. +func (suite *KeeperTestSuite) TestMsgServerV2PacketFlow() { + suite.SetupTest() + + path := ibctesting.NewPath(suite.chainA, suite.chainB) + path.SetupV2() + + timeoutTimestamp := suite.chainA.GetTimeoutTimestamp() + + msg := &channeltypesv2.MsgSendPacket{ + SourceId: path.EndpointA.ClientID, + TimeoutTimestamp: timeoutTimestamp, + PacketData: []channeltypes.PacketData{ + { + SourcePort: mock.ModuleNameV2A, + DestinationPort: mock.ModuleNameV2A, + Payload: channeltypes.Payload{ + Version: mock.Version, + Encoding: "json", + Value: ibctesting.MockPacketData, + }, + }, + }, + Signer: suite.chainA.SenderAccount.GetAddress().String(), + } + + res, err := suite.chainA.SendMsgs(msg) + suite.Require().NoError(err) + suite.Require().NotNil(res) + + packet := channeltypesv2.NewPacketV2(1, msg.SourceId, msg.DestinationId, msg.TimeoutTimestamp, msg.PacketData...) + + packetKey := host.PacketCommitmentKey("foo", packet.SourceId, packet.GetSequence()) + proof, proofHeight := path.EndpointA.QueryProof(packetKey) + suite.Require().NotNil(proof) + suite.Require().False(proofHeight.IsZero()) + + // // RecvPacket + // recvMsg := channeltypes.NewMsgRecvPacket(packet, proof, proofHeight, suite.chainB.SenderAccount.GetAddress().String()) + // recvPacketResponse, err := path.EndpointB.Chain.SendMsgs(recvMsg) + // suite.Require().NoError(path.EndpointA.UpdateClient()) + + // suite.Require().NotNil(recvPacketResponse) + // suite.Require().NoError(err) + + // // ensure that the ack that was written, is a multi ack with a single item that hat as a success status. + // ack, found := suite.chainB.App.GetIBCKeeper().ChannelKeeper.GetPacketAcknowledgement(suite.chainB.GetContext(), packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence()) + // suite.Require().True(found) + // suite.Require().NotNil(ack) + + // expectedAck := channeltypes.MultiAcknowledgement{ + // AcknowledgementResults: []channeltypes.AcknowledgementResult{ + // { + // AppName: path.EndpointB.ChannelConfig.PortID, + // RecvPacketResult: channeltypes.RecvPacketResult{ + // Status: channeltypes.PacketStatus_Success, + // Acknowledgement: ibctesting.MockAcknowledgement, + // }, + // }, + // }, + // } + + // expectedBz := suite.chainB.Codec.MustMarshal(&expectedAck) + // expectedCommittedBz := channeltypes.CommitAcknowledgement(expectedBz) + // suite.Require().Equal(expectedCommittedBz, ack) + + // packetKey = host.PacketAcknowledgementKey(packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence()) + // proof, proofHeight = path.EndpointB.QueryProof(packetKey) + + // legacyMultiAck := legacy.NewLMultiAck(suite.chainA.Codec, ibcmock.MockAcknowledgement, path.EndpointB.ChannelConfig.PortID) + + // msgAck := channeltypes.NewMsgAcknowledgement(packet, legacyMultiAck.Acknowledgement(), proof, proofHeight, suite.chainA.SenderAccount.GetAddress().String()) + + // ackPacketResponse, err := path.EndpointA.Chain.SendMsgs(msgAck) + // suite.Require().NoError(path.EndpointB.UpdateClient()) + + // suite.Require().NoError(err) + // suite.Require().NotNil(ackPacketResponse) +} From 9e767ab4d2654f626cd7d5083e144a70b149b5d4 Mon Sep 17 00:00:00 2001 From: chatton Date: Wed, 18 Sep 2024 12:17:09 +0100 Subject: [PATCH 14/27] chore: adding passing MessageServerV2 happy path test --- modules/core/04-channel/types/packet.go | 5 -- modules/core/keeper/msg_server_v2_test.go | 100 ++++++++++++++-------- 2 files changed, 66 insertions(+), 39 deletions(-) diff --git a/modules/core/04-channel/types/packet.go b/modules/core/04-channel/types/packet.go index 9954eb6b288..6e564786c92 100644 --- a/modules/core/04-channel/types/packet.go +++ b/modules/core/04-channel/types/packet.go @@ -138,11 +138,6 @@ func hashPacketData(data PacketData) []byte { } func (p PacketV2) ValidateBasic() error { - // TODO: temporarily assume a single packet data - if len(p.Data) != 1 { - return errorsmod.Wrap(ErrInvalidPacket, "packet data length must be 1") - } - for _, pd := range p.Data { if err := host.PortIdentifierValidator(pd.SourcePort); err != nil { return errorsmod.Wrap(err, "invalid source port ID") diff --git a/modules/core/keeper/msg_server_v2_test.go b/modules/core/keeper/msg_server_v2_test.go index 89bc6356f46..6dbf5b4b9bc 100644 --- a/modules/core/keeper/msg_server_v2_test.go +++ b/modules/core/keeper/msg_server_v2_test.go @@ -31,6 +31,15 @@ func (suite *KeeperTestSuite) TestMsgServerV2PacketFlow() { Value: ibctesting.MockPacketData, }, }, + { + SourcePort: mock.ModuleNameV2B, + DestinationPort: mock.ModuleNameV2B, + Payload: channeltypes.Payload{ + Version: mock.Version, + Encoding: "json", + Value: ibctesting.MockPacketData, + }, + }, }, Signer: suite.chainA.SenderAccount.GetAddress().String(), } @@ -39,52 +48,75 @@ func (suite *KeeperTestSuite) TestMsgServerV2PacketFlow() { suite.Require().NoError(err) suite.Require().NotNil(res) - packet := channeltypesv2.NewPacketV2(1, msg.SourceId, msg.DestinationId, msg.TimeoutTimestamp, msg.PacketData...) + suite.Require().NoError(path.EndpointB.UpdateClient()) + + packet := channeltypesv2.NewPacketV2(1, msg.SourceId, path.EndpointB.ClientID, msg.TimeoutTimestamp, msg.PacketData...) + + packetCommitment := suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper.GetPacketCommitment(suite.chainA.GetContext(), host.SentinelV2PortID, packet.SourceId, packet.GetSequence()) + suite.Require().NotNil(packetCommitment) - packetKey := host.PacketCommitmentKey("foo", packet.SourceId, packet.GetSequence()) + packetKey := host.PacketCommitmentKey(host.SentinelV2PortID, packet.SourceId, packet.GetSequence()) proof, proofHeight := path.EndpointA.QueryProof(packetKey) suite.Require().NotNil(proof) suite.Require().False(proofHeight.IsZero()) - // // RecvPacket - // recvMsg := channeltypes.NewMsgRecvPacket(packet, proof, proofHeight, suite.chainB.SenderAccount.GetAddress().String()) - // recvPacketResponse, err := path.EndpointB.Chain.SendMsgs(recvMsg) - // suite.Require().NoError(path.EndpointA.UpdateClient()) + // RecvPacket + recvMsg := &channeltypesv2.MsgRecvPacket{ + Packet: packet, + ProofCommitment: proof, + ProofHeight: proofHeight, + Signer: suite.chainB.SenderAccount.GetAddress().String(), + } - // suite.Require().NotNil(recvPacketResponse) - // suite.Require().NoError(err) + recvPacketResponse, err := path.EndpointB.Chain.SendMsgs(recvMsg) - // // ensure that the ack that was written, is a multi ack with a single item that hat as a success status. - // ack, found := suite.chainB.App.GetIBCKeeper().ChannelKeeper.GetPacketAcknowledgement(suite.chainB.GetContext(), packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence()) - // suite.Require().True(found) - // suite.Require().NotNil(ack) + suite.Require().NotNil(recvPacketResponse) + suite.Require().NoError(err) + suite.Require().NoError(path.EndpointA.UpdateClient()) - // expectedAck := channeltypes.MultiAcknowledgement{ - // AcknowledgementResults: []channeltypes.AcknowledgementResult{ - // { - // AppName: path.EndpointB.ChannelConfig.PortID, - // RecvPacketResult: channeltypes.RecvPacketResult{ - // Status: channeltypes.PacketStatus_Success, - // Acknowledgement: ibctesting.MockAcknowledgement, - // }, - // }, - // }, - // } + // ensure that the ack that was written, is a multi ack with a single item that hat as a success status. + ack, found := suite.chainB.App.GetIBCKeeper().ChannelKeeper.GetPacketAcknowledgement(suite.chainB.GetContext(), host.SentinelV2PortID, packet.DestinationId, packet.GetSequence()) + suite.Require().True(found) + suite.Require().NotNil(ack) - // expectedBz := suite.chainB.Codec.MustMarshal(&expectedAck) - // expectedCommittedBz := channeltypes.CommitAcknowledgement(expectedBz) - // suite.Require().Equal(expectedCommittedBz, ack) + // the expected multi ack should be a successful ack for the underlying mock applications. + expectedAck := channeltypes.MultiAcknowledgement{ + AcknowledgementResults: []channeltypes.AcknowledgementResult{ + { + AppName: mock.ModuleNameV2A, + RecvPacketResult: channeltypes.RecvPacketResult{ + Status: channeltypes.PacketStatus_Success, + Acknowledgement: ibctesting.MockAcknowledgement, + }, + }, + { + AppName: mock.ModuleNameV2B, + RecvPacketResult: channeltypes.RecvPacketResult{ + Status: channeltypes.PacketStatus_Success, + Acknowledgement: ibctesting.MockAcknowledgement, + }, + }, + }, + } - // packetKey = host.PacketAcknowledgementKey(packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence()) - // proof, proofHeight = path.EndpointB.QueryProof(packetKey) + expectedBz := suite.chainB.Codec.MustMarshal(&expectedAck) + expectedCommittedBz := channeltypes.CommitAcknowledgement(expectedBz) + suite.Require().Equal(expectedCommittedBz, ack) - // legacyMultiAck := legacy.NewLMultiAck(suite.chainA.Codec, ibcmock.MockAcknowledgement, path.EndpointB.ChannelConfig.PortID) + packetKey = host.PacketAcknowledgementKey(host.SentinelV2PortID, packet.DestinationId, packet.GetSequence()) + proof, proofHeight = path.EndpointB.QueryProof(packetKey) - // msgAck := channeltypes.NewMsgAcknowledgement(packet, legacyMultiAck.Acknowledgement(), proof, proofHeight, suite.chainA.SenderAccount.GetAddress().String()) + msgAck := &channeltypesv2.MsgAcknowledgement{ + Packet: packet, + MultiAcknowledgement: expectedAck, + ProofAcked: proof, + ProofHeight: proofHeight, + Signer: suite.chainA.SenderAccount.GetAddress().String(), + } - // ackPacketResponse, err := path.EndpointA.Chain.SendMsgs(msgAck) - // suite.Require().NoError(path.EndpointB.UpdateClient()) + ackPacketResponse, err := path.EndpointA.Chain.SendMsgs(msgAck) + suite.Require().NoError(path.EndpointB.UpdateClient()) - // suite.Require().NoError(err) - // suite.Require().NotNil(ackPacketResponse) + suite.Require().NoError(err) + suite.Require().NotNil(ackPacketResponse) } From ba29b6e5dde45d7989654f99a81594e73e8b675f Mon Sep 17 00:00:00 2001 From: chatton Date: Wed, 18 Sep 2024 12:21:45 +0100 Subject: [PATCH 15/27] chore: remove unused fields for proto --- modules/core/04-channel/v2/types/tx.pb.go | 158 ++++++++-------------- modules/core/keeper/msg_server_test.go | 62 --------- proto/ibc/core/channel/v2/tx.proto | 8 +- 3 files changed, 59 insertions(+), 169 deletions(-) diff --git a/modules/core/04-channel/v2/types/tx.pb.go b/modules/core/04-channel/v2/types/tx.pb.go index 06a40916545..8a7cccaf97a 100644 --- a/modules/core/04-channel/v2/types/tx.pb.go +++ b/modules/core/04-channel/v2/types/tx.pb.go @@ -273,10 +273,9 @@ var xxx_messageInfo_MsgAcknowledgementResponse proto.InternalMessageInfo // MsgSendPacket sends an outgoing IBC packet. type MsgSendPacket struct { SourceId string `protobuf:"bytes,1,opt,name=source_id,json=sourceId,proto3" json:"source_id,omitempty"` - DestinationId string `protobuf:"bytes,2,opt,name=destination_id,json=destinationId,proto3" json:"destination_id,omitempty"` - TimeoutTimestamp uint64 `protobuf:"varint,3,opt,name=timeout_timestamp,json=timeoutTimestamp,proto3" json:"timeout_timestamp,omitempty"` - PacketData []types.PacketData `protobuf:"bytes,4,rep,name=packet_data,json=packetData,proto3" json:"packet_data"` - Signer string `protobuf:"bytes,5,opt,name=signer,proto3" json:"signer,omitempty"` + TimeoutTimestamp uint64 `protobuf:"varint,2,opt,name=timeout_timestamp,json=timeoutTimestamp,proto3" json:"timeout_timestamp,omitempty"` + PacketData []types.PacketData `protobuf:"bytes,3,rep,name=packet_data,json=packetData,proto3" json:"packet_data"` + Signer string `protobuf:"bytes,4,opt,name=signer,proto3" json:"signer,omitempty"` } func (m *MsgSendPacket) Reset() { *m = MsgSendPacket{} } @@ -364,56 +363,54 @@ func init() { func init() { proto.RegisterFile("ibc/core/channel/v2/tx.proto", fileDescriptor_d421c7119e969b99) } var fileDescriptor_d421c7119e969b99 = []byte{ - // 770 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4f, 0x4f, 0xe3, 0x46, - 0x14, 0x8f, 0x83, 0x89, 0xc8, 0x24, 0xfc, 0x9b, 0x42, 0x1b, 0xb9, 0x34, 0x49, 0x23, 0x55, 0x04, - 0x5a, 0xec, 0xc6, 0xed, 0x05, 0x5a, 0xa9, 0x02, 0xaa, 0xaa, 0x1c, 0x22, 0x55, 0x06, 0x72, 0xe8, - 0x4a, 0x44, 0xce, 0x78, 0xd6, 0xb1, 0x88, 0x3d, 0x5e, 0xcf, 0xd8, 0x0b, 0xb7, 0xd5, 0x9e, 0xf6, - 0xc8, 0x71, 0x8f, 0xfb, 0x11, 0xf8, 0x14, 0x2b, 0x8e, 0x1c, 0xf7, 0xb4, 0x5a, 0x81, 0x56, 0x9c, - 0xf7, 0x1b, 0xac, 0x3c, 0x9e, 0xfc, 0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e, 0x6f, 0x3f, 0x47, 0x20, 0xdf, 0x9f, 0x8b, 0xf7, 0xc5, - 0xef, 0xb3, 0xee, 0x8e, 0x3f, 0x66, 0xc2, 0x1e, 0x82, 0xac, 0x18, 0x02, 0x0d, 0x1d, 0x96, 0xee, - 0x72, 0x14, 0x14, 0x65, 0xf5, 0x01, 0x42, 0x2f, 0xac, 0x0b, 0x16, 0x6f, 0x9d, 0xda, 0x86, 0x0e, - 0xef, 0xf4, 0xbe, 0x45, 0x55, 0xb4, 0x47, 0x12, 0xbb, 0xe9, 0x94, 0xe9, 0x57, 0x37, 0xe7, 0xeb, - 0xd2, 0x4e, 0xe3, 0xe2, 0xaa, 0x28, 0x5d, 0x5e, 0x15, 0xa5, 0x4f, 0x57, 0x45, 0xe9, 0xec, 0xba, - 0x98, 0xba, 0xbc, 0x2e, 0xa6, 0x3e, 0x5c, 0x17, 0x53, 0xff, 0xff, 0x69, 0x3b, 0xac, 0x1d, 0xb6, - 0x54, 0x44, 0x5c, 0x4d, 0xdc, 0xe7, 0x4e, 0x0b, 0x6d, 0xd8, 0x44, 0x8b, 0x36, 0x35, 0x97, 0x58, - 0x61, 0x07, 0xd3, 0xe4, 0x1e, 0xfe, 0xf5, 0xf7, 0x8d, 0xc1, 0x1f, 0x86, 0x53, 0x1f, 0xd3, 0x56, - 0x86, 0x5f, 0xc7, 0xbf, 0x7d, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xc1, 0x3c, 0x1a, 0x3b, 0x54, 0x08, - 0x00, 0x00, + // 745 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4f, 0x4f, 0x13, 0x41, + 0x14, 0xef, 0xd2, 0xd2, 0xd0, 0x69, 0x15, 0x18, 0x41, 0x9b, 0x15, 0xdb, 0xda, 0x0b, 0x05, 0x65, + 0xd7, 0xae, 0x5e, 0x40, 0x13, 0x03, 0x18, 0xa3, 0x87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eb, 0xfd, 0x73, 0x8c, 0x45, 0x5f, 0x45, 0x3b, 0x2e, 0xf9, + 0xdc, 0xc6, 0xa6, 0x85, 0xd9, 0xa1, 0xba, 0x91, 0xee, 0x26, 0x98, 0x75, 0xc2, 0x76, 0x60, 0x37, + 0x8c, 0xfe, 0xa8, 0x4c, 0xfc, 0xac, 0xb6, 0x30, 0x34, 0x56, 0x2d, 0xf6, 0x38, 0xb7, 0x0d, 0x11, + 0x77, 0xc6, 0x19, 0x62, 0x83, 0x45, 0xc0, 0xc5, 0x8f, 0xb3, 0x60, 0x93, 0x75, 0x2c, 0xa7, 0x03, + 0x06, 0xad, 0xc6, 0xc8, 0x40, 0x4f, 0x53, 0x37, 0xbb, 0x18, 0x57, 0x74, 0x09, 0x01, 0x79, 0x50, + 0xc7, 0x51, 0x77, 0xeb, 0x17, 0x9f, 0x32, 0x1b, 0xd8, 0x35, 0xc5, 0x94, 0xb9, 0x0f, 0x32, 0x94, + 0x84, 0x3e, 0xc2, 0x0d, 0xdb, 0x64, 0xb1, 0x33, 0xfa, 0x04, 0x07, 0xde, 0x9a, 0xf0, 0x11, 0x98, + 0x0e, 0xf8, 0xb1, 0x69, 0xc4, 0xbf, 0x34, 0x30, 0x1c, 0x8f, 0x35, 0x21, 0xa5, 0x4f, 0x09, 0xc3, + 0x66, 0x07, 0x87, 0xaf, 0x41, 0x96, 0xf7, 0xaf, 0x61, 0x1a, 0x81, 0x91, 0x4f, 0x96, 0x92, 0x95, + 0xac, 0x56, 0xbc, 0xa4, 0xef, 0xaf, 0x8c, 0xc0, 0x10, 0x92, 0x01, 0xaf, 0x8b, 0x5c, 0x7f, 0x94, + 0x2c, 0xb3, 0x51, 0xd2, 0xab, 0xa5, 0x2b, 0x96, 0x0c, 0x26, 0x3a, 0x57, 0x88, 0x95, 0x94, 0xd2, + 0xbb, 0xdf, 0x5c, 0x07, 0xed, 0x7b, 0x12, 0x64, 0xb8, 0x53, 0x8d, 0x5a, 0x70, 0x1b, 0xe4, 0x7a, + 0x51, 0xea, 0x1a, 0x2c, 0x0f, 0xd9, 0xb4, 0xa6, 0xf4, 0xe5, 0x92, 0x17, 0xaf, 0xe6, 0x74, 0xf7, + 0xb3, 0x0d, 0x72, 0xbd, 0x81, 0x77, 0x59, 0xfc, 0x1e, 0xeb, 0xe2, 0xf8, 0x43, 0x46, 0xe7, 0x16, + 0xc8, 0x88, 0xdb, 0x5d, 0xd7, 0x60, 0xf1, 0x22, 0x47, 0x41, 0x91, 0xe7, 0xaf, 0x20, 0x74, 0xc3, + 0x3a, 0x60, 0xfa, 0xdc, 0x71, 0xac, 0x6b, 0xf0, 0x42, 0xef, 0x73, 0x54, 0x59, 0xbd, 0x26, 0xb1, + 0x93, 0x4e, 0x1e, 0xff, 0x72, 0x7a, 0xb0, 0x28, 0xad, 0xd5, 0x0f, 0x8f, 0x0b, 0xd2, 0xd1, 0x71, + 0x41, 0xfa, 0x7b, 0x5c, 0x90, 0xf6, 0x4f, 0x0a, 0x89, 0xa3, 0x93, 0x42, 0xe2, 0xf7, 0x49, 0x21, + 0xf1, 0xfe, 0x85, 0x65, 0x07, 0xad, 0xb0, 0xa9, 0x20, 0xe2, 0xa8, 0xe2, 0xa1, 0xb6, 0x9b, 0x68, + 0xc9, 0x22, 0x6a, 0xb4, 0xac, 0x3a, 0xc4, 0x0c, 0xdb, 0x98, 0xf2, 0x07, 0xf6, 0xc9, 0xb3, 0xa5, + 0xb3, 0xff, 0x04, 0xf6, 0x3c, 0x4c, 0x9b, 0x69, 0xf6, 0xce, 0x3e, 0xfd, 0x1f, 0x00, 0x00, 0xff, + 0xff, 0xef, 0xbc, 0x85, 0xfd, 0x2d, 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -907,7 +904,7 @@ func (m *MsgSendPacket) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.Signer) i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) i-- - dAtA[i] = 0x2a + dAtA[i] = 0x22 } if len(m.PacketData) > 0 { for iNdEx := len(m.PacketData) - 1; iNdEx >= 0; iNdEx-- { @@ -920,20 +917,13 @@ func (m *MsgSendPacket) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTx(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x22 + dAtA[i] = 0x1a } } if m.TimeoutTimestamp != 0 { i = encodeVarintTx(dAtA, i, uint64(m.TimeoutTimestamp)) i-- - dAtA[i] = 0x18 - } - if len(m.DestinationId) > 0 { - i -= len(m.DestinationId) - copy(dAtA[i:], m.DestinationId) - i = encodeVarintTx(dAtA, i, uint64(len(m.DestinationId))) - i-- - dAtA[i] = 0x12 + dAtA[i] = 0x10 } if len(m.SourceId) > 0 { i -= len(m.SourceId) @@ -1098,10 +1088,6 @@ func (m *MsgSendPacket) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.DestinationId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } if m.TimeoutTimestamp != 0 { n += 1 + sovTx(uint64(m.TimeoutTimestamp)) } @@ -2003,38 +1989,6 @@ func (m *MsgSendPacket) Unmarshal(dAtA []byte) error { m.SourceId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DestinationId", 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.DestinationId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field TimeoutTimestamp", wireType) } @@ -2053,7 +2007,7 @@ func (m *MsgSendPacket) Unmarshal(dAtA []byte) error { break } } - case 4: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field PacketData", wireType) } @@ -2087,7 +2041,7 @@ func (m *MsgSendPacket) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 5: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) } diff --git a/modules/core/keeper/msg_server_test.go b/modules/core/keeper/msg_server_test.go index 15787973685..b8caf268553 100644 --- a/modules/core/keeper/msg_server_test.go +++ b/modules/core/keeper/msg_server_test.go @@ -3250,68 +3250,6 @@ func (suite *KeeperTestSuite) TestPruneAcknowledgements() { } } -// TestV2PacketFlow sets up clients and counterparties and sends a V2 packet. -// It ensures that a V2 ack structure is used and that the ack is correctly written to state. -func (suite *KeeperTestSuite) TestV2PacketFlow() { - suite.SetupTest() - - path := ibctesting.NewPath(suite.chainA, suite.chainB) - path.SetupV2() - - timeoutTimestamp := suite.chainA.GetTimeoutTimestamp() - sequence, err := path.EndpointA.SendPacketV2(clienttypes.ZeroHeight(), timeoutTimestamp, ibcmock.Version, ibctesting.MockPacketData) - suite.Require().NoError(err) - - packet := channeltypes.NewPacketWithVersion(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ClientID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ClientID, clienttypes.ZeroHeight(), timeoutTimestamp, ibcmock.Version) - - packetKey := host.PacketCommitmentKey(packet.GetSourcePort(), packet.GetSourceChannel(), packet.GetSequence()) - proof, proofHeight := path.EndpointA.QueryProof(packetKey) - suite.Require().NotNil(proof) - suite.Require().False(proofHeight.IsZero()) - - // RecvPacket - recvMsg := channeltypes.NewMsgRecvPacket(packet, proof, proofHeight, suite.chainB.SenderAccount.GetAddress().String()) - recvPacketResponse, err := path.EndpointB.Chain.SendMsgs(recvMsg) - suite.Require().NoError(path.EndpointA.UpdateClient()) - - suite.Require().NotNil(recvPacketResponse) - suite.Require().NoError(err) - - // ensure that the ack that was written, is a multi ack with a single item that hat as a success status. - ack, found := suite.chainB.App.GetIBCKeeper().ChannelKeeper.GetPacketAcknowledgement(suite.chainB.GetContext(), packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence()) - suite.Require().True(found) - suite.Require().NotNil(ack) - - expectedAck := channeltypes.MultiAcknowledgement{ - AcknowledgementResults: []channeltypes.AcknowledgementResult{ - { - AppName: path.EndpointB.ChannelConfig.PortID, - RecvPacketResult: channeltypes.RecvPacketResult{ - Status: channeltypes.PacketStatus_Success, - Acknowledgement: ibctesting.MockAcknowledgement, - }, - }, - }, - } - - expectedBz := suite.chainB.Codec.MustMarshal(&expectedAck) - expectedCommittedBz := channeltypes.CommitAcknowledgement(expectedBz) - suite.Require().Equal(expectedCommittedBz, ack) - - packetKey = host.PacketAcknowledgementKey(packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence()) - proof, proofHeight = path.EndpointB.QueryProof(packetKey) - - legacyMultiAck := legacy.NewLMultiAck(suite.chainA.Codec, ibcmock.MockAcknowledgement, path.EndpointB.ChannelConfig.PortID) - - msgAck := channeltypes.NewMsgAcknowledgement(packet, legacyMultiAck.Acknowledgement(), proof, proofHeight, suite.chainA.SenderAccount.GetAddress().String()) - - ackPacketResponse, err := path.EndpointA.Chain.SendMsgs(msgAck) - suite.Require().NoError(path.EndpointB.UpdateClient()) - - suite.Require().NoError(err) - suite.Require().NotNil(ackPacketResponse) -} - // TestV1PacketFlow sets up a channel and sends a V1 packet. // It ensures that a V1 ack structure is used and that the ack is correctly written to state. func (suite *KeeperTestSuite) TestV1PacketFlow() { diff --git a/proto/ibc/core/channel/v2/tx.proto b/proto/ibc/core/channel/v2/tx.proto index baed83915da..5d478a8a59a 100644 --- a/proto/ibc/core/channel/v2/tx.proto +++ b/proto/ibc/core/channel/v2/tx.proto @@ -91,11 +91,9 @@ message MsgSendPacket { option (cosmos.msg.v1.signer) = "signer"; option (gogoproto.goproto_getters) = false; string source_id = 1; - string destination_id = 2; - uint64 timeout_timestamp = 3; - repeated ibc.core.channel.v1.PacketData packet_data = 4 [(gogoproto.nullable) = false]; - string signer = 5; - // string dest_port = 6; + uint64 timeout_timestamp = 2; + repeated ibc.core.channel.v1.PacketData packet_data = 3 [(gogoproto.nullable) = false]; + string signer = 4; } // MsgSendPacketResponse defines the Msg/SendPacket response type. From 974e0979e5c8f348fd4f6c83cef356e0ed5ee1fe Mon Sep 17 00:00:00 2001 From: bznein Date: Wed, 18 Sep 2024 14:56:29 +0100 Subject: [PATCH 16/27] added V2 transfer module --- modules/apps/transfer/ibc_module_v2.go | 171 +++++++++++++ modules/apps/transfer/keeper/export_test.go | 5 - modules/apps/transfer/keeper/keeper.go | 46 +++- modules/apps/transfer/keeper/msg_server.go | 2 +- modules/apps/transfer/keeper/relay.go | 48 +++- modules/apps/transfer/keeper/relay_v2.go | 253 ++++++++++++++++++++ testing/simapp/app.go | 4 +- 7 files changed, 515 insertions(+), 14 deletions(-) create mode 100644 modules/apps/transfer/ibc_module_v2.go create mode 100644 modules/apps/transfer/keeper/relay_v2.go diff --git a/modules/apps/transfer/ibc_module_v2.go b/modules/apps/transfer/ibc_module_v2.go new file mode 100644 index 00000000000..d8bd48a7cac --- /dev/null +++ b/modules/apps/transfer/ibc_module_v2.go @@ -0,0 +1,171 @@ +package transfer + +import ( + "context" + "fmt" + + errorsmod "cosmossdk.io/errors" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/cosmos/ibc-go/v9/modules/apps/transfer/internal/events" + "github.com/cosmos/ibc-go/v9/modules/apps/transfer/keeper" + "github.com/cosmos/ibc-go/v9/modules/apps/transfer/types" + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" + porttypes "github.com/cosmos/ibc-go/v9/modules/core/05-port/types" + ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors" +) + +var _ porttypes.IBCModuleV2 = (*IBCModuleV2)(nil) + +// IBCModuleV2 implements the ICS26 interface for transfer given the transfer keeper. +type IBCModuleV2 struct { + keeper keeper.Keeper +} + +// NewIBCModule creates a new IBCModule given the keeper +func NewIBCModuleV2(k keeper.Keeper) IBCModuleV2 { + return IBCModuleV2{ + keeper: k, + } +} + +// OnSendPacketV2 implements the IBCModuleV2 interface. +func (im *IBCModuleV2) OnSendPacketV2( + ctx context.Context, + sourceID string, + sequence uint64, + timeoutTimestamp uint64, + payload channeltypes.Payload, + signer sdk.AccAddress, +) error { + if !im.keeper.GetParams(ctx).SendEnabled { + return types.ErrSendDisabled + } + if im.keeper.IsBlockedAddr(signer) { + return errorsmod.Wrapf(ibcerrors.ErrUnauthorized, "%s is not allowed to send funds", signer) + } + + data, err := types.UnmarshalPacketData(payload.Value, payload.Version) + if err != nil { + return err + } + + // If the ics20version is V1, we can't have multiple tokens nor forwarding info. + // However, we do not need to check it here, as a packet containing that data would + // fail the unmarshaling above, where if ics20version == types.V1 we first unmarshal + // into a V1 packet and then convert. + + if data.Sender != signer.String() { + return errorsmod.Wrapf(ibcerrors.ErrInvalidAddress, "invalid signer address: expected %s, got %s", data.Sender, signer) + } + + return im.keeper.OnSendPacket(ctx, sourceID, data, signer) + + // TODO: port +} + +// OnRecvPacketV2 implements the IBCModuleV2 interface. A successful acknowledgement +// is returned if the packet data is successfully decoded and the receive application +// logic returns without error. +// A nil acknowledgement may be returned when using the packet forwarding feature. This signals to core IBC that the acknowledgement will be written asynchronously. +func (im IBCModuleV2) OnRecvPacketV2( + ctx context.Context, + packet channeltypes.PacketV2, + payload channeltypes.Payload, + relayer sdk.AccAddress, +) channeltypes.RecvPacketResult { + var ( + ackErr error + data types.FungibleTokenPacketDataV2 + ) + + ack := channeltypes.NewResultAcknowledgement([]byte{byte(1)}) + + // we are explicitly wrapping this emit event call in an anonymous function so that + // the packet data is evaluated after it has been assigned a value. + // defer func() { + // events.EmitOnRecvPacketEvent(ctx, data, ack, ackErr) + // }() + + data, ackErr = types.UnmarshalPacketData(payload.Value, payload.Version) + if ackErr != nil { + ack = channeltypes.NewErrorAcknowledgement(ackErr) + im.keeper.Logger(ctx).Error(fmt.Sprintf("%s sequence %d", ackErr.Error(), packet.Sequence)) + return channeltypes.RecvPacketResult{ + Status: channeltypes.PacketStatus_Failure, + Acknowledgement: ack.Acknowledgement(), + } + } + + if ackErr = im.keeper.OnRecvPacketV2(ctx, packet, payload, data); ackErr != nil { + ack = channeltypes.NewErrorAcknowledgement(ackErr) + im.keeper.Logger(ctx).Error(fmt.Sprintf("%s sequence %d", ackErr.Error(), packet.Sequence)) + return channeltypes.RecvPacketResult{ + Status: channeltypes.PacketStatus_Failure, + Acknowledgement: ack.Acknowledgement(), + } + } + + im.keeper.Logger(ctx).Info("successfully handled ICS-20 packet", "sequence", packet.Sequence) + + if data.HasForwarding() { + // NOTE: acknowledgement will be written asynchronously + return channeltypes.RecvPacketResult{ + Status: channeltypes.PacketStatus_Async, + } + } + + // NOTE: acknowledgement will be written synchronously during IBC handler execution. + return channeltypes.RecvPacketResult{ + Status: channeltypes.PacketStatus_Success, + Acknowledgement: ack.Acknowledgement(), + } +} + +func (im IBCModuleV2) OnAcknowledgementPacketV2( + ctx context.Context, + packet channeltypes.PacketV2, + payload channeltypes.Payload, + recvPacketResult channeltypes.RecvPacketResult, + relayer sdk.AccAddress, +) error { + // TODO: use the recvPacketResult directly, don't need to unmarshal the acknowledgement + var ack channeltypes.Acknowledgement + if err := types.ModuleCdc.UnmarshalJSON(recvPacketResult.Acknowledgement, &ack); err != nil { + return errorsmod.Wrapf(ibcerrors.ErrUnknownRequest, "cannot unmarshal ICS-20 transfer packet acknowledgement: %v", err) + } + + data, err := types.UnmarshalPacketData(payload.Value, payload.Version) + if err != nil { + return err + } + + if err := im.keeper.OnAcknowledgementPacketV2(ctx, packet, data, ack); err != nil { + return err + } + + events.EmitOnAcknowledgementPacketEvent(ctx, data, ack) + + return nil +} + +func (im IBCModuleV2) OnTimeoutPacketV2( + ctx context.Context, + packet channeltypes.PacketV2, + payload channeltypes.Payload, + relayer sdk.AccAddress, +) error { + data, err := types.UnmarshalPacketData(payload.Value, payload.Version) + if err != nil { + return err + } + + // refund tokens + if err := im.keeper.OnTimeoutPacketV2(ctx, packet, data); err != nil { + return err + } + + events.EmitOnTimeoutEvent(ctx, data) + return nil +} diff --git a/modules/apps/transfer/keeper/export_test.go b/modules/apps/transfer/keeper/export_test.go index 5efd6a85910..dedfd560b9b 100644 --- a/modules/apps/transfer/keeper/export_test.go +++ b/modules/apps/transfer/keeper/export_test.go @@ -54,11 +54,6 @@ func (k Keeper) GetAllForwardedPackets(ctx sdk.Context) []types.ForwardedPacket return k.getAllForwardedPackets(ctx) } -// IsBlockedAddr is a wrapper around isBlockedAddr for testing purposes -func (k Keeper) IsBlockedAddr(addr sdk.AccAddress) bool { - return k.isBlockedAddr(addr) -} - // CreatePacketDataBytesFromVersion is a wrapper around createPacketDataBytesFromVersion for testing purposes func CreatePacketDataBytesFromVersion(appVersion, sender, receiver, memo string, tokens types.Tokens, hops []types.Hop) ([]byte, error) { return createPacketDataBytesFromVersion(appVersion, sender, receiver, memo, tokens, hops) diff --git a/modules/apps/transfer/keeper/keeper.go b/modules/apps/transfer/keeper/keeper.go index 1ebb14ace71..604c9869d80 100644 --- a/modules/apps/transfer/keeper/keeper.go +++ b/modules/apps/transfer/keeper/keeper.go @@ -24,6 +24,7 @@ import ( porttypes "github.com/cosmos/ibc-go/v9/modules/core/05-port/types" host "github.com/cosmos/ibc-go/v9/modules/core/24-host" "github.com/cosmos/ibc-go/v9/modules/core/exported" + packetserverkeeper "github.com/cosmos/ibc-go/v9/modules/core/packet-server/keeper" ) // Keeper defines the IBC fungible transfer keeper @@ -32,16 +33,51 @@ type Keeper struct { cdc codec.BinaryCodec legacySubspace types.ParamSubspace - ics4Wrapper porttypes.ICS4Wrapper - channelKeeper types.ChannelKeeper - authKeeper types.AccountKeeper - bankKeeper types.BankKeeper + ics4Wrapper porttypes.ICS4Wrapper + channelKeeper types.ChannelKeeper + authKeeper types.AccountKeeper + bankKeeper types.BankKeeper + packetServerKeeper packetserverkeeper.Keeper // the address capable of executing a MsgUpdateParams message. Typically, this // should be the x/gov module account. authority string } +// NewKeeperWithPacketServer creates a new IBC transfer Keeper instance +func NewKeeperWithPacketServer( + cdc codec.BinaryCodec, + storeService corestore.KVStoreService, + legacySubspace types.ParamSubspace, + ics4Wrapper porttypes.ICS4Wrapper, + channelKeeper types.ChannelKeeper, + authKeeper types.AccountKeeper, + bankKeeper types.BankKeeper, + packetserverKeeper packetserverkeeper.Keeper, + authority string, +) Keeper { + // ensure ibc transfer module account is set + if addr := authKeeper.GetModuleAddress(types.ModuleName); addr == nil { + panic(errors.New("the IBC transfer module account has not been set")) + } + + if strings.TrimSpace(authority) == "" { + panic(errors.New("authority must be non-empty")) + } + + return Keeper{ + cdc: cdc, + storeService: storeService, + legacySubspace: legacySubspace, + ics4Wrapper: ics4Wrapper, + channelKeeper: channelKeeper, + authKeeper: authKeeper, + bankKeeper: bankKeeper, + authority: authority, + packetServerKeeper: packetserverKeeper, + } +} + // NewKeeper creates a new IBC transfer Keeper instance func NewKeeper( cdc codec.BinaryCodec, @@ -385,7 +421,7 @@ func (k Keeper) iterateForwardedPackets(ctx context.Context, cb func(packet type // IsBlockedAddr checks if the given address is allowed to send or receive tokens. // The module account is always allowed to send and receive tokens. -func (k Keeper) isBlockedAddr(addr sdk.AccAddress) bool { +func (k Keeper) IsBlockedAddr(addr sdk.AccAddress) bool { moduleAddr := k.authKeeper.GetModuleAddress(types.ModuleName) if addr.Equals(moduleAddr) { return false diff --git a/modules/apps/transfer/keeper/msg_server.go b/modules/apps/transfer/keeper/msg_server.go index b0cb57398b7..b93299475a7 100644 --- a/modules/apps/transfer/keeper/msg_server.go +++ b/modules/apps/transfer/keeper/msg_server.go @@ -33,7 +33,7 @@ func (k Keeper) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*types. return nil, errorsmod.Wrapf(types.ErrSendDisabled, err.Error()) } - if k.isBlockedAddr(sender) { + if k.IsBlockedAddr(sender) { return nil, errorsmod.Wrapf(ibcerrors.ErrUnauthorized, "%s is not allowed to send funds", sender) } diff --git a/modules/apps/transfer/keeper/relay.go b/modules/apps/transfer/keeper/relay.go index 71ef740132c..e251fe1cf15 100644 --- a/modules/apps/transfer/keeper/relay.go +++ b/modules/apps/transfer/keeper/relay.go @@ -178,7 +178,7 @@ func (k Keeper) OnRecvPacket(ctx context.Context, packet channeltypes.Packet, da return err } - if k.isBlockedAddr(receiver) { + if k.IsBlockedAddr(receiver) { return errorsmod.Wrapf(ibcerrors.ErrUnauthorized, "%s is not allowed to receive funds", receiver) } @@ -346,7 +346,7 @@ func (k Keeper) refundPacketTokens(ctx context.Context, packet channeltypes.Pack if err != nil { return err } - if k.isBlockedAddr(sender) { + if k.IsBlockedAddr(sender) { return errorsmod.Wrapf(ibcerrors.ErrUnauthorized, "%s is not allowed to receive funds", sender) } @@ -383,6 +383,50 @@ func (k Keeper) refundPacketTokens(ctx context.Context, packet channeltypes.Pack return nil } +func (k Keeper) refundPacketTokensV2(ctx context.Context, packet channeltypes.PacketV2, data types.FungibleTokenPacketDataV2) error { + // NOTE: packet data type already checked in handler.go + + sender, err := sdk.AccAddressFromBech32(data.Sender) + if err != nil { + return err + } + if k.IsBlockedAddr(sender) { + return errorsmod.Wrapf(ibcerrors.ErrUnauthorized, "%s is not allowed to receive funds", sender) + } + + // escrow address for unescrowing tokens back to sender + escrowAddress := types.GetEscrowAddress(types.ModuleName, packet.SourceId) + + moduleAccountAddr := k.authKeeper.GetModuleAddress(types.ModuleName) + for _, token := range data.Tokens { + coin, err := token.ToCoin() + if err != nil { + return err + } + + // if the token we must refund is prefixed by the source port and channel + // then the tokens were burnt when the packet was sent and we must mint new tokens + if token.Denom.HasPrefix(types.ModuleName, packet.SourceId) { + // mint vouchers back to sender + if err := k.bankKeeper.MintCoins( + ctx, types.ModuleName, sdk.NewCoins(coin), + ); err != nil { + return err + } + + if err := k.bankKeeper.SendCoins(ctx, moduleAccountAddr, sender, sdk.NewCoins(coin)); err != nil { + panic(fmt.Errorf("unable to send coins from module to account despite previously minting coins to module account: %v", err)) + } + } else { + if err := k.unescrowCoin(ctx, escrowAddress, sender, coin); err != nil { + return err + } + } + } + + return nil +} + // escrowCoin will send the given coin from the provided sender to the escrow address. It will also // update the total escrowed amount by adding the escrowed coin's amount to the current total escrow. func (k Keeper) escrowCoin(ctx context.Context, sender, escrowAddress sdk.AccAddress, coin sdk.Coin) error { diff --git a/modules/apps/transfer/keeper/relay_v2.go b/modules/apps/transfer/keeper/relay_v2.go new file mode 100644 index 00000000000..3fd6b7cb49f --- /dev/null +++ b/modules/apps/transfer/keeper/relay_v2.go @@ -0,0 +1,253 @@ +package keeper + +import ( + "context" + "fmt" + + errorsmod "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/ibc-go/v9/modules/apps/transfer/internal/events" + "github.com/cosmos/ibc-go/v9/modules/apps/transfer/types" + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" + ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors" + packetservertypes "github.com/cosmos/ibc-go/v9/modules/core/packet-server/types" +) + +func (k Keeper) OnRecvPacketV2(ctx context.Context, packet channeltypes.PacketV2, payload channeltypes.Payload, data types.FungibleTokenPacketDataV2) error { + // validate packet data upon receiving + if err := data.ValidateBasic(); err != nil { + return errorsmod.Wrapf(err, "error validating ICS-20 transfer packet data") + } + + if !k.GetParams(ctx).ReceiveEnabled { + return types.ErrReceiveDisabled + } + + receiver, err := k.getReceiverFromPacketData(data) + if err != nil { + return err + } + + if k.IsBlockedAddr(receiver) { + return errorsmod.Wrapf(ibcerrors.ErrUnauthorized, "%s is not allowed to receive funds", receiver) + } + + receivedCoins := make(sdk.Coins, 0, len(data.Tokens)) + for _, token := range data.Tokens { + // parse the transfer amount + transferAmount, ok := sdkmath.NewIntFromString(token.Amount) + if !ok { + return errorsmod.Wrapf(types.ErrInvalidAmount, "unable to parse transfer amount: %s", token.Amount) + } + + // This is the prefix that would have been prefixed to the denomination + // on sender chain IF and only if the token originally came from the + // receiving chain. + // + // NOTE: We use SourcePort and SourceChannel here, because the counterparty + // chain would have prefixed with DestPort and DestChannel when originally + // receiving this token. + // TODO figure out what to use for source port in denom trace + if token.Denom.HasPrefix(types.ModuleName, packet.GetSourceId()) { + // sender chain is not the source, unescrow tokens + + // remove prefix added by sender chain + token.Denom.Trace = token.Denom.Trace[1:] + + coin := sdk.NewCoin(token.Denom.IBCDenom(), transferAmount) + + escrowAddress := types.GetEscrowAddress(types.ModuleName, packet.DestinationId) + if err := k.unescrowCoin(ctx, escrowAddress, receiver, coin); err != nil { + return err + } + + // Appending token. The new denom has been computed + receivedCoins = append(receivedCoins, coin) + } else { + // sender chain is the source, mint vouchers + + // since SendPacket did not prefix the denomination, we must add the destination port and channel to the trace + trace := []types.Hop{types.NewHop(types.ModuleName, packet.DestinationId)} + token.Denom.Trace = append(trace, token.Denom.Trace...) + + if !k.HasDenom(ctx, token.Denom.Hash()) { + k.SetDenom(ctx, token.Denom) + } + + voucherDenom := token.Denom.IBCDenom() + if !k.bankKeeper.HasDenomMetaData(ctx, voucherDenom) { + k.setDenomMetadata(ctx, token.Denom) + } + + events.EmitDenomEvent(ctx, token) + + voucher := sdk.NewCoin(voucherDenom, transferAmount) + + // mint new tokens if the source of the transfer is the same chain + if err := k.bankKeeper.MintCoins( + ctx, types.ModuleName, sdk.NewCoins(voucher), + ); err != nil { + return errorsmod.Wrap(err, "failed to mint IBC tokens") + } + + // send to receiver + moduleAddr := k.authKeeper.GetModuleAddress(types.ModuleName) + if err := k.bankKeeper.SendCoins( + ctx, moduleAddr, receiver, sdk.NewCoins(voucher), + ); err != nil { + return errorsmod.Wrapf(err, "failed to send coins to receiver %s", receiver.String()) + } + + receivedCoins = append(receivedCoins, voucher) + } + } + + // if data.HasForwarding() { + // // we are now sending from the forward escrow address to the final receiver address. + // if err := k.forwardPacketV2(ctx, data, packet, receivedCoins); err != nil { + // return err + // } + // } + + // telemetry.ReportOnRecvPacketV2(packet, data.Tokens) + + // The ibc_module.go module will return the proper ack. + return nil +} + +func (k Keeper) OnAcknowledgementPacketV2(ctx context.Context, packet channeltypes.PacketV2, data types.FungibleTokenPacketDataV2, ack channeltypes.Acknowledgement) error { + // forwardedPacket, isForwarded := k.getForwardedPacketV2(ctx, packet.SourcePort, packet.SourceChannel, packet.Sequence) + + switch ack.Response.(type) { + case *channeltypes.Acknowledgement_Result: + // if isForwarded { + // // Write a successful async ack for the forwardedPacket + // forwardAck := channeltypes.NewResultAcknowledgement([]byte{byte(1)}) + // return k.acknowledgeForwardedPacketV2(ctx, forwardedPacket, packet, forwardAck) + // } + + // the acknowledgement succeeded on the receiving chain so nothing + // needs to be executed and no error needs to be returned + return nil + case *channeltypes.Acknowledgement_Error: + // We refund the tokens from the escrow address to the sender + if err := k.refundPacketTokensV2(ctx, packet, data); err != nil { + return err + } + // if isForwarded { + // // the forwarded packet has failed, thus the funds have been refunded to the intermediate address. + // // we must revert the changes that came from successfully receiving the tokens on our chain + // // before propagating the error acknowledgement back to original sender chain + // if err := k.revertForwardedPacketV2(ctx, forwardedPacket, data); err != nil { + // return err + // } + + // forwardAck := internaltypes.NewForwardErrorAcknowledgementV2(packet, ack) + // return k.acknowledgeForwardedPacketV2(ctx, forwardedPacket, packet, forwardAck) + // } + + return nil + default: + return errorsmod.Wrapf(ibcerrors.ErrInvalidType, "expected one of [%T, %T], got %T", channeltypes.Acknowledgement_Result{}, channeltypes.Acknowledgement_Error{}, ack.Response) + } +} + +func (k Keeper) OnTimeoutPacketV2(ctx context.Context, packet channeltypes.PacketV2, data types.FungibleTokenPacketDataV2) error { + if err := k.refundPacketTokensV2(ctx, packet, data); err != nil { + return err + } + + // forwardedPacket, isForwarded := k.getForwardedPacketV2(ctx, packet.SourcePort, packet.SourceChannel, packet.Sequence) + // if isForwarded { + // if err := k.revertForwardedPacketV2(ctx, forwardedPacket, data); err != nil { + // return err + // } + + // forwardAck := internaltypes.NewForwardTimeoutAcknowledgementV2(packet) + // return k.acknowledgeForwardedPacketV2(ctx, forwardedPacket, packet, forwardAck) + // } + + return nil +} + +func (k Keeper) OnSendPacket( + ctx context.Context, + sourceID string, + packetData types.FungibleTokenPacketDataV2, + sender sdk.AccAddress, +) error { + _, ok := k.packetServerKeeper.GetCounterparty(ctx, sourceID) + if !ok { + return errorsmod.Wrap(packetservertypes.ErrCounterpartyNotFound, sourceID) + } + + var coins sdk.Coins + for _, token := range packetData.Tokens { + transferAmount, ok := sdkmath.NewIntFromString(token.Amount) + if !ok { + return errorsmod.Wrapf(types.ErrInvalidAmount, "unable to parse transfer amount: %s", token.Amount) + } + + coins = append(coins, sdk.NewCoin(token.Denom.IBCDenom(), transferAmount)) + } + + if err := k.bankKeeper.IsSendEnabledCoins(ctx, coins...); err != nil { + return errorsmod.Wrapf(types.ErrSendDisabled, err.Error()) + } + + // begin createOutgoingPacket logic + // See spec for this logic: https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#packet-relay + tokens := make([]types.Token, 0, len(coins)) + + sdkCtx := sdk.UnwrapSDKContext(ctx) + for _, coin := range coins { + // Using types.UnboundedSpendLimit allows us to send the entire balance of a given denom. + if coin.Amount.Equal(types.UnboundedSpendLimit()) { + coin.Amount = k.bankKeeper.GetBalance(ctx, sender, coin.Denom).Amount + } + + token, err := k.tokenFromCoin(sdkCtx, coin) + if err != nil { + return err + } + + // NOTE: SendTransfer simply sends the denomination as it exists on its own + // chain inside the packet data. The receiving chain will perform denom + // prefixing as necessary. + + // if the denom is prefixed by the port and channel on which we are sending + // the token, then we must be returning the token back to the chain they originated from + if token.Denom.HasPrefix(types.ModuleName, sourceID) { + // transfer the coins to the module account and burn them + if err := k.bankKeeper.SendCoinsFromAccountToModule( + ctx, sender, types.ModuleName, sdk.NewCoins(coin), + ); err != nil { + return err + } + + if err := k.bankKeeper.BurnCoins( + ctx, types.ModuleName, sdk.NewCoins(coin), + ); err != nil { + // NOTE: should not happen as the module account was + // retrieved on the step above and it has enough balance + // to burn. + panic(fmt.Errorf("cannot burn coins after a successful send to a module account: %v", err)) + } + } else { + // obtain the escrow address for the source channel end + escrowAddress := types.GetEscrowAddress(types.ModuleName, sourceID) + if err := k.escrowCoin(ctx, sender, escrowAddress, coin); err != nil { + return err + } + } + + tokens = append(tokens, token) + } + + // events.EmitTransferEvent(ctx, sender.String(), packetData.Receiver, tokens, packetData.Memo, packetData.Forwarding.Hops) + + // telemetry.ReportTransfer(sourcePort, sourceChannel, destinationPort, destinationChannel, tokens) + + return nil +} diff --git a/testing/simapp/app.go b/testing/simapp/app.go index 397ef8e4fa8..8222582a00b 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -402,11 +402,12 @@ func NewSimApp( // Create Transfer Keeper and pass IBCFeeKeeper as expected Channel and PortKeeper // since fee middleware will wrap the IBCKeeper for underlying application. - app.TransferKeeper = ibctransferkeeper.NewKeeper( + app.TransferKeeper = ibctransferkeeper.NewKeeperWithPacketServer( appCodec, runtime.NewKVStoreService(keys[ibctransfertypes.StoreKey]), app.GetSubspace(ibctransfertypes.ModuleName), app.IBCFeeKeeper, // ISC4 Wrapper: fee IBC middleware app.IBCKeeper.ChannelKeeper, app.AccountKeeper, app.BankKeeper, + *app.PacketServer, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) @@ -447,6 +448,7 @@ func NewSimApp( // Add transfer stack to IBC Router ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferStack) + ibcRouterV2.AddRoute(ibctransfertypes.ModuleName, transfer.NewIBCModuleV2(app.TransferKeeper)) // Create Interchain Accounts Stack // SendPacket, since it is originating from the application to core IBC: From 7104c3e424684fc80ffc908a235d0712a66493ff Mon Sep 17 00:00:00 2001 From: chatton Date: Wed, 18 Sep 2024 16:02:22 +0100 Subject: [PATCH 17/27] wip: adding WIP test for msg server v2 transfer --- modules/apps/transfer/ibc_module_v2.go | 6 +- modules/apps/transfer/transfer_v2_test.go | 138 ++++++++++++++++++++++ 2 files changed, 141 insertions(+), 3 deletions(-) create mode 100644 modules/apps/transfer/transfer_v2_test.go diff --git a/modules/apps/transfer/ibc_module_v2.go b/modules/apps/transfer/ibc_module_v2.go index d8bd48a7cac..5d2da13836c 100644 --- a/modules/apps/transfer/ibc_module_v2.go +++ b/modules/apps/transfer/ibc_module_v2.go @@ -24,8 +24,8 @@ type IBCModuleV2 struct { } // NewIBCModule creates a new IBCModule given the keeper -func NewIBCModuleV2(k keeper.Keeper) IBCModuleV2 { - return IBCModuleV2{ +func NewIBCModuleV2(k keeper.Keeper) *IBCModuleV2 { + return &IBCModuleV2{ keeper: k, } } @@ -56,7 +56,7 @@ func (im *IBCModuleV2) OnSendPacketV2( // fail the unmarshaling above, where if ics20version == types.V1 we first unmarshal // into a V1 packet and then convert. - if data.Sender != signer.String() { + if data.Sender != string(signer) { return errorsmod.Wrapf(ibcerrors.ErrInvalidAddress, "invalid signer address: expected %s, got %s", data.Sender, signer) } diff --git a/modules/apps/transfer/transfer_v2_test.go b/modules/apps/transfer/transfer_v2_test.go new file mode 100644 index 00000000000..9a0e223614f --- /dev/null +++ b/modules/apps/transfer/transfer_v2_test.go @@ -0,0 +1,138 @@ +package transfer_test + +import ( + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/ibc-go/v9/modules/apps/transfer/types" + clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" + channeltypesv2 "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types" + "testing" + + testifysuite "github.com/stretchr/testify/suite" + + ibctesting "github.com/cosmos/ibc-go/v9/testing" +) + +type TransferV2TestSuite struct { + testifysuite.Suite + + coordinator *ibctesting.Coordinator + + // testing chains used for convenience and readability + chainA *ibctesting.TestChain + chainB *ibctesting.TestChain + chainC *ibctesting.TestChain +} + +func (suite *TransferV2TestSuite) SetupTest() { + suite.coordinator = ibctesting.NewCoordinator(suite.T(), 3) + suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1)) + suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(2)) + suite.chainC = suite.coordinator.GetChain(ibctesting.GetChainID(3)) +} + +// Constructs the following sends based on the established channels/connections +// 1 - from chainA to chainB +// 2 - from chainB to chainC +// 3 - from chainC to chainB +func (suite *TransferV2TestSuite) TestHandleMsgV2Transfer() { + suite.SetupTest() // reset + + // setup between chainA and chainB + // NOTE: + // pathAToB.EndpointA = endpoint on chainA + // pathAToB.EndpointB = endpoint on chainB + pathAToB := ibctesting.NewTransferPath(suite.chainA, suite.chainB) + pathAToB.Setup() + traceAToB := types.NewHop(pathAToB.EndpointB.ChannelConfig.PortID, pathAToB.EndpointB.ChannelID) + + originalBalances := sdk.NewCoins() + originalBalance := suite.chainA.GetSimApp().BankKeeper.GetBalance(suite.chainA.GetContext(), suite.chainA.SenderAccount.GetAddress(), sdk.DefaultBondDenom) + originalBalances = originalBalances.Add(originalBalance) + + timeoutHeight := clienttypes.NewHeight(1, 110) + + amount, ok := sdkmath.NewIntFromString("9223372036854775808") // 2^63 (one above int64) + suite.Require().True(ok) + originalCoins := sdk.NewCoins() + + coinToSendToB := sdk.NewCoin(sdk.DefaultBondDenom, amount) + originalCoins = originalCoins.Add(coinToSendToB) + + // send from chainA to chainB + msg := types.NewMsgTransfer(pathAToB.EndpointA.ChannelConfig.PortID, pathAToB.EndpointA.ChannelID, originalCoins, suite.chainA.SenderAccount.GetAddress().String(), suite.chainB.SenderAccount.GetAddress().String(), timeoutHeight, 0, "", nil) + res, err := suite.chainA.SendMsgs(msg) + suite.Require().NoError(err) // message committed + + packet, err := ibctesting.ParsePacketFromEvents(res.Events) + suite.Require().NoError(err) + + // relay send + err = pathAToB.RelayPacket(packet) + suite.Require().NoError(err) // relay committed + + escrowAddress := types.GetEscrowAddress(packet.GetSourcePort(), packet.GetSourceChannel()) + coinsSentFromAToB := sdk.NewCoins() + for _, coin := range originalCoins { + // check that the balance for chainA is updated + chainABalance := suite.chainA.GetSimApp().BankKeeper.GetBalance(suite.chainA.GetContext(), suite.chainA.SenderAccount.GetAddress(), coin.Denom) + suite.Require().Equal(originalBalances.AmountOf(coin.Denom).Sub(amount).Int64(), chainABalance.Amount.Int64()) + + // check that module account escrow address has locked the tokens + chainAEscrowBalance := suite.chainA.GetSimApp().BankKeeper.GetBalance(suite.chainA.GetContext(), escrowAddress, coin.Denom) + suite.Require().Equal(coin, chainAEscrowBalance) + + // check that voucher exists on chain B + chainBDenom := types.NewDenom(coin.Denom, traceAToB) + chainBBalance := suite.chainB.GetSimApp().BankKeeper.GetBalance(suite.chainB.GetContext(), suite.chainB.SenderAccount.GetAddress(), chainBDenom.IBCDenom()) + coinSentFromAToB := sdk.NewCoin(chainBDenom.IBCDenom(), amount) + suite.Require().Equal(coinSentFromAToB, chainBBalance) + + coinsSentFromAToB = coinsSentFromAToB.Add(coinSentFromAToB) + } + + sender := suite.chainB.SenderAccount.GetAddress().String() + ftpd := types.FungibleTokenPacketDataV2{ + Tokens: []types.Token{ + { + // "transfer/channel-0/stake" + Denom: types.NewDenom(sdk.DefaultBondDenom, traceAToB), + Amount: "100", + }, + }, + Sender: sender, + Receiver: suite.chainA.SenderAccount.GetAddress().String(), + Memo: "", + Forwarding: types.ForwardingPacketData{}, + } + + bz, err := ftpd.Marshal() + suite.Require().NoError(err) + + timeoutTimestamp := suite.chainB.GetTimeoutTimestamp() + msgSendPacket := &channeltypesv2.MsgSendPacket{ + SourceId: pathAToB.EndpointB.ChannelID, + TimeoutTimestamp: timeoutTimestamp, + PacketData: []channeltypes.PacketData{ + { + SourcePort: "transfer", + DestinationPort: "transfer", + Payload: channeltypes.Payload{ + Encoding: "json", + Version: types.V2, + Value: bz, + }, + }, + }, + Signer: sender, + } + + res, err = suite.chainB.SendMsgs(msgSendPacket) + suite.Require().NoError(err) + suite.Require().NotNil(res) +} + +func TestTransferV2TestSuite(t *testing.T) { + testifysuite.Run(t, new(TransferV2TestSuite)) +} From 444c0fcd4b15ce6d3626eccfbea2702eab0d5331 Mon Sep 17 00:00:00 2001 From: chatton Date: Wed, 18 Sep 2024 16:54:27 +0100 Subject: [PATCH 18/27] wip: experiementing with transfer test --- modules/apps/transfer/keeper/relay_v2.go | 9 +++---- modules/apps/transfer/transfer_v2_test.go | 8 +++--- modules/core/04-channel/keeper/keeper.go | 26 +++++++++++++++++++ modules/core/packet-server/keeper/keeper.go | 13 ++++++++++ modules/core/packet-server/keeper/relay_v2.go | 21 +++++++-------- .../packet-server/types/expected_keepers.go | 3 ++- 6 files changed, 60 insertions(+), 20 deletions(-) diff --git a/modules/apps/transfer/keeper/relay_v2.go b/modules/apps/transfer/keeper/relay_v2.go index 3fd6b7cb49f..3a9528efee9 100644 --- a/modules/apps/transfer/keeper/relay_v2.go +++ b/modules/apps/transfer/keeper/relay_v2.go @@ -11,7 +11,6 @@ import ( "github.com/cosmos/ibc-go/v9/modules/apps/transfer/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors" - packetservertypes "github.com/cosmos/ibc-go/v9/modules/core/packet-server/types" ) func (k Keeper) OnRecvPacketV2(ctx context.Context, packet channeltypes.PacketV2, payload channeltypes.Payload, data types.FungibleTokenPacketDataV2) error { @@ -177,10 +176,10 @@ func (k Keeper) OnSendPacket( packetData types.FungibleTokenPacketDataV2, sender sdk.AccAddress, ) error { - _, ok := k.packetServerKeeper.GetCounterparty(ctx, sourceID) - if !ok { - return errorsmod.Wrap(packetservertypes.ErrCounterpartyNotFound, sourceID) - } + //_, ok := k.packetServerKeeper.GetCounterparty(ctx, sourceID) + //if !ok { + // return errorsmod.Wrap(packetservertypes.ErrCounterpartyNotFound, sourceID) + //} var coins sdk.Coins for _, token := range packetData.Tokens { diff --git a/modules/apps/transfer/transfer_v2_test.go b/modules/apps/transfer/transfer_v2_test.go index 9a0e223614f..cd70cda9813 100644 --- a/modules/apps/transfer/transfer_v2_test.go +++ b/modules/apps/transfer/transfer_v2_test.go @@ -92,7 +92,9 @@ func (suite *TransferV2TestSuite) TestHandleMsgV2Transfer() { coinsSentFromAToB = coinsSentFromAToB.Add(coinSentFromAToB) } - sender := suite.chainB.SenderAccount.GetAddress().String() + suite.Require().NoError(pathAToB.EndpointA.UpdateClient()) + suite.Require().NoError(pathAToB.EndpointB.UpdateClient()) + ftpd := types.FungibleTokenPacketDataV2{ Tokens: []types.Token{ { @@ -101,7 +103,7 @@ func (suite *TransferV2TestSuite) TestHandleMsgV2Transfer() { Amount: "100", }, }, - Sender: sender, + Sender: suite.chainB.SenderAccount.GetAddress().String(), Receiver: suite.chainA.SenderAccount.GetAddress().String(), Memo: "", Forwarding: types.ForwardingPacketData{}, @@ -125,7 +127,7 @@ func (suite *TransferV2TestSuite) TestHandleMsgV2Transfer() { }, }, }, - Signer: sender, + Signer: suite.chainB.SenderAccount.GetAddress().String(), } res, err = suite.chainB.SendMsgs(msgSendPacket) diff --git a/modules/core/04-channel/keeper/keeper.go b/modules/core/04-channel/keeper/keeper.go index 8e3c96eb40a..eb7b9017df7 100644 --- a/modules/core/04-channel/keeper/keeper.go +++ b/modules/core/04-channel/keeper/keeper.go @@ -3,6 +3,8 @@ package keeper import ( "context" "errors" + commitmenttypes "github.com/cosmos/ibc-go/v9/modules/core/23-commitment/types" + packetservertypes "github.com/cosmos/ibc-go/v9/modules/core/packet-server/types" "strconv" "strings" @@ -849,3 +851,27 @@ func (k *Keeper) PruneAcknowledgements(ctx context.Context, portID, channelID st return totalPruned, totalRemaining, nil } + +// GetV2Counterparty returns a version 2 counterparty for the given port and channel ID +// by converting the channel into a version 2 counterparty +func (k *Keeper) GetV2Counterparty(ctx context.Context, portID, channelID string) (packetservertypes.Counterparty, bool) { + channel, ok := k.GetChannel(ctx, portID, channelID) + if !ok { + return packetservertypes.Counterparty{}, false + } + // Do not allow channel to be converted into a version 2 counterparty + // if the channel is not OPEN or if it is ORDERED + if channel.State != types.OPEN || channel.Ordering == types.ORDERED { + return packetservertypes.Counterparty{}, false + } + connection, ok := k.connectionKeeper.GetConnection(ctx, channel.ConnectionHops[0]) + if !ok { + return packetservertypes.Counterparty{}, false + } + merklePathPrefix := commitmenttypes.NewMerklePath(connection.Counterparty.Prefix.KeyPrefix, []byte("")) + counterparty := packetservertypes.Counterparty{ + ClientId: connection.ClientId, + MerklePathPrefix: merklePathPrefix, + } + return counterparty, true +} diff --git a/modules/core/packet-server/keeper/keeper.go b/modules/core/packet-server/keeper/keeper.go index 8c98d623a12..927c0fb9600 100644 --- a/modules/core/packet-server/keeper/keeper.go +++ b/modules/core/packet-server/keeper/keeper.go @@ -66,3 +66,16 @@ func (k *Keeper) GetCounterparty(ctx context.Context, clientID string) (types.Co k.cdc.MustUnmarshal(bz, &counterparty) return counterparty, true } + +// GetCounterparty gets the Counterparty for a given client identifier. +func (k *Keeper) GetCounterpartyV2(ctx context.Context, portID, channelID, clientID string) (types.Counterparty, bool) { + store := k.ChannelStore(ctx, clientID) + bz := store.Get([]byte(types.CounterpartyKey)) + if len(bz) == 0 { + return k.ChannelKeeper.GetV2Counterparty(ctx, portID, channelID) + } + + var counterparty types.Counterparty + k.cdc.MustUnmarshal(bz, &counterparty) + return counterparty, true +} diff --git a/modules/core/packet-server/keeper/relay_v2.go b/modules/core/packet-server/keeper/relay_v2.go index 9482a5d0d98..01ba5d9bdb4 100644 --- a/modules/core/packet-server/keeper/relay_v2.go +++ b/modules/core/packet-server/keeper/relay_v2.go @@ -26,36 +26,35 @@ func (k Keeper) SendPacketV2( data []channeltypes.PacketData, ) (uint64, error) { // Lookup counterparty associated with our source channel to retrieve the destination channel - counterparty, ok := k.GetCounterparty(ctx, sourceID) + counterparty, ok := k.GetCounterpartyV2(ctx, "transfer", "channel-2", sourceID) if !ok { return 0, errorsmod.Wrap(types.ErrCounterpartyNotFound, sourceID) } - destChannel := counterparty.ClientId // retrieve the sequence send for this channel // if no packets have been sent yet, initialize the sequence to 1. - sequence, found := k.ChannelKeeper.GetNextSequenceSend(ctx, host.SentinelV2PortID, sourceID) + sequence, found := k.ChannelKeeper.GetNextSequenceSend(ctx, host.SentinelV2PortID, counterparty.ClientId) if !found { sequence = 1 } // construct packet from given fields and channel state - packet := channeltypesv2.NewPacketV2(sequence, sourceID, destChannel, timeoutTimestamp, data...) + packet := channeltypesv2.NewPacketV2(sequence, sourceID, counterparty.ClientId, timeoutTimestamp, data...) if err := packet.ValidateBasic(); err != nil { return 0, errorsmod.Wrapf(channeltypes.ErrInvalidPacket, "constructed packet failed basic validation: %v", err) } // check that the client of counterparty chain is still active - if status := k.ClientKeeper.GetClientStatus(ctx, sourceID); status != exported.Active { - return 0, errorsmod.Wrapf(clienttypes.ErrClientNotActive, "client (%s) status is %s", sourceID, status) + if status := k.ClientKeeper.GetClientStatus(ctx, counterparty.ClientId); status != exported.Active { + return 0, errorsmod.Wrapf(clienttypes.ErrClientNotActive, "client (%s) status is %s", counterparty.ClientId, status) } // retrieve latest height and timestamp of the client of counterparty chain - latestHeight := k.ClientKeeper.GetClientLatestHeight(ctx, sourceID) + latestHeight := k.ClientKeeper.GetClientLatestHeight(ctx, counterparty.ClientId) if latestHeight.IsZero() { - return 0, errorsmod.Wrapf(clienttypes.ErrInvalidHeight, "cannot send packet using client (%s) with zero height", sourceID) + return 0, errorsmod.Wrapf(clienttypes.ErrInvalidHeight, "cannot send packet using client (%s) with zero height", counterparty.ClientId) } - latestTimestamp, err := k.ClientKeeper.GetClientTimestampAtHeight(ctx, sourceID, latestHeight) + latestTimestamp, err := k.ClientKeeper.GetClientTimestampAtHeight(ctx, counterparty.ClientId, latestHeight) if err != nil { return 0, err } @@ -67,8 +66,8 @@ func (k Keeper) SendPacketV2( commitment := channeltypes.CommitPacketV2(packet) // bump the sequence and set the packet commitment so it is provable by the counterparty - k.ChannelKeeper.SetNextSequenceSend(ctx, host.SentinelV2PortID, sourceID, sequence+1) - k.ChannelKeeper.SetPacketCommitment(ctx, host.SentinelV2PortID, sourceID, packet.GetSequence(), commitment) + k.ChannelKeeper.SetNextSequenceSend(ctx, host.SentinelV2PortID, counterparty.ClientId, sequence+1) + k.ChannelKeeper.SetPacketCommitment(ctx, host.SentinelV2PortID, counterparty.ClientId, packet.GetSequence(), commitment) // k.Logger(ctx).Info("packet sent", "sequence", strconv.FormatUint(packet.Sequence, 10), "src_port", packetV2SentinelPort, "src_channel", packet.SourceChannel, "dst_port", packet.DestinationPort, "dst_channel", packet.DestinationChannel) // channelkeeper.EmitSendPacketEventV2(ctx, packet, sentinelChannel(sourceID), timeoutHeight) diff --git a/modules/core/packet-server/types/expected_keepers.go b/modules/core/packet-server/types/expected_keepers.go index 9bd93fa871b..b83bf44529c 100644 --- a/modules/core/packet-server/types/expected_keepers.go +++ b/modules/core/packet-server/types/expected_keepers.go @@ -2,7 +2,6 @@ package types import ( "context" - clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" "github.com/cosmos/ibc-go/v9/modules/core/exported" @@ -44,6 +43,8 @@ type ChannelKeeper interface { GetMultiAcknowledgement(ctx context.Context, portID, channelID string, sequence uint64) (types.MultiAcknowledgement, bool) // SetMultiAcknowledgement writes the multi ack under the multi ack path. SetMultiAcknowledgement(ctx context.Context, portID, channelID string, sequence uint64, recvResults types.MultiAcknowledgement) + + GetV2Counterparty(ctx context.Context, portID, channelID string) (Counterparty, bool) } type ClientKeeper interface { From 2f59a8838b33344e723cc051768393d28fe5f50f Mon Sep 17 00:00:00 2001 From: chatton Date: Thu, 19 Sep 2024 10:42:41 +0100 Subject: [PATCH 19/27] wip: got recv flow technically working with some hard coded hacks --- modules/apps/transfer/ibc_module_v2.go | 4 +- modules/apps/transfer/keeper/relay_v2.go | 5 --- modules/apps/transfer/transfer_v2_test.go | 36 +++++++++++++++++- modules/core/04-channel/keeper/keeper.go | 1 + modules/core/keeper/msg_server_v2.go | 9 ++++- modules/core/packet-server/keeper/keeper.go | 8 +++- modules/core/packet-server/keeper/relay_v2.go | 38 ++++++++++--------- 7 files changed, 72 insertions(+), 29 deletions(-) diff --git a/modules/apps/transfer/ibc_module_v2.go b/modules/apps/transfer/ibc_module_v2.go index 5d2da13836c..623beeaa32b 100644 --- a/modules/apps/transfer/ibc_module_v2.go +++ b/modules/apps/transfer/ibc_module_v2.go @@ -56,13 +56,11 @@ func (im *IBCModuleV2) OnSendPacketV2( // fail the unmarshaling above, where if ics20version == types.V1 we first unmarshal // into a V1 packet and then convert. - if data.Sender != string(signer) { + if data.Sender != signer.String() { return errorsmod.Wrapf(ibcerrors.ErrInvalidAddress, "invalid signer address: expected %s, got %s", data.Sender, signer) } return im.keeper.OnSendPacket(ctx, sourceID, data, signer) - - // TODO: port } // OnRecvPacketV2 implements the IBCModuleV2 interface. A successful acknowledgement diff --git a/modules/apps/transfer/keeper/relay_v2.go b/modules/apps/transfer/keeper/relay_v2.go index 3a9528efee9..a02db5b5d84 100644 --- a/modules/apps/transfer/keeper/relay_v2.go +++ b/modules/apps/transfer/keeper/relay_v2.go @@ -176,11 +176,6 @@ func (k Keeper) OnSendPacket( packetData types.FungibleTokenPacketDataV2, sender sdk.AccAddress, ) error { - //_, ok := k.packetServerKeeper.GetCounterparty(ctx, sourceID) - //if !ok { - // return errorsmod.Wrap(packetservertypes.ErrCounterpartyNotFound, sourceID) - //} - var coins sdk.Coins for _, token := range packetData.Tokens { transferAmount, ok := sdkmath.NewIntFromString(token.Amount) diff --git a/modules/apps/transfer/transfer_v2_test.go b/modules/apps/transfer/transfer_v2_test.go index cd70cda9813..7e8f785b3e7 100644 --- a/modules/apps/transfer/transfer_v2_test.go +++ b/modules/apps/transfer/transfer_v2_test.go @@ -7,6 +7,7 @@ import ( clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" channeltypesv2 "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types" + host "github.com/cosmos/ibc-go/v9/modules/core/24-host" "testing" testifysuite "github.com/stretchr/testify/suite" @@ -64,6 +65,7 @@ func (suite *TransferV2TestSuite) TestHandleMsgV2Transfer() { msg := types.NewMsgTransfer(pathAToB.EndpointA.ChannelConfig.PortID, pathAToB.EndpointA.ChannelID, originalCoins, suite.chainA.SenderAccount.GetAddress().String(), suite.chainB.SenderAccount.GetAddress().String(), timeoutHeight, 0, "", nil) res, err := suite.chainA.SendMsgs(msg) suite.Require().NoError(err) // message committed + suite.Require().NoError(pathAToB.EndpointB.UpdateClient()) packet, err := ibctesting.ParsePacketFromEvents(res.Events) suite.Require().NoError(err) @@ -92,8 +94,8 @@ func (suite *TransferV2TestSuite) TestHandleMsgV2Transfer() { coinsSentFromAToB = coinsSentFromAToB.Add(coinSentFromAToB) } - suite.Require().NoError(pathAToB.EndpointA.UpdateClient()) suite.Require().NoError(pathAToB.EndpointB.UpdateClient()) + suite.Require().NoError(pathAToB.EndpointA.UpdateClient()) ftpd := types.FungibleTokenPacketDataV2{ Tokens: []types.Token{ @@ -109,7 +111,7 @@ func (suite *TransferV2TestSuite) TestHandleMsgV2Transfer() { Forwarding: types.ForwardingPacketData{}, } - bz, err := ftpd.Marshal() + bz, err := suite.chainB.Codec.Marshal(&ftpd) suite.Require().NoError(err) timeoutTimestamp := suite.chainB.GetTimeoutTimestamp() @@ -133,6 +135,36 @@ func (suite *TransferV2TestSuite) TestHandleMsgV2Transfer() { res, err = suite.chainB.SendMsgs(msgSendPacket) suite.Require().NoError(err) suite.Require().NotNil(res) + suite.Require().NoError(pathAToB.EndpointA.UpdateClient()) + suite.Require().NoError(pathAToB.EndpointB.UpdateClient()) + + packetKey := host.PacketCommitmentKey(host.SentinelV2PortID, pathAToB.EndpointB.ClientID, 1) + proof, proofHeight := pathAToB.EndpointB.QueryProof(packetKey) + suite.Require().NotNil(proof) + suite.Require().False(proofHeight.IsZero()) + + packetV2 := channeltypesv2.NewPacketV2(1, pathAToB.EndpointB.ChannelID, pathAToB.EndpointA.ChannelID, timeoutTimestamp, channeltypes.PacketData{ + SourcePort: "transfer", + DestinationPort: "transfer", + Payload: channeltypes.Payload{ + Version: types.V2, + Encoding: "json", + Value: bz, + }, + }) + + msgRecvPacket := &channeltypesv2.MsgRecvPacket{ + Packet: packetV2, + ProofCommitment: proof, + ProofHeight: proofHeight, + Signer: suite.chainA.SenderAccount.GetAddress().String(), + } + + res, err = suite.chainA.SendMsgs(msgRecvPacket) + suite.Require().NoError(err) + suite.Require().NotNil(res) + suite.Require().NoError(pathAToB.EndpointB.UpdateClient()) + } func TestTransferV2TestSuite(t *testing.T) { diff --git a/modules/core/04-channel/keeper/keeper.go b/modules/core/04-channel/keeper/keeper.go index eb7b9017df7..11c39422e32 100644 --- a/modules/core/04-channel/keeper/keeper.go +++ b/modules/core/04-channel/keeper/keeper.go @@ -873,5 +873,6 @@ func (k *Keeper) GetV2Counterparty(ctx context.Context, portID, channelID string ClientId: connection.ClientId, MerklePathPrefix: merklePathPrefix, } + return counterparty, true } diff --git a/modules/core/keeper/msg_server_v2.go b/modules/core/keeper/msg_server_v2.go index adb710241ab..b57981036fc 100644 --- a/modules/core/keeper/msg_server_v2.go +++ b/modules/core/keeper/msg_server_v2.go @@ -27,7 +27,14 @@ func (k *Keeper) SendPacketV2(ctx context.Context, msg *channeltypesv2.MsgSendPa for _, pd := range msg.PacketData { cbs := k.PortKeeper.AppRouter.Route(pd.SourcePort) - err := cbs.OnSendPacketV2(ctx, msg.SourceId, sequence, msg.TimeoutTimestamp, pd.Payload, sdk.AccAddress(msg.Signer)) + + // TODO: is it safe to assume an sdk.AccAddress? + signer, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + return nil, err + } + + err = cbs.OnSendPacketV2(ctx, msg.SourceId, sequence, msg.TimeoutTimestamp, pd.Payload, signer) if err != nil { return nil, err } diff --git a/modules/core/packet-server/keeper/keeper.go b/modules/core/packet-server/keeper/keeper.go index 927c0fb9600..a80088f192a 100644 --- a/modules/core/packet-server/keeper/keeper.go +++ b/modules/core/packet-server/keeper/keeper.go @@ -72,7 +72,13 @@ func (k *Keeper) GetCounterpartyV2(ctx context.Context, portID, channelID, clien store := k.ChannelStore(ctx, clientID) bz := store.Get([]byte(types.CounterpartyKey)) if len(bz) == 0 { - return k.ChannelKeeper.GetV2Counterparty(ctx, portID, channelID) + cp, ok := k.ChannelKeeper.GetV2Counterparty(ctx, portID, clientID) + if !ok { + return types.Counterparty{}, false + } + k.SetCounterparty(ctx, channelID, cp) + //k.SetCounterparty(ctx, clientID, cp) + return cp, true } var counterparty types.Counterparty diff --git a/modules/core/packet-server/keeper/relay_v2.go b/modules/core/packet-server/keeper/relay_v2.go index 01ba5d9bdb4..2157c46e1a4 100644 --- a/modules/core/packet-server/keeper/relay_v2.go +++ b/modules/core/packet-server/keeper/relay_v2.go @@ -38,7 +38,7 @@ func (k Keeper) SendPacketV2( } // construct packet from given fields and channel state - packet := channeltypesv2.NewPacketV2(sequence, sourceID, counterparty.ClientId, timeoutTimestamp, data...) + packet := channeltypesv2.NewPacketV2(sequence, sourceID, "channel-1", timeoutTimestamp, data...) if err := packet.ValidateBasic(); err != nil { return 0, errorsmod.Wrapf(channeltypes.ErrInvalidPacket, "constructed packet failed basic validation: %v", err) @@ -82,13 +82,13 @@ func (k Keeper) RecvPacketV2( ) error { // Lookup counterparty associated with our channel and ensure // that the packet was indeed sent by our counterparty. - counterparty, ok := k.GetCounterparty(ctx, packet.DestinationId) + counterparty, ok := k.GetCounterpartyV2(ctx, packet.Data[0].DestinationPort, "channel-1", packet.DestinationId) if !ok { return errorsmod.Wrap(types.ErrCounterpartyNotFound, packet.DestinationId) } - if counterparty.ClientId != packet.SourceId { - return channeltypes.ErrInvalidChannelIdentifier - } + //if counterparty.ClientId != packet.SourceId { + // return channeltypes.ErrInvalidChannelIdentifier + //} sdkCtx := sdk.UnwrapSDKContext(ctx) // check if packet timed out by comparing it with the latest height of the chain @@ -101,7 +101,8 @@ func (k Keeper) RecvPacketV2( // 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. - _, found := k.ChannelKeeper.GetPacketReceipt(ctx, host.SentinelV2PortID, packet.DestinationId, packet.Sequence) + //_, found := k.ChannelKeeper.GetPacketReceipt(ctx, host.SentinelV2PortID, packet.DestinationId, packet.Sequence) + _, found := k.ChannelKeeper.GetPacketReceipt(ctx, packet.Data[0].DestinationPort, packet.DestinationId, packet.Sequence) if found { // TODO: figure out events // channelkeeper.EmitRecvPacketEventV2(ctx, packet, sentinelChannel(packet.DestinationChannel)) @@ -111,21 +112,22 @@ func (k Keeper) RecvPacketV2( return channeltypes.ErrNoOpMsg } - path := host.PacketCommitmentKey(host.SentinelV2PortID, packet.SourceId, packet.Sequence) + path := host.PacketCommitmentKey(host.SentinelV2PortID, counterparty.ClientId, packet.Sequence) + //path := host.PacketCommitmentKey(packet.Data[0].SourcePort, packet.SourceId, packet.Sequence) merklePath := types.BuildMerklePath(counterparty.MerklePathPrefix, path) commitment := channeltypes.CommitPacketV2(packet) if err := k.ClientKeeper.VerifyMembership( ctx, - packet.DestinationId, + counterparty.ClientId, proofHeight, 0, 0, proof, merklePath, commitment, ); err != nil { - return errorsmod.Wrapf(err, "failed packet commitment verification for client (%s)", packet.DestinationId) + return errorsmod.Wrapf(err, "failed packet commitment verification for client (%s)", counterparty.ClientId) } // Set Packet Receipt to prevent timeout from occurring on counterparty @@ -150,14 +152,16 @@ func (k Keeper) WriteAcknowledgementV2( // TODO: this should probably error out if any of the acks are async. // Lookup counterparty associated with our channel and ensure // that the packet was indeed sent by our counterparty. - counterparty, ok := k.GetCounterparty(ctx, packet.DestinationId) - if !ok { - return errorsmod.Wrap(types.ErrCounterpartyNotFound, packet.DestinationId) - } - - if counterparty.ClientId != packet.SourceId { - return channeltypes.ErrInvalidChannelIdentifier - } + //counterparty, ok := k.GetCounterparty(ctx, packet.DestinationId) + //if !ok { + // return errorsmod.Wrap(types.ErrCounterpartyNotFound, packet.DestinationId) + //} + + // TODO: how can we make this work if packet.SourceID is a channelID and counterparty has been stored + // under the key of a channelID? + //if counterparty.ClientId != packet.SourceId { + // return channeltypes.ErrInvalidChannelIdentifier + //} // NOTE: IBC app modules might have written the acknowledgement synchronously on // the OnRecvPacket callback so we need to check if the acknowledgement is already From e0aa8a7353b97d02cff9022b89f7699ce49a374c Mon Sep 17 00:00:00 2001 From: bznein Date: Thu, 19 Sep 2024 14:18:07 +0100 Subject: [PATCH 20/27] added constructors for MsgSendPacket and its fields --- modules/apps/transfer/transfer_v2_test.go | 26 +++++++------------- modules/core/04-channel/types/packet.go | 18 ++++++++++++++ modules/core/04-channel/v2/types/msgs.go | 18 ++++++++++++++ modules/core/keeper/msg_server_v2_test.go | 29 ++++------------------- 4 files changed, 49 insertions(+), 42 deletions(-) create mode 100644 modules/core/04-channel/v2/types/msgs.go diff --git a/modules/apps/transfer/transfer_v2_test.go b/modules/apps/transfer/transfer_v2_test.go index 7e8f785b3e7..66b11aaed73 100644 --- a/modules/apps/transfer/transfer_v2_test.go +++ b/modules/apps/transfer/transfer_v2_test.go @@ -1,6 +1,8 @@ package transfer_test import ( + "testing" + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/ibc-go/v9/modules/apps/transfer/types" @@ -8,7 +10,6 @@ import ( channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" channeltypesv2 "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types" host "github.com/cosmos/ibc-go/v9/modules/core/24-host" - "testing" testifysuite "github.com/stretchr/testify/suite" @@ -115,22 +116,12 @@ func (suite *TransferV2TestSuite) TestHandleMsgV2Transfer() { suite.Require().NoError(err) timeoutTimestamp := suite.chainB.GetTimeoutTimestamp() - msgSendPacket := &channeltypesv2.MsgSendPacket{ - SourceId: pathAToB.EndpointB.ChannelID, - TimeoutTimestamp: timeoutTimestamp, - PacketData: []channeltypes.PacketData{ - { - SourcePort: "transfer", - DestinationPort: "transfer", - Payload: channeltypes.Payload{ - Encoding: "json", - Version: types.V2, - Value: bz, - }, - }, - }, - Signer: suite.chainB.SenderAccount.GetAddress().String(), - } + msgSendPacket := channeltypesv2.NewMsgSendPacket( + pathAToB.EndpointB.ChannelID, + timeoutTimestamp, + suite.chainB.SenderAccount.GetAddress().String(), + *channeltypes.NewPacketData("transfer", "transfer", *channeltypes.NewPayload(types.V2, "json", bz)), + ) res, err = suite.chainB.SendMsgs(msgSendPacket) suite.Require().NoError(err) @@ -164,7 +155,6 @@ func (suite *TransferV2TestSuite) TestHandleMsgV2Transfer() { suite.Require().NoError(err) suite.Require().NotNil(res) suite.Require().NoError(pathAToB.EndpointB.UpdateClient()) - } func TestTransferV2TestSuite(t *testing.T) { diff --git a/modules/core/04-channel/types/packet.go b/modules/core/04-channel/types/packet.go index 6e564786c92..7691c8a6c9a 100644 --- a/modules/core/04-channel/types/packet.go +++ b/modules/core/04-channel/types/packet.go @@ -343,3 +343,21 @@ func ConvertPacketV1toV2(packet Packet) (PacketV2, error) { }, }, nil } + +// NewPayload constructs and returns a new payload. +func NewPayload(version, encoding string, value []byte) *Payload { + return &Payload{ + Version: version, + Encoding: encoding, + Value: value, + } +} + +// NewPacketData constructs and returns a new PacketData. +func NewPacketData(sourcePort, destPort string, payload Payload) *PacketData { + return &PacketData{ + SourcePort: sourcePort, + DestinationPort: destPort, + Payload: payload, + } +} diff --git a/modules/core/04-channel/v2/types/msgs.go b/modules/core/04-channel/v2/types/msgs.go new file mode 100644 index 00000000000..aa891900d68 --- /dev/null +++ b/modules/core/04-channel/v2/types/msgs.go @@ -0,0 +1,18 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + v1types "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" +) + +var _ sdk.Msg = (*MsgSendPacket)(nil) + +// NewMsgSendPacket constructs and returns a new MsgSendPacket. +func NewMsgSendPacket(sourceID string, timeoutTimestamp uint64, signer string, packetData ...v1types.PacketData) *MsgSendPacket { + return &MsgSendPacket{ + SourceId: sourceID, + TimeoutTimestamp: timeoutTimestamp, + PacketData: packetData, + Signer: signer, + } +} diff --git a/modules/core/keeper/msg_server_v2_test.go b/modules/core/keeper/msg_server_v2_test.go index 6dbf5b4b9bc..e98fa346719 100644 --- a/modules/core/keeper/msg_server_v2_test.go +++ b/modules/core/keeper/msg_server_v2_test.go @@ -18,31 +18,12 @@ func (suite *KeeperTestSuite) TestMsgServerV2PacketFlow() { timeoutTimestamp := suite.chainA.GetTimeoutTimestamp() - msg := &channeltypesv2.MsgSendPacket{ - SourceId: path.EndpointA.ClientID, - TimeoutTimestamp: timeoutTimestamp, - PacketData: []channeltypes.PacketData{ - { - SourcePort: mock.ModuleNameV2A, - DestinationPort: mock.ModuleNameV2A, - Payload: channeltypes.Payload{ - Version: mock.Version, - Encoding: "json", - Value: ibctesting.MockPacketData, - }, - }, - { - SourcePort: mock.ModuleNameV2B, - DestinationPort: mock.ModuleNameV2B, - Payload: channeltypes.Payload{ - Version: mock.Version, - Encoding: "json", - Value: ibctesting.MockPacketData, - }, - }, - }, - Signer: suite.chainA.SenderAccount.GetAddress().String(), + payload := channeltypes.NewPayload(mock.Version, "json", ibctesting.MockPacketData) + packetData := []channeltypes.PacketData{ + *channeltypes.NewPacketData(mock.ModuleNameV2A, mock.ModuleNameV2A, *payload), + *channeltypes.NewPacketData(mock.ModuleNameV2B, mock.ModuleNameV2B, *payload), } + msg := channeltypesv2.NewMsgSendPacket(path.EndpointA.ClientID, timeoutTimestamp, suite.chainA.SenderAccount.GetAddress().String(), packetData...) res, err := suite.chainA.SendMsgs(msg) suite.Require().NoError(err) From 382a08df15277fd85f8f6dc82683c9c0099800b8 Mon Sep 17 00:00:00 2001 From: bznein Date: Thu, 19 Sep 2024 14:21:33 +0100 Subject: [PATCH 21/27] use constructor for FungibleTokenPacketDataV2 in test --- modules/apps/transfer/transfer_v2_test.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/modules/apps/transfer/transfer_v2_test.go b/modules/apps/transfer/transfer_v2_test.go index 66b11aaed73..45932489d7a 100644 --- a/modules/apps/transfer/transfer_v2_test.go +++ b/modules/apps/transfer/transfer_v2_test.go @@ -98,19 +98,15 @@ func (suite *TransferV2TestSuite) TestHandleMsgV2Transfer() { suite.Require().NoError(pathAToB.EndpointB.UpdateClient()) suite.Require().NoError(pathAToB.EndpointA.UpdateClient()) - ftpd := types.FungibleTokenPacketDataV2{ - Tokens: []types.Token{ + ftpd := types.NewFungibleTokenPacketDataV2( + []types.Token{ { // "transfer/channel-0/stake" Denom: types.NewDenom(sdk.DefaultBondDenom, traceAToB), Amount: "100", }, - }, - Sender: suite.chainB.SenderAccount.GetAddress().String(), - Receiver: suite.chainA.SenderAccount.GetAddress().String(), - Memo: "", - Forwarding: types.ForwardingPacketData{}, - } + }, suite.chainB.SenderAccount.GetAddress().String(), suite.chainA.SenderAccount.GetAddress().String(), "", types.ForwardingPacketData{}, + ) bz, err := suite.chainB.Codec.Marshal(&ftpd) suite.Require().NoError(err) From 213e5adfa344cab094332c21a571111d472591d3 Mon Sep 17 00:00:00 2001 From: bznein Date: Thu, 19 Sep 2024 14:23:02 +0100 Subject: [PATCH 22/27] use consturctor for PacketData in test --- modules/apps/transfer/transfer_v2_test.go | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/modules/apps/transfer/transfer_v2_test.go b/modules/apps/transfer/transfer_v2_test.go index 45932489d7a..ec7c5c4ec00 100644 --- a/modules/apps/transfer/transfer_v2_test.go +++ b/modules/apps/transfer/transfer_v2_test.go @@ -130,15 +130,8 @@ func (suite *TransferV2TestSuite) TestHandleMsgV2Transfer() { suite.Require().NotNil(proof) suite.Require().False(proofHeight.IsZero()) - packetV2 := channeltypesv2.NewPacketV2(1, pathAToB.EndpointB.ChannelID, pathAToB.EndpointA.ChannelID, timeoutTimestamp, channeltypes.PacketData{ - SourcePort: "transfer", - DestinationPort: "transfer", - Payload: channeltypes.Payload{ - Version: types.V2, - Encoding: "json", - Value: bz, - }, - }) + packetV2 := channeltypesv2.NewPacketV2(1, pathAToB.EndpointB.ChannelID, pathAToB.EndpointA.ChannelID, timeoutTimestamp, + *channeltypes.NewPacketData("transfer", "transfer", *channeltypes.NewPayload(types.V2, "json", bz))) msgRecvPacket := &channeltypesv2.MsgRecvPacket{ Packet: packetV2, From 3ba3b6fe148cf115d8769575af36d69800fe391e Mon Sep 17 00:00:00 2001 From: bznein Date: Thu, 19 Sep 2024 14:26:34 +0100 Subject: [PATCH 23/27] add constructor for MsgRecvPacket --- modules/apps/transfer/transfer_v2_test.go | 7 +------ modules/core/04-channel/v2/types/msgs.go | 12 ++++++++++++ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/modules/apps/transfer/transfer_v2_test.go b/modules/apps/transfer/transfer_v2_test.go index ec7c5c4ec00..360e863c60d 100644 --- a/modules/apps/transfer/transfer_v2_test.go +++ b/modules/apps/transfer/transfer_v2_test.go @@ -133,12 +133,7 @@ func (suite *TransferV2TestSuite) TestHandleMsgV2Transfer() { packetV2 := channeltypesv2.NewPacketV2(1, pathAToB.EndpointB.ChannelID, pathAToB.EndpointA.ChannelID, timeoutTimestamp, *channeltypes.NewPacketData("transfer", "transfer", *channeltypes.NewPayload(types.V2, "json", bz))) - msgRecvPacket := &channeltypesv2.MsgRecvPacket{ - Packet: packetV2, - ProofCommitment: proof, - ProofHeight: proofHeight, - Signer: suite.chainA.SenderAccount.GetAddress().String(), - } + msgRecvPacket := channeltypesv2.NewMsgRecvPacket(packetV2, proof, proofHeight, suite.chainA.SenderAccount.GetAddress().String()) res, err = suite.chainA.SendMsgs(msgRecvPacket) suite.Require().NoError(err) diff --git a/modules/core/04-channel/v2/types/msgs.go b/modules/core/04-channel/v2/types/msgs.go index aa891900d68..a2013e8bd7d 100644 --- a/modules/core/04-channel/v2/types/msgs.go +++ b/modules/core/04-channel/v2/types/msgs.go @@ -2,6 +2,8 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" + + clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" v1types "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" ) @@ -16,3 +18,13 @@ func NewMsgSendPacket(sourceID string, timeoutTimestamp uint64, signer string, p Signer: signer, } } + +// NewMsgRecvPacket constructs and returns a new MsgRecvPacket +func NewMsgRecvPacket(packet v1types.PacketV2, proofCommitment []byte, proofHeight clienttypes.Height, signer string) *MsgRecvPacket { + return &MsgRecvPacket{ + Packet: packet, + ProofCommitment: proofCommitment, + ProofHeight: proofHeight, + Signer: signer, + } +} From 9d0ff03b8e38a12e3b30fb68db8f10131374fdeb Mon Sep 17 00:00:00 2001 From: bznein Date: Thu, 19 Sep 2024 14:27:59 +0100 Subject: [PATCH 24/27] Use consutrctor for MsgRecvPacket in test --- modules/core/keeper/msg_server_v2_test.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/modules/core/keeper/msg_server_v2_test.go b/modules/core/keeper/msg_server_v2_test.go index e98fa346719..84cadd120b3 100644 --- a/modules/core/keeper/msg_server_v2_test.go +++ b/modules/core/keeper/msg_server_v2_test.go @@ -42,12 +42,7 @@ func (suite *KeeperTestSuite) TestMsgServerV2PacketFlow() { suite.Require().False(proofHeight.IsZero()) // RecvPacket - recvMsg := &channeltypesv2.MsgRecvPacket{ - Packet: packet, - ProofCommitment: proof, - ProofHeight: proofHeight, - Signer: suite.chainB.SenderAccount.GetAddress().String(), - } + recvMsg := channeltypesv2.NewMsgRecvPacket(packet, proof, proofHeight, suite.chainB.SenderAccount.GetAddress().String()) recvPacketResponse, err := path.EndpointB.Chain.SendMsgs(recvMsg) From a0049293354bf1e45b831bbb1c84d8a8045fad46 Mon Sep 17 00:00:00 2001 From: bznein Date: Thu, 19 Sep 2024 14:31:32 +0100 Subject: [PATCH 25/27] Add constructor for MsgAcknowledgement --- modules/core/04-channel/v2/types/msgs.go | 11 +++++++++++ modules/core/keeper/msg_server_v2_test.go | 8 +------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/modules/core/04-channel/v2/types/msgs.go b/modules/core/04-channel/v2/types/msgs.go index a2013e8bd7d..c7b84770ed4 100644 --- a/modules/core/04-channel/v2/types/msgs.go +++ b/modules/core/04-channel/v2/types/msgs.go @@ -28,3 +28,14 @@ func NewMsgRecvPacket(packet v1types.PacketV2, proofCommitment []byte, proofHeig Signer: signer, } } + +// NewMsgAcknowledgement constructs and returns a new MsgAcknowledgement +func NewMsgAcknoweldgement(packet v1types.PacketV2, multiAck v1types.MultiAcknowledgement, proofAcked []byte, proofHeight clienttypes.Height, signer string) *MsgAcknowledgement { + return &MsgAcknowledgement{ + Packet: packet, + MultiAcknowledgement: multiAck, + ProofAcked: proofAcked, + ProofHeight: proofHeight, + Signer: signer, + } +} diff --git a/modules/core/keeper/msg_server_v2_test.go b/modules/core/keeper/msg_server_v2_test.go index 84cadd120b3..6a730a9abe5 100644 --- a/modules/core/keeper/msg_server_v2_test.go +++ b/modules/core/keeper/msg_server_v2_test.go @@ -82,13 +82,7 @@ func (suite *KeeperTestSuite) TestMsgServerV2PacketFlow() { packetKey = host.PacketAcknowledgementKey(host.SentinelV2PortID, packet.DestinationId, packet.GetSequence()) proof, proofHeight = path.EndpointB.QueryProof(packetKey) - msgAck := &channeltypesv2.MsgAcknowledgement{ - Packet: packet, - MultiAcknowledgement: expectedAck, - ProofAcked: proof, - ProofHeight: proofHeight, - Signer: suite.chainA.SenderAccount.GetAddress().String(), - } + msgAck := channeltypesv2.NewMsgAcknoweldgement(packet, expectedAck, proof, proofHeight, suite.chainA.SenderAccount.GetAddress().String()) ackPacketResponse, err := path.EndpointA.Chain.SendMsgs(msgAck) suite.Require().NoError(path.EndpointB.UpdateClient()) From 4de5e727e8d062ebc84d5e2dab78df656b1706a7 Mon Sep 17 00:00:00 2001 From: Nikolas De Giorgis Date: Thu, 19 Sep 2024 16:30:31 +0100 Subject: [PATCH 26/27] [WIP - POC] revert transfer test (#7315) * revert transfer test * revert additional commit * delete files * remove multiack v1 logic * remove getcounterpartyv2 * revert packetv1 to packetv2 conversions --- modules/apps/transfer/ibc_module_v2.go | 169 ------------ modules/apps/transfer/keeper/export_test.go | 5 + modules/apps/transfer/keeper/keeper.go | 46 +--- modules/apps/transfer/keeper/msg_server.go | 2 +- modules/apps/transfer/keeper/relay.go | 48 +--- modules/apps/transfer/keeper/relay_v2.go | 247 ------------------ modules/apps/transfer/transfer_v2_test.go | 146 ----------- modules/core/04-channel/keeper/keeper.go | 27 -- modules/core/04-channel/keeper/packet.go | 15 -- modules/core/keeper/msg_server_v2.go | 9 +- modules/core/packet-server/keeper/keeper.go | 19 -- modules/core/packet-server/keeper/relay.go | 96 +++---- .../core/packet-server/keeper/relay_test.go | 13 +- modules/core/packet-server/keeper/relay_v2.go | 43 ++- .../packet-server/types/expected_keepers.go | 3 +- testing/simapp/app.go | 4 +- 16 files changed, 73 insertions(+), 819 deletions(-) delete mode 100644 modules/apps/transfer/ibc_module_v2.go delete mode 100644 modules/apps/transfer/keeper/relay_v2.go delete mode 100644 modules/apps/transfer/transfer_v2_test.go diff --git a/modules/apps/transfer/ibc_module_v2.go b/modules/apps/transfer/ibc_module_v2.go deleted file mode 100644 index 623beeaa32b..00000000000 --- a/modules/apps/transfer/ibc_module_v2.go +++ /dev/null @@ -1,169 +0,0 @@ -package transfer - -import ( - "context" - "fmt" - - errorsmod "cosmossdk.io/errors" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/cosmos/ibc-go/v9/modules/apps/transfer/internal/events" - "github.com/cosmos/ibc-go/v9/modules/apps/transfer/keeper" - "github.com/cosmos/ibc-go/v9/modules/apps/transfer/types" - channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" - porttypes "github.com/cosmos/ibc-go/v9/modules/core/05-port/types" - ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors" -) - -var _ porttypes.IBCModuleV2 = (*IBCModuleV2)(nil) - -// IBCModuleV2 implements the ICS26 interface for transfer given the transfer keeper. -type IBCModuleV2 struct { - keeper keeper.Keeper -} - -// NewIBCModule creates a new IBCModule given the keeper -func NewIBCModuleV2(k keeper.Keeper) *IBCModuleV2 { - return &IBCModuleV2{ - keeper: k, - } -} - -// OnSendPacketV2 implements the IBCModuleV2 interface. -func (im *IBCModuleV2) OnSendPacketV2( - ctx context.Context, - sourceID string, - sequence uint64, - timeoutTimestamp uint64, - payload channeltypes.Payload, - signer sdk.AccAddress, -) error { - if !im.keeper.GetParams(ctx).SendEnabled { - return types.ErrSendDisabled - } - if im.keeper.IsBlockedAddr(signer) { - return errorsmod.Wrapf(ibcerrors.ErrUnauthorized, "%s is not allowed to send funds", signer) - } - - data, err := types.UnmarshalPacketData(payload.Value, payload.Version) - if err != nil { - return err - } - - // If the ics20version is V1, we can't have multiple tokens nor forwarding info. - // However, we do not need to check it here, as a packet containing that data would - // fail the unmarshaling above, where if ics20version == types.V1 we first unmarshal - // into a V1 packet and then convert. - - if data.Sender != signer.String() { - return errorsmod.Wrapf(ibcerrors.ErrInvalidAddress, "invalid signer address: expected %s, got %s", data.Sender, signer) - } - - return im.keeper.OnSendPacket(ctx, sourceID, data, signer) -} - -// OnRecvPacketV2 implements the IBCModuleV2 interface. A successful acknowledgement -// is returned if the packet data is successfully decoded and the receive application -// logic returns without error. -// A nil acknowledgement may be returned when using the packet forwarding feature. This signals to core IBC that the acknowledgement will be written asynchronously. -func (im IBCModuleV2) OnRecvPacketV2( - ctx context.Context, - packet channeltypes.PacketV2, - payload channeltypes.Payload, - relayer sdk.AccAddress, -) channeltypes.RecvPacketResult { - var ( - ackErr error - data types.FungibleTokenPacketDataV2 - ) - - ack := channeltypes.NewResultAcknowledgement([]byte{byte(1)}) - - // we are explicitly wrapping this emit event call in an anonymous function so that - // the packet data is evaluated after it has been assigned a value. - // defer func() { - // events.EmitOnRecvPacketEvent(ctx, data, ack, ackErr) - // }() - - data, ackErr = types.UnmarshalPacketData(payload.Value, payload.Version) - if ackErr != nil { - ack = channeltypes.NewErrorAcknowledgement(ackErr) - im.keeper.Logger(ctx).Error(fmt.Sprintf("%s sequence %d", ackErr.Error(), packet.Sequence)) - return channeltypes.RecvPacketResult{ - Status: channeltypes.PacketStatus_Failure, - Acknowledgement: ack.Acknowledgement(), - } - } - - if ackErr = im.keeper.OnRecvPacketV2(ctx, packet, payload, data); ackErr != nil { - ack = channeltypes.NewErrorAcknowledgement(ackErr) - im.keeper.Logger(ctx).Error(fmt.Sprintf("%s sequence %d", ackErr.Error(), packet.Sequence)) - return channeltypes.RecvPacketResult{ - Status: channeltypes.PacketStatus_Failure, - Acknowledgement: ack.Acknowledgement(), - } - } - - im.keeper.Logger(ctx).Info("successfully handled ICS-20 packet", "sequence", packet.Sequence) - - if data.HasForwarding() { - // NOTE: acknowledgement will be written asynchronously - return channeltypes.RecvPacketResult{ - Status: channeltypes.PacketStatus_Async, - } - } - - // NOTE: acknowledgement will be written synchronously during IBC handler execution. - return channeltypes.RecvPacketResult{ - Status: channeltypes.PacketStatus_Success, - Acknowledgement: ack.Acknowledgement(), - } -} - -func (im IBCModuleV2) OnAcknowledgementPacketV2( - ctx context.Context, - packet channeltypes.PacketV2, - payload channeltypes.Payload, - recvPacketResult channeltypes.RecvPacketResult, - relayer sdk.AccAddress, -) error { - // TODO: use the recvPacketResult directly, don't need to unmarshal the acknowledgement - var ack channeltypes.Acknowledgement - if err := types.ModuleCdc.UnmarshalJSON(recvPacketResult.Acknowledgement, &ack); err != nil { - return errorsmod.Wrapf(ibcerrors.ErrUnknownRequest, "cannot unmarshal ICS-20 transfer packet acknowledgement: %v", err) - } - - data, err := types.UnmarshalPacketData(payload.Value, payload.Version) - if err != nil { - return err - } - - if err := im.keeper.OnAcknowledgementPacketV2(ctx, packet, data, ack); err != nil { - return err - } - - events.EmitOnAcknowledgementPacketEvent(ctx, data, ack) - - return nil -} - -func (im IBCModuleV2) OnTimeoutPacketV2( - ctx context.Context, - packet channeltypes.PacketV2, - payload channeltypes.Payload, - relayer sdk.AccAddress, -) error { - data, err := types.UnmarshalPacketData(payload.Value, payload.Version) - if err != nil { - return err - } - - // refund tokens - if err := im.keeper.OnTimeoutPacketV2(ctx, packet, data); err != nil { - return err - } - - events.EmitOnTimeoutEvent(ctx, data) - return nil -} diff --git a/modules/apps/transfer/keeper/export_test.go b/modules/apps/transfer/keeper/export_test.go index dedfd560b9b..5efd6a85910 100644 --- a/modules/apps/transfer/keeper/export_test.go +++ b/modules/apps/transfer/keeper/export_test.go @@ -54,6 +54,11 @@ func (k Keeper) GetAllForwardedPackets(ctx sdk.Context) []types.ForwardedPacket return k.getAllForwardedPackets(ctx) } +// IsBlockedAddr is a wrapper around isBlockedAddr for testing purposes +func (k Keeper) IsBlockedAddr(addr sdk.AccAddress) bool { + return k.isBlockedAddr(addr) +} + // CreatePacketDataBytesFromVersion is a wrapper around createPacketDataBytesFromVersion for testing purposes func CreatePacketDataBytesFromVersion(appVersion, sender, receiver, memo string, tokens types.Tokens, hops []types.Hop) ([]byte, error) { return createPacketDataBytesFromVersion(appVersion, sender, receiver, memo, tokens, hops) diff --git a/modules/apps/transfer/keeper/keeper.go b/modules/apps/transfer/keeper/keeper.go index 604c9869d80..1ebb14ace71 100644 --- a/modules/apps/transfer/keeper/keeper.go +++ b/modules/apps/transfer/keeper/keeper.go @@ -24,7 +24,6 @@ import ( porttypes "github.com/cosmos/ibc-go/v9/modules/core/05-port/types" host "github.com/cosmos/ibc-go/v9/modules/core/24-host" "github.com/cosmos/ibc-go/v9/modules/core/exported" - packetserverkeeper "github.com/cosmos/ibc-go/v9/modules/core/packet-server/keeper" ) // Keeper defines the IBC fungible transfer keeper @@ -33,51 +32,16 @@ type Keeper struct { cdc codec.BinaryCodec legacySubspace types.ParamSubspace - ics4Wrapper porttypes.ICS4Wrapper - channelKeeper types.ChannelKeeper - authKeeper types.AccountKeeper - bankKeeper types.BankKeeper - packetServerKeeper packetserverkeeper.Keeper + ics4Wrapper porttypes.ICS4Wrapper + channelKeeper types.ChannelKeeper + authKeeper types.AccountKeeper + bankKeeper types.BankKeeper // the address capable of executing a MsgUpdateParams message. Typically, this // should be the x/gov module account. authority string } -// NewKeeperWithPacketServer creates a new IBC transfer Keeper instance -func NewKeeperWithPacketServer( - cdc codec.BinaryCodec, - storeService corestore.KVStoreService, - legacySubspace types.ParamSubspace, - ics4Wrapper porttypes.ICS4Wrapper, - channelKeeper types.ChannelKeeper, - authKeeper types.AccountKeeper, - bankKeeper types.BankKeeper, - packetserverKeeper packetserverkeeper.Keeper, - authority string, -) Keeper { - // ensure ibc transfer module account is set - if addr := authKeeper.GetModuleAddress(types.ModuleName); addr == nil { - panic(errors.New("the IBC transfer module account has not been set")) - } - - if strings.TrimSpace(authority) == "" { - panic(errors.New("authority must be non-empty")) - } - - return Keeper{ - cdc: cdc, - storeService: storeService, - legacySubspace: legacySubspace, - ics4Wrapper: ics4Wrapper, - channelKeeper: channelKeeper, - authKeeper: authKeeper, - bankKeeper: bankKeeper, - authority: authority, - packetServerKeeper: packetserverKeeper, - } -} - // NewKeeper creates a new IBC transfer Keeper instance func NewKeeper( cdc codec.BinaryCodec, @@ -421,7 +385,7 @@ func (k Keeper) iterateForwardedPackets(ctx context.Context, cb func(packet type // IsBlockedAddr checks if the given address is allowed to send or receive tokens. // The module account is always allowed to send and receive tokens. -func (k Keeper) IsBlockedAddr(addr sdk.AccAddress) bool { +func (k Keeper) isBlockedAddr(addr sdk.AccAddress) bool { moduleAddr := k.authKeeper.GetModuleAddress(types.ModuleName) if addr.Equals(moduleAddr) { return false diff --git a/modules/apps/transfer/keeper/msg_server.go b/modules/apps/transfer/keeper/msg_server.go index b93299475a7..b0cb57398b7 100644 --- a/modules/apps/transfer/keeper/msg_server.go +++ b/modules/apps/transfer/keeper/msg_server.go @@ -33,7 +33,7 @@ func (k Keeper) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*types. return nil, errorsmod.Wrapf(types.ErrSendDisabled, err.Error()) } - if k.IsBlockedAddr(sender) { + if k.isBlockedAddr(sender) { return nil, errorsmod.Wrapf(ibcerrors.ErrUnauthorized, "%s is not allowed to send funds", sender) } diff --git a/modules/apps/transfer/keeper/relay.go b/modules/apps/transfer/keeper/relay.go index e251fe1cf15..71ef740132c 100644 --- a/modules/apps/transfer/keeper/relay.go +++ b/modules/apps/transfer/keeper/relay.go @@ -178,7 +178,7 @@ func (k Keeper) OnRecvPacket(ctx context.Context, packet channeltypes.Packet, da return err } - if k.IsBlockedAddr(receiver) { + if k.isBlockedAddr(receiver) { return errorsmod.Wrapf(ibcerrors.ErrUnauthorized, "%s is not allowed to receive funds", receiver) } @@ -346,7 +346,7 @@ func (k Keeper) refundPacketTokens(ctx context.Context, packet channeltypes.Pack if err != nil { return err } - if k.IsBlockedAddr(sender) { + if k.isBlockedAddr(sender) { return errorsmod.Wrapf(ibcerrors.ErrUnauthorized, "%s is not allowed to receive funds", sender) } @@ -383,50 +383,6 @@ func (k Keeper) refundPacketTokens(ctx context.Context, packet channeltypes.Pack return nil } -func (k Keeper) refundPacketTokensV2(ctx context.Context, packet channeltypes.PacketV2, data types.FungibleTokenPacketDataV2) error { - // NOTE: packet data type already checked in handler.go - - sender, err := sdk.AccAddressFromBech32(data.Sender) - if err != nil { - return err - } - if k.IsBlockedAddr(sender) { - return errorsmod.Wrapf(ibcerrors.ErrUnauthorized, "%s is not allowed to receive funds", sender) - } - - // escrow address for unescrowing tokens back to sender - escrowAddress := types.GetEscrowAddress(types.ModuleName, packet.SourceId) - - moduleAccountAddr := k.authKeeper.GetModuleAddress(types.ModuleName) - for _, token := range data.Tokens { - coin, err := token.ToCoin() - if err != nil { - return err - } - - // if the token we must refund is prefixed by the source port and channel - // then the tokens were burnt when the packet was sent and we must mint new tokens - if token.Denom.HasPrefix(types.ModuleName, packet.SourceId) { - // mint vouchers back to sender - if err := k.bankKeeper.MintCoins( - ctx, types.ModuleName, sdk.NewCoins(coin), - ); err != nil { - return err - } - - if err := k.bankKeeper.SendCoins(ctx, moduleAccountAddr, sender, sdk.NewCoins(coin)); err != nil { - panic(fmt.Errorf("unable to send coins from module to account despite previously minting coins to module account: %v", err)) - } - } else { - if err := k.unescrowCoin(ctx, escrowAddress, sender, coin); err != nil { - return err - } - } - } - - return nil -} - // escrowCoin will send the given coin from the provided sender to the escrow address. It will also // update the total escrowed amount by adding the escrowed coin's amount to the current total escrow. func (k Keeper) escrowCoin(ctx context.Context, sender, escrowAddress sdk.AccAddress, coin sdk.Coin) error { diff --git a/modules/apps/transfer/keeper/relay_v2.go b/modules/apps/transfer/keeper/relay_v2.go deleted file mode 100644 index a02db5b5d84..00000000000 --- a/modules/apps/transfer/keeper/relay_v2.go +++ /dev/null @@ -1,247 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - errorsmod "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/ibc-go/v9/modules/apps/transfer/internal/events" - "github.com/cosmos/ibc-go/v9/modules/apps/transfer/types" - channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" - ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors" -) - -func (k Keeper) OnRecvPacketV2(ctx context.Context, packet channeltypes.PacketV2, payload channeltypes.Payload, data types.FungibleTokenPacketDataV2) error { - // validate packet data upon receiving - if err := data.ValidateBasic(); err != nil { - return errorsmod.Wrapf(err, "error validating ICS-20 transfer packet data") - } - - if !k.GetParams(ctx).ReceiveEnabled { - return types.ErrReceiveDisabled - } - - receiver, err := k.getReceiverFromPacketData(data) - if err != nil { - return err - } - - if k.IsBlockedAddr(receiver) { - return errorsmod.Wrapf(ibcerrors.ErrUnauthorized, "%s is not allowed to receive funds", receiver) - } - - receivedCoins := make(sdk.Coins, 0, len(data.Tokens)) - for _, token := range data.Tokens { - // parse the transfer amount - transferAmount, ok := sdkmath.NewIntFromString(token.Amount) - if !ok { - return errorsmod.Wrapf(types.ErrInvalidAmount, "unable to parse transfer amount: %s", token.Amount) - } - - // This is the prefix that would have been prefixed to the denomination - // on sender chain IF and only if the token originally came from the - // receiving chain. - // - // NOTE: We use SourcePort and SourceChannel here, because the counterparty - // chain would have prefixed with DestPort and DestChannel when originally - // receiving this token. - // TODO figure out what to use for source port in denom trace - if token.Denom.HasPrefix(types.ModuleName, packet.GetSourceId()) { - // sender chain is not the source, unescrow tokens - - // remove prefix added by sender chain - token.Denom.Trace = token.Denom.Trace[1:] - - coin := sdk.NewCoin(token.Denom.IBCDenom(), transferAmount) - - escrowAddress := types.GetEscrowAddress(types.ModuleName, packet.DestinationId) - if err := k.unescrowCoin(ctx, escrowAddress, receiver, coin); err != nil { - return err - } - - // Appending token. The new denom has been computed - receivedCoins = append(receivedCoins, coin) - } else { - // sender chain is the source, mint vouchers - - // since SendPacket did not prefix the denomination, we must add the destination port and channel to the trace - trace := []types.Hop{types.NewHop(types.ModuleName, packet.DestinationId)} - token.Denom.Trace = append(trace, token.Denom.Trace...) - - if !k.HasDenom(ctx, token.Denom.Hash()) { - k.SetDenom(ctx, token.Denom) - } - - voucherDenom := token.Denom.IBCDenom() - if !k.bankKeeper.HasDenomMetaData(ctx, voucherDenom) { - k.setDenomMetadata(ctx, token.Denom) - } - - events.EmitDenomEvent(ctx, token) - - voucher := sdk.NewCoin(voucherDenom, transferAmount) - - // mint new tokens if the source of the transfer is the same chain - if err := k.bankKeeper.MintCoins( - ctx, types.ModuleName, sdk.NewCoins(voucher), - ); err != nil { - return errorsmod.Wrap(err, "failed to mint IBC tokens") - } - - // send to receiver - moduleAddr := k.authKeeper.GetModuleAddress(types.ModuleName) - if err := k.bankKeeper.SendCoins( - ctx, moduleAddr, receiver, sdk.NewCoins(voucher), - ); err != nil { - return errorsmod.Wrapf(err, "failed to send coins to receiver %s", receiver.String()) - } - - receivedCoins = append(receivedCoins, voucher) - } - } - - // if data.HasForwarding() { - // // we are now sending from the forward escrow address to the final receiver address. - // if err := k.forwardPacketV2(ctx, data, packet, receivedCoins); err != nil { - // return err - // } - // } - - // telemetry.ReportOnRecvPacketV2(packet, data.Tokens) - - // The ibc_module.go module will return the proper ack. - return nil -} - -func (k Keeper) OnAcknowledgementPacketV2(ctx context.Context, packet channeltypes.PacketV2, data types.FungibleTokenPacketDataV2, ack channeltypes.Acknowledgement) error { - // forwardedPacket, isForwarded := k.getForwardedPacketV2(ctx, packet.SourcePort, packet.SourceChannel, packet.Sequence) - - switch ack.Response.(type) { - case *channeltypes.Acknowledgement_Result: - // if isForwarded { - // // Write a successful async ack for the forwardedPacket - // forwardAck := channeltypes.NewResultAcknowledgement([]byte{byte(1)}) - // return k.acknowledgeForwardedPacketV2(ctx, forwardedPacket, packet, forwardAck) - // } - - // the acknowledgement succeeded on the receiving chain so nothing - // needs to be executed and no error needs to be returned - return nil - case *channeltypes.Acknowledgement_Error: - // We refund the tokens from the escrow address to the sender - if err := k.refundPacketTokensV2(ctx, packet, data); err != nil { - return err - } - // if isForwarded { - // // the forwarded packet has failed, thus the funds have been refunded to the intermediate address. - // // we must revert the changes that came from successfully receiving the tokens on our chain - // // before propagating the error acknowledgement back to original sender chain - // if err := k.revertForwardedPacketV2(ctx, forwardedPacket, data); err != nil { - // return err - // } - - // forwardAck := internaltypes.NewForwardErrorAcknowledgementV2(packet, ack) - // return k.acknowledgeForwardedPacketV2(ctx, forwardedPacket, packet, forwardAck) - // } - - return nil - default: - return errorsmod.Wrapf(ibcerrors.ErrInvalidType, "expected one of [%T, %T], got %T", channeltypes.Acknowledgement_Result{}, channeltypes.Acknowledgement_Error{}, ack.Response) - } -} - -func (k Keeper) OnTimeoutPacketV2(ctx context.Context, packet channeltypes.PacketV2, data types.FungibleTokenPacketDataV2) error { - if err := k.refundPacketTokensV2(ctx, packet, data); err != nil { - return err - } - - // forwardedPacket, isForwarded := k.getForwardedPacketV2(ctx, packet.SourcePort, packet.SourceChannel, packet.Sequence) - // if isForwarded { - // if err := k.revertForwardedPacketV2(ctx, forwardedPacket, data); err != nil { - // return err - // } - - // forwardAck := internaltypes.NewForwardTimeoutAcknowledgementV2(packet) - // return k.acknowledgeForwardedPacketV2(ctx, forwardedPacket, packet, forwardAck) - // } - - return nil -} - -func (k Keeper) OnSendPacket( - ctx context.Context, - sourceID string, - packetData types.FungibleTokenPacketDataV2, - sender sdk.AccAddress, -) error { - var coins sdk.Coins - for _, token := range packetData.Tokens { - transferAmount, ok := sdkmath.NewIntFromString(token.Amount) - if !ok { - return errorsmod.Wrapf(types.ErrInvalidAmount, "unable to parse transfer amount: %s", token.Amount) - } - - coins = append(coins, sdk.NewCoin(token.Denom.IBCDenom(), transferAmount)) - } - - if err := k.bankKeeper.IsSendEnabledCoins(ctx, coins...); err != nil { - return errorsmod.Wrapf(types.ErrSendDisabled, err.Error()) - } - - // begin createOutgoingPacket logic - // See spec for this logic: https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#packet-relay - tokens := make([]types.Token, 0, len(coins)) - - sdkCtx := sdk.UnwrapSDKContext(ctx) - for _, coin := range coins { - // Using types.UnboundedSpendLimit allows us to send the entire balance of a given denom. - if coin.Amount.Equal(types.UnboundedSpendLimit()) { - coin.Amount = k.bankKeeper.GetBalance(ctx, sender, coin.Denom).Amount - } - - token, err := k.tokenFromCoin(sdkCtx, coin) - if err != nil { - return err - } - - // NOTE: SendTransfer simply sends the denomination as it exists on its own - // chain inside the packet data. The receiving chain will perform denom - // prefixing as necessary. - - // if the denom is prefixed by the port and channel on which we are sending - // the token, then we must be returning the token back to the chain they originated from - if token.Denom.HasPrefix(types.ModuleName, sourceID) { - // transfer the coins to the module account and burn them - if err := k.bankKeeper.SendCoinsFromAccountToModule( - ctx, sender, types.ModuleName, sdk.NewCoins(coin), - ); err != nil { - return err - } - - if err := k.bankKeeper.BurnCoins( - ctx, types.ModuleName, sdk.NewCoins(coin), - ); err != nil { - // NOTE: should not happen as the module account was - // retrieved on the step above and it has enough balance - // to burn. - panic(fmt.Errorf("cannot burn coins after a successful send to a module account: %v", err)) - } - } else { - // obtain the escrow address for the source channel end - escrowAddress := types.GetEscrowAddress(types.ModuleName, sourceID) - if err := k.escrowCoin(ctx, sender, escrowAddress, coin); err != nil { - return err - } - } - - tokens = append(tokens, token) - } - - // events.EmitTransferEvent(ctx, sender.String(), packetData.Receiver, tokens, packetData.Memo, packetData.Forwarding.Hops) - - // telemetry.ReportTransfer(sourcePort, sourceChannel, destinationPort, destinationChannel, tokens) - - return nil -} diff --git a/modules/apps/transfer/transfer_v2_test.go b/modules/apps/transfer/transfer_v2_test.go deleted file mode 100644 index 360e863c60d..00000000000 --- a/modules/apps/transfer/transfer_v2_test.go +++ /dev/null @@ -1,146 +0,0 @@ -package transfer_test - -import ( - "testing" - - sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/ibc-go/v9/modules/apps/transfer/types" - clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" - channeltypesv2 "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" - - testifysuite "github.com/stretchr/testify/suite" - - ibctesting "github.com/cosmos/ibc-go/v9/testing" -) - -type TransferV2TestSuite struct { - testifysuite.Suite - - coordinator *ibctesting.Coordinator - - // testing chains used for convenience and readability - chainA *ibctesting.TestChain - chainB *ibctesting.TestChain - chainC *ibctesting.TestChain -} - -func (suite *TransferV2TestSuite) SetupTest() { - suite.coordinator = ibctesting.NewCoordinator(suite.T(), 3) - suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1)) - suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(2)) - suite.chainC = suite.coordinator.GetChain(ibctesting.GetChainID(3)) -} - -// Constructs the following sends based on the established channels/connections -// 1 - from chainA to chainB -// 2 - from chainB to chainC -// 3 - from chainC to chainB -func (suite *TransferV2TestSuite) TestHandleMsgV2Transfer() { - suite.SetupTest() // reset - - // setup between chainA and chainB - // NOTE: - // pathAToB.EndpointA = endpoint on chainA - // pathAToB.EndpointB = endpoint on chainB - pathAToB := ibctesting.NewTransferPath(suite.chainA, suite.chainB) - pathAToB.Setup() - traceAToB := types.NewHop(pathAToB.EndpointB.ChannelConfig.PortID, pathAToB.EndpointB.ChannelID) - - originalBalances := sdk.NewCoins() - originalBalance := suite.chainA.GetSimApp().BankKeeper.GetBalance(suite.chainA.GetContext(), suite.chainA.SenderAccount.GetAddress(), sdk.DefaultBondDenom) - originalBalances = originalBalances.Add(originalBalance) - - timeoutHeight := clienttypes.NewHeight(1, 110) - - amount, ok := sdkmath.NewIntFromString("9223372036854775808") // 2^63 (one above int64) - suite.Require().True(ok) - originalCoins := sdk.NewCoins() - - coinToSendToB := sdk.NewCoin(sdk.DefaultBondDenom, amount) - originalCoins = originalCoins.Add(coinToSendToB) - - // send from chainA to chainB - msg := types.NewMsgTransfer(pathAToB.EndpointA.ChannelConfig.PortID, pathAToB.EndpointA.ChannelID, originalCoins, suite.chainA.SenderAccount.GetAddress().String(), suite.chainB.SenderAccount.GetAddress().String(), timeoutHeight, 0, "", nil) - res, err := suite.chainA.SendMsgs(msg) - suite.Require().NoError(err) // message committed - suite.Require().NoError(pathAToB.EndpointB.UpdateClient()) - - packet, err := ibctesting.ParsePacketFromEvents(res.Events) - suite.Require().NoError(err) - - // relay send - err = pathAToB.RelayPacket(packet) - suite.Require().NoError(err) // relay committed - - escrowAddress := types.GetEscrowAddress(packet.GetSourcePort(), packet.GetSourceChannel()) - coinsSentFromAToB := sdk.NewCoins() - for _, coin := range originalCoins { - // check that the balance for chainA is updated - chainABalance := suite.chainA.GetSimApp().BankKeeper.GetBalance(suite.chainA.GetContext(), suite.chainA.SenderAccount.GetAddress(), coin.Denom) - suite.Require().Equal(originalBalances.AmountOf(coin.Denom).Sub(amount).Int64(), chainABalance.Amount.Int64()) - - // check that module account escrow address has locked the tokens - chainAEscrowBalance := suite.chainA.GetSimApp().BankKeeper.GetBalance(suite.chainA.GetContext(), escrowAddress, coin.Denom) - suite.Require().Equal(coin, chainAEscrowBalance) - - // check that voucher exists on chain B - chainBDenom := types.NewDenom(coin.Denom, traceAToB) - chainBBalance := suite.chainB.GetSimApp().BankKeeper.GetBalance(suite.chainB.GetContext(), suite.chainB.SenderAccount.GetAddress(), chainBDenom.IBCDenom()) - coinSentFromAToB := sdk.NewCoin(chainBDenom.IBCDenom(), amount) - suite.Require().Equal(coinSentFromAToB, chainBBalance) - - coinsSentFromAToB = coinsSentFromAToB.Add(coinSentFromAToB) - } - - suite.Require().NoError(pathAToB.EndpointB.UpdateClient()) - suite.Require().NoError(pathAToB.EndpointA.UpdateClient()) - - ftpd := types.NewFungibleTokenPacketDataV2( - []types.Token{ - { - // "transfer/channel-0/stake" - Denom: types.NewDenom(sdk.DefaultBondDenom, traceAToB), - Amount: "100", - }, - }, suite.chainB.SenderAccount.GetAddress().String(), suite.chainA.SenderAccount.GetAddress().String(), "", types.ForwardingPacketData{}, - ) - - bz, err := suite.chainB.Codec.Marshal(&ftpd) - suite.Require().NoError(err) - - timeoutTimestamp := suite.chainB.GetTimeoutTimestamp() - msgSendPacket := channeltypesv2.NewMsgSendPacket( - pathAToB.EndpointB.ChannelID, - timeoutTimestamp, - suite.chainB.SenderAccount.GetAddress().String(), - *channeltypes.NewPacketData("transfer", "transfer", *channeltypes.NewPayload(types.V2, "json", bz)), - ) - - res, err = suite.chainB.SendMsgs(msgSendPacket) - suite.Require().NoError(err) - suite.Require().NotNil(res) - suite.Require().NoError(pathAToB.EndpointA.UpdateClient()) - suite.Require().NoError(pathAToB.EndpointB.UpdateClient()) - - packetKey := host.PacketCommitmentKey(host.SentinelV2PortID, pathAToB.EndpointB.ClientID, 1) - proof, proofHeight := pathAToB.EndpointB.QueryProof(packetKey) - suite.Require().NotNil(proof) - suite.Require().False(proofHeight.IsZero()) - - packetV2 := channeltypesv2.NewPacketV2(1, pathAToB.EndpointB.ChannelID, pathAToB.EndpointA.ChannelID, timeoutTimestamp, - *channeltypes.NewPacketData("transfer", "transfer", *channeltypes.NewPayload(types.V2, "json", bz))) - - msgRecvPacket := channeltypesv2.NewMsgRecvPacket(packetV2, proof, proofHeight, suite.chainA.SenderAccount.GetAddress().String()) - - res, err = suite.chainA.SendMsgs(msgRecvPacket) - suite.Require().NoError(err) - suite.Require().NotNil(res) - suite.Require().NoError(pathAToB.EndpointB.UpdateClient()) -} - -func TestTransferV2TestSuite(t *testing.T) { - testifysuite.Run(t, new(TransferV2TestSuite)) -} diff --git a/modules/core/04-channel/keeper/keeper.go b/modules/core/04-channel/keeper/keeper.go index 11c39422e32..8e3c96eb40a 100644 --- a/modules/core/04-channel/keeper/keeper.go +++ b/modules/core/04-channel/keeper/keeper.go @@ -3,8 +3,6 @@ package keeper import ( "context" "errors" - commitmenttypes "github.com/cosmos/ibc-go/v9/modules/core/23-commitment/types" - packetservertypes "github.com/cosmos/ibc-go/v9/modules/core/packet-server/types" "strconv" "strings" @@ -851,28 +849,3 @@ func (k *Keeper) PruneAcknowledgements(ctx context.Context, portID, channelID st return totalPruned, totalRemaining, nil } - -// GetV2Counterparty returns a version 2 counterparty for the given port and channel ID -// by converting the channel into a version 2 counterparty -func (k *Keeper) GetV2Counterparty(ctx context.Context, portID, channelID string) (packetservertypes.Counterparty, bool) { - channel, ok := k.GetChannel(ctx, portID, channelID) - if !ok { - return packetservertypes.Counterparty{}, false - } - // Do not allow channel to be converted into a version 2 counterparty - // if the channel is not OPEN or if it is ORDERED - if channel.State != types.OPEN || channel.Ordering == types.ORDERED { - return packetservertypes.Counterparty{}, false - } - connection, ok := k.connectionKeeper.GetConnection(ctx, channel.ConnectionHops[0]) - if !ok { - return packetservertypes.Counterparty{}, false - } - merklePathPrefix := commitmenttypes.NewMerklePath(connection.Counterparty.Prefix.KeyPrefix, []byte("")) - counterparty := packetservertypes.Counterparty{ - ClientId: connection.ClientId, - MerklePathPrefix: merklePathPrefix, - } - - return counterparty, true -} diff --git a/modules/core/04-channel/keeper/packet.go b/modules/core/04-channel/keeper/packet.go index 77c30ee1784..bef9e7cad7c 100644 --- a/modules/core/04-channel/keeper/packet.go +++ b/modules/core/04-channel/keeper/packet.go @@ -14,7 +14,6 @@ import ( connectiontypes "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types" "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" "github.com/cosmos/ibc-go/v9/modules/core/exported" - "github.com/cosmos/ibc-go/v9/modules/core/legacy" ) // SendPacket is called by a module in order to send an IBC packet on a channel. @@ -284,20 +283,6 @@ func (k *Keeper) WriteAcknowledgement( packet exported.PacketI, acknowledgement exported.Acknowledgement, ) error { - v1Packet, ok := packet.(types.Packet) - if !ok { - return errorsmod.Wrapf(types.ErrInvalidPacket, "expected packet type %T, got %T", types.Packet{}, packet) - } - - // if an acknowledgement is being written for a V2 packet, we need to ensure that the acknowledgement - // structure uses the multi ack structure. - // TODO: this is a bit gross / hacky, can we ensure that async acks will always have the correct structure? - if v1Packet.ProtocolVersion == types.IBC_VERSION_2 { - if _, ok := acknowledgement.(*legacy.MultiAck); !ok { - acknowledgement = legacy.NewLMultiAck(k.cdc, acknowledgement, packet.GetDestPort()) - } - } - channel, found := k.GetChannel(ctx, packet.GetDestPort(), packet.GetDestChannel()) if !found { return errorsmod.Wrap(types.ErrChannelNotFound, packet.GetDestChannel()) diff --git a/modules/core/keeper/msg_server_v2.go b/modules/core/keeper/msg_server_v2.go index b57981036fc..adb710241ab 100644 --- a/modules/core/keeper/msg_server_v2.go +++ b/modules/core/keeper/msg_server_v2.go @@ -27,14 +27,7 @@ func (k *Keeper) SendPacketV2(ctx context.Context, msg *channeltypesv2.MsgSendPa for _, pd := range msg.PacketData { cbs := k.PortKeeper.AppRouter.Route(pd.SourcePort) - - // TODO: is it safe to assume an sdk.AccAddress? - signer, err := sdk.AccAddressFromBech32(msg.Signer) - if err != nil { - return nil, err - } - - err = cbs.OnSendPacketV2(ctx, msg.SourceId, sequence, msg.TimeoutTimestamp, pd.Payload, signer) + err := cbs.OnSendPacketV2(ctx, msg.SourceId, sequence, msg.TimeoutTimestamp, pd.Payload, sdk.AccAddress(msg.Signer)) if err != nil { return nil, err } diff --git a/modules/core/packet-server/keeper/keeper.go b/modules/core/packet-server/keeper/keeper.go index a80088f192a..8c98d623a12 100644 --- a/modules/core/packet-server/keeper/keeper.go +++ b/modules/core/packet-server/keeper/keeper.go @@ -66,22 +66,3 @@ func (k *Keeper) GetCounterparty(ctx context.Context, clientID string) (types.Co k.cdc.MustUnmarshal(bz, &counterparty) return counterparty, true } - -// GetCounterparty gets the Counterparty for a given client identifier. -func (k *Keeper) GetCounterpartyV2(ctx context.Context, portID, channelID, clientID string) (types.Counterparty, bool) { - store := k.ChannelStore(ctx, clientID) - bz := store.Get([]byte(types.CounterpartyKey)) - if len(bz) == 0 { - cp, ok := k.ChannelKeeper.GetV2Counterparty(ctx, portID, clientID) - if !ok { - return types.Counterparty{}, false - } - k.SetCounterparty(ctx, channelID, cp) - //k.SetCounterparty(ctx, clientID, cp) - return cp, true - } - - var counterparty types.Counterparty - k.cdc.MustUnmarshal(bz, &counterparty) - return counterparty, true -} diff --git a/modules/core/packet-server/keeper/relay.go b/modules/core/packet-server/keeper/relay.go index c9af870a1e2..730c147d09d 100644 --- a/modules/core/packet-server/keeper/relay.go +++ b/modules/core/packet-server/keeper/relay.go @@ -46,17 +46,10 @@ func (k Keeper) SendPacket( } // construct packet from given fields and channel state - // TODO: packet only being used in event emission. packet := channeltypes.NewPacketWithVersion(data, sequence, sourcePort, sourceChannel, destPort, destChannel, timeoutHeight, timeoutTimestamp, version) - // TODO: replace with a direct creation of a PacketV2 - packetV2, err := channeltypes.ConvertPacketV1toV2(packet) - if err != nil { - return 0, err - } - - if err := packetV2.ValidateBasic(); err != nil { + if err := packet.ValidateBasic(); err != nil { return 0, errorsmod.Wrapf(channeltypes.ErrInvalidPacket, "constructed packet failed basic validation: %v", err) } // check that the client of counterparty chain is still active @@ -76,18 +69,18 @@ func (k Keeper) SendPacket( } // check if packet is timed out on the receiving chain - timeout := channeltypes.NewTimeoutWithTimestamp(packetV2.GetTimeoutTimestamp()) + timeout := channeltypes.NewTimeoutWithTimestamp(packet.GetTimeoutTimestamp()) if timeout.Elapsed(latestHeight, latestTimestamp) { return 0, errorsmod.Wrap(timeout.ErrTimeoutElapsed(latestHeight, latestTimestamp), "invalid packet timeout") } - commitment := channeltypes.CommitPacketV2(packetV2) + commitment := channeltypes.CommitPacket(packet) // bump the sequence and set the packet commitment so it is provable by the counterparty k.ChannelKeeper.SetNextSequenceSend(ctx, sourcePort, sourceChannel, sequence+1) - k.ChannelKeeper.SetPacketCommitment(ctx, sourcePort, sourceChannel, packetV2.GetSequence(), commitment) + k.ChannelKeeper.SetPacketCommitment(ctx, sourcePort, sourceChannel, packet.GetSequence(), commitment) - k.Logger(ctx).Info("packet sent", "sequence", strconv.FormatUint(packetV2.Sequence, 10), "src_port", packetV2.Data[0].SourcePort, "src_channel", packetV2.SourceId, "dst_port", packetV2.Data[0].DestinationPort, "dst_channel", packetV2.DestinationId) + k.Logger(ctx).Info("packet sent", "sequence", strconv.FormatUint(packet.Sequence, 10), "src_port", packet.SourcePort, "src_channel", packet.SourceChannel, "dst_port", packet.DestinationPort, "dst_channel", packet.DestinationChannel) channelkeeper.EmitSendPacketEvent(ctx, packet, nil, timeoutHeight) @@ -107,26 +100,21 @@ func (k Keeper) RecvPacket( proof []byte, proofHeight exported.Height, ) (string, error) { - packetV2, err := channeltypes.ConvertPacketV1toV2(packet) - if err != nil { - return "", err - } - // Lookup counterparty associated with our channel and ensure // that the packet was indeed sent by our counterparty. - counterparty, ok := k.GetCounterparty(ctx, packetV2.DestinationId) + counterparty, ok := k.GetCounterparty(ctx, packet.DestinationChannel) if !ok { - return "", errorsmod.Wrap(types.ErrCounterpartyNotFound, packetV2.DestinationId) + return "", errorsmod.Wrap(types.ErrCounterpartyNotFound, packet.DestinationChannel) } - if counterparty.ClientId != packetV2.SourceId { + if counterparty.ClientId != packet.SourceChannel { return "", channeltypes.ErrInvalidChannelIdentifier } // check if packet timed out by comparing it with the latest height of the chain sdkCtx := sdk.UnwrapSDKContext(ctx) selfHeight, selfTimestamp := clienttypes.GetSelfHeight(ctx), uint64(sdkCtx.BlockTime().UnixNano()) - timeout := channeltypes.NewTimeoutWithTimestamp(packetV2.GetTimeoutTimestamp()) + timeout := channeltypes.NewTimeoutWithTimestamp(packet.GetTimeoutTimestamp()) if timeout.Elapsed(selfHeight, selfTimestamp) { return "", errorsmod.Wrap(timeout.ErrTimeoutElapsed(selfHeight, selfTimestamp), "packet timeout elapsed") } @@ -134,7 +122,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 // by the increase of the recvStartSequence. - _, found := k.ChannelKeeper.GetPacketReceipt(ctx, packetV2.Data[0].DestinationPort, packetV2.DestinationId, packetV2.Sequence) + _, found := k.ChannelKeeper.GetPacketReceipt(ctx, packet.DestinationPort, packet.DestinationChannel, packet.Sequence) if found { // TODO: explicitly using packet(V1) here, as the event structure will remain the same until PacketV2 API is being used. channelkeeper.EmitRecvPacketEvent(ctx, packet, nil) @@ -144,14 +132,14 @@ func (k Keeper) RecvPacket( return "", channeltypes.ErrNoOpMsg } - path := host.PacketCommitmentKey(packetV2.Data[0].SourcePort, packetV2.SourceId, packetV2.Sequence) + path := host.PacketCommitmentKey(packet.SourcePort, packet.SourceChannel, packet.Sequence) merklePath := types.BuildMerklePath(counterparty.MerklePathPrefix, path) - commitment := channeltypes.CommitPacketV2(packetV2) + commitment := channeltypes.CommitPacket(packet) if err := k.ClientKeeper.VerifyMembership( ctx, - packetV2.DestinationId, + packet.DestinationChannel, proofHeight, 0, 0, proof, @@ -162,14 +150,14 @@ func (k Keeper) RecvPacket( } // Set Packet Receipt to prevent timeout from occurring on counterparty - k.ChannelKeeper.SetPacketReceipt(ctx, packetV2.Data[0].DestinationPort, packetV2.DestinationId, packetV2.Sequence) + k.ChannelKeeper.SetPacketReceipt(ctx, packet.DestinationPort, packet.DestinationChannel, packet.Sequence) - k.Logger(ctx).Info("packet received", "sequence", strconv.FormatUint(packetV2.Sequence, 10), "src_port", packetV2.Data[0].SourcePort, "src_channel", packetV2.SourceId, "dst_port", packetV2.Data[0].DestinationPort, "dst_channel", packetV2.DestinationId) + k.Logger(ctx).Info("packet received", "sequence", strconv.FormatUint(packet.Sequence, 10), "src_port", packet.SourcePort, "src_channel", packet.SourceChannel, "dst_port", packet.DestinationPort, "dst_channel", packet.DestinationChannel) // TODO: explicitly using packet(V1) here, as the event structure will remain the same until PacketV2 API is being used. channelkeeper.EmitRecvPacketEvent(ctx, packet, nil) - return packetV2.Data[0].Payload.Version, nil + return packet.AppVersion, nil } // WriteAcknowledgement implements the async acknowledgement writing logic required by a packet handler. @@ -242,23 +230,18 @@ func (k Keeper) AcknowledgePacket( proofAcked []byte, proofHeight exported.Height, ) (string, error) { - packetV2, err := channeltypes.ConvertPacketV1toV2(packet) - if err != nil { - return "", err - } - // Lookup counterparty associated with our channel and ensure // that the packet was indeed sent by our counterparty. - counterparty, ok := k.GetCounterparty(ctx, packetV2.SourceId) + counterparty, ok := k.GetCounterparty(ctx, packet.SourceChannel) if !ok { - return "", errorsmod.Wrap(types.ErrCounterpartyNotFound, packetV2.SourceId) + return "", errorsmod.Wrap(types.ErrCounterpartyNotFound, packet.SourceChannel) } - if counterparty.ClientId != packetV2.DestinationId { + if counterparty.ClientId != packet.DestinationChannel { return "", channeltypes.ErrInvalidChannelIdentifier } - commitment := k.ChannelKeeper.GetPacketCommitment(ctx, packetV2.Data[0].SourcePort, packetV2.SourceId, packetV2.Sequence) + commitment := k.ChannelKeeper.GetPacketCommitment(ctx, packet.SourcePort, packet.SourceChannel, packet.Sequence) if len(commitment) == 0 { // TODO: explicitly using packet(V1) here, as the event structure will remain the same until PacketV2 API is being used. channelkeeper.EmitAcknowledgePacketEvent(ctx, packet, nil) @@ -270,36 +253,36 @@ func (k Keeper) AcknowledgePacket( return "", channeltypes.ErrNoOpMsg } - packetCommitment := channeltypes.CommitPacketV2(packetV2) + packetCommitment := channeltypes.CommitPacket(packet) // verify we sent the packet and haven't cleared it out yet if !bytes.Equal(commitment, packetCommitment) { return "", errorsmod.Wrapf(channeltypes.ErrInvalidPacket, "commitment bytes are not equal: got (%v), expected (%v)", packetCommitment, commitment) } - path := host.PacketAcknowledgementKey(packetV2.Data[0].DestinationPort, packetV2.DestinationId, packetV2.Sequence) + path := host.PacketAcknowledgementKey(packet.DestinationPort, packet.DestinationChannel, packet.Sequence) merklePath := types.BuildMerklePath(counterparty.MerklePathPrefix, path) if err := k.ClientKeeper.VerifyMembership( ctx, - packetV2.SourceId, + packet.SourceChannel, proofHeight, 0, 0, proofAcked, merklePath, channeltypes.CommitAcknowledgement(acknowledgement), ); err != nil { - return "", errorsmod.Wrapf(err, "failed packet acknowledgement verification for client (%s)", packetV2.SourceId) + return "", errorsmod.Wrapf(err, "failed packet acknowledgement verification for client (%s)", packet.SourceChannel) } - k.ChannelKeeper.DeletePacketCommitment(ctx, packetV2.Data[0].SourcePort, packetV2.SourceId, packetV2.Sequence) + k.ChannelKeeper.DeletePacketCommitment(ctx, packet.SourcePort, packet.SourceChannel, packet.Sequence) - k.Logger(ctx).Info("packet acknowledged", "sequence", strconv.FormatUint(packetV2.Sequence, 10), "src_port", packetV2.Data[0].SourcePort, "src_channel", packetV2.SourceId, "dst_port", packetV2.Data[0].DestinationPort, "dst_channel", packetV2.DestinationId) + k.Logger(ctx).Info("packet acknowledged", "sequence", strconv.FormatUint(packet.Sequence, 10), "src_port", packet.SourcePort, "src_channel", packet.SourceChannel, "dst_port", packet.DestinationPort, "dst_channel", packet.DestinationChannel) // TODO: explicitly using packet(V1) here, as the event structure will remain the same until PacketV2 API is being used. channelkeeper.EmitAcknowledgePacketEvent(ctx, packet, nil) - return packetV2.Data[0].Payload.Version, nil + return packet.AppVersion, nil } // TimeoutPacket implements the timeout logic required by a packet handler. @@ -316,24 +299,19 @@ func (k Keeper) TimeoutPacket( proofHeight exported.Height, _ uint64, ) (string, error) { - packetV2, err := channeltypes.ConvertPacketV1toV2(packet) - if err != nil { - return "", err - } - // Lookup counterparty associated with our channel and ensure // that the packet was indeed sent by our counterparty. - counterparty, ok := k.GetCounterparty(ctx, packetV2.SourceId) + counterparty, ok := k.GetCounterparty(ctx, packet.SourceChannel) if !ok { - return "", errorsmod.Wrap(types.ErrCounterpartyNotFound, packetV2.SourceId) + return "", errorsmod.Wrap(types.ErrCounterpartyNotFound, packet.SourceChannel) } - if counterparty.ClientId != packetV2.DestinationId { + if counterparty.ClientId != packet.DestinationChannel { return "", channeltypes.ErrInvalidChannelIdentifier } // check that timeout height or timeout timestamp has passed on the other end - proofTimestamp, err := k.ClientKeeper.GetClientTimestampAtHeight(ctx, packetV2.SourceId, proofHeight) + proofTimestamp, err := k.ClientKeeper.GetClientTimestampAtHeight(ctx, packet.SourceChannel, proofHeight) if err != nil { return "", err } @@ -344,7 +322,7 @@ func (k Keeper) TimeoutPacket( } // check that the commitment has not been cleared and that it matches the packet sent by relayer - commitment := k.ChannelKeeper.GetPacketCommitment(ctx, packetV2.Data[0].SourcePort, packetV2.SourceId, packetV2.Sequence) + commitment := k.ChannelKeeper.GetPacketCommitment(ctx, packet.SourcePort, packet.SourceChannel, packet.Sequence) if len(commitment) == 0 { // TODO: explicitly using packet(V1) here, as the event structure will remain the same until PacketV2 API is being used. @@ -356,19 +334,19 @@ func (k Keeper) TimeoutPacket( return "", channeltypes.ErrNoOpMsg } - packetCommitment := channeltypes.CommitPacketV2(packetV2) + packetCommitment := channeltypes.CommitPacket(packet) // verify we sent the packet and haven't cleared it out yet if !bytes.Equal(commitment, packetCommitment) { return "", errorsmod.Wrapf(channeltypes.ErrInvalidPacket, "packet commitment bytes are not equal: got (%v), expected (%v)", commitment, packetCommitment) } // verify packet receipt absence - path := host.PacketReceiptKey(packetV2.Data[0].DestinationPort, packetV2.DestinationId, packetV2.Sequence) + path := host.PacketReceiptKey(packet.DestinationPort, packet.DestinationChannel, packet.Sequence) merklePath := types.BuildMerklePath(counterparty.MerklePathPrefix, path) if err := k.ClientKeeper.VerifyNonMembership( ctx, - packetV2.SourceId, + packet.SourceChannel, proofHeight, 0, 0, proof, @@ -378,9 +356,9 @@ func (k Keeper) TimeoutPacket( } // delete packet commitment to prevent replay - k.ChannelKeeper.DeletePacketCommitment(ctx, packetV2.Data[0].SourcePort, packetV2.SourceId, packetV2.Sequence) + k.ChannelKeeper.DeletePacketCommitment(ctx, packet.SourcePort, packet.SourceChannel, packet.Sequence) - k.Logger(ctx).Info("packet timed out", "sequence", strconv.FormatUint(packetV2.Sequence, 10), "src_port", packetV2.Data[0].SourcePort, "src_channel", packetV2.SourceId, "dst_port", packetV2.Data[0].DestinationPort, "dst_channel", packetV2.DestinationId) + k.Logger(ctx).Info("packet timed out", "sequence", strconv.FormatUint(packet.Sequence, 10), "src_port", packet.SourcePort, "src_channel", packet.SourceChannel, "dst_port", packet.DestinationPort, "dst_channel", packet.DestinationChannel) // TODO: explicitly using packet(V1) here, as the event structure will remain the same until PacketV2 API is being used. channelkeeper.EmitTimeoutPacketEvent(ctx, packet, nil) diff --git a/modules/core/packet-server/keeper/relay_test.go b/modules/core/packet-server/keeper/relay_test.go index a5397cb1936..6412f0d8636 100644 --- a/modules/core/packet-server/keeper/relay_test.go +++ b/modules/core/packet-server/keeper/relay_test.go @@ -116,10 +116,6 @@ func (suite *KeeperTestSuite) TestSendPacket() { packet = channeltypes.NewPacketWithVersion(mock.MockPacketData, 1, mock.PortID, path.EndpointA.ClientID, mock.PortID, path.EndpointB.ClientID, clienttypes.ZeroHeight(), suite.chainA.GetTimeoutTimestamp(), mock.Version) - // TODO: constructor function for packetV2 instead of conversion - packetV2, err := channeltypes.ConvertPacketV1toV2(packet) - suite.Require().NoError(err) - // malleate the test case tc.malleate() // send packet @@ -129,7 +125,7 @@ func (suite *KeeperTestSuite) TestSendPacket() { if expPass { suite.Require().NoError(err) suite.Require().Equal(uint64(1), seq) - expCommitment := channeltypes.CommitPacketV2(packetV2) + expCommitment := channeltypes.CommitPacket(packet) suite.Require().Equal(expCommitment, suite.chainA.App.GetIBCKeeper().ChannelKeeper.GetPacketCommitment(suite.chainA.GetContext(), packet.SourcePort, packet.SourceChannel, seq)) } else { suite.Require().Error(err) @@ -156,13 +152,6 @@ func (suite *KeeperTestSuite) TestRecvPacket() { func() {}, nil, }, - { - "failure: protocol version is not V2", - func() { - packet.ProtocolVersion = channeltypes.IBC_VERSION_1 - }, - channeltypes.ErrInvalidPacket, - }, { "failure: counterparty not found", func() { diff --git a/modules/core/packet-server/keeper/relay_v2.go b/modules/core/packet-server/keeper/relay_v2.go index 2157c46e1a4..2b7485f5444 100644 --- a/modules/core/packet-server/keeper/relay_v2.go +++ b/modules/core/packet-server/keeper/relay_v2.go @@ -3,9 +3,8 @@ package keeper import ( "bytes" "context" - "strconv" - "slices" + "strconv" errorsmod "cosmossdk.io/errors" @@ -26,7 +25,7 @@ func (k Keeper) SendPacketV2( data []channeltypes.PacketData, ) (uint64, error) { // Lookup counterparty associated with our source channel to retrieve the destination channel - counterparty, ok := k.GetCounterpartyV2(ctx, "transfer", "channel-2", sourceID) + counterparty, ok := k.GetCounterparty(ctx, sourceID) if !ok { return 0, errorsmod.Wrap(types.ErrCounterpartyNotFound, sourceID) } @@ -38,7 +37,7 @@ func (k Keeper) SendPacketV2( } // construct packet from given fields and channel state - packet := channeltypesv2.NewPacketV2(sequence, sourceID, "channel-1", timeoutTimestamp, data...) + packet := channeltypesv2.NewPacketV2(sequence, sourceID, counterparty.ClientId, timeoutTimestamp, data...) if err := packet.ValidateBasic(); err != nil { return 0, errorsmod.Wrapf(channeltypes.ErrInvalidPacket, "constructed packet failed basic validation: %v", err) @@ -82,13 +81,13 @@ func (k Keeper) RecvPacketV2( ) error { // Lookup counterparty associated with our channel and ensure // that the packet was indeed sent by our counterparty. - counterparty, ok := k.GetCounterpartyV2(ctx, packet.Data[0].DestinationPort, "channel-1", packet.DestinationId) + counterparty, ok := k.GetCounterparty(ctx, packet.DestinationId) if !ok { return errorsmod.Wrap(types.ErrCounterpartyNotFound, packet.DestinationId) } - //if counterparty.ClientId != packet.SourceId { - // return channeltypes.ErrInvalidChannelIdentifier - //} + if counterparty.ClientId != packet.SourceId { + return channeltypes.ErrInvalidChannelIdentifier + } sdkCtx := sdk.UnwrapSDKContext(ctx) // check if packet timed out by comparing it with the latest height of the chain @@ -101,8 +100,7 @@ func (k Keeper) RecvPacketV2( // 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. - //_, found := k.ChannelKeeper.GetPacketReceipt(ctx, host.SentinelV2PortID, packet.DestinationId, packet.Sequence) - _, found := k.ChannelKeeper.GetPacketReceipt(ctx, packet.Data[0].DestinationPort, packet.DestinationId, packet.Sequence) + _, found := k.ChannelKeeper.GetPacketReceipt(ctx, host.SentinelV2PortID, packet.DestinationId, packet.Sequence) if found { // TODO: figure out events // channelkeeper.EmitRecvPacketEventV2(ctx, packet, sentinelChannel(packet.DestinationChannel)) @@ -112,22 +110,21 @@ func (k Keeper) RecvPacketV2( return channeltypes.ErrNoOpMsg } - path := host.PacketCommitmentKey(host.SentinelV2PortID, counterparty.ClientId, packet.Sequence) - //path := host.PacketCommitmentKey(packet.Data[0].SourcePort, packet.SourceId, packet.Sequence) + path := host.PacketCommitmentKey(host.SentinelV2PortID, packet.SourceId, packet.Sequence) merklePath := types.BuildMerklePath(counterparty.MerklePathPrefix, path) commitment := channeltypes.CommitPacketV2(packet) if err := k.ClientKeeper.VerifyMembership( ctx, - counterparty.ClientId, + packet.DestinationId, proofHeight, 0, 0, proof, merklePath, commitment, ); err != nil { - return errorsmod.Wrapf(err, "failed packet commitment verification for client (%s)", counterparty.ClientId) + return errorsmod.Wrapf(err, "failed packet commitment verification for client (%s)", packet.DestinationId) } // Set Packet Receipt to prevent timeout from occurring on counterparty @@ -152,16 +149,14 @@ func (k Keeper) WriteAcknowledgementV2( // TODO: this should probably error out if any of the acks are async. // Lookup counterparty associated with our channel and ensure // that the packet was indeed sent by our counterparty. - //counterparty, ok := k.GetCounterparty(ctx, packet.DestinationId) - //if !ok { - // return errorsmod.Wrap(types.ErrCounterpartyNotFound, packet.DestinationId) - //} - - // TODO: how can we make this work if packet.SourceID is a channelID and counterparty has been stored - // under the key of a channelID? - //if counterparty.ClientId != packet.SourceId { - // return channeltypes.ErrInvalidChannelIdentifier - //} + counterparty, ok := k.GetCounterparty(ctx, packet.DestinationId) + if !ok { + return errorsmod.Wrap(types.ErrCounterpartyNotFound, packet.DestinationId) + } + + if counterparty.ClientId != packet.SourceId { + return channeltypes.ErrInvalidChannelIdentifier + } // NOTE: IBC app modules might have written the acknowledgement synchronously on // the OnRecvPacket callback so we need to check if the acknowledgement is already diff --git a/modules/core/packet-server/types/expected_keepers.go b/modules/core/packet-server/types/expected_keepers.go index b83bf44529c..9bd93fa871b 100644 --- a/modules/core/packet-server/types/expected_keepers.go +++ b/modules/core/packet-server/types/expected_keepers.go @@ -2,6 +2,7 @@ package types import ( "context" + clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" "github.com/cosmos/ibc-go/v9/modules/core/exported" @@ -43,8 +44,6 @@ type ChannelKeeper interface { GetMultiAcknowledgement(ctx context.Context, portID, channelID string, sequence uint64) (types.MultiAcknowledgement, bool) // SetMultiAcknowledgement writes the multi ack under the multi ack path. SetMultiAcknowledgement(ctx context.Context, portID, channelID string, sequence uint64, recvResults types.MultiAcknowledgement) - - GetV2Counterparty(ctx context.Context, portID, channelID string) (Counterparty, bool) } type ClientKeeper interface { diff --git a/testing/simapp/app.go b/testing/simapp/app.go index 8222582a00b..397ef8e4fa8 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -402,12 +402,11 @@ func NewSimApp( // Create Transfer Keeper and pass IBCFeeKeeper as expected Channel and PortKeeper // since fee middleware will wrap the IBCKeeper for underlying application. - app.TransferKeeper = ibctransferkeeper.NewKeeperWithPacketServer( + app.TransferKeeper = ibctransferkeeper.NewKeeper( appCodec, runtime.NewKVStoreService(keys[ibctransfertypes.StoreKey]), app.GetSubspace(ibctransfertypes.ModuleName), app.IBCFeeKeeper, // ISC4 Wrapper: fee IBC middleware app.IBCKeeper.ChannelKeeper, app.AccountKeeper, app.BankKeeper, - *app.PacketServer, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) @@ -448,7 +447,6 @@ func NewSimApp( // Add transfer stack to IBC Router ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferStack) - ibcRouterV2.AddRoute(ibctransfertypes.ModuleName, transfer.NewIBCModuleV2(app.TransferKeeper)) // Create Interchain Accounts Stack // SendPacket, since it is originating from the application to core IBC: From d11f7610cbf75f21f58a37f8839e712907a63a45 Mon Sep 17 00:00:00 2001 From: chatton Date: Wed, 25 Sep 2024 11:37:36 +0100 Subject: [PATCH 27/27] chore: fix signer parsing --- modules/core/keeper/msg_server_v2.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/core/keeper/msg_server_v2.go b/modules/core/keeper/msg_server_v2.go index adb710241ab..f2db07450be 100644 --- a/modules/core/keeper/msg_server_v2.go +++ b/modules/core/keeper/msg_server_v2.go @@ -25,9 +25,15 @@ func (k *Keeper) SendPacketV2(ctx context.Context, msg *channeltypesv2.MsgSendPa return nil, errorsmod.Wrapf(err, "send packet failed for source id: %s", msg.SourceId) } + signer, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + sdkCtx.Logger().Error("send packet failed", "error", errorsmod.Wrap(err, "Invalid address for msg Signer")) + return nil, errorsmod.Wrap(err, "Invalid address for msg Signer") + } + for _, pd := range msg.PacketData { cbs := k.PortKeeper.AppRouter.Route(pd.SourcePort) - err := cbs.OnSendPacketV2(ctx, msg.SourceId, sequence, msg.TimeoutTimestamp, pd.Payload, sdk.AccAddress(msg.Signer)) + err := cbs.OnSendPacketV2(ctx, msg.SourceId, sequence, msg.TimeoutTimestamp, pd.Payload, signer) if err != nil { return nil, err }