diff --git a/modules/apps/27-interchain-accounts/host/ibc_module.go b/modules/apps/27-interchain-accounts/host/ibc_module.go index 622bf284bd9..81dbb148679 100644 --- a/modules/apps/27-interchain-accounts/host/ibc_module.go +++ b/modules/apps/27-interchain-accounts/host/ibc_module.go @@ -119,6 +119,7 @@ func (im IBCModule) OnRecvPacket( logger := im.keeper.Logger(ctx) if !im.keeper.GetParams(ctx).HostEnabled { logger.Info("host submodule is disabled") + keeper.EmitHostDisabledEvent(ctx, packet) return channeltypes.NewErrorAcknowledgement(types.ErrHostSubModuleDisabled) } diff --git a/modules/apps/27-interchain-accounts/host/keeper/events.go b/modules/apps/27-interchain-accounts/host/keeper/events.go index 3bfe7759670..77b5cf5a75b 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/events.go +++ b/modules/apps/27-interchain-accounts/host/keeper/events.go @@ -5,7 +5,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types" icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" "github.com/cosmos/ibc-go/v8/modules/core/exported" ) @@ -29,3 +31,16 @@ func EmitAcknowledgementEvent(ctx sdk.Context, packet exported.PacketI, ack expo ), ) } + +// EmitHostDisabledEvent emits an event signalling that the host submodule is disabled. +func EmitHostDisabledEvent(ctx sdk.Context, packet channeltypes.Packet) { + ctx.EventManager().EmitEvent( + sdk.NewEvent( + icatypes.EventTypePacket, + sdk.NewAttribute(sdk.AttributeKeyModule, icatypes.ModuleName), + sdk.NewAttribute(icatypes.AttributeKeyHostChannelID, packet.GetDestChannel()), + sdk.NewAttribute(icatypes.AttributeKeyAckError, types.ErrHostSubModuleDisabled.Error()), + sdk.NewAttribute(icatypes.AttributeKeyAckSuccess, "false"), + ), + ) +}