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

imp(release/v8.3.x): emit host disabled event #6143

Merged
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
1 change: 1 addition & 0 deletions modules/apps/27-interchain-accounts/host/ibc_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
15 changes: 15 additions & 0 deletions modules/apps/27-interchain-accounts/host/keeper/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -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"),
),
)
}
Loading