From 40f122b73e9e25cdf3e8f1238e7df752c03e4136 Mon Sep 17 00:00:00 2001 From: Matija Salopek Date: Thu, 10 Nov 2022 13:30:01 +0100 Subject: [PATCH] update after reviews --- x/ccv/consumer/keeper/relay.go | 10 ++++------ x/ccv/provider/keeper/keeper.go | 3 ++- x/ccv/types/events.go | 20 ++++++++++---------- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/x/ccv/consumer/keeper/relay.go b/x/ccv/consumer/keeper/relay.go index 00e1770b1d..24f185ede1 100644 --- a/x/ccv/consumer/keeper/relay.go +++ b/x/ccv/consumer/keeper/relay.go @@ -38,15 +38,13 @@ func (k Keeper) OnRecvVSCPacket(ctx sdk.Context, packet channeltypes.Packet, new // - send pending slash requests in states k.SendPendingSlashRequests(ctx) - // emit first VSC packet to signal that CCV is working + // emit event on first VSC packet to signal that CCV is working ctx.EventManager().EmitEvent( sdk.NewEvent( - ccv.EventTypeFirstVSCPacket, + ccv.EventTypeChannelEstablished, sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), - sdk.NewAttribute(channeltypes.AttributeKeySrcChannel, packet.SourceChannel), - sdk.NewAttribute(channeltypes.AttributeKeySrcPort, packet.SourcePort), - sdk.NewAttribute(channeltypes.AttributeKeyDstChannel, packet.DestinationChannel), - sdk.NewAttribute(channeltypes.AttributeKeyDstPort, packet.DestinationPort), + sdk.NewAttribute(channeltypes.AttributeKeyChannelID, packet.DestinationChannel), + sdk.NewAttribute(channeltypes.AttributeKeyPortID, packet.DestinationPort), ), ) } diff --git a/x/ccv/provider/keeper/keeper.go b/x/ccv/provider/keeper/keeper.go index 24026862c4..f831ad18f1 100644 --- a/x/ccv/provider/keeper/keeper.go +++ b/x/ccv/provider/keeper/keeper.go @@ -289,10 +289,11 @@ func (k Keeper) SetConsumerChain(ctx sdk.Context, channelID string) error { // emit event on successful addition ctx.EventManager().EmitEvent( sdk.NewEvent( - ccv.EventTypeConsumerChainAdded, + ccv.EventTypeChannelEstablished, sdk.NewAttribute(sdk.AttributeKeyModule, consumertypes.ModuleName), sdk.NewAttribute(ccv.AttributeChainID, chainID), sdk.NewAttribute(conntypes.AttributeKeyClientID, clientID), + sdk.NewAttribute(channeltypes.AttributeKeyChannelID, channelID), sdk.NewAttribute(conntypes.AttributeKeyConnectionID, connectionID), ), ) diff --git a/x/ccv/types/events.go b/x/ccv/types/events.go index 791056f110..c189c19f4a 100644 --- a/x/ccv/types/events.go +++ b/x/ccv/types/events.go @@ -2,17 +2,17 @@ package types // CCV events const ( - EventTypeTimeout = "timeout" - EventTypePacket = "ccv_packet" - EventTypeChannelClose = "channel_closed" - - EventTypeConsumerChainAdded = "consumer_added" + EventTypeTimeout = "timeout" + EventTypePacket = "ccv_packet" + EventTypeChannelClose = "channel_closed" + EventTypeChannelEstablished = "channel_established" EventTypeFeeTransferChannelOpened = "fee_channel_opened" - EventExecuteConsumerChainSlash = "execute_consumer_chain_slash" - EventTypeFirstVSCPacket = "first_vsc_packet" - EventTypeFeeDistribution = "fee_distribution" - EventTypeSendSlashPacket = "send_slash_packet" - EventTypeSendMaturedVSCPacket = "send_matured_vsc_packet" + EventTypeConsumerClientCreated = "consumer_client_created" + + EventExecuteConsumerChainSlash = "execute_consumer_chain_slash" + EventTypeFeeDistribution = "fee_distribution" + EventTypeSendSlashPacket = "send_slash_packet" + EventTypeSendMaturedVSCPacket = "send_matured_vsc_packet" AttributeKeyAckSuccess = "success" AttributeKeyAck = "acknowledgement"