diff --git a/x/crosschain/keeper/attestation.go b/x/crosschain/keeper/attestation.go index c93828cf8..0dd09fa8b 100644 --- a/x/crosschain/keeper/attestation.go +++ b/x/crosschain/keeper/attestation.go @@ -89,7 +89,7 @@ func (k Keeper) TryAttestation(ctx sdk.Context, att *types.Attestation, claim ty k.SetAttestation(ctx, claim.GetEventNonce(), claim.ClaimHash(), att) err := k.processAttestation(ctx, claim) - ctx.EventManager().EmitEvent(sdk.NewEvent( + event := sdk.NewEvent( types.EventTypeContractEvent, sdk.NewAttribute(sdk.AttributeKeyModule, k.moduleName), sdk.NewAttribute(types.AttributeKeyClaimType, claim.GetType().String()), @@ -97,7 +97,11 @@ func (k Keeper) TryAttestation(ctx sdk.Context, att *types.Attestation, claim ty sdk.NewAttribute(types.AttributeKeyClaimHash, fmt.Sprint(hex.EncodeToString(claim.ClaimHash()))), sdk.NewAttribute(types.AttributeKeyBlockHeight, fmt.Sprint(claim.GetBlockHeight())), sdk.NewAttribute(types.AttributeKeyStateSuccess, fmt.Sprint(err == nil)), - )) + ) + if err != nil { + event.AppendAttributes(sdk.NewAttribute(types.AttributeKeyErrReason, err.Error())) + } + ctx.EventManager().EmitEvent(event) k.pruneAttestations(ctx) break diff --git a/x/crosschain/types/events.go b/x/crosschain/types/events.go index acaa142ac..6afcc20ea 100644 --- a/x/crosschain/types/events.go +++ b/x/crosschain/types/events.go @@ -8,6 +8,7 @@ const ( AttributeKeyBlockHeight = "block_height" AttributeKeyStateSuccess = "state_success" + AttributeKeyErrReason = "err_reason" EventTypeOracleSetUpdate = "oracle_set_update" AttributeKeyOracleSetNonce = "oracle_set_nonce"