Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better events for corks and contract call observation #571

Merged
merged 2 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions module/x/gravity/keeper/contract_call.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package keeper
import (
"bytes"
"encoding/hex"
"fmt"
"sort"

"cosmossdk.io/errors"
Expand Down Expand Up @@ -65,6 +66,12 @@ func (k Keeper) contractCallExecuted(ctx sdk.Context, invalidationScope []byte,
})

k.CompleteOutgoingTx(ctx, completedCallTx)

ctx.EventManager().EmitEvent(sdk.NewEvent(
types.EventTypeContractCallTxCompleted,
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
Expand Down
1 change: 1 addition & 0 deletions module/x/gravity/types/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const (
EventTypeBridgeWithdrawalReceived = "withdrawal_received"
EventTypeBridgeDepositReceived = "deposit_received"
EventTypeBridgeWithdrawCanceled = "withdraw_canceled"
EventTypeContractCallTxCompleted = "contract_call_tx_completed"

AttributeKeyEthereumEventVoteRecordID = "ethereum_event_vote_record_id"
AttributeKeyBatchConfirmKey = "batch_confirm_key"
Expand Down
Loading