From 3dd3d78c547a048ea4b34d1bc5704a4302a6f3a2 Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Tue, 27 Aug 2024 11:38:12 +0200 Subject: [PATCH] fix todos --- .../27-interchain-accounts/controller/keeper/events.go | 2 +- .../27-interchain-accounts/controller/keeper/keeper.go | 8 ++++---- .../apps/27-interchain-accounts/host/keeper/events.go | 4 ++-- .../27-interchain-accounts/host/keeper/handshake.go | 2 +- .../apps/27-interchain-accounts/host/keeper/keeper.go | 6 +++--- .../apps/27-interchain-accounts/host/keeper/relay.go | 2 +- modules/apps/27-interchain-accounts/types/account.go | 2 +- modules/apps/29-fee/keeper/escrow.go | 6 +++--- modules/apps/transfer/internal/events/events.go | 10 +++++----- modules/apps/transfer/keeper/forwarding.go | 2 +- modules/apps/transfer/keeper/keeper.go | 8 ++++---- modules/core/keeper/msg_server_test.go | 8 ++++---- testing/mock/ibc_module.go | 10 +++++----- testing/mock/middleware.go | 10 +++++----- 14 files changed, 40 insertions(+), 40 deletions(-) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/events.go b/modules/apps/27-interchain-accounts/controller/keeper/events.go index 0cd11ba9f74..468a1028a5c 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/events.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/events.go @@ -14,7 +14,7 @@ import ( // EmitAcknowledgementEvent emits an event signalling a successful or failed acknowledgement and including the error // details if any. func EmitAcknowledgementEvent(ctx context.Context, packet channeltypes.Packet, ack exported.Acknowledgement, err error) { - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 attributes := []sdk.Attribute{ sdk.NewAttribute(sdk.AttributeKeyModule, icatypes.ModuleName), sdk.NewAttribute(icatypes.AttributeKeyControllerChannelID, packet.GetDestChannel()), diff --git a/modules/apps/27-interchain-accounts/controller/keeper/keeper.go b/modules/apps/27-interchain-accounts/controller/keeper/keeper.go index 165eb5a5651..36a920882b3 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/keeper.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/keeper.go @@ -82,7 +82,7 @@ func (k Keeper) GetICS4Wrapper() porttypes.ICS4Wrapper { // Logger returns the application logger, scoped to the associated module func (Keeper) Logger(ctx context.Context) log.Logger { - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 return sdkCtx.Logger().With("module", fmt.Sprintf("x/%s-%s", exported.ModuleName, icatypes.ModuleName)) } @@ -119,20 +119,20 @@ func (k Keeper) setPort(ctx context.Context, portID string) { // hasCapability checks if the interchain account controller module owns the port capability for the desired port func (k Keeper) hasCapability(ctx context.Context, portID string) bool { - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 _, ok := k.scopedKeeper.GetCapability(sdkCtx, host.PortPath(portID)) return ok } // AuthenticateCapability wraps the scopedKeeper's AuthenticateCapability function func (k Keeper) AuthenticateCapability(ctx context.Context, cap *capabilitytypes.Capability, name string) bool { - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 return k.scopedKeeper.AuthenticateCapability(sdkCtx, cap, name) } // ClaimCapability wraps the scopedKeeper's ClaimCapability function func (k Keeper) ClaimCapability(ctx context.Context, cap *capabilitytypes.Capability, name string) error { - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 return k.scopedKeeper.ClaimCapability(sdkCtx, cap, name) } diff --git a/modules/apps/27-interchain-accounts/host/keeper/events.go b/modules/apps/27-interchain-accounts/host/keeper/events.go index b6d432ac9df..fb497ec2ca3 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/events.go +++ b/modules/apps/27-interchain-accounts/host/keeper/events.go @@ -24,7 +24,7 @@ func EmitAcknowledgementEvent(ctx context.Context, packet channeltypes.Packet, a if err != nil { attributes = append(attributes, sdk.NewAttribute(icatypes.AttributeKeyAckError, err.Error())) } - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 sdkCtx.EventManager().EmitEvent( sdk.NewEvent( icatypes.EventTypePacket, @@ -35,7 +35,7 @@ func EmitAcknowledgementEvent(ctx context.Context, packet channeltypes.Packet, a // EmitHostDisabledEvent emits an event signalling that the host submodule is disabled. func EmitHostDisabledEvent(ctx context.Context, packet channeltypes.Packet) { - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 sdkCtx.EventManager().EmitEvent( sdk.NewEvent( icatypes.EventTypePacket, diff --git a/modules/apps/27-interchain-accounts/host/keeper/handshake.go b/modules/apps/27-interchain-accounts/host/keeper/handshake.go index 13d82e96eeb..4e8fcfb5f93 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/handshake.go +++ b/modules/apps/27-interchain-accounts/host/keeper/handshake.go @@ -72,7 +72,7 @@ func (k Keeper) OnChanOpenTry( // On the host chain the capability may only be claimed during the OnChanOpenTry // The capability being claimed in OpenInit is for a controller chain (the port is different) - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 if err = k.ClaimCapability(sdkCtx, chanCap, host.ChannelCapabilityPath(portID, channelID)); err != nil { return "", errorsmod.Wrapf(err, "failed to claim capability for channel %s on port %s", channelID, portID) } diff --git a/modules/apps/27-interchain-accounts/host/keeper/keeper.go b/modules/apps/27-interchain-accounts/host/keeper/keeper.go index df46c7cf551..d4eb582b8ff 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/keeper.go +++ b/modules/apps/27-interchain-accounts/host/keeper/keeper.go @@ -124,20 +124,20 @@ func (k Keeper) setPort(ctx context.Context, portID string) { // hasCapability checks if the interchain account host module owns the port capability for the desired port func (k Keeper) hasCapability(ctx context.Context, portID string) bool { - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 _, ok := k.scopedKeeper.GetCapability(sdkCtx, host.PortPath(portID)) return ok } // AuthenticateCapability wraps the scopedKeeper's AuthenticateCapability function func (k Keeper) AuthenticateCapability(ctx context.Context, cap *capabilitytypes.Capability, name string) bool { - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 return k.scopedKeeper.AuthenticateCapability(sdkCtx, cap, name) } // ClaimCapability wraps the scopedKeeper's ClaimCapability function func (k Keeper) ClaimCapability(ctx context.Context, cap *capabilitytypes.Capability, name string) error { - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 return k.scopedKeeper.ClaimCapability(sdkCtx, cap, name) } diff --git a/modules/apps/27-interchain-accounts/host/keeper/relay.go b/modules/apps/27-interchain-accounts/host/keeper/relay.go index 2ec1e08e9b6..cc395a1197a 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/relay.go +++ b/modules/apps/27-interchain-accounts/host/keeper/relay.go @@ -68,7 +68,7 @@ func (k Keeper) executeTx(ctx context.Context, sourcePort, destPort, destChannel // CacheContext returns a new context with the multi-store branched into a cached storage object // writeCache is called only if all msgs succeed, performing state transitions atomically - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 cacheCtx, writeCache := sdkCtx.CacheContext() for i, msg := range msgs { if m, ok := msg.(sdk.HasValidateBasic); ok { diff --git a/modules/apps/27-interchain-accounts/types/account.go b/modules/apps/27-interchain-accounts/types/account.go index 92f9336b91b..d1542f52ace 100644 --- a/modules/apps/27-interchain-accounts/types/account.go +++ b/modules/apps/27-interchain-accounts/types/account.go @@ -46,7 +46,7 @@ type interchainAccountPretty struct { // the current block app hash, and the current block data hash. The sdk.AccAddress returned is a sub-address of the host module account. func GenerateAddress(ctx context.Context, connectionID, portID string) sdk.AccAddress { hostModuleAcc := sdkaddress.Module(ModuleName, []byte(hostAccountsKey)) - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 header := sdkCtx.BlockHeader() buf := []byte(connectionID + portID) diff --git a/modules/apps/29-fee/keeper/escrow.go b/modules/apps/29-fee/keeper/escrow.go index 1f7e5eec437..40c1b29eb49 100644 --- a/modules/apps/29-fee/keeper/escrow.go +++ b/modules/apps/29-fee/keeper/escrow.go @@ -50,7 +50,7 @@ func (k Keeper) escrowPacketFee(ctx sdk.Context, packetID channeltypes.PacketId, func (k Keeper) DistributePacketFeesOnAcknowledgement(ctx context.Context, forwardRelayer string, reverseRelayer sdk.AccAddress, packetFees []types.PacketFee, packetID channeltypes.PacketId) { // cache context before trying to distribute fees // if the escrow account has insufficient balance then we want to avoid partially distributing fees - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 cacheCtx, writeFn := sdkCtx.CacheContext() // forward relayer address will be empty if conversion fails @@ -108,7 +108,7 @@ func (k Keeper) distributePacketFeeOnAcknowledgement(ctx sdk.Context, refundAddr func (k Keeper) DistributePacketFeesOnTimeout(ctx context.Context, timeoutRelayer sdk.AccAddress, packetFees []types.PacketFee, packetID channeltypes.PacketId) { // cache context before trying to distribute fees // if the escrow account has insufficient balance then we want to avoid partially distributing fees - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 cacheCtx, writeFn := sdkCtx.CacheContext() for _, packetFee := range packetFees { @@ -189,7 +189,7 @@ func (k Keeper) RefundFeesOnChannelClosure(ctx context.Context, portID, channelI // cache context before trying to distribute fees // if the escrow account has insufficient balance then we want to avoid partially distributing fees - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 cacheCtx, writeFn := sdkCtx.CacheContext() for _, identifiedPacketFee := range identifiedPacketFees { diff --git a/modules/apps/transfer/internal/events/events.go b/modules/apps/transfer/internal/events/events.go index 4e055f21c5b..b6e48282e3c 100644 --- a/modules/apps/transfer/internal/events/events.go +++ b/modules/apps/transfer/internal/events/events.go @@ -13,7 +13,7 @@ import ( // EmitTransferEvent emits a ibc transfer event on successful transfers. func EmitTransferEvent(ctx context.Context, sender, receiver string, tokens types.Tokens, memo string, forwardingHops []types.Hop) { - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 tokensStr := mustMarshalJSON(tokens) forwardingHopsStr := mustMarshalJSON(forwardingHops) @@ -51,7 +51,7 @@ func EmitOnRecvPacketEvent(ctx context.Context, packetData types.FungibleTokenPa eventAttributes = append(eventAttributes, sdk.NewAttribute(types.AttributeKeyAckError, ackErr.Error())) } - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( @@ -69,7 +69,7 @@ func EmitOnRecvPacketEvent(ctx context.Context, packetData types.FungibleTokenPa func EmitOnAcknowledgementPacketEvent(ctx context.Context, packetData types.FungibleTokenPacketDataV2, ack channeltypes.Acknowledgement) { tokensStr := mustMarshalJSON(packetData.Tokens) forwardingHopsStr := mustMarshalJSON(packetData.Forwarding.Hops) - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypePacket, @@ -106,7 +106,7 @@ func EmitOnAcknowledgementPacketEvent(ctx context.Context, packetData types.Fung // EmitOnTimeoutEvent emits a fungible token packet event in the OnTimeoutPacket callback func EmitOnTimeoutEvent(ctx context.Context, packetData types.FungibleTokenPacketDataV2) { - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 tokensStr := mustMarshalJSON(packetData.Tokens) forwardingHopsStr := mustMarshalJSON(packetData.Forwarding.Hops) @@ -127,7 +127,7 @@ func EmitOnTimeoutEvent(ctx context.Context, packetData types.FungibleTokenPacke // EmitDenomEvent emits a denomination event in the OnRecv callback. func EmitDenomEvent(ctx context.Context, token types.Token) { - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 denomStr := mustMarshalJSON(token.Denom) sdkCtx.EventManager().EmitEvent( diff --git a/modules/apps/transfer/keeper/forwarding.go b/modules/apps/transfer/keeper/forwarding.go index 7def930c92b..656fbb75c4a 100644 --- a/modules/apps/transfer/keeper/forwarding.go +++ b/modules/apps/transfer/keeper/forwarding.go @@ -48,7 +48,7 @@ func (k Keeper) forwardPacket(ctx context.Context, data types.FungibleTokenPacke // acknowledgeForwardedPacket writes the async acknowledgement for forwardedPacket func (k Keeper) acknowledgeForwardedPacket(ctx context.Context, forwardedPacket, packet channeltypes.Packet, ack channeltypes.Acknowledgement) error { - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 capability, ok := k.scopedKeeper.GetCapability(sdkCtx, host.ChannelCapabilityPath(forwardedPacket.DestinationPort, forwardedPacket.DestinationChannel)) if !ok { return errorsmod.Wrap(channeltypes.ErrChannelCapabilityNotFound, "module does not own channel capability") diff --git a/modules/apps/transfer/keeper/keeper.go b/modules/apps/transfer/keeper/keeper.go index 5a7c0385191..8033e3a8952 100644 --- a/modules/apps/transfer/keeper/keeper.go +++ b/modules/apps/transfer/keeper/keeper.go @@ -100,13 +100,13 @@ func (k Keeper) GetAuthority() string { // Logger returns a module-specific logger. func (Keeper) Logger(ctx context.Context) log.Logger { - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 return sdkCtx.Logger().With("module", "x/"+exported.ModuleName+"-"+types.ModuleName) } // hasCapability checks if the transfer module owns the port capability for the desired port func (k Keeper) hasCapability(ctx context.Context, portID string) bool { - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 _, ok := k.scopedKeeper.GetCapability(sdkCtx, host.PortPath(portID)) return ok } @@ -314,14 +314,14 @@ func (k Keeper) IterateTokensInEscrow(ctx context.Context, storeprefix []byte, c // AuthenticateCapability wraps the scopedKeeper's AuthenticateCapability function func (k Keeper) AuthenticateCapability(ctx context.Context, cap *capabilitytypes.Capability, name string) bool { - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 return k.scopedKeeper.AuthenticateCapability(sdkCtx, cap, name) } // ClaimCapability allows the transfer module that can claim a capability that IBC module // passes to it func (k Keeper) ClaimCapability(ctx context.Context, cap *capabilitytypes.Capability, name string) error { - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 return k.scopedKeeper.ClaimCapability(sdkCtx, cap, name) } diff --git a/modules/core/keeper/msg_server_test.go b/modules/core/keeper/msg_server_test.go index c394cb80aab..2c04b9d378d 100644 --- a/modules/core/keeper/msg_server_test.go +++ b/modules/core/keeper/msg_server_test.go @@ -1007,7 +1007,7 @@ func (suite *KeeperTestSuite) TestChannelUpgradeInit() { suite.chainA.GetSimApp().IBCMockModule.IBCApp.OnChanUpgradeInit = func(ctx context.Context, portID, channelID string, order channeltypes.Order, connectionHops []string, version string) (string, error) { storeKey := suite.chainA.GetSimApp().GetKey(exported.ModuleName) - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 store := sdkCtx.KVStore(storeKey) store.Set(ibcmock.TestKey, ibcmock.TestValue) @@ -1169,7 +1169,7 @@ func (suite *KeeperTestSuite) TestChannelUpgradeTry() { func() { suite.chainA.GetSimApp().IBCMockModule.IBCApp.OnChanUpgradeTry = func(ctx context.Context, portID, channelID string, order channeltypes.Order, connectionHops []string, counterpartyVersion string) (string, error) { storeKey := suite.chainA.GetSimApp().GetKey(exported.ModuleName) - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 store := sdkCtx.KVStore(storeKey) store.Set(ibcmock.TestKey, ibcmock.TestValue) @@ -1390,7 +1390,7 @@ func (suite *KeeperTestSuite) TestChannelUpgradeAck() { ctx context.Context, portID, channelID, counterpartyVersion string, ) error { // set arbitrary value in store to mock application state changes - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 store := sdkCtx.KVStore(suite.chainA.GetSimApp().GetKey(exported.ModuleName)) store.Set([]byte("foo"), []byte("bar")) return fmt.Errorf("mock app callback failed") @@ -1465,7 +1465,7 @@ func (suite *KeeperTestSuite) TestChannelUpgradeAck() { func() { suite.chainA.GetSimApp().IBCMockModule.IBCApp.OnChanUpgradeAck = func(ctx context.Context, portID, channelID, counterpartyVersion string) error { storeKey := suite.chainA.GetSimApp().GetKey(exported.ModuleName) - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 store := sdkCtx.KVStore(storeKey) store.Set(ibcmock.TestKey, ibcmock.TestValue) diff --git a/testing/mock/ibc_module.go b/testing/mock/ibc_module.go index 29de9179b26..732d193de35 100644 --- a/testing/mock/ibc_module.go +++ b/testing/mock/ibc_module.go @@ -60,7 +60,7 @@ func (im IBCModule) OnChanOpenInit( if chanCap != nil { // Claim channel capability passed back by IBC module - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 if err := im.IBCApp.ScopedKeeper.ClaimCapability(sdkCtx, chanCap, host.ChannelCapabilityPath(portID, channelID)); err != nil { return "", err } @@ -80,7 +80,7 @@ func (im IBCModule) OnChanOpenTry( if chanCap != nil { // Claim channel capability passed back by IBC module - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 if err := im.IBCApp.ScopedKeeper.ClaimCapability(sdkCtx, chanCap, host.ChannelCapabilityPath(portID, channelID)); err != nil { return "", err } @@ -133,7 +133,7 @@ func (im IBCModule) OnRecvPacket(ctx context.Context, channelVersion string, pac // set state by claiming capability to check if revert happens return capName := GetMockRecvCanaryCapabilityName(packet) - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 if _, err := im.IBCApp.ScopedKeeper.NewCapability(sdkCtx, capName); err != nil { // application callback called twice on same packet sequence // must never occur @@ -158,7 +158,7 @@ func (im IBCModule) OnAcknowledgementPacket(ctx context.Context, channelVersion } capName := GetMockAckCanaryCapabilityName(packet) - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 if _, err := im.IBCApp.ScopedKeeper.NewCapability(sdkCtx, capName); err != nil { // application callback called twice on same packet sequence // must never occur @@ -177,7 +177,7 @@ func (im IBCModule) OnTimeoutPacket(ctx context.Context, channelVersion string, } capName := GetMockTimeoutCanaryCapabilityName(packet) - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 if _, err := im.IBCApp.ScopedKeeper.NewCapability(sdkCtx, capName); err != nil { // application callback called twice on same packet sequence // must never occur diff --git a/testing/mock/middleware.go b/testing/mock/middleware.go index 06e8b475ece..659438d239d 100644 --- a/testing/mock/middleware.go +++ b/testing/mock/middleware.go @@ -51,7 +51,7 @@ func (im BlockUpgradeMiddleware) OnChanOpenInit( if chanCap != nil { // Claim channel capability passed back by IBC module - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 if err := im.IBCApp.ScopedKeeper.ClaimCapability(sdkCtx, chanCap, host.ChannelCapabilityPath(portID, channelID)); err != nil { return "", err } @@ -71,7 +71,7 @@ func (im BlockUpgradeMiddleware) OnChanOpenTry( if chanCap != nil { // Claim channel capability passed back by IBC module - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 if err := im.IBCApp.ScopedKeeper.ClaimCapability(sdkCtx, chanCap, host.ChannelCapabilityPath(portID, channelID)); err != nil { return "", err } @@ -124,7 +124,7 @@ func (im BlockUpgradeMiddleware) OnRecvPacket(ctx context.Context, channelVersio // set state by claiming capability to check if revert happens return capName := GetMockRecvCanaryCapabilityName(packet) - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 if _, err := im.IBCApp.ScopedKeeper.NewCapability(sdkCtx, capName); err != nil { // application callback called twice on same packet sequence // must never occur @@ -147,7 +147,7 @@ func (im BlockUpgradeMiddleware) OnAcknowledgementPacket(ctx context.Context, ch } capName := GetMockAckCanaryCapabilityName(packet) - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 if _, err := im.IBCApp.ScopedKeeper.NewCapability(sdkCtx, capName); err != nil { // application callback called twice on same packet sequence // must never occur @@ -164,7 +164,7 @@ func (im BlockUpgradeMiddleware) OnTimeoutPacket(ctx context.Context, channelVer } capName := GetMockTimeoutCanaryCapabilityName(packet) - sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after sdk.Context is removed from core IBC + sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917 if _, err := im.IBCApp.ScopedKeeper.NewCapability(sdkCtx, capName); err != nil { // application callback called twice on same packet sequence // must never occur