Skip to content

Commit

Permalink
feat: Replace ibc-go 9.0.2 with release/10.0.x (#2125)
Browse files Browse the repository at this point in the history
  • Loading branch information
kulikthebird authored Feb 19, 2025
1 parent 4e7c441 commit 2b4efde
Show file tree
Hide file tree
Showing 42 changed files with 261 additions and 530 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# docker build . -t cosmwasm/wasmd:latest
# docker run --rm -it cosmwasm/wasmd:latest /bin/sh

FROM golang:1.23-alpine3.19 AS go-builder
FROM golang:1.23.6-alpine AS go-builder

# this comes from standard alpine nightly file
# https://github.com/rust-lang/docker-rust-nightly/blob/master/alpine3.12/Dockerfile
Expand Down
4 changes: 2 additions & 2 deletions app/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package app
import (
"errors"

ibcante "github.com/cosmos/ibc-go/v9/modules/core/ante"
"github.com/cosmos/ibc-go/v9/modules/core/keeper"
ibcante "github.com/cosmos/ibc-go/v10/modules/core/ante"
"github.com/cosmos/ibc-go/v10/modules/core/keeper"

corestoretypes "cosmossdk.io/core/store"
circuitante "cosmossdk.io/x/circuit/ante"
Expand Down
115 changes: 30 additions & 85 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,27 @@ import (
dbm "github.com/cosmos/cosmos-db"
"github.com/cosmos/gogoproto/proto"
ibccallbacks "github.com/cosmos/ibc-go/modules/apps/callbacks"
"github.com/cosmos/ibc-go/modules/capability"
capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper"
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
ica "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts"
icacontroller "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller"
icacontrollerkeeper "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller/keeper"
icacontrollertypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller/types"
icahost "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/host"
icahostkeeper "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/host/keeper"
icahosttypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/host/types"
icatypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/types"
ibcfee "github.com/cosmos/ibc-go/v9/modules/apps/29-fee"
ibcfeekeeper "github.com/cosmos/ibc-go/v9/modules/apps/29-fee/keeper"
ibcfeetypes "github.com/cosmos/ibc-go/v9/modules/apps/29-fee/types"
"github.com/cosmos/ibc-go/v9/modules/apps/transfer"
ibctransferkeeper "github.com/cosmos/ibc-go/v9/modules/apps/transfer/keeper"
ibctransfertypes "github.com/cosmos/ibc-go/v9/modules/apps/transfer/types"
ibc "github.com/cosmos/ibc-go/v9/modules/core"
ibcclienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types"
ibcconnectiontypes "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types"
porttypes "github.com/cosmos/ibc-go/v9/modules/core/05-port/types"
ibcexported "github.com/cosmos/ibc-go/v9/modules/core/exported"
ibckeeper "github.com/cosmos/ibc-go/v9/modules/core/keeper"
ibctm "github.com/cosmos/ibc-go/v9/modules/light-clients/07-tendermint"
ica "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts"
icacontroller "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/controller"
icacontrollerkeeper "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/controller/keeper"
icacontrollertypes "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/controller/types"
icahost "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/host"
icahostkeeper "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/host/keeper"
icahosttypes "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/host/types"
icatypes "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/types"
ibcfee "github.com/cosmos/ibc-go/v10/modules/apps/29-fee"
ibcfeekeeper "github.com/cosmos/ibc-go/v10/modules/apps/29-fee/keeper"
ibcfeetypes "github.com/cosmos/ibc-go/v10/modules/apps/29-fee/types"
"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"
ibc "github.com/cosmos/ibc-go/v10/modules/core"
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"
ibcexported "github.com/cosmos/ibc-go/v10/modules/core/exported"
ibckeeper "github.com/cosmos/ibc-go/v10/modules/core/keeper"
ibctm "github.com/cosmos/ibc-go/v10/modules/light-clients/07-tendermint"
"github.com/spf13/cast"

autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
Expand Down Expand Up @@ -195,14 +192,12 @@ type WasmApp struct {
interfaceRegistry types.InterfaceRegistry

// keys to access the substores
keys map[string]*storetypes.KVStoreKey
tkeys map[string]*storetypes.TransientStoreKey
memKeys map[string]*storetypes.MemoryStoreKey
keys map[string]*storetypes.KVStoreKey
tkeys map[string]*storetypes.TransientStoreKey

// keepers
AccountKeeper authkeeper.AccountKeeper
BankKeeper bankkeeper.BaseKeeper
CapabilityKeeper *capabilitykeeper.Keeper
StakingKeeper *stakingkeeper.Keeper
SlashingKeeper slashingkeeper.Keeper
MintKeeper mintkeeper.Keeper
Expand All @@ -226,13 +221,6 @@ type WasmApp struct {
TransferKeeper ibctransferkeeper.Keeper
WasmKeeper wasmkeeper.Keeper

ScopedIBCKeeper capabilitykeeper.ScopedKeeper
ScopedICAHostKeeper capabilitykeeper.ScopedKeeper
ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper
ScopedTransferKeeper capabilitykeeper.ScopedKeeper
ScopedIBCFeeKeeper capabilitykeeper.ScopedKeeper
ScopedWasmKeeper capabilitykeeper.ScopedKeeper

// the module manager
ModuleManager *module.Manager
BasicModuleManager module.BasicManager
Expand Down Expand Up @@ -321,13 +309,12 @@ func NewWasmApp(
evidencetypes.StoreKey, circuittypes.StoreKey,
authzkeeper.StoreKey, nftkeeper.StoreKey, group.StoreKey,
// non sdk store keys
capabilitytypes.StoreKey, ibcexported.StoreKey, ibctransfertypes.StoreKey, ibcfeetypes.StoreKey,
ibcexported.StoreKey, ibctransfertypes.StoreKey, ibcfeetypes.StoreKey,
wasmtypes.StoreKey, icahosttypes.StoreKey,
icacontrollertypes.StoreKey,
)

tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey)
memKeys := storetypes.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)

// register streaming services
if err := bApp.RegisterStreamingServices(appOpts, keys); err != nil {
Expand All @@ -342,7 +329,6 @@ func NewWasmApp(
interfaceRegistry: interfaceRegistry,
keys: keys,
tkeys: tkeys,
memKeys: memKeys,
}

app.ParamsKeeper = initParamsKeeper(
Expand All @@ -361,20 +347,6 @@ func NewWasmApp(
)
bApp.SetParamStore(app.ConsensusParamsKeeper.ParamsStore)

// add capability keeper and ScopeToModule for ibc module
app.CapabilityKeeper = capabilitykeeper.NewKeeper(
appCodec,
keys[capabilitytypes.StoreKey],
memKeys[capabilitytypes.MemStoreKey],
)

scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName)
scopedICAHostKeeper := app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName)
scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName)
scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName)
scopedWasmKeeper := app.CapabilityKeeper.ScopeToModule(wasmtypes.ModuleName)
app.CapabilityKeeper.Seal()

// add keepers

app.AccountKeeper = authkeeper.NewAccountKeeper(
Expand Down Expand Up @@ -513,10 +485,9 @@ func NewWasmApp(

app.IBCKeeper = ibckeeper.NewKeeper(
appCodec,
keys[ibcexported.StoreKey],
runtime.NewKVStoreService(keys[ibcexported.StoreKey]),
app.GetSubspace(ibcexported.ModuleName),
app.UpgradeKeeper,
scopedIBCKeeper,
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

Expand Down Expand Up @@ -574,48 +545,42 @@ func NewWasmApp(

// IBC Fee Module keeper
app.IBCFeeKeeper = ibcfeekeeper.NewKeeper(
appCodec, keys[ibcfeetypes.StoreKey],
appCodec, runtime.NewKVStoreService(keys[ibcfeetypes.StoreKey]),
app.IBCKeeper.ChannelKeeper, // may be replaced with IBC middleware
app.IBCKeeper.ChannelKeeper,
app.IBCKeeper.PortKeeper, app.AccountKeeper, app.BankKeeper,
app.AccountKeeper, app.BankKeeper,
)

// Create Transfer Keepers
app.TransferKeeper = ibctransferkeeper.NewKeeper(
appCodec,
keys[ibctransfertypes.StoreKey],
runtime.NewKVStoreService(keys[ibctransfertypes.StoreKey]),
app.GetSubspace(ibctransfertypes.ModuleName),
app.IBCFeeKeeper, // ISC4 Wrapper: fee IBC middleware
app.IBCKeeper.ChannelKeeper,
app.IBCKeeper.PortKeeper,
app.AccountKeeper,
app.BankKeeper,
scopedTransferKeeper,
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

app.ICAHostKeeper = icahostkeeper.NewKeeper(
appCodec,
keys[icahosttypes.StoreKey],
runtime.NewKVStoreService(keys[icahosttypes.StoreKey]),
app.GetSubspace(icahosttypes.SubModuleName),
app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack
app.IBCKeeper.ChannelKeeper,
app.IBCKeeper.PortKeeper,
app.AccountKeeper,
scopedICAHostKeeper,
app.MsgServiceRouter(),
app.GRPCQueryRouter(), // set grpc router for ica host
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

app.ICAControllerKeeper = icacontrollerkeeper.NewKeeper(
appCodec,
keys[icacontrollertypes.StoreKey],
runtime.NewKVStoreService(keys[icacontrollertypes.StoreKey]),
app.GetSubspace(icacontrollertypes.SubModuleName),
app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack
app.IBCKeeper.ChannelKeeper,
app.IBCKeeper.PortKeeper,
scopedICAControllerKeeper,
app.MsgServiceRouter(),
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)
Expand All @@ -637,8 +602,6 @@ func NewWasmApp(
distrkeeper.NewQuerier(app.DistrKeeper),
app.IBCFeeKeeper, // ISC4 Wrapper: fee IBC middleware
app.IBCKeeper.ChannelKeeper,
app.IBCKeeper.PortKeeper,
scopedWasmKeeper,
app.TransferKeeper,
app.MsgServiceRouter(),
app.GRPCQueryRouter(),
Expand Down Expand Up @@ -733,7 +696,6 @@ func NewWasmApp(
consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper),
circuit.NewAppModule(appCodec, app.CircuitKeeper),
// non sdk modules
capability.NewAppModule(appCodec, *app.CapabilityKeeper, false),
wasm.NewAppModule(appCodec, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.MsgServiceRouter(), app.GetSubspace(wasmtypes.ModuleName)),
ibc.NewAppModule(app.IBCKeeper),
transfer.NewAppModule(app.TransferKeeper),
Expand Down Expand Up @@ -779,7 +741,6 @@ func NewWasmApp(
genutiltypes.ModuleName,
authz.ModuleName,
// additional non simd modules
capabilitytypes.ModuleName,
ibctransfertypes.ModuleName,
ibcexported.ModuleName,
icatypes.ModuleName,
Expand All @@ -795,7 +756,6 @@ func NewWasmApp(
feegrant.ModuleName,
group.ModuleName,
// additional non simd modules
capabilitytypes.ModuleName,
ibctransfertypes.ModuleName,
ibcexported.ModuleName,
icatypes.ModuleName,
Expand All @@ -812,7 +772,6 @@ func NewWasmApp(
// NOTE: wasm module should be at the end as it can call other module functionality direct or via message dispatching during
// genesis phase. For example bank transfer, auth account check, staking, ...
genesisModuleOrder := []string{
capabilitytypes.ModuleName,
// simd modules
authtypes.ModuleName, banktypes.ModuleName,
distrtypes.ModuleName, stakingtypes.ModuleName, slashingtypes.ModuleName, govtypes.ModuleName,
Expand Down Expand Up @@ -869,7 +828,6 @@ func NewWasmApp(
// initialize stores
app.MountKVStores(keys)
app.MountTransientStores(tkeys)
app.MountMemoryStores(memKeys)

// initialize BaseApp
app.SetInitChainer(app.InitChainer)
Expand All @@ -890,12 +848,6 @@ func NewWasmApp(
}
}

app.ScopedIBCKeeper = scopedIBCKeeper
app.ScopedTransferKeeper = scopedTransferKeeper
app.ScopedWasmKeeper = scopedWasmKeeper
app.ScopedICAHostKeeper = scopedICAHostKeeper
app.ScopedICAControllerKeeper = scopedICAControllerKeeper

// In v0.46, the SDK introduces _postHandlers_. PostHandlers are like
// antehandlers, but are run _after_ the `runMsgs` execution. They are also
// defined as a chain, and have the same signature as antehandlers.
Expand Down Expand Up @@ -1094,13 +1046,6 @@ func (app *WasmApp) GetTKey(storeKey string) *storetypes.TransientStoreKey {
return app.tkeys[storeKey]
}

// GetMemKey returns the MemStoreKey for the provided mem key.
//
// NOTE: This is solely used for testing purposes.
func (app *WasmApp) GetMemKey(storeKey string) *storetypes.MemoryStoreKey {
return app.memKeys[storeKey]
}

// GetSubspace returns a param subspace for a given module name.
//
// NOTE: This is solely to be used for testing purposes.
Expand Down
7 changes: 1 addition & 6 deletions app/test_support.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package app

import (
capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper"
ibckeeper "github.com/cosmos/ibc-go/v9/modules/core/keeper"
ibckeeper "github.com/cosmos/ibc-go/v10/modules/core/keeper"

"github.com/cosmos/cosmos-sdk/baseapp"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
Expand All @@ -16,10 +15,6 @@ func (app *WasmApp) GetIBCKeeper() *ibckeeper.Keeper {
return app.IBCKeeper
}

func (app *WasmApp) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper {
return app.ScopedIBCKeeper
}

func (app *WasmApp) GetBaseApp() *baseapp.BaseApp {
return app.BaseApp
}
Expand Down
1 change: 0 additions & 1 deletion app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ func (app *WasmApp) RegisterUpgradeHandlers() {
AccountKeeper: &app.AccountKeeper,
ParamsKeeper: &app.ParamsKeeper,
ConsensusParamsKeeper: &app.ConsensusParamsKeeper,
CapabilityKeeper: app.CapabilityKeeper,
IBCKeeper: app.IBCKeeper,
Codec: app.appCodec,
GetStoreKey: app.GetKey,
Expand Down
4 changes: 1 addition & 3 deletions app/upgrades/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ package upgrades
import (
"context"

capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper"
ibckeeper "github.com/cosmos/ibc-go/v9/modules/core/keeper"
ibckeeper "github.com/cosmos/ibc-go/v10/modules/core/keeper"

storetypes "cosmossdk.io/store/types"
upgradetypes "cosmossdk.io/x/upgrade/types"
Expand All @@ -22,7 +21,6 @@ type AppKeepers struct {
ConsensusParamsKeeper *consensusparamkeeper.Keeper
Codec codec.Codec
GetStoreKey func(storeKey string) *storetypes.KVStoreKey
CapabilityKeeper *capabilitykeeper.Keeper
IBCKeeper *ibckeeper.Keeper
}
type ModuleManager interface {
Expand Down
Loading

0 comments on commit 2b4efde

Please sign in to comment.