Skip to content

Commit 2f97f0b

Browse files
authored
emit hex encoded ack attribute in events (#197)
* emit hex encoded ack in events * add changelog and update migration docs
1 parent 4570955 commit 2f97f0b

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
7070
* (07-tendermint) [\#182](https://github.com/cosmos/ibc-go/pull/182) Remove duplicate checks in upgrade logic.
7171
* (modules/core/04-channel) [\#7949](https://github.com/cosmos/cosmos-sdk/issues/7949) Standardized channel `Acknowledgement` moved to its own file. Codec registration redundancy removed.
7272
* (modules/core/04-channel) [\#144](https://github.com/cosmos/ibc-go/pull/144) Introduced a `packet_data_hex` attribute to emit the hex-encoded packet data in events. This allows for raw binary (proto-encoded message) to be sent over events and decoded correctly on relayer. Original `packet_data` is DEPRECATED. All relayers and IBC event consumers are encouraged to switch to `packet_data_hex` as soon as possible.
73+
* (core/04-channel) [\#197](https://github.com/cosmos/ibc-go/pull/197) Introduced a `packet_ack_hex` attribute to emit the hex-encoded acknowledgement in events. This allows for raw binary (proto-encoded message) to be sent over events and decoded correctly on relayer. Original `packet_ack` is DEPRECATED. All relayers and IBC event consumers are encouraged to switch to `packet_ack_hex` as soon as possible.
7374
* (modules/light-clients/07-tendermint) [\#125](https://github.com/cosmos/ibc-go/pull/125) Implement efficient iteration of consensus states and pruning of earliest expired consensus state on UpdateClient.
7475
* (modules/light-clients/07-tendermint) [\#141](https://github.com/cosmos/ibc-go/pull/141) Return early in case there's a duplicate update call to save Gas.
7576

docs/migrations/ibc-migration-043.md

+2
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ The `OnRecvPacket` callback has been modified to only return the acknowledgement
110110

111111
The `packet_data` attribute has been deprecated in favor of `packet_data_hex`, in order to provide standardized encoding/decoding of packet data in events. While the `packet_data` event still exists, all relayers and IBC Event consumers are strongly encouraged to switch over to using `packet_data_hex` as soon as possible.
112112

113+
The `packet_ack` attribute has also been deprecated in favor of `packet_ack_hex` for the same reason stated above. All relayers and IBC Event consumers are strongly encouraged to switch over to using `packet_ack_hex` as soon as possible.
114+
113115
The `consensus_height` attribute has been removed in the Misbehaviour event emitted. IBC clients no longer have a frozen height and misbehaviour does not necessarily have an associated height.
114116

115117
## Relevant SDK changes

modules/core/04-channel/keeper/packet.go

+1
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ func (k Keeper) WriteAcknowledgement(
381381
sdk.NewAttribute(types.AttributeKeyDstPort, packet.GetDestPort()),
382382
sdk.NewAttribute(types.AttributeKeyDstChannel, packet.GetDestChannel()),
383383
sdk.NewAttribute(types.AttributeKeyAck, string(acknowledgement)),
384+
sdk.NewAttribute(types.AttributeKeyAckHex, hex.EncodeToString(acknowledgement)),
384385
// we only support 1-hop packets now, and that is the most important hop for a relayer
385386
// (is it going to a chain I am connected to)
386387
sdk.NewAttribute(types.AttributeKeyConnection, channel.ConnectionHops[0]),

modules/core/04-channel/types/events.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ const (
2323

2424
// NOTE: DEPRECATED in favor of AttributeKeyDataHex
2525
AttributeKeyData = "packet_data"
26+
// NOTE: DEPRECATED in favor of AttributeKeyAckHex
27+
AttributeKeyAck = "packet_ack"
2628

2729
AttributeKeyDataHex = "packet_data_hex"
28-
AttributeKeyAck = "packet_ack"
30+
AttributeKeyAckHex = "packet_ack_hex"
2931
AttributeKeyTimeoutHeight = "packet_timeout_height"
3032
AttributeKeyTimeoutTimestamp = "packet_timeout_timestamp"
3133
AttributeKeySequence = "packet_sequence"

0 commit comments

Comments
 (0)