Skip to content

Commit

Permalink
chore: remove upgrade prefix from upgrade event attributes (cosmos#…
Browse files Browse the repository at this point in the history
…5603)

* chore: remove upgrade prefix from upgrade event attributes

* add migration docs for v9

* Update docs/docs/05-migrations/12-v8-to-v9.md

Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com>

* rename attribute string

---------

Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com>
  • Loading branch information
crodriguezvega and DimitrisJim authored Jan 16, 2024
1 parent 9184de3 commit f3c76cd
Show file tree
Hide file tree
Showing 4 changed files with 173 additions and 138 deletions.
35 changes: 35 additions & 0 deletions docs/docs/05-migrations/12-v8-to-v9.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
title: IBC-Go v8 to v9
sidebar_label: IBC-Go v8 to v9
sidebar_position: 12
slug: /migrations/v8-to-v9
---

# Migrating from v8 to v9

This guide provides instructions for migrating to a new version of ibc-go.

There are four sections based on the four potential user groups of this document:

- [Chains](#chains)
- [IBC Apps](#ibc-apps)
- [Relayers](#relayers)
- [IBC Light Clients](#ibc-light-clients)

**Note:** ibc-go supports golang semantic versioning and therefore all imports must be updated on major version releases.

## Chains

- No relevant changes were made in this release.

## IBC Apps

- No relevant changes were made in this release.

## Relayers

- Renaming of event attribute keys in [#5603](https://github.com/cosmos/ibc-go/pull/5603).

## IBC Light Clients

- No relevant changes were made in this release.
42 changes: 21 additions & 21 deletions modules/core/04-channel/keeper/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func emitChannelOpenInitEvent(ctx sdk.Context, portID string, channelID string,
sdk.NewAttribute(types.AttributeKeyChannelID, channelID),
sdk.NewAttribute(types.AttributeCounterpartyPortID, channel.Counterparty.PortId),
sdk.NewAttribute(types.AttributeKeyConnectionID, channel.ConnectionHops[0]),
sdk.NewAttribute(types.AttributeVersion, channel.Version),
sdk.NewAttribute(types.AttributeKeyVersion, channel.Version),
),
sdk.NewEvent(
sdk.EventTypeMessage,
Expand All @@ -38,7 +38,7 @@ func emitChannelOpenTryEvent(ctx sdk.Context, portID string, channelID string, c
sdk.NewAttribute(types.AttributeCounterpartyPortID, channel.Counterparty.PortId),
sdk.NewAttribute(types.AttributeCounterpartyChannelID, channel.Counterparty.ChannelId),
sdk.NewAttribute(types.AttributeKeyConnectionID, channel.ConnectionHops[0]),
sdk.NewAttribute(types.AttributeVersion, channel.Version),
sdk.NewAttribute(types.AttributeKeyVersion, channel.Version),
),
sdk.NewEvent(
sdk.EventTypeMessage,
Expand Down Expand Up @@ -280,9 +280,9 @@ func EmitChannelUpgradeInitEvent(ctx sdk.Context, portID string, channelID strin
sdk.NewAttribute(types.AttributeKeyChannelID, channelID),
sdk.NewAttribute(types.AttributeCounterpartyPortID, currentChannel.Counterparty.PortId),
sdk.NewAttribute(types.AttributeCounterpartyChannelID, currentChannel.Counterparty.ChannelId),
sdk.NewAttribute(types.AttributeKeyUpgradeConnectionHops, upgrade.Fields.ConnectionHops[0]),
sdk.NewAttribute(types.AttributeKeyUpgradeVersion, upgrade.Fields.Version),
sdk.NewAttribute(types.AttributeKeyUpgradeOrdering, upgrade.Fields.Ordering.String()),
sdk.NewAttribute(types.AttributeKeyConnectionHops, upgrade.Fields.ConnectionHops[0]),
sdk.NewAttribute(types.AttributeKeyVersion, upgrade.Fields.Version),
sdk.NewAttribute(types.AttributeKeyOrdering, upgrade.Fields.Ordering.String()),
sdk.NewAttribute(types.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", currentChannel.UpgradeSequence)),
),
sdk.NewEvent(
Expand All @@ -301,9 +301,9 @@ func EmitChannelUpgradeTryEvent(ctx sdk.Context, portID string, channelID string
sdk.NewAttribute(types.AttributeKeyChannelID, channelID),
sdk.NewAttribute(types.AttributeCounterpartyPortID, currentChannel.Counterparty.PortId),
sdk.NewAttribute(types.AttributeCounterpartyChannelID, currentChannel.Counterparty.ChannelId),
sdk.NewAttribute(types.AttributeKeyUpgradeConnectionHops, upgrade.Fields.ConnectionHops[0]),
sdk.NewAttribute(types.AttributeKeyUpgradeVersion, upgrade.Fields.Version),
sdk.NewAttribute(types.AttributeKeyUpgradeOrdering, upgrade.Fields.Ordering.String()),
sdk.NewAttribute(types.AttributeKeyConnectionHops, upgrade.Fields.ConnectionHops[0]),
sdk.NewAttribute(types.AttributeKeyVersion, upgrade.Fields.Version),
sdk.NewAttribute(types.AttributeKeyOrdering, upgrade.Fields.Ordering.String()),
sdk.NewAttribute(types.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", currentChannel.UpgradeSequence)),
),
sdk.NewEvent(
Expand All @@ -322,9 +322,9 @@ func EmitChannelUpgradeAckEvent(ctx sdk.Context, portID string, channelID string
sdk.NewAttribute(types.AttributeKeyChannelID, channelID),
sdk.NewAttribute(types.AttributeCounterpartyPortID, currentChannel.Counterparty.PortId),
sdk.NewAttribute(types.AttributeCounterpartyChannelID, currentChannel.Counterparty.ChannelId),
sdk.NewAttribute(types.AttributeKeyUpgradeConnectionHops, upgrade.Fields.ConnectionHops[0]),
sdk.NewAttribute(types.AttributeKeyUpgradeVersion, upgrade.Fields.Version),
sdk.NewAttribute(types.AttributeKeyUpgradeOrdering, upgrade.Fields.Ordering.String()),
sdk.NewAttribute(types.AttributeKeyConnectionHops, upgrade.Fields.ConnectionHops[0]),
sdk.NewAttribute(types.AttributeKeyVersion, upgrade.Fields.Version),
sdk.NewAttribute(types.AttributeKeyOrdering, upgrade.Fields.Ordering.String()),
sdk.NewAttribute(types.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", currentChannel.UpgradeSequence)),
),
sdk.NewEvent(
Expand Down Expand Up @@ -363,9 +363,9 @@ func EmitChannelUpgradeOpenEvent(ctx sdk.Context, portID string, channelID strin
sdk.NewAttribute(types.AttributeKeyChannelState, currentChannel.State.String()),
sdk.NewAttribute(types.AttributeCounterpartyPortID, currentChannel.Counterparty.PortId),
sdk.NewAttribute(types.AttributeCounterpartyChannelID, currentChannel.Counterparty.ChannelId),
sdk.NewAttribute(types.AttributeKeyUpgradeConnectionHops, currentChannel.ConnectionHops[0]),
sdk.NewAttribute(types.AttributeKeyUpgradeVersion, currentChannel.Version),
sdk.NewAttribute(types.AttributeKeyUpgradeOrdering, currentChannel.Ordering.String()),
sdk.NewAttribute(types.AttributeKeyConnectionHops, currentChannel.ConnectionHops[0]),
sdk.NewAttribute(types.AttributeKeyVersion, currentChannel.Version),
sdk.NewAttribute(types.AttributeKeyOrdering, currentChannel.Ordering.String()),
sdk.NewAttribute(types.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", currentChannel.UpgradeSequence)),
),
sdk.NewEvent(
Expand All @@ -384,9 +384,9 @@ func EmitChannelUpgradeTimeoutEvent(ctx sdk.Context, portID string, channelID st
sdk.NewAttribute(types.AttributeKeyChannelID, channelID),
sdk.NewAttribute(types.AttributeCounterpartyPortID, currentChannel.Counterparty.PortId),
sdk.NewAttribute(types.AttributeCounterpartyChannelID, currentChannel.Counterparty.ChannelId),
sdk.NewAttribute(types.AttributeKeyUpgradeConnectionHops, upgrade.Fields.ConnectionHops[0]),
sdk.NewAttribute(types.AttributeKeyUpgradeVersion, upgrade.Fields.Version),
sdk.NewAttribute(types.AttributeKeyUpgradeOrdering, upgrade.Fields.Ordering.String()),
sdk.NewAttribute(types.AttributeKeyConnectionHops, upgrade.Fields.ConnectionHops[0]),
sdk.NewAttribute(types.AttributeKeyVersion, upgrade.Fields.Version),
sdk.NewAttribute(types.AttributeKeyOrdering, upgrade.Fields.Ordering.String()),
sdk.NewAttribute(types.AttributeKeyUpgradeTimeoutHeight, upgrade.Timeout.Height.String()),
sdk.NewAttribute(types.AttributeKeyUpgradeTimeoutTimestamp, fmt.Sprintf("%d", upgrade.Timeout.Timestamp)),
sdk.NewAttribute(types.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", currentChannel.UpgradeSequence)),
Expand All @@ -408,7 +408,7 @@ func EmitErrorReceiptEvent(ctx sdk.Context, portID string, channelID string, cur
sdk.NewAttribute(types.AttributeCounterpartyPortID, currentChannel.Counterparty.PortId),
sdk.NewAttribute(types.AttributeCounterpartyChannelID, currentChannel.Counterparty.ChannelId),
sdk.NewAttribute(types.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", currentChannel.UpgradeSequence)),
sdk.NewAttribute(types.AttributeKeyUpgradeErrorReceipt, err.Error()),
sdk.NewAttribute(types.AttributeKeyErrorReceipt, err.Error()),
),
sdk.NewEvent(
sdk.EventTypeMessage,
Expand All @@ -426,9 +426,9 @@ func EmitChannelUpgradeCancelEvent(ctx sdk.Context, portID string, channelID str
sdk.NewAttribute(types.AttributeKeyChannelID, channelID),
sdk.NewAttribute(types.AttributeCounterpartyPortID, currentChannel.Counterparty.PortId),
sdk.NewAttribute(types.AttributeCounterpartyChannelID, currentChannel.Counterparty.ChannelId),
sdk.NewAttribute(types.AttributeKeyUpgradeConnectionHops, upgrade.Fields.ConnectionHops[0]),
sdk.NewAttribute(types.AttributeKeyUpgradeVersion, upgrade.Fields.Version),
sdk.NewAttribute(types.AttributeKeyUpgradeOrdering, upgrade.Fields.Ordering.String()),
sdk.NewAttribute(types.AttributeKeyConnectionHops, upgrade.Fields.ConnectionHops[0]),
sdk.NewAttribute(types.AttributeKeyVersion, upgrade.Fields.Version),
sdk.NewAttribute(types.AttributeKeyOrdering, upgrade.Fields.Ordering.String()),
sdk.NewAttribute(types.AttributeKeyUpgradeSequence, fmt.Sprintf("%d", currentChannel.UpgradeSequence)),
),
sdk.NewEvent(
Expand Down
28 changes: 14 additions & 14 deletions modules/core/04-channel/types/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,20 @@ import (

// IBC channel events
const (
AttributeKeyConnectionID = "connection_id"
AttributeKeyPortID = "port_id"
AttributeKeyChannelID = "channel_id"
AttributeKeyChannelState = "channel_state"
AttributeVersion = "version"
AttributeKeyConnectionID = "connection_id"
AttributeKeyPortID = "port_id"
AttributeKeyChannelID = "channel_id"
AttributeKeyChannelState = "channel_state"
AttributeKeyVersion = "version"
AttributeKeyConnectionHops = "connection_hops"
AttributeKeyOrdering = "ordering"

// upgrade specific keys
AttributeKeyUpgradeTimeoutHeight = "timeout_height"
AttributeKeyUpgradeTimeoutTimestamp = "timeout_timestamp"
AttributeKeyUpgradeSequence = "upgrade_sequence"
AttributeKeyErrorReceipt = "error_receipt"

AttributeCounterpartyPortID = "counterparty_port_id"
AttributeCounterpartyChannelID = "counterparty_channel_id"

Expand All @@ -38,15 +47,6 @@ const (
AttributeKeyDstChannel = "packet_dst_channel"
AttributeKeyChannelOrdering = "packet_channel_ordering"
AttributeKeyConnection = "packet_connection"

// upgrade specific keys
AttributeKeyUpgradeSequence = "upgrade_sequence"
AttributeKeyUpgradeVersion = "upgrade_version"
AttributeKeyUpgradeConnectionHops = "upgrade_connection_hops"
AttributeKeyUpgradeOrdering = "upgrade_ordering"
AttributeKeyUpgradeErrorReceipt = "upgrade_error_receipt"
AttributeKeyUpgradeTimeoutHeight = "upgrade_timeout_height"
AttributeKeyUpgradeTimeoutTimestamp = "upgrade_timeout_timestamp"
)

// IBC channel events vars
Expand Down
Loading

0 comments on commit f3c76cd

Please sign in to comment.