diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index ac5be946af..63f1727e7e 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -16,7 +16,9 @@ import ( ratelimit "github.com/cosmos/ibc-apps/modules/rate-limiting/v10" ratelimitkeeper "github.com/cosmos/ibc-apps/modules/rate-limiting/v10/keeper" ratelimittypes "github.com/cosmos/ibc-apps/modules/rate-limiting/v10/types" + ratelimitv2 "github.com/cosmos/ibc-apps/modules/rate-limiting/v10/v2" ibccallbacks "github.com/cosmos/ibc-go/modules/apps/callbacks" + ibccallbacksv2 "github.com/cosmos/ibc-go/modules/apps/callbacks/v2" ibcwasmkeeper "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/keeper" ibcwasmtypes "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" ica "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts" @@ -29,9 +31,11 @@ import ( "github.com/cosmos/ibc-go/v10/modules/apps/transfer" ibctransferkeeper "github.com/cosmos/ibc-go/v10/modules/apps/transfer/keeper" ibctransfertypes "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types" + transferv2 "github.com/cosmos/ibc-go/v10/modules/apps/transfer/v2" ibcclienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types" ibcconnectiontypes "github.com/cosmos/ibc-go/v10/modules/core/03-connection/types" porttypes "github.com/cosmos/ibc-go/v10/modules/core/05-port/types" + ibcapi "github.com/cosmos/ibc-go/v10/modules/core/api" ibcexported "github.com/cosmos/ibc-go/v10/modules/core/exported" ibckeeper "github.com/cosmos/ibc-go/v10/modules/core/keeper" icsprovider "github.com/cosmos/interchain-security/v7/x/ccv/provider" @@ -539,6 +543,13 @@ func NewAppKeeper( appKeepers.ICAControllerKeeper.WithICS4Wrapper(icaICS4Wrapper) wasmStack := wasm.NewIBCHandler(appKeepers.WasmKeeper, appKeepers.IBCKeeper.ChannelKeeper, appKeepers.IBCKeeper.ChannelKeeper) + // Create IBCv2 Transfer Stack + var transferStackV2 ibcapi.IBCModule + transferStackV2 = transferv2.NewIBCModule(appKeepers.TransferKeeper) + transferStackV2 = ibccallbacksv2.NewIBCMiddleware(transferStackV2, appKeepers.IBCKeeper.ChannelKeeperV2, + wasmStackIBCHandler, appKeepers.IBCKeeper.ChannelKeeperV2, gaiaparams.MaxIBCCallbackGas) + transferStackV2 = ratelimitv2.NewIBCMiddleware(appKeepers.RatelimitKeeper, transferStackV2) + // Create IBC Router & seal ibcRouter := porttypes.NewRouter(). AddRoute(icahosttypes.SubModuleName, icaHostStack). @@ -549,6 +560,11 @@ func NewAppKeeper( appKeepers.IBCKeeper.SetRouter(ibcRouter) + // Create IBCv2 Router & seal + ibcv2Router := ibcapi.NewRouter(). + AddRoute(ibctransfertypes.PortID, transferStackV2) + appKeepers.IBCKeeper.SetRouterV2(ibcv2Router) + return appKeepers } diff --git a/app/upgrades/v23/upgrades.go b/app/upgrades/v23/upgrades.go index 0805144f2a..adcd4e9257 100644 --- a/app/upgrades/v23/upgrades.go +++ b/app/upgrades/v23/upgrades.go @@ -4,7 +4,7 @@ import ( "context" ibcwasmtypes "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" - clientkeeper "github.com/cosmos/ibc-go/v10/modules/core/02-client/keeper" + ibctmtypes "github.com/cosmos/ibc-go/v10/modules/light-clients/07-tendermint" errorsmod "cosmossdk.io/errors" upgradetypes "cosmossdk.io/x/upgrade/types" @@ -30,17 +30,12 @@ func CreateUpgradeHandler( return vm, errorsmod.Wrapf(err, "running module migrations") } - // Add the Wasm client type to the allowed clients - Add08WasmToAllowedClients(ctx, *keepers.IBCKeeper.ClientKeeper) + // Set IBC Client AllowedClients + params := keepers.IBCKeeper.ClientKeeper.GetParams(ctx) + params.AllowedClients = []string{ibctmtypes.ModuleName, ibcwasmtypes.ModuleName} + keepers.IBCKeeper.ClientKeeper.SetParams(ctx, params) ctx.Logger().Info("Upgrade v23 complete") return vm, nil } } - -func Add08WasmToAllowedClients(ctx sdk.Context, clientKeeper clientkeeper.Keeper) { - // explicitly update the IBC 02-client params, adding the wasm client type - params := clientKeeper.GetParams(ctx) - params.AllowedClients = append(params.AllowedClients, ibcwasmtypes.Wasm) - clientKeeper.SetParams(ctx, params) -}