Skip to content

Commit

Permalink
updating logger kvs, and simplifying OnRecvPacket
Browse files Browse the repository at this point in the history
  • Loading branch information
damiannolan committed Nov 17, 2021
1 parent 70d2d59 commit e61c5c9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
"github.com/tendermint/tendermint/libs/log"

controllertypes "github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/controller/types"
"github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/types"
channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types"
host "github.com/cosmos/ibc-go/v2/modules/core/24-host"
Expand Down Expand Up @@ -53,7 +52,7 @@ func NewKeeper(

// Logger returns the application logger, scoped to the associated module
func (k Keeper) Logger(ctx sdk.Context) log.Logger {
return ctx.Logger().With("module", fmt.Sprintf("x/%s-%s", host.ModuleName, controllertypes.ModuleName))
return ctx.Logger().With("module", fmt.Sprintf("x/%s-%s", host.ModuleName, types.ModuleName))
}

// InitInterchainAccount is the entry point to registering an interchain account.
Expand Down
9 changes: 2 additions & 7 deletions modules/apps/27-interchain-accounts/host/ibc_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,8 @@ func (im IBCModule) OnRecvPacket(
) ibcexported.Acknowledgement {
ack := channeltypes.NewResultAcknowledgement([]byte{byte(1)})

// only attempt the application logic if the packet data
// was successfully decoded
if ack.Success() {
err := im.keeper.OnRecvPacket(ctx, packet)
if err != nil {
ack = channeltypes.NewErrorAcknowledgement(err.Error())
}
if err := im.keeper.OnRecvPacket(ctx, packet); err != nil {
ack = channeltypes.NewErrorAcknowledgement(err.Error())
}

// NOTE: acknowledgement will be written synchronously during IBC handler execution.
Expand Down
3 changes: 1 addition & 2 deletions modules/apps/27-interchain-accounts/host/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
"github.com/tendermint/tendermint/libs/log"

hosttypes "github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/host/types"
"github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/types"
channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types"
host "github.com/cosmos/ibc-go/v2/modules/core/24-host"
Expand Down Expand Up @@ -57,7 +56,7 @@ func NewKeeper(

// Logger returns the application logger, scoped to the associated module
func (k Keeper) Logger(ctx sdk.Context) log.Logger {
return ctx.Logger().With("module", fmt.Sprintf("x/%s-%s", host.ModuleName, hosttypes.ModuleName))
return ctx.Logger().With("module", fmt.Sprintf("x/%s-%s", host.ModuleName, types.ModuleName))
}

// RegisterInterchainAccount attempts to create a new account using the provided address and stores it in state keyed by the provided port identifier
Expand Down

0 comments on commit e61c5c9

Please sign in to comment.