diff --git a/modules/core/04-channel/v2/keeper/msg_server.go b/modules/core/04-channel/v2/keeper/msg_server.go index 00d631bbe0f..0d06ba8e792 100644 --- a/modules/core/04-channel/v2/keeper/msg_server.go +++ b/modules/core/04-channel/v2/keeper/msg_server.go @@ -71,7 +71,7 @@ func (k *Keeper) Acknowledgement(ctx context.Context, msg *channeltypesv2.MsgAck recvResults[r.AppName] = r.RecvPacketResult } - for _, pd := range msg.Packet.Data { + for _, pd := range msg.Packet.Payloads { cbs := k.Router.Route(pd.SourcePort) err := cbs.OnAcknowledgementPacket(ctx, msg.Packet.SourceChannel, msg.Packet.DestinationChannel, pd, recvResults[pd.DestinationPort].Acknowledgement, relayer) if err != nil { @@ -116,7 +116,7 @@ func (k *Keeper) RecvPacket(ctx context.Context, msg *channeltypesv2.MsgRecvPack AcknowledgementResults: []channeltypesv2.AcknowledgementResult{}, } - for _, pd := range msg.Packet.Data { + for _, pd := range msg.Packet.Payloads { // Cache context so that we may discard state changes from callback if the acknowledgement is unsuccessful. cacheCtx, writeFn = sdkCtx.CacheContext() cb := k.Router.Route(pd.DestinationPort) @@ -136,13 +136,13 @@ func (k *Keeper) RecvPacket(ctx context.Context, msg *channeltypesv2.MsgRecvPack }) } - // note this should never happen as the packet data would have had to be empty. + // note this should never happen as the payload would have had to be empty. if len(ack.AcknowledgementResults) == 0 { sdkCtx.Logger().Error("receive packet failed", "source-channel", msg.Packet.SourceChannel, "error", errorsmod.Wrap(err, "invalid acknowledgement results")) return &channeltypesv2.MsgRecvPacketResponse{Result: channeltypesv1.FAILURE}, errorsmod.Wrapf(err, "receive packet failed source-channel %s invalid acknowledgement results", msg.Packet.SourceChannel) } - // NOTE: TBD how we will handle async acknowledgements with more than one packet data. + // NOTE: TBD how we will handle async acknowledgements with more than one payload. isAsync := slices.ContainsFunc(ack.AcknowledgementResults, func(ackResult channeltypesv2.AcknowledgementResult) bool { return ackResult.RecvPacketResult.Status == channeltypesv2.PacketStatus_Async }) @@ -190,7 +190,7 @@ func (k *Keeper) Timeout(ctx context.Context, timeout *channeltypesv2.MsgTimeout return nil, errorsmod.Wrap(err, "timeout packet verification failed") } - for _, pd := range timeout.Packet.Data { + for _, pd := range timeout.Packet.Payloads { cbs := k.Router.Route(pd.SourcePort) err := cbs.OnTimeoutPacket(ctx, timeout.Packet.SourceChannel, timeout.Packet.DestinationChannel, pd, signer) if err != nil { diff --git a/modules/core/04-channel/v2/keeper/packet.go b/modules/core/04-channel/v2/keeper/packet.go index 59190861f86..d625b5f71ff 100644 --- a/modules/core/04-channel/v2/keeper/packet.go +++ b/modules/core/04-channel/v2/keeper/packet.go @@ -28,7 +28,7 @@ func (k *Keeper) sendPacket( // Lookup channel associated with our source channel to retrieve the destination channel channel, ok := k.GetChannel(ctx, sourceChannel) if !ok { - // TODO: figure out how aliasing will work when more than one packet data is sent. + // TODO: figure out how aliasing will work when more than one payload is sent. channel, ok = k.convertV1Channel(ctx, payloads[0].SourcePort, sourceChannel) if !ok { return 0, "", errorsmod.Wrap(types.ErrChannelNotFound, sourceChannel) @@ -107,8 +107,8 @@ func (k *Keeper) recvPacket( // packet sender is our channel's counterparty channel id. channel, ok := k.GetChannel(ctx, packet.DestinationChannel) if !ok { - // TODO: figure out how aliasing will work when more than one packet data is sent. - channel, ok = k.convertV1Channel(ctx, packet.Data[0].DestinationPort, packet.DestinationChannel) + // TODO: figure out how aliasing will work when more than one payload is sent. + channel, ok = k.convertV1Channel(ctx, packet.Payloads[0].DestinationPort, packet.DestinationChannel) if !ok { return errorsmod.Wrap(types.ErrChannelNotFound, packet.DestinationChannel) } @@ -197,8 +197,8 @@ func (k Keeper) WriteAcknowledgement( // TODO: Validate Acknowledgment more thoroughly here after Issue #7472: https://github.com/cosmos/ibc-go/issues/7472 - if len(ack.AcknowledgementResults) != len(packet.Data) { - return errorsmod.Wrapf(types.ErrInvalidAcknowledgement, "length of acknowledgement results %d does not match length of packet data %d", len(ack.AcknowledgementResults), len(packet.Data)) + if len(ack.AcknowledgementResults) != len(packet.Payloads) { + return errorsmod.Wrapf(types.ErrInvalidAcknowledgement, "length of acknowledgement results %d does not match length of payload %d", len(ack.AcknowledgementResults), len(packet.Payloads)) } // set the acknowledgement so that it can be verified on the other side @@ -288,8 +288,8 @@ func (k *Keeper) timeoutPacket( // that the packet was indeed sent by our counterparty. channel, ok := k.GetChannel(ctx, packet.SourceChannel) if !ok { - // TODO: figure out how aliasing will work when more than one packet data is sent. - channel, ok = k.convertV1Channel(ctx, packet.Data[0].SourcePort, packet.SourceChannel) + // TODO: figure out how aliasing will work when more than one payload is sent. + channel, ok = k.convertV1Channel(ctx, packet.Payloads[0].SourcePort, packet.SourceChannel) if !ok { return errorsmod.Wrap(types.ErrChannelNotFound, packet.DestinationChannel) } diff --git a/modules/core/04-channel/v2/keeper/packet_test.go b/modules/core/04-channel/v2/keeper/packet_test.go index 871aa3479c1..a01c5959f64 100644 --- a/modules/core/04-channel/v2/keeper/packet_test.go +++ b/modules/core/04-channel/v2/keeper/packet_test.go @@ -37,7 +37,7 @@ func (suite *KeeperTestSuite) TestSendPacket() { "success with later packet", func() { // send the same packet earlier so next packet send should be sequence 2 - _, _, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceChannel, packet.TimeoutTimestamp, packet.Data) + _, _, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceChannel, packet.TimeoutTimestamp, packet.Payloads) suite.Require().NoError(err) expSequence = 2 }, @@ -54,7 +54,7 @@ func (suite *KeeperTestSuite) TestSendPacket() { "packet failed basic validation", func() { // invalid data - packet.Data = nil + packet.Payloads = nil }, channeltypes.ErrInvalidPacket, }, @@ -97,20 +97,20 @@ func (suite *KeeperTestSuite) TestSendPacket() { path = ibctesting.NewPath(suite.chainA, suite.chainB) path.SetupV2() - packetData := mockv2.NewMockPayload(mockv2.ModuleNameA, mockv2.ModuleNameB) + payload := mockv2.NewMockPayload(mockv2.ModuleNameA, mockv2.ModuleNameB) timeoutTimestamp := uint64(suite.chainB.GetContext().BlockTime().Add(time.Hour).Unix()) // create standard packet that can be malleated packet = types.NewPacket(1, path.EndpointA.ChannelID, path.EndpointB.ChannelID, - timeoutTimestamp, packetData) + timeoutTimestamp, payload) expSequence = 1 // malleate the test case tc.malleate() // send packet - seq, destChannel, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceChannel, packet.TimeoutTimestamp, packet.Data) + seq, destChannel, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceChannel, packet.TimeoutTimestamp, packet.Payloads) expPass := tc.expError == nil if expPass { @@ -204,12 +204,12 @@ func (suite *KeeperTestSuite) TestRecvPacket() { path = ibctesting.NewPath(suite.chainA, suite.chainB) path.SetupV2() - packetData := mockv2.NewMockPayload(mockv2.ModuleNameA, mockv2.ModuleNameB) + payload := mockv2.NewMockPayload(mockv2.ModuleNameA, mockv2.ModuleNameB) timeoutTimestamp := uint64(suite.chainB.GetContext().BlockTime().Add(time.Hour).Unix()) // send packet - packet, err = path.EndpointA.MsgSendPacket(timeoutTimestamp, packetData) + packet, err = path.EndpointA.MsgSendPacket(timeoutTimestamp, payload) suite.Require().NoError(err) tc.malleate() @@ -298,13 +298,13 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgement() { path := ibctesting.NewPath(suite.chainA, suite.chainB) path.SetupV2() - packetData := mockv2.NewMockPayload(mockv2.ModuleNameA, mockv2.ModuleNameB) + payload := mockv2.NewMockPayload(mockv2.ModuleNameA, mockv2.ModuleNameB) timeoutTimestamp := uint64(suite.chainB.GetContext().BlockTime().Add(time.Hour).Unix()) // create standard packet that can be malleated packet = types.NewPacket(1, path.EndpointA.ChannelID, path.EndpointB.ChannelID, - timeoutTimestamp, packetData) + timeoutTimestamp, payload) // create standard ack that can be malleated ack = types.Acknowledgement{ @@ -390,8 +390,8 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { { "failure: packet commitment bytes differ", func() { - // change packet data after send to acknowledge different packet - packet.Data[0].Value = []byte("different value") + // change payload after send to acknowledge different packet + packet.Payloads[0].Value = []byte("different value") }, channeltypes.ErrInvalidPacket, }, @@ -414,12 +414,12 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() { freezeClient = false - packetData := mockv2.NewMockPayload(mockv2.ModuleNameA, mockv2.ModuleNameB) + payload := mockv2.NewMockPayload(mockv2.ModuleNameA, mockv2.ModuleNameB) timeoutTimestamp := uint64(suite.chainB.GetContext().BlockTime().Add(time.Hour).Unix()) // send packet - packet, err = path.EndpointA.MsgSendPacket(timeoutTimestamp, packetData) + packet, err = path.EndpointA.MsgSendPacket(timeoutTimestamp, payload) suite.Require().NoError(err) err = path.EndpointB.MsgRecvPacket(packet) @@ -467,7 +467,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { func() { // send packet _, _, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceChannel, - packet.TimeoutTimestamp, packet.Data) + packet.TimeoutTimestamp, packet.Payloads) suite.Require().NoError(err, "send packet failed") }, nil, @@ -477,7 +477,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { func() { // send packet _, _, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceChannel, - packet.TimeoutTimestamp, packet.Data) + packet.TimeoutTimestamp, packet.Payloads) suite.Require().NoError(err, "send packet failed") packet.SourceChannel = ibctesting.InvalidID @@ -489,7 +489,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { func() { // send packet _, _, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceChannel, - packet.TimeoutTimestamp, packet.Data) + packet.TimeoutTimestamp, packet.Payloads) suite.Require().NoError(err, "send packet failed") packet.DestinationChannel = unusedChannel @@ -503,7 +503,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { // send packet _, _, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceChannel, - packet.TimeoutTimestamp, packet.Data) + packet.TimeoutTimestamp, packet.Payloads) suite.Require().NoError(err, "send packet failed") }, channeltypes.ErrTimeoutNotReached, @@ -517,11 +517,11 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { "failure: packet does not match commitment", func() { _, _, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceChannel, - packet.TimeoutTimestamp, packet.Data) + packet.TimeoutTimestamp, packet.Payloads) suite.Require().NoError(err, "send packet failed") // try to timeout packet with different data - packet.Data[0].Value = []byte("different value") + packet.Payloads[0].Value = []byte("different value") }, channeltypes.ErrInvalidPacket, }, @@ -530,7 +530,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { func() { // send packet _, _, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceChannel, - packet.TimeoutTimestamp, packet.Data) + packet.TimeoutTimestamp, packet.Payloads) suite.Require().NoError(err, "send packet failed") freezeClient = true @@ -542,7 +542,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { func() { // send packet _, _, err := suite.chainA.App.GetIBCKeeper().ChannelKeeperV2.SendPacketTest(suite.chainA.GetContext(), packet.SourceChannel, - packet.TimeoutTimestamp, packet.Data) + packet.TimeoutTimestamp, packet.Payloads) suite.Require().NoError(err, "send packet failed") // set packet receipt to mock a valid past receive @@ -564,13 +564,13 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() { path.SetupV2() // create default packet with a timed out timestamp - packetData := mockv2.NewMockPayload(mockv2.ModuleNameA, mockv2.ModuleNameB) + payload := mockv2.NewMockPayload(mockv2.ModuleNameA, mockv2.ModuleNameB) timeoutTimestamp := uint64(suite.chainB.GetContext().BlockTime().Unix()) // test cases may mutate timeout values packet = types.NewPacket(1, path.EndpointA.ChannelID, path.EndpointB.ChannelID, - timeoutTimestamp, packetData) + timeoutTimestamp, payload) tc.malleate() diff --git a/modules/core/04-channel/v2/types/commitment.go b/modules/core/04-channel/v2/types/commitment.go index 8a14e77f91f..6d815f3da46 100644 --- a/modules/core/04-channel/v2/types/commitment.go +++ b/modules/core/04-channel/v2/types/commitment.go @@ -7,7 +7,7 @@ import ( ) // CommitPacket returns the V2 packet commitment bytes. The commitment consists of: -// sha256_hash(timeout) + sha256_hash(destinationChannel) + sha256_hash(packetData) from a given packet. +// sha256_hash(timeout) + sha256_hash(destinationChannel) + sha256_hash(payload) from a given packet. // This results in a fixed length preimage. // NOTE: A fixed length preimage is ESSENTIAL to prevent relayers from being able // to malleate the packet fields and create a commitment hash that matches the original packet. @@ -17,15 +17,15 @@ func CommitPacket(packet Packet) []byte { destIDHash := sha256.Sum256([]byte(packet.DestinationChannel)) buf = append(buf, destIDHash[:]...) - for _, data := range packet.Data { - buf = append(buf, hashPayload(data)...) + for _, payload := range packet.Payloads { + buf = append(buf, hashPayload(payload)...) } hash := sha256.Sum256(buf) return hash[:] } -// hashPayload returns the hash of the packet data. +// hashPayload returns the hash of the payload. func hashPayload(data Payload) []byte { var buf []byte sourceHash := sha256.Sum256([]byte(data.SourcePort)) diff --git a/modules/core/04-channel/v2/types/msgs_test.go b/modules/core/04-channel/v2/types/msgs_test.go index a5bc812cc1d..2e90f34a5ea 100644 --- a/modules/core/04-channel/v2/types/msgs_test.go +++ b/modules/core/04-channel/v2/types/msgs_test.go @@ -181,7 +181,7 @@ func (s *TypesTestSuite) TestMsgSendPacketValidateBasic() { expError: types.ErrInvalidPayload, }, { - name: "failure: invalid packetdata", + name: "failure: invalid payload", malleate: func() { msg.Payloads[0].DestinationPort = "" }, @@ -230,7 +230,7 @@ func (s *TypesTestSuite) TestMsgRecvPacketValidateBasic() { { name: "failure: invalid packet", malleate: func() { - msg.Packet.Data = []types.Payload{} + msg.Packet.Payloads = []types.Payload{} }, expError: types.ErrInvalidPacket, }, diff --git a/modules/core/04-channel/v2/types/packet.go b/modules/core/04-channel/v2/types/packet.go index c00e7a37e73..8c602162fc9 100644 --- a/modules/core/04-channel/v2/types/packet.go +++ b/modules/core/04-channel/v2/types/packet.go @@ -9,17 +9,17 @@ import ( ) // NewPacket constructs a new packet. -func NewPacket(sequence uint64, sourceChannel, destinationChannel string, timeoutTimestamp uint64, data ...Payload) Packet { +func NewPacket(sequence uint64, sourceChannel, destinationChannel string, timeoutTimestamp uint64, payloads ...Payload) Packet { return Packet{ Sequence: sequence, SourceChannel: sourceChannel, DestinationChannel: destinationChannel, TimeoutTimestamp: timeoutTimestamp, - Data: data, + Payloads: payloads, } } -// NewPayload constructs a new PacketData +// NewPayload constructs a new Payload func NewPayload(sourcePort, destPort, version, encoding string, value []byte) Payload { return Payload{ SourcePort: sourcePort, @@ -32,13 +32,13 @@ func NewPayload(sourcePort, destPort, version, encoding string, value []byte) Pa // ValidateBasic validates that a Packet satisfies the basic requirements. func (p Packet) ValidateBasic() error { - if len(p.Data) == 0 { - return errorsmod.Wrap(ErrInvalidPacket, "packet data must not be empty") + if len(p.Payloads) == 0 { + return errorsmod.Wrap(ErrInvalidPacket, "payloads must not be empty") } - for _, pd := range p.Data { + for _, pd := range p.Payloads { if err := pd.ValidateBasic(); err != nil { - return errorsmod.Wrap(err, "invalid Packet Data") + return errorsmod.Wrap(err, "invalid Payload") } } diff --git a/modules/core/04-channel/v2/types/packet.pb.go b/modules/core/04-channel/v2/types/packet.pb.go index 0811b9e52b4..a264047c3d6 100644 --- a/modules/core/04-channel/v2/types/packet.pb.go +++ b/modules/core/04-channel/v2/types/packet.pb.go @@ -71,8 +71,8 @@ type Packet struct { DestinationChannel string `protobuf:"bytes,3,opt,name=destination_channel,json=destinationChannel,proto3" json:"destination_channel,omitempty"` // timeout timestamp after which the packet times out. TimeoutTimestamp uint64 `protobuf:"varint,4,opt,name=timeout_timestamp,json=timeoutTimestamp,proto3" json:"timeout_timestamp,omitempty"` - // a list of packet data, each one for a specific application. - Data []Payload `protobuf:"bytes,5,rep,name=data,proto3" json:"data"` + // a list of payloads, each one for a specific application. + Payloads []Payload `protobuf:"bytes,5,rep,name=payloads,proto3" json:"payloads"` } func (m *Packet) Reset() { *m = Packet{} } @@ -136,9 +136,9 @@ func (m *Packet) GetTimeoutTimestamp() uint64 { return 0 } -func (m *Packet) GetData() []Payload { +func (m *Packet) GetPayloads() []Payload { if m != nil { - return m.Data + return m.Payloads } return nil } @@ -390,48 +390,48 @@ func init() { func init() { proto.RegisterFile("ibc/core/channel/v2/packet.proto", fileDescriptor_2f814aba9ca97169) } var fileDescriptor_2f814aba9ca97169 = []byte{ - // 643 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x94, 0xc1, 0x6e, 0xd3, 0x40, - 0x10, 0x86, 0xb3, 0x6d, 0xd2, 0x34, 0x9b, 0xd2, 0x9a, 0x6d, 0x0b, 0x6e, 0x84, 0x52, 0x13, 0xa9, - 0x10, 0x8a, 0x6a, 0xa3, 0x80, 0x90, 0x2a, 0x71, 0x49, 0x43, 0x2a, 0x55, 0xa0, 0x10, 0xd9, 0x09, - 0x52, 0xb9, 0x58, 0x9b, 0xcd, 0xca, 0xb5, 0x6a, 0x7b, 0x8d, 0x77, 0xed, 0xaa, 0x12, 0x4f, 0x50, - 0x09, 0x89, 0x17, 0xe8, 0x81, 0x33, 0x2f, 0xd2, 0x63, 0x8f, 0x9c, 0x10, 0xb4, 0x2f, 0x82, 0xb2, - 0x76, 0xa3, 0x24, 0x84, 0x93, 0x3d, 0xff, 0x7c, 0xb3, 0x9e, 0x7f, 0xbc, 0x1a, 0xa8, 0xb9, 0x03, - 0x62, 0x10, 0x16, 0x51, 0x83, 0x9c, 0xe0, 0x20, 0xa0, 0x9e, 0x91, 0x34, 0x8c, 0x10, 0x93, 0x53, - 0x2a, 0xf4, 0x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xbb, - 0xdf, 0xb1, 0xba, 0xed, 0xd6, 0xd1, 0xe1, 0x51, 0xfb, 0xad, 0x92, 0xab, 0x2c, 0x5f, 0x5c, 0x6a, - 0xf9, 0xce, 0x87, 0x4e, 0x1b, 0x3d, 0x81, 0x9b, 0xd3, 0xa0, 0xd5, 0x6f, 0xb5, 0xda, 0x96, 0xa5, - 0x80, 0x4a, 0xf9, 0xe2, 0x52, 0x2b, 0x5a, 0x31, 0x21, 0x94, 0xf3, 0x7f, 0xb9, 0xc3, 0xe6, 0xd1, - 0xfb, 0xbe, 0xd9, 0x56, 0x16, 0x52, 0xee, 0x10, 0xbb, 0x5e, 0x1c, 0x51, 0x54, 0x83, 0xeb, 0xd3, - 0x5c, 0xd3, 0x3a, 0xee, 0xb4, 0x94, 0xc5, 0x4a, 0xe9, 0xe2, 0x52, 0x2b, 0x34, 0xf9, 0x79, 0x40, - 0x0e, 0x3e, 0x5e, 0xdd, 0x54, 0xc1, 0xf5, 0x4d, 0x15, 0xfc, 0xbe, 0xa9, 0x82, 0x6f, 0xb7, 0xd5, - 0xdc, 0xf5, 0x6d, 0x35, 0xf7, 0xf3, 0xb6, 0x9a, 0xfb, 0xf4, 0xc6, 0x71, 0xc5, 0x49, 0x3c, 0xd0, - 0x09, 0xf3, 0x0d, 0xc2, 0xb8, 0xcf, 0xb8, 0xe1, 0x0e, 0xc8, 0x9e, 0xc3, 0x8c, 0x64, 0xdf, 0xf0, - 0xd9, 0x30, 0xf6, 0x28, 0x4f, 0x77, 0xc8, 0x8b, 0x57, 0x7b, 0x13, 0x6b, 0x44, 0x9c, 0x87, 0x94, - 0x0f, 0x96, 0xe4, 0x6e, 0x78, 0xf9, 0x37, 0x00, 0x00, 0xff, 0xff, 0x42, 0xe1, 0x97, 0xae, 0x6a, - 0x04, 0x00, 0x00, + // 645 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x94, 0xc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 0x4f, 0x0e, 0x3f, 0x5e, 0xdf, 0x56, 0xc0, 0xcd, 0x6d, 0x05, 0xfc, 0xbe, 0xad, 0x80, 0x6f, 0x77, + 0x95, 0xcc, 0xcd, 0x5d, 0x25, 0xf3, 0xf3, 0xae, 0x92, 0xf9, 0xf4, 0x7a, 0xe8, 0x88, 0xd3, 0xa8, + 0xaf, 0x13, 0xe6, 0x19, 0x84, 0x71, 0x8f, 0x71, 0xc3, 0xe9, 0x93, 0xfd, 0x21, 0x33, 0xe2, 0x03, + 0xc3, 0x63, 0x83, 0xc8, 0xa5, 0x3c, 0x79, 0x4b, 0x5e, 0xbc, 0xda, 0x9f, 0x7a, 0x4e, 0xc4, 0x45, + 0x40, 0x79, 0x7f, 0x45, 0xbe, 0x11, 0x2f, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x1a, 0x59, 0x03, + 0x6e, 0x72, 0x04, 0x00, 0x00, } func (m *Packet) Marshal() (dAtA []byte, err error) { @@ -454,10 +454,10 @@ func (m *Packet) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Data) > 0 { - for iNdEx := len(m.Data) - 1; iNdEx >= 0; iNdEx-- { + if len(m.Payloads) > 0 { + for iNdEx := len(m.Payloads) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.Data[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Payloads[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -696,8 +696,8 @@ func (m *Packet) Size() (n int) { if m.TimeoutTimestamp != 0 { n += 1 + sovPacket(uint64(m.TimeoutTimestamp)) } - if len(m.Data) > 0 { - for _, e := range m.Data { + if len(m.Payloads) > 0 { + for _, e := range m.Payloads { l = e.Size() n += 1 + l + sovPacket(uint64(l)) } @@ -919,7 +919,7 @@ func (m *Packet) Unmarshal(dAtA []byte) error { } case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Payloads", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -946,8 +946,8 @@ func (m *Packet) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Data = append(m.Data, Payload{}) - if err := m.Data[len(m.Data)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Payloads = append(m.Payloads, Payload{}) + if err := m.Payloads[len(m.Payloads)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/modules/core/04-channel/v2/types/packet_test.go b/modules/core/04-channel/v2/types/packet_test.go index e00258d7a7f..0a8b079b0a5 100644 --- a/modules/core/04-channel/v2/types/packet_test.go +++ b/modules/core/04-channel/v2/types/packet_test.go @@ -26,30 +26,30 @@ func TestValidateBasic(t *testing.T) { nil, }, { - "failure: packet data is nil", + "failure: payloads is nil", func() { - packet.Data = nil + packet.Payloads = nil }, types.ErrInvalidPacket, }, { - "failure: empty data", + "failure: empty payload", func() { - packet.Data = []types.Payload{} + packet.Payloads = []types.Payload{} }, types.ErrInvalidPacket, }, { - "failure: invalid data source port ID", + "failure: invalid payload source port ID", func() { - packet.Data[0].SourcePort = "" + packet.Payloads[0].SourcePort = "" }, host.ErrInvalidID, }, { - "failure: invalid data dest port ID", + "failure: invalid payload dest port ID", func() { - packet.Data[0].DestinationPort = "" + packet.Payloads[0].DestinationPort = "" }, host.ErrInvalidID, }, @@ -84,21 +84,21 @@ func TestValidateBasic(t *testing.T) { { "failure: empty version", func() { - packet.Data[0].Version = "" + packet.Payloads[0].Version = "" }, types.ErrInvalidPayload, }, { "failure: empty encoding", func() { - packet.Data[0].Encoding = "" + packet.Payloads[0].Encoding = "" }, types.ErrInvalidPayload, }, { "failure: empty value", func() { - packet.Data[0].Value = []byte{} + packet.Payloads[0].Value = []byte{} }, types.ErrInvalidPayload, }, diff --git a/proto/ibc/core/channel/v2/packet.proto b/proto/ibc/core/channel/v2/packet.proto index dc545d329ea..98d581915f9 100644 --- a/proto/ibc/core/channel/v2/packet.proto +++ b/proto/ibc/core/channel/v2/packet.proto @@ -19,8 +19,8 @@ message Packet { string destination_channel = 3; // timeout timestamp after which the packet times out. uint64 timeout_timestamp = 4; - // a list of packet data, each one for a specific application. - repeated Payload data = 5 [(gogoproto.nullable) = false]; + // a list of payloads, each one for a specific application. + repeated Payload payloads = 5 [(gogoproto.nullable) = false]; } // Payload contains the source and destination ports and payload for the application (version, encoding, raw bytes)