diff --git a/x/ccv/consumer/keeper/relay.go b/x/ccv/consumer/keeper/relay.go index c28a90ade0..646cdd2f1a 100644 --- a/x/ccv/consumer/keeper/relay.go +++ b/x/ccv/consumer/keeper/relay.go @@ -124,6 +124,16 @@ func (k Keeper) SendVSCMaturedPackets(ctx sdk.Context) error { return err } k.DeletePacketMaturityTime(ctx, vscId) + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeSendMaturedVSCPacket, + sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), + sdk.NewAttribute(consumertypes.AttributeChainID, ctx.ChainID()), + sdk.NewAttribute(consumertypes.AttributeConsumerHeight, strconv.Itoa(int(ctx.BlockHeight()))), + sdk.NewAttribute(consumertypes.AttributeValSetUpdateID, strconv.Itoa(int(vscId))), + sdk.NewAttribute(consumertypes.AttributeTimestamp, strconv.Itoa(int(currentTime))), + ), + ) } else { break } diff --git a/x/ccv/consumer/types/events.go b/x/ccv/consumer/types/events.go index 4f155a6333..cc9f05bf9a 100644 --- a/x/ccv/consumer/types/events.go +++ b/x/ccv/consumer/types/events.go @@ -2,9 +2,10 @@ package types // CCV events const ( - EventTypeFirstVSCPacket = "ccv_first_vsc_packet" - EventTypeFeeDistribution = "ccv_fee_distribution" - EventTypeSendSlashPacket = "ccv_send_slash_packet" + EventTypeFirstVSCPacket = "ccv_first_vsc_packet" + EventTypeFeeDistribution = "ccv_fee_distribution" + EventTypeSendSlashPacket = "ccv_send_slash_packet" + EventTypeSendMaturedVSCPacket = "ccv_send_maturec_vsc_packet" AttributeDistributionCurrentHeight = "current_distribution_height" AttributeDistributionNextHeight = "next_distribution_height" @@ -16,4 +17,7 @@ const ( AttributeValAddress = "validator_address" AttributeValSetUpdateID = "valset_update_id" AttributeInfraction = "infraction" + AttributeTimestamp = "timestamp" + AttributeConsumerHeight = "consumer_height" + AttributeChainID = "chain_id" ) diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index 12b4588e46..5d24d1944a 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -2,6 +2,7 @@ package keeper import ( "fmt" + "strconv" "time" sdk "github.com/cosmos/cosmos-sdk/types" @@ -308,6 +309,17 @@ func (k Keeper) HandleSlashPacket(ctx sdk.Context, chainID string, data ccv.Slas } k.slashingKeeper.JailUntil(ctx, consAddr, jailTime) + ctx.EventManager().EmitEvent( + sdk.NewEvent( + ccv.EventExecuteConsumerChainSlash, + sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), + sdk.NewAttribute(ccv.AttributeValidatorAddres, consAddr.String()), + sdk.NewAttribute(ccv.AttributeInfraction, data.Infraction.String()), + sdk.NewAttribute(ccv.AttributeInfractionHeight, strconv.Itoa(int(infractionHeight))), + sdk.NewAttribute(ccv.AttributeValSetUpdateID, strconv.Itoa(int(data.ValsetUpdateId))), + ), + ) + return true, nil } diff --git a/x/ccv/types/events.go b/x/ccv/types/events.go index 4e7772d54f..495c5fd71b 100644 --- a/x/ccv/types/events.go +++ b/x/ccv/types/events.go @@ -8,10 +8,15 @@ const ( EventTypeConsumerChainAdded = "ccv_consumer_added" EventTypeFeeTransferChannelOpened = "ccv_fee_channel_opened" + EventExecuteConsumerChainSlash = "ccv_execute_consumer_chain_slash" AttributeKeyAckSuccess = "success" AttributeKeyAck = "acknowledgement" AttributeKeyAckError = "error" - AttributeChainID = "chain_id" + AttributeChainID = "chain_id" + AttributeValidatorAddres = "validator_address" + AttributeInfraction = "infraction" + AttributeInfractionHeight = "infraction_height" + AttributeValSetUpdateID = "valset_update_id" )