From ba1c328d12fb3ffb355159dc33485055ad5bdcf3 Mon Sep 17 00:00:00 2001 From: Nikolas De Giorgis Date: Mon, 2 Dec 2024 14:45:07 +0000 Subject: [PATCH] refactor: update transfer to use runtime.Environment --- modules/apps/callbacks/testing/simapp/app.go | 4 +- modules/apps/transfer/ibc_module.go | 10 ++-- modules/apps/transfer/keeper/grpc_query.go | 2 +- modules/apps/transfer/keeper/keeper.go | 52 ++++++++----------- modules/apps/transfer/keeper/keeper_test.go | 7 +-- modules/apps/transfer/keeper/migrations.go | 14 ++--- modules/apps/transfer/keeper/msg_server.go | 2 +- .../08-wasm/testing/simapp/app.go | 4 +- simapp/app.go | 3 +- testing/simapp/app.go | 3 +- 10 files changed, 50 insertions(+), 51 deletions(-) diff --git a/modules/apps/callbacks/testing/simapp/app.go b/modules/apps/callbacks/testing/simapp/app.go index 330878d0af9..7456725ef02 100644 --- a/modules/apps/callbacks/testing/simapp/app.go +++ b/modules/apps/callbacks/testing/simapp/app.go @@ -459,7 +459,9 @@ func NewSimApp( // since fee middleware will wrap the IBCKeeper for underlying application. // NOTE: the Transfer Keeper's ICS4Wrapper can later be replaced. app.TransferKeeper = ibctransferkeeper.NewKeeper( - appCodec, runtime.NewKVStoreService(keys[ibctransfertypes.StoreKey]), app.GetSubspace(ibctransfertypes.ModuleName), + appCodec, + runtime.NewEnvironment(runtime.NewKVStoreService(keys[ibctransfertypes.StoreKey]), logger.With(log.ModuleKey, "x/transfer")), + app.GetSubspace(ibctransfertypes.ModuleName), app.IBCFeeKeeper, // ISC4 Wrapper: fee IBC middleware app.IBCKeeper.ChannelKeeper, app.AuthKeeper, app.BankKeeper, diff --git a/modules/apps/transfer/ibc_module.go b/modules/apps/transfer/ibc_module.go index c6445645c23..ba13442a196 100644 --- a/modules/apps/transfer/ibc_module.go +++ b/modules/apps/transfer/ibc_module.go @@ -111,7 +111,7 @@ func (im IBCModule) OnChanOpenTry( } if !slices.Contains(types.SupportedVersions, counterpartyVersion) { - im.keeper.Logger(ctx).Debug("invalid counterparty version, proposing latest app version", "counterpartyVersion", counterpartyVersion, "version", types.V2) + im.keeper.Logger.Debug("invalid counterparty version, proposing latest app version", "counterpartyVersion", counterpartyVersion, "version", types.V2) return types.V2, nil } @@ -187,17 +187,17 @@ func (im IBCModule) OnRecvPacket( data, ackErr = types.UnmarshalPacketData(packet.GetData(), channelVersion) if ackErr != nil { ack = channeltypes.NewErrorAcknowledgement(ackErr) - im.keeper.Logger(ctx).Error(fmt.Sprintf("%s sequence %d", ackErr.Error(), packet.Sequence)) + im.keeper.Logger.Error(fmt.Sprintf("%s sequence %d", ackErr.Error(), packet.Sequence)) return ack } if ackErr = im.keeper.OnRecvPacket(ctx, packet, data); ackErr != nil { ack = channeltypes.NewErrorAcknowledgement(ackErr) - im.keeper.Logger(ctx).Error(fmt.Sprintf("%s sequence %d", ackErr.Error(), packet.Sequence)) + im.keeper.Logger.Error(fmt.Sprintf("%s sequence %d", ackErr.Error(), packet.Sequence)) return ack } - im.keeper.Logger(ctx).Info("successfully handled ICS-20 packet", "sequence", packet.Sequence) + im.keeper.Logger.Info("successfully handled ICS-20 packet", "sequence", packet.Sequence) if data.HasForwarding() { // NOTE: acknowledgement will be written asynchronously @@ -276,7 +276,7 @@ func (im IBCModule) OnChanUpgradeTry(ctx context.Context, portID, channelID stri } if !slices.Contains(types.SupportedVersions, counterpartyVersion) { - im.keeper.Logger(ctx).Debug("invalid counterparty version, proposing latest app version", "counterpartyVersion", counterpartyVersion, "version", types.V2) + im.keeper.Logger.Debug("invalid counterparty version, proposing latest app version", "counterpartyVersion", counterpartyVersion, "version", types.V2) return types.V2, nil } diff --git a/modules/apps/transfer/keeper/grpc_query.go b/modules/apps/transfer/keeper/grpc_query.go index 90f53542985..b0f62adc442 100644 --- a/modules/apps/transfer/keeper/grpc_query.go +++ b/modules/apps/transfer/keeper/grpc_query.go @@ -56,7 +56,7 @@ func (k Keeper) Denoms(ctx context.Context, req *types.QueryDenomsRequest) (*typ } var denoms types.Denoms - store := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), types.DenomKey) + store := prefix.NewStore(runtime.KVStoreAdapter(k.KVStoreService.OpenKVStore(ctx)), types.DenomKey) pageRes, err := query.Paginate(store, req.Pagination, func(_, value []byte) error { var denom types.Denom diff --git a/modules/apps/transfer/keeper/keeper.go b/modules/apps/transfer/keeper/keeper.go index 070ccbb5197..217eb5a8e9a 100644 --- a/modules/apps/transfer/keeper/keeper.go +++ b/modules/apps/transfer/keeper/keeper.go @@ -6,8 +6,7 @@ import ( "fmt" "strings" - corestore "cosmossdk.io/core/store" - "cosmossdk.io/log" + "cosmossdk.io/core/appmodule" "cosmossdk.io/math" "cosmossdk.io/store/prefix" storetypes "cosmossdk.io/store/types" @@ -23,13 +22,12 @@ import ( channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" porttypes "github.com/cosmos/ibc-go/v9/modules/core/05-port/types" host "github.com/cosmos/ibc-go/v9/modules/core/24-host" - "github.com/cosmos/ibc-go/v9/modules/core/exported" coretypes "github.com/cosmos/ibc-go/v9/modules/core/types" ) // Keeper defines the IBC fungible transfer keeper type Keeper struct { - storeService corestore.KVStoreService + appmodule.Environment cdc codec.BinaryCodec legacySubspace types.ParamSubspace @@ -46,7 +44,7 @@ type Keeper struct { // NewKeeper creates a new IBC transfer Keeper instance func NewKeeper( cdc codec.BinaryCodec, - storeService corestore.KVStoreService, + env appmodule.Environment, legacySubspace types.ParamSubspace, ics4Wrapper porttypes.ICS4Wrapper, channelKeeper types.ChannelKeeper, @@ -65,7 +63,7 @@ func NewKeeper( return Keeper{ cdc: cdc, - storeService: storeService, + Environment: env, legacySubspace: legacySubspace, ics4Wrapper: ics4Wrapper, channelKeeper: channelKeeper, @@ -92,15 +90,9 @@ func (k Keeper) GetAuthority() string { return k.authority } -// Logger returns a module-specific logger. -func (Keeper) Logger(ctx context.Context) log.Logger { - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 - return sdkCtx.Logger().With("module", "x/"+exported.ModuleName+"-"+types.ModuleName) -} - // GetPort returns the portID for the transfer module. Used in ExportGenesis func (k Keeper) GetPort(ctx context.Context) string { - store := k.storeService.OpenKVStore(ctx) + store := k.KVStoreService.OpenKVStore(ctx) bz, err := store.Get(types.PortKey) if err != nil { panic(err) @@ -110,7 +102,7 @@ func (k Keeper) GetPort(ctx context.Context) string { // SetPort sets the portID for the transfer module. Used in InitGenesis func (k Keeper) SetPort(ctx context.Context, portID string) { - store := k.storeService.OpenKVStore(ctx) + store := k.KVStoreService.OpenKVStore(ctx) if err := store.Set(types.PortKey, []byte(portID)); err != nil { panic(err) } @@ -118,7 +110,7 @@ func (k Keeper) SetPort(ctx context.Context, portID string) { // GetParams returns the current transfer module parameters. func (k Keeper) GetParams(ctx context.Context) types.Params { - store := k.storeService.OpenKVStore(ctx) + store := k.KVStoreService.OpenKVStore(ctx) bz, err := store.Get([]byte(types.ParamsKey)) if err != nil { panic(err) @@ -134,7 +126,7 @@ func (k Keeper) GetParams(ctx context.Context) types.Params { // SetParams sets the transfer module parameters. func (k Keeper) SetParams(ctx context.Context, params types.Params) { - store := k.storeService.OpenKVStore(ctx) + store := k.KVStoreService.OpenKVStore(ctx) bz := k.cdc.MustMarshal(¶ms) if err := store.Set([]byte(types.ParamsKey), bz); err != nil { panic(err) @@ -143,7 +135,7 @@ func (k Keeper) SetParams(ctx context.Context, params types.Params) { // GetDenom retrieves the denom from store given the hash of the denom. func (k Keeper) GetDenom(ctx context.Context, denomHash cmtbytes.HexBytes) (types.Denom, bool) { - store := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), types.DenomKey) + store := prefix.NewStore(runtime.KVStoreAdapter(k.KVStoreService.OpenKVStore(ctx)), types.DenomKey) bz := store.Get(denomHash) if len(bz) == 0 { return types.Denom{}, false @@ -157,14 +149,14 @@ func (k Keeper) GetDenom(ctx context.Context, denomHash cmtbytes.HexBytes) (type // HasDenom checks if a the key with the given denomination hash exists on the store. func (k Keeper) HasDenom(ctx context.Context, denomHash cmtbytes.HexBytes) bool { - store := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), types.DenomKey) + store := prefix.NewStore(runtime.KVStoreAdapter(k.KVStoreService.OpenKVStore(ctx)), types.DenomKey) return store.Has(denomHash) } // SetDenom sets a new {denom hash -> denom } pair to the store. // This allows for reverse lookup of the denom given the hash. func (k Keeper) SetDenom(ctx context.Context, denom types.Denom) { - store := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), types.DenomKey) + store := prefix.NewStore(runtime.KVStoreAdapter(k.KVStoreService.OpenKVStore(ctx)), types.DenomKey) bz := k.cdc.MustMarshal(&denom) store.Set(denom.Hash(), bz) } @@ -182,10 +174,10 @@ func (k Keeper) GetAllDenoms(ctx context.Context) types.Denoms { // IterateDenoms iterates over the denominations in the store and performs a callback function. func (k Keeper) IterateDenoms(ctx context.Context, cb func(denom types.Denom) bool) { - store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := runtime.KVStoreAdapter(k.KVStoreService.OpenKVStore(ctx)) iterator := storetypes.KVStorePrefixIterator(store, types.DenomKey) - defer coretypes.LogDeferred(k.Logger(ctx), func() error { return iterator.Close() }) + defer coretypes.LogDeferred(k.Logger, func() error { return iterator.Close() }) for ; iterator.Valid(); iterator.Next() { var denom types.Denom k.cdc.MustUnmarshal(iterator.Value(), &denom) @@ -224,7 +216,7 @@ func (k Keeper) setDenomMetadata(ctx context.Context, denom types.Denom) { // NOTE: if there is no value stored in state for the provided denom then a new Coin is returned for the denom with an initial value of zero. // This accommodates callers to simply call `Add()` on the returned Coin as an empty Coin literal (e.g. sdk.Coin{}) will trigger a panic due to the absence of a denom. func (k Keeper) GetTotalEscrowForDenom(ctx context.Context, denom string) sdk.Coin { - store := k.storeService.OpenKVStore(ctx) + store := k.KVStoreService.OpenKVStore(ctx) bz, err := store.Get(types.TotalEscrowForDenomKey(denom)) if err != nil { panic(err) @@ -249,7 +241,7 @@ func (k Keeper) SetTotalEscrowForDenom(ctx context.Context, coin sdk.Coin) { panic(fmt.Errorf("amount cannot be negative: %s", coin.Amount)) } - store := k.storeService.OpenKVStore(ctx) + store := k.KVStoreService.OpenKVStore(ctx) key := types.TotalEscrowForDenomKey(coin.Denom) if coin.Amount.IsZero() { @@ -283,10 +275,10 @@ func (k Keeper) GetAllTotalEscrowed(ctx context.Context) sdk.Coins { // and performs a callback function. Denominations for which an invalid value // (i.e. not integer) is stored, will be skipped. func (k Keeper) IterateTokensInEscrow(ctx context.Context, storeprefix []byte, cb func(denomEscrow sdk.Coin) bool) { - store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := runtime.KVStoreAdapter(k.KVStoreService.OpenKVStore(ctx)) iterator := storetypes.KVStorePrefixIterator(store, storeprefix) - defer coretypes.LogDeferred(k.Logger(ctx), func() error { return iterator.Close() }) + defer coretypes.LogDeferred(k.Logger, func() error { return iterator.Close() }) for ; iterator.Valid(); iterator.Next() { denom := strings.TrimPrefix(string(iterator.Key()), fmt.Sprintf("%s/", types.KeyTotalEscrowPrefix)) if strings.TrimSpace(denom) == "" { @@ -307,7 +299,7 @@ func (k Keeper) IterateTokensInEscrow(ctx context.Context, storeprefix []byte, c // setForwardedPacket sets the forwarded packet in the store. func (k Keeper) setForwardedPacket(ctx context.Context, portID, channelID string, sequence uint64, packet channeltypes.Packet) { - store := k.storeService.OpenKVStore(ctx) + store := k.KVStoreService.OpenKVStore(ctx) bz := k.cdc.MustMarshal(&packet) if err := store.Set(types.PacketForwardKey(portID, channelID, sequence), bz); err != nil { panic(err) @@ -316,7 +308,7 @@ func (k Keeper) setForwardedPacket(ctx context.Context, portID, channelID string // getForwardedPacket gets the forwarded packet from the store. func (k Keeper) getForwardedPacket(ctx context.Context, portID, channelID string, sequence uint64) (channeltypes.Packet, bool) { - store := k.storeService.OpenKVStore(ctx) + store := k.KVStoreService.OpenKVStore(ctx) bz, err := store.Get(types.PacketForwardKey(portID, channelID, sequence)) if err != nil { panic(err) @@ -333,7 +325,7 @@ func (k Keeper) getForwardedPacket(ctx context.Context, portID, channelID string // deleteForwardedPacket deletes the forwarded packet from the store. func (k Keeper) deleteForwardedPacket(ctx context.Context, portID, channelID string, sequence uint64) { - store := k.storeService.OpenKVStore(ctx) + store := k.KVStoreService.OpenKVStore(ctx) packetKey := types.PacketForwardKey(portID, channelID, sequence) if err := store.Delete(packetKey); err != nil { @@ -354,10 +346,10 @@ func (k Keeper) getAllForwardedPackets(ctx context.Context) []types.ForwardedPac // iterateForwardedPackets iterates over the forward packets in the store and performs a callback function. func (k Keeper) iterateForwardedPackets(ctx context.Context, cb func(packet types.ForwardedPacket) bool) { - store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := runtime.KVStoreAdapter(k.KVStoreService.OpenKVStore(ctx)) iterator := storetypes.KVStorePrefixIterator(store, types.ForwardedPacketKey) - defer coretypes.LogDeferred(k.Logger(ctx), func() error { return iterator.Close() }) + defer coretypes.LogDeferred(k.Logger, func() error { return iterator.Close() }) for ; iterator.Valid(); iterator.Next() { var forwardPacket types.ForwardedPacket k.cdc.MustUnmarshal(iterator.Value(), &forwardPacket.Packet) diff --git a/modules/apps/transfer/keeper/keeper_test.go b/modules/apps/transfer/keeper/keeper_test.go index e63bb597f0b..3ff56bd7998 100644 --- a/modules/apps/transfer/keeper/keeper_test.go +++ b/modules/apps/transfer/keeper/keeper_test.go @@ -6,6 +6,7 @@ import ( testifysuite "github.com/stretchr/testify/suite" + "cosmossdk.io/log" sdkmath "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" minttypes "cosmossdk.io/x/mint/types" @@ -57,7 +58,7 @@ func (suite *KeeperTestSuite) TestNewKeeper() { {"success", func() { keeper.NewKeeper( suite.chainA.GetSimApp().AppCodec(), - runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(types.StoreKey)), + runtime.NewEnvironment(runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(types.StoreKey)), log.NewNopLogger()), suite.chainA.GetSimApp().GetSubspace(types.ModuleName), suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, @@ -69,7 +70,7 @@ func (suite *KeeperTestSuite) TestNewKeeper() { {"failure: transfer module account does not exist", func() { keeper.NewKeeper( suite.chainA.GetSimApp().AppCodec(), - runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(types.StoreKey)), + runtime.NewEnvironment(runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(types.StoreKey)), log.NewNopLogger()), suite.chainA.GetSimApp().GetSubspace(types.ModuleName), suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, @@ -81,7 +82,7 @@ func (suite *KeeperTestSuite) TestNewKeeper() { {"failure: empty authority", func() { keeper.NewKeeper( suite.chainA.GetSimApp().AppCodec(), - runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(types.StoreKey)), + runtime.NewEnvironment(runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(types.StoreKey)), log.NewNopLogger()), suite.chainA.GetSimApp().GetSubspace(types.ModuleName), suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, diff --git a/modules/apps/transfer/keeper/migrations.go b/modules/apps/transfer/keeper/migrations.go index 8141e34d1d4..d276aef8091 100644 --- a/modules/apps/transfer/keeper/migrations.go +++ b/modules/apps/transfer/keeper/migrations.go @@ -35,7 +35,7 @@ func (m Migrator) MigrateParams(ctx sdk.Context) error { m.keeper.legacySubspace.GetParamSet(ctx, ¶ms) m.keeper.SetParams(ctx, params) - m.keeper.Logger(ctx).Info("successfully migrated transfer app self-manage params") + m.keeper.Logger.Info("successfully migrated transfer app self-manage params") return nil } @@ -50,7 +50,7 @@ func (m Migrator) MigrateDenomMetadata(ctx sdk.Context) error { return false }) - m.keeper.Logger(ctx).Info("successfully added metadata to IBC voucher denominations") + m.keeper.Logger.Info("successfully added metadata to IBC voucher denominations") return nil } @@ -71,7 +71,7 @@ func (m Migrator) MigrateTotalEscrowForDenom(ctx sdk.Context) error { m.keeper.SetTotalEscrowForDenom(ctx, totalEscrow) } - m.keeper.Logger(ctx).Info("successfully set total escrow", "number of denominations", totalEscrowed.Len()) + m.keeper.Logger.Info("successfully set total escrow", "number of denominations", totalEscrowed.Len()) return nil } @@ -117,7 +117,7 @@ func (m Migrator) MigrateDenomTraceToDenom(ctx sdk.Context) error { // setDenomTrace sets a new {trace hash -> denom trace} pair to the store. func (k Keeper) setDenomTrace(ctx context.Context, denomTrace internaltypes.DenomTrace) { - store := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), types.DenomTraceKey) + store := prefix.NewStore(runtime.KVStoreAdapter(k.KVStoreService.OpenKVStore(ctx)), types.DenomTraceKey) bz := k.cdc.MustMarshal(&denomTrace) store.Set(denomTrace.Hash(), bz) @@ -125,17 +125,17 @@ func (k Keeper) setDenomTrace(ctx context.Context, denomTrace internaltypes.Deno // deleteDenomTrace deletes the denom trace func (k Keeper) deleteDenomTrace(ctx context.Context, denomTrace internaltypes.DenomTrace) { - store := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), types.DenomTraceKey) + store := prefix.NewStore(runtime.KVStoreAdapter(k.KVStoreService.OpenKVStore(ctx)), types.DenomTraceKey) store.Delete(denomTrace.Hash()) } // iterateDenomTraces iterates over the denomination traces in the store // and performs a callback function. func (k Keeper) iterateDenomTraces(ctx context.Context, cb func(denomTrace internaltypes.DenomTrace) bool) { - store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := runtime.KVStoreAdapter(k.KVStoreService.OpenKVStore(ctx)) iterator := storetypes.KVStorePrefixIterator(store, types.DenomTraceKey) - defer coretypes.LogDeferred(k.Logger(ctx), func() error { return iterator.Close() }) + defer coretypes.LogDeferred(k.Logger, func() error { return iterator.Close() }) for ; iterator.Valid(); iterator.Next() { var denomTrace internaltypes.DenomTrace k.cdc.MustUnmarshal(iterator.Value(), &denomTrace) diff --git a/modules/apps/transfer/keeper/msg_server.go b/modules/apps/transfer/keeper/msg_server.go index b0cb57398b7..3c9f479caa1 100644 --- a/modules/apps/transfer/keeper/msg_server.go +++ b/modules/apps/transfer/keeper/msg_server.go @@ -51,7 +51,7 @@ func (k Keeper) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*types. return nil, err } - k.Logger(ctx).Info("IBC fungible token transfer", "tokens", coins, "sender", msg.Sender, "receiver", msg.Receiver) + k.Logger.Info("IBC fungible token transfer", "tokens", coins, "sender", msg.Sender, "receiver", msg.Receiver) return &types.MsgTransferResponse{Sequence: sequence}, nil } diff --git a/modules/light-clients/08-wasm/testing/simapp/app.go b/modules/light-clients/08-wasm/testing/simapp/app.go index d132314a756..74729cef41f 100644 --- a/modules/light-clients/08-wasm/testing/simapp/app.go +++ b/modules/light-clients/08-wasm/testing/simapp/app.go @@ -584,7 +584,9 @@ func NewSimApp( // Create Transfer Keeper and pass IBCFeeKeeper as expected Channel and PortKeeper // since fee middleware will wrap the IBCKeeper for underlying application. app.TransferKeeper = ibctransferkeeper.NewKeeper( - appCodec, runtime.NewKVStoreService(keys[ibctransfertypes.StoreKey]), app.GetSubspace(ibctransfertypes.ModuleName), + appCodec, + runtime.NewEnvironment(runtime.NewKVStoreService(keys[ibctransfertypes.StoreKey]), logger.With(log.ModuleKey, "x/transfer")), + app.GetSubspace(ibctransfertypes.ModuleName), app.IBCFeeKeeper, // ISC4 Wrapper: fee IBC middleware app.IBCKeeper.ChannelKeeper, app.AuthKeeper, app.BankKeeper, diff --git a/simapp/app.go b/simapp/app.go index 080d09a3533..3f16a59c329 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -564,7 +564,8 @@ func NewSimApp( // since fee middleware will wrap the IBCKeeper for underlying application. app.TransferKeeper = ibctransferkeeper.NewKeeper( appCodec, - runtime.NewKVStoreService(keys[ibctransfertypes.StoreKey]), app.GetSubspace(ibctransfertypes.ModuleName), + runtime.NewEnvironment(runtime.NewKVStoreService(keys[ibctransfertypes.StoreKey]), logger.With(log.ModuleKey, "x/transfer")), + app.GetSubspace(ibctransfertypes.ModuleName), app.IBCFeeKeeper, // ISC4 Wrapper: fee IBC middleware app.IBCKeeper.ChannelKeeper, app.AuthKeeper, app.BankKeeper, diff --git a/testing/simapp/app.go b/testing/simapp/app.go index 0f888e10d54..0d062890b7a 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -541,7 +541,8 @@ func NewSimApp( // since fee middleware will wrap the IBCKeeper for underlying application. app.TransferKeeper = ibctransferkeeper.NewKeeper( appCodec, - runtime.NewKVStoreService(keys[ibctransfertypes.StoreKey]), app.GetSubspace(ibctransfertypes.ModuleName), + runtime.NewEnvironment(runtime.NewKVStoreService(keys[ibctransfertypes.StoreKey]), logger.With(log.ModuleKey, "x/trasfer")), + app.GetSubspace(ibctransfertypes.ModuleName), app.IBCFeeKeeper, // ISC4 Wrapper: fee IBC middleware app.IBCKeeper.ChannelKeeper, app.AuthKeeper, app.BankKeeper,