diff --git a/x/batch/wasm/interface_msg.go b/x/batch/wasm/interface_msg.go index 22cb8ca8..8966286d 100644 --- a/x/batch/wasm/interface_msg.go +++ b/x/batch/wasm/interface_msg.go @@ -10,7 +10,7 @@ import ( type BatchMsg struct { // Contracts can withdraw all rewards for the delegations from the contract. - WithdrawAllDelegatorRewards *WithdrawAllDelegatorRewards `json:"withdrawAllDelegatorRewards,omitempty"` + WithdrawAllDelegatorRewards *WithdrawAllDelegatorRewards `json:"withdraw_all_delegator_rewards,omitempty"` } type WithdrawAllDelegatorRewards struct{} diff --git a/x/cw-ica/keeper/ibc_handlers.go b/x/cw-ica/keeper/ibc_handlers.go index a4ad578d..a4b48a04 100644 --- a/x/cw-ica/keeper/ibc_handlers.go +++ b/x/cw-ica/keeper/ibc_handlers.go @@ -5,10 +5,9 @@ import ( "strings" "cosmossdk.io/errors" + "github.com/Team-Kujira/core/x/cw-ica/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - - "github.com/Team-Kujira/core/x/cw-ica/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" ) @@ -63,6 +62,8 @@ func (k *Keeper) createCachedContext(ctx sdk.Context) (sdk.Context, func(), sdk. } gasMeter = sdk.NewGasMeter(newLimit) + } else { + gasMeter = sdk.NewInfiniteGasMeter() } cacheCtx = cacheCtx.WithGasMeter(gasMeter) @@ -101,7 +102,20 @@ func (k *Keeper) HandleAcknowledgement(ctx sdk.Context, packet channeltypes.Pack } if err != nil { - k.Logger(ctx).Debug("HandleAcknowledgement: failed to Sudo contract on packet acknowledgement", "error", err) + k.Logger(ctx).Debug( + "HandleAcknowledgement: failed to Sudo contract on packet acknowledgement", + "source_port", packet.SourcePort, + "source_channel", packet.SourceChannel, + "sequence", packet.Sequence, + "error", err) + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeICATxCallbackFailure, + sdk.NewAttribute(types.AttributePacketSourcePort, packet.SourcePort), + sdk.NewAttribute(types.AttributePacketSourceChannel, packet.SourceChannel), + sdk.NewAttribute(types.AttributePacketSequence, fmt.Sprintf("%d", packet.Sequence)), + ), + }) } else { ctx.EventManager().EmitEvents(cacheCtx.EventManager().Events()) writeFn() @@ -124,7 +138,20 @@ func (k *Keeper) HandleTimeout(ctx sdk.Context, packet channeltypes.Packet, _ sd Timeout: &types.IcaCallbackTimeout{}, }) if err != nil { - k.Logger(ctx).Error("HandleTimeout: failed to Sudo contract on packet timeout", "port", packet.SourcePort, "error", err) + k.Logger(ctx).Debug( + "HandleTimeout: failed to Sudo contract on packet timeout", + "source_port", packet.SourcePort, + "source_channel", packet.SourceChannel, + "sequence", packet.Sequence, + "error", err) + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeICATimeoutCallbackFailure, + sdk.NewAttribute(types.AttributePacketSourcePort, packet.SourcePort), + sdk.NewAttribute(types.AttributePacketSourceChannel, packet.SourceChannel), + sdk.NewAttribute(types.AttributePacketSequence, fmt.Sprintf("%d", packet.Sequence)), + ), + }) } else { ctx.EventManager().EmitEvents(cacheCtx.EventManager().Events()) writeFn() @@ -165,10 +192,23 @@ func (k *Keeper) HandleChanOpenAck( }, }) if err != nil { - k.Logger(ctx).Error("SudoCallback failure", "error", err) + k.Logger(ctx).Error( + "HandleChanOpenAck: failed to Sudo contract on packet ChanOpenAck", + "port", portID, + "channel", channelID, + "error", err) + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeICARegisterCallbackFailure, + sdk.NewAttribute(types.AttributePacketSourcePort, portID), + sdk.NewAttribute(types.AttributePacketSourceChannel, channelID), + ), + }) } else { + ctx.EventManager().EmitEvents(cacheCtx.EventManager().Events()) writeFn() } + ctx.GasMeter().ConsumeGas(newGasMeter.GasConsumed(), "consume from cached context") // remove the callback data k.RemoveCallbackData(ctx, callbackDataKey) diff --git a/x/cw-ica/types/events.go b/x/cw-ica/types/events.go new file mode 100644 index 00000000..246fb871 --- /dev/null +++ b/x/cw-ica/types/events.go @@ -0,0 +1,14 @@ +package types + +const ( + EventTypeICATxCallbackFailure = "ica_tx_callback_failure" + EventTypeICARegisterCallbackFailure = "ica_register_callback_failure" + EventTypeICATimeoutCallbackFailure = "ica_timeout_callback_failure" +) + +// event attributes returned +const ( + AttributePacketSourcePort = "source_port" + AttributePacketSourceChannel = "source_channel" + AttributePacketSequence = "sequence" +)