From d44d53518318364cdb6d4de458d1a6a08ea23179 Mon Sep 17 00:00:00 2001 From: Collin Brittain Date: Tue, 22 Oct 2024 14:43:07 -0500 Subject: [PATCH 1/2] Better events for corks and contract call observation --- module/x/gravity/keeper/contract_call.go | 7 +++++++ module/x/gravity/types/events.go | 1 + 2 files changed, 8 insertions(+) diff --git a/module/x/gravity/keeper/contract_call.go b/module/x/gravity/keeper/contract_call.go index 3a18b3e06..80834a21a 100644 --- a/module/x/gravity/keeper/contract_call.go +++ b/module/x/gravity/keeper/contract_call.go @@ -3,6 +3,7 @@ package keeper import ( "bytes" "encoding/hex" + "fmt" "sort" "cosmossdk.io/errors" @@ -65,6 +66,12 @@ func (k Keeper) contractCallExecuted(ctx sdk.Context, invalidationScope []byte, }) k.CompleteOutgoingTx(ctx, completedCallTx) + + ctx.EventManager().EmitEvent(sdk.NewEvent( + types.EventTypeContractCallExecuted, + sdk.NewAttribute(types.AttributeKeyContractCallInvalidationScope, hex.EncodeToString(invalidationScope)), + sdk.NewAttribute(types.AttributeKeyContractCallInvalidationNonce, fmt.Sprint(invalidationNonce)), + )) } // orderContractCallsByNonceAscending sorts a slice of contract calls by nonce in ascending order diff --git a/module/x/gravity/types/events.go b/module/x/gravity/types/events.go index 08f75da45..0f66d73c2 100644 --- a/module/x/gravity/types/events.go +++ b/module/x/gravity/types/events.go @@ -9,6 +9,7 @@ const ( EventTypeBridgeWithdrawalReceived = "withdrawal_received" EventTypeBridgeDepositReceived = "deposit_received" EventTypeBridgeWithdrawCanceled = "withdraw_canceled" + EventTypeContractCallExecuted = "contract_call_executed" AttributeKeyEthereumEventVoteRecordID = "ethereum_event_vote_record_id" AttributeKeyBatchConfirmKey = "batch_confirm_key" From c93341e5ee6005ea11b3b15636f28ddeed209bab Mon Sep 17 00:00:00 2001 From: Collin Brittain Date: Wed, 23 Oct 2024 08:48:51 -0500 Subject: [PATCH 2/2] Better name for event --- module/x/gravity/keeper/contract_call.go | 2 +- module/x/gravity/types/events.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/module/x/gravity/keeper/contract_call.go b/module/x/gravity/keeper/contract_call.go index 80834a21a..2f94f4a54 100644 --- a/module/x/gravity/keeper/contract_call.go +++ b/module/x/gravity/keeper/contract_call.go @@ -68,7 +68,7 @@ func (k Keeper) contractCallExecuted(ctx sdk.Context, invalidationScope []byte, k.CompleteOutgoingTx(ctx, completedCallTx) ctx.EventManager().EmitEvent(sdk.NewEvent( - types.EventTypeContractCallExecuted, + types.EventTypeContractCallTxCompleted, sdk.NewAttribute(types.AttributeKeyContractCallInvalidationScope, hex.EncodeToString(invalidationScope)), sdk.NewAttribute(types.AttributeKeyContractCallInvalidationNonce, fmt.Sprint(invalidationNonce)), )) diff --git a/module/x/gravity/types/events.go b/module/x/gravity/types/events.go index 0f66d73c2..979bbac3a 100644 --- a/module/x/gravity/types/events.go +++ b/module/x/gravity/types/events.go @@ -9,7 +9,7 @@ const ( EventTypeBridgeWithdrawalReceived = "withdrawal_received" EventTypeBridgeDepositReceived = "deposit_received" EventTypeBridgeWithdrawCanceled = "withdraw_canceled" - EventTypeContractCallExecuted = "contract_call_executed" + EventTypeContractCallTxCompleted = "contract_call_tx_completed" AttributeKeyEthereumEventVoteRecordID = "ethereum_event_vote_record_id" AttributeKeyBatchConfirmKey = "batch_confirm_key"