Skip to content

Commit

Permalink
fix: v0.50 ibc genesis issue (#3767)
Browse files Browse the repository at this point in the history
* remove unused callers

* register ibc into the basic module manager for the clint

* add changelog

---------

Co-authored-by: Pantani <Pantani>
  • Loading branch information
Pantani authored Nov 23, 2023
1 parent 9fe1f4c commit e73b971
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
- [#3726](https://github.com/ignite/cli/pull/3726) Update TS client dependencies. Bump vue/react template versions
- [#3728](https://github.com/ignite/cli/pull/3728) Fix wrong parser for proto package names
- [#3729](https://github.com/ignite/cli/pull/3729) Fix broken generator due to caching /tmp include folders
- [#3767](https://github.com/ignite/cli/pull/3767) Fix `v0.50` ibc genesis issue

## [`v0.27.2`](https://github.com/ignite/cli/releases/tag/v0.27.2)

Expand Down
11 changes: 5 additions & 6 deletions ignite/templates/app/files/app/app.go.plush
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,15 @@ func New(
appConfig = depinject.Configs(
AppConfig(),
depinject.Supply(
// supply the application options
// Supply the application options
appOpts,
// Supply with IBC keeper getter for the IBC modules with App Wiring.
// The IBC Keeper cannot be passed because it has not been initiated yet.
// Passing the getter, the app IBC Keeper will always be accessible.
// This needs to be removed after IBC supported App Wiring.
// This needs to be removed after IBC supports App Wiring.
app.GetIBCKeeper,
app.GetCapabilityScopedKeeper,
// supply the logger
// Supply the logger
logger,

// ADVANCED CONFIGURATION
Expand Down Expand Up @@ -323,7 +323,7 @@ func New(
// However, when registering a module manually (i.e. that does not support app wiring), the module version map
// must be set manually as follow. The upgrade module will de-duplicate the module version map.
//
// app.SetInitChainer(func(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain {
// app.SetInitChainer(func(ctx sdk.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error) {
// app.UpgradeKeeper.SetModuleVersionMap(ctx, app.ModuleManager.GetVersionMap())
// return app.App.InitChainer(ctx, req)
// })
Expand Down Expand Up @@ -353,8 +353,7 @@ func (app *App) AppCodec() codec.Codec {

// GetKey returns the KVStoreKey for the provided store key.
func (app *App) GetKey(storeKey string) *storetypes.KVStoreKey {
sk := app.UnsafeFindStoreKey(storeKey)
kvStoreKey, ok := sk.(*storetypes.KVStoreKey)
kvStoreKey, ok := app.UnsafeFindStoreKey(storeKey).(*storetypes.KVStoreKey)
if !ok {
return nil
}
Expand Down
14 changes: 13 additions & 1 deletion ignite/templates/app/files/app/ibc.go.plush
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package app

import (
storetypes "cosmossdk.io/store/types"
"github.com/cosmos/cosmos-sdk/types/module"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
Expand All @@ -16,6 +17,7 @@ import (
icahost "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host"
icahostkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/keeper"
icahosttypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types"
icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types"
ibcfee "github.com/cosmos/ibc-go/v8/modules/apps/29-fee"
ibcfeekeeper "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/keeper"
ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types"
Expand All @@ -34,6 +36,7 @@ import (
// this line is used by starport scaffolding # ibc/app/import
)

// registerIBCModules register IBC keepers and non dependency inject modules.
func (app *App) registerIBCModules() {
// set up non depinject support modules store keys
if err := app.RegisterStores(
Expand Down Expand Up @@ -162,7 +165,7 @@ func (app *App) registerIBCModules() {
app.ScopedICAHostKeeper = scopedICAHostKeeper
app.ScopedICAControllerKeeper = scopedICAControllerKeeper

// register IBC modules
// register IBC modules
if err := app.RegisterModules(
ibc.NewAppModule(app.IBCKeeper),
ibctransfer.NewAppModule(app.TransferKeeper),
Expand All @@ -175,3 +178,12 @@ func (app *App) registerIBCModules() {
panic(err)
}
}

// AddIBCModuleManager adds the missing IBC modules into the module manager.
func AddIBCModuleManager(moduleManager module.BasicManager) {
moduleManager[ibcexported.ModuleName] = ibc.AppModule{}
moduleManager[ibctransfertypes.ModuleName] = ibctransfer.AppModule{}
moduleManager[ibcfeetypes.ModuleName] = ibcfee.AppModule{}
moduleManager[icatypes.ModuleName] = icamodule.AppModule{}
moduleManager[capabilitytypes.ModuleName] = capability.AppModule{}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ func NewRootCmd() *cobra.Command {
); err != nil {
panic(err)
}
// Since the IBC modules don't support dependency injection, we need to
// manually add the modules to the basic manager on the client side.
// This needs to be removed after IBC supports App Wiring.
app.AddIBCModuleManager(moduleBasicManager)

rootCmd := &cobra.Command{
Use: app.Name + "d",
Expand Down

0 comments on commit e73b971

Please sign in to comment.