Skip to content

Commit

Permalink
imp: separate height and timestamp attribute in upgrade timeout event (
Browse files Browse the repository at this point in the history
  • Loading branch information
crodriguezvega committed Jan 16, 2024
1 parent ef0055b commit d596310
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
3 changes: 2 additions & 1 deletion modules/core/04-channel/keeper/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,8 @@ func EmitChannelUpgradeTimeoutEvent(ctx sdk.Context, portID string, channelID st
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.AttributeKeyUpgradeTimeout, upgrade.Timeout.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)),
),
sdk.NewEvent(
Expand Down
13 changes: 7 additions & 6 deletions modules/core/04-channel/types/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@ const (
AttributeKeyConnection = "packet_connection"

// upgrade specific keys
AttributeKeyUpgradeSequence = "upgrade_sequence"
AttributeKeyUpgradeVersion = "upgrade_version"
AttributeKeyUpgradeConnectionHops = "upgrade_connection_hops"
AttributeKeyUpgradeOrdering = "upgrade_ordering"
AttributeKeyUpgradeErrorReceipt = "upgrade_error_receipt"
AttributeKeyUpgradeTimeout = "upgrade_timeout"
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
19 changes: 10 additions & 9 deletions modules/core/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2309,15 +2309,16 @@ func (suite *KeeperTestSuite) TestChannelUpgradeTimeout() {
timeout := channeltypes.NewTimeout(clienttypes.ZeroHeight(), 1)
expEvents := ibctesting.EventsMap{
channeltypes.EventTypeChannelUpgradeTimeout: {
channeltypes.AttributeKeyPortID: path.EndpointA.ChannelConfig.PortID,
channeltypes.AttributeKeyChannelID: path.EndpointA.ChannelID,
channeltypes.AttributeCounterpartyPortID: path.EndpointB.ChannelConfig.PortID,
channeltypes.AttributeCounterpartyChannelID: path.EndpointB.ChannelID,
channeltypes.AttributeKeyUpgradeConnectionHops: proposedUpgrade.Fields.ConnectionHops[0],
channeltypes.AttributeKeyUpgradeVersion: proposedUpgrade.Fields.Version,
channeltypes.AttributeKeyUpgradeOrdering: proposedUpgrade.Fields.Ordering.String(),
channeltypes.AttributeKeyUpgradeTimeout: timeout.String(),
channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence),
channeltypes.AttributeKeyPortID: path.EndpointA.ChannelConfig.PortID,
channeltypes.AttributeKeyChannelID: path.EndpointA.ChannelID,
channeltypes.AttributeCounterpartyPortID: path.EndpointB.ChannelConfig.PortID,
channeltypes.AttributeCounterpartyChannelID: path.EndpointB.ChannelID,
channeltypes.AttributeKeyUpgradeConnectionHops: proposedUpgrade.Fields.ConnectionHops[0],
channeltypes.AttributeKeyUpgradeVersion: proposedUpgrade.Fields.Version,
channeltypes.AttributeKeyUpgradeOrdering: proposedUpgrade.Fields.Ordering.String(),
channeltypes.AttributeKeyUpgradeTimeoutHeight: timeout.Height.String(),
channeltypes.AttributeKeyUpgradeTimeoutTimestamp: fmt.Sprintf("%d", timeout.Timestamp),
channeltypes.AttributeKeyUpgradeSequence: fmt.Sprintf("%d", channel.UpgradeSequence),
},
channeltypes.EventTypeChannelUpgradeError: {
channeltypes.AttributeKeyPortID: path.EndpointA.ChannelConfig.PortID,
Expand Down

0 comments on commit d596310

Please sign in to comment.