diff --git a/CHANGELOG.md b/CHANGELOG.md index fedaa25a195..c25ce8d2ae1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (core/02-client) [\#6084](https://github.com/cosmos/ibc-go/pull/6084) Removed `stakingKeeper` as an argument to `NewKeeper` and replaced with a `ConsensusHost` implementation. * (testing) [\#6070](https://github.com/cosmos/ibc-go/pull/6070) Remove `AssertEventsLegacy` function. * (core) [\#6138](https://github.com/cosmos/ibc-go/pull/6138) Remove `Router` reference from IBC core keeper and use instead the router on the existing `PortKeeper` reference. +* (core/04-channel) [\#6023](https://github.com/cosmos/ibc-go/pull/6023) Remove emission of non-hexlified event attributes `packet_data` and `packet_ack`. ### State Machine Breaking diff --git a/docs/docs/05-migrations/13-v8-to-v9.md b/docs/docs/05-migrations/13-v8-to-v9.md index b2c0380e3e5..0012683f295 100644 --- a/docs/docs/05-migrations/13-v8-to-v9.md +++ b/docs/docs/05-migrations/13-v8-to-v9.md @@ -85,6 +85,7 @@ func NewKeeper( ## Relayers - Renaming of event attribute keys in [#5603](https://github.com/cosmos/ibc-go/pull/5603). +- Removal of duplicate non-hexlified event attributes in [#6023](https://github.com/cosmos/ibc-go/pull/6023). ## IBC Light Clients diff --git a/e2e/go.mod b/e2e/go.mod index 37ea0225a87..17cacdf44f8 100644 --- a/e2e/go.mod +++ b/e2e/go.mod @@ -2,6 +2,8 @@ module github.com/cosmos/ibc-go/e2e go 1.21 +replace github.com/strangelove-ventures/interchaintest/v8 => github.com/DimitrisJim/interchaintest/v8 v8.0.0-20240419095404-2c9270423b9a + require ( cosmossdk.io/errors v1.0.1 cosmossdk.io/math v1.3.0 @@ -12,7 +14,7 @@ require ( github.com/cosmos/ibc-go/modules/light-clients/08-wasm v0.0.0-00010101000000-000000000000 github.com/cosmos/ibc-go/v8 v8.1.0 github.com/docker/docker v24.0.7+incompatible - github.com/strangelove-ventures/interchaintest/v8 v8.2.0 + github.com/strangelove-ventures/interchaintest/v8 v8.2.1-0.20240419152858-c8b741617cd8 github.com/stretchr/testify v1.9.0 go.uber.org/zap v1.27.0 golang.org/x/mod v0.17.0 @@ -235,7 +237,6 @@ require ( golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.5.0 // indirect golang.org/x/tools v0.20.0 // indirect - golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect google.golang.org/api v0.162.0 // indirect google.golang.org/appengine v1.6.8 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect diff --git a/e2e/go.sum b/e2e/go.sum index 197692586b6..7092d131741 100644 --- a/e2e/go.sum +++ b/e2e/go.sum @@ -238,6 +238,8 @@ github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bp github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= +github.com/DimitrisJim/interchaintest/v8 v8.0.0-20240419095404-2c9270423b9a h1:Ecz2QGDNdO/Hej2Dd490Vyg1yy55/2Lt2bN81tWuSgo= +github.com/DimitrisJim/interchaintest/v8 v8.0.0-20240419095404-2c9270423b9a/go.mod h1:B1TjQjU1te0ek05LQGjDwEu1NwWpfmC3+eAEDtouY+0= github.com/FactomProject/basen v0.0.0-20150613233007-fe3947df716e h1:ahyvB3q25YnZWly5Gq1ekg6jcmWaGj/vG/MhF4aisoc= github.com/FactomProject/basen v0.0.0-20150613233007-fe3947df716e/go.mod h1:kGUqhHd//musdITWjFvNTHn90WG9bMLBEPQZ17Cmlpw= github.com/FactomProject/btcutilecc v0.0.0-20130527213604-d3a63a5752ec h1:1Qb69mGp/UtRPn422BH4/Y4Q3SLUrD9KHuDkm8iodFc= @@ -1052,8 +1054,6 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ= github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= -github.com/strangelove-ventures/interchaintest/v8 v8.2.0 h1:EZXPvZXL1y/kvh9XI04A2stL+2UMvykhNUv28euRnL8= -github.com/strangelove-ventures/interchaintest/v8 v8.2.0/go.mod h1:pupV0YN3A56/u9kHj9U1F8MdDUEolBIn05F0W1q/0oI= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= diff --git a/modules/core/04-channel/keeper/events.go b/modules/core/04-channel/keeper/events.go index 7d2e9fe4a6a..102034aae84 100644 --- a/modules/core/04-channel/keeper/events.go +++ b/modules/core/04-channel/keeper/events.go @@ -125,7 +125,6 @@ func emitSendPacketEvent(ctx sdk.Context, packet types.Packet, channel types.Cha ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeSendPacket, - sdk.NewAttribute(types.AttributeKeyData, string(packet.GetData())), //nolint:staticcheck // DEPRECATED sdk.NewAttribute(types.AttributeKeyDataHex, hex.EncodeToString(packet.GetData())), sdk.NewAttribute(types.AttributeKeyTimeoutHeight, timeoutHeight.String()), sdk.NewAttribute(types.AttributeKeyTimeoutTimestamp, fmt.Sprintf("%d", packet.GetTimeoutTimestamp())), @@ -153,7 +152,6 @@ func emitRecvPacketEvent(ctx sdk.Context, packet types.Packet, channel types.Cha ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeRecvPacket, - sdk.NewAttribute(types.AttributeKeyData, string(packet.GetData())), //nolint:staticcheck // DEPRECATED sdk.NewAttribute(types.AttributeKeyDataHex, hex.EncodeToString(packet.GetData())), sdk.NewAttribute(types.AttributeKeyTimeoutHeight, packet.GetTimeoutHeight().String()), sdk.NewAttribute(types.AttributeKeyTimeoutTimestamp, fmt.Sprintf("%d", packet.GetTimeoutTimestamp())), @@ -180,7 +178,6 @@ func emitWriteAcknowledgementEvent(ctx sdk.Context, packet types.Packet, channel ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeWriteAck, - sdk.NewAttribute(types.AttributeKeyData, string(packet.GetData())), //nolint:staticcheck // DEPRECATED sdk.NewAttribute(types.AttributeKeyDataHex, hex.EncodeToString(packet.GetData())), sdk.NewAttribute(types.AttributeKeyTimeoutHeight, packet.GetTimeoutHeight().String()), sdk.NewAttribute(types.AttributeKeyTimeoutTimestamp, fmt.Sprintf("%d", packet.GetTimeoutTimestamp())), @@ -189,7 +186,6 @@ func emitWriteAcknowledgementEvent(ctx sdk.Context, packet types.Packet, channel sdk.NewAttribute(types.AttributeKeySrcChannel, packet.GetSourceChannel()), sdk.NewAttribute(types.AttributeKeyDstPort, packet.GetDestPort()), sdk.NewAttribute(types.AttributeKeyDstChannel, packet.GetDestChannel()), - sdk.NewAttribute(types.AttributeKeyAck, string(acknowledgement)), //nolint:staticcheck // DEPRECATED sdk.NewAttribute(types.AttributeKeyAckHex, hex.EncodeToString(acknowledgement)), // we only support 1-hop packets now, and that is the most important hop for a relayer // (is it going to a chain I am connected to) diff --git a/modules/core/04-channel/types/events.go b/modules/core/04-channel/types/events.go index 6e7c7e83ae7..3d5747a3ed1 100644 --- a/modules/core/04-channel/types/events.go +++ b/modules/core/04-channel/types/events.go @@ -31,11 +31,6 @@ const ( EventTypeAcknowledgePacket = "acknowledge_packet" EventTypeTimeoutPacket = "timeout_packet" - // Deprecated: in favor of AttributeKeyDataHex - AttributeKeyData = "packet_data" - // Deprecated: in favor of AttributeKeyAckHex - AttributeKeyAck = "packet_ack" - AttributeKeyDataHex = "packet_data_hex" AttributeKeyAckHex = "packet_ack_hex" AttributeKeyTimeoutHeight = "packet_timeout_height" diff --git a/testing/events.go b/testing/events.go index 96b9063759a..af585a87669 100644 --- a/testing/events.go +++ b/testing/events.go @@ -1,6 +1,7 @@ package ibctesting import ( + "encoding/hex" "fmt" "slices" "strconv" @@ -84,9 +85,12 @@ func ParsePacketsFromEvents(events []abci.Event) ([]channeltypes.Packet, error) var packet channeltypes.Packet for _, attr := range ev.Attributes { switch attr.Key { - case channeltypes.AttributeKeyData: //nolint:staticcheck // DEPRECATED - packet.Data = []byte(attr.Value) - + case channeltypes.AttributeKeyDataHex: + data, err := hex.DecodeString(attr.Value) + if err != nil { + return ferr(err) + } + packet.Data = data case channeltypes.AttributeKeySequence: seq, err := strconv.ParseUint(attr.Value, 10, 64) if err != nil { @@ -143,8 +147,13 @@ func ParseAckFromEvents(events []abci.Event) ([]byte, error) { for _, ev := range events { if ev.Type == channeltypes.EventTypeWriteAck { for _, attr := range ev.Attributes { - if attr.Key == channeltypes.AttributeKeyAck { //nolint:staticcheck // DEPRECATED - return []byte(attr.Value), nil + if attr.Key == channeltypes.AttributeKeyAckHex { + value, err := hex.DecodeString(attr.Value) + if err != nil { + return nil, err + } + + return value, nil } } } diff --git a/testing/events_test.go b/testing/events_test.go index 9ecb7d30f59..a9cf524c68a 100644 --- a/testing/events_test.go +++ b/testing/events_test.go @@ -1,6 +1,7 @@ package ibctesting_test import ( + "encoding/hex" "testing" "github.com/stretchr/testify/require" @@ -29,8 +30,8 @@ func TestParsePacketsFromEvents(t *testing.T) { Type: channeltypes.EventTypeSendPacket, Attributes: []abci.EventAttribute{ { - Key: channeltypes.AttributeKeyData, - Value: "data1", + Key: channeltypes.AttributeKeyDataHex, + Value: hex.EncodeToString([]byte("data1")), }, { Key: channeltypes.AttributeKeySequence, @@ -69,8 +70,8 @@ func TestParsePacketsFromEvents(t *testing.T) { Type: channeltypes.EventTypeSendPacket, Attributes: []abci.EventAttribute{ { - Key: channeltypes.AttributeKeyData, - Value: "data2", + Key: channeltypes.AttributeKeyDataHex, + Value: hex.EncodeToString([]byte("data2")), }, { Key: channeltypes.AttributeKeySequence,