From 3b234fe48583f5ae157c3761fb2f378b1b0c6c67 Mon Sep 17 00:00:00 2001 From: Pantani Date: Wed, 22 Nov 2023 01:33:18 +0100 Subject: [PATCH 1/8] remove unused callers --- ignite/templates/app/files/app/app.go.plush | 2 +- ignite/templates/app/files/app/ibc.go.plush | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/ignite/templates/app/files/app/app.go.plush b/ignite/templates/app/files/app/app.go.plush index 194f2a58f8..fc4430e2cf 100644 --- a/ignite/templates/app/files/app/app.go.plush +++ b/ignite/templates/app/files/app/app.go.plush @@ -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) // }) diff --git a/ignite/templates/app/files/app/ibc.go.plush b/ignite/templates/app/files/app/ibc.go.plush index 3682300472..5415fa598f 100644 --- a/ignite/templates/app/files/app/ibc.go.plush +++ b/ignite/templates/app/files/app/ibc.go.plush @@ -28,8 +28,6 @@ import ( porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" - solomachine "github.com/cosmos/ibc-go/v8/modules/light-clients/06-solomachine" - ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" // this line is used by starport scaffolding # ibc/app/import ) @@ -169,8 +167,6 @@ func (app *App) registerIBCModules() { ibcfee.NewAppModule(app.IBCFeeKeeper), icamodule.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper), capability.NewAppModule(app.appCodec, *app.CapabilityKeeper, false), - ibctm.AppModule{}, - solomachine.AppModule{}, ); err != nil { panic(err) } From c29224bb19d35b4814a835595e341d2adea8e261 Mon Sep 17 00:00:00 2001 From: Pantani Date: Wed, 22 Nov 2023 02:32:25 +0100 Subject: [PATCH 2/8] register ibc into the basic module manager for the clint --- ignite/templates/app/files/app/app.go.plush | 3 +-- ignite/templates/app/files/app/ibc.go.plush | 12 ++++++++++++ .../cmd/{{binaryNamePrefix}}d/cmd/root.go.plush | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ignite/templates/app/files/app/app.go.plush b/ignite/templates/app/files/app/app.go.plush index fc4430e2cf..5bcefa966b 100644 --- a/ignite/templates/app/files/app/app.go.plush +++ b/ignite/templates/app/files/app/app.go.plush @@ -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 } diff --git a/ignite/templates/app/files/app/ibc.go.plush b/ignite/templates/app/files/app/ibc.go.plush index 5415fa598f..257d9d261c 100644 --- a/ignite/templates/app/files/app/ibc.go.plush +++ b/ignite/templates/app/files/app/ibc.go.plush @@ -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" @@ -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" @@ -32,6 +34,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( @@ -171,3 +174,12 @@ func (app *App) registerIBCModules() { panic(err) } } + +// AddIBCModuleManager add 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{} +} diff --git a/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/root.go.plush b/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/root.go.plush index e60eba7ca8..2d3b88996a 100644 --- a/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/root.go.plush +++ b/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/root.go.plush @@ -55,6 +55,7 @@ func NewRootCmd() *cobra.Command { ); err != nil { panic(err) } + app.AddIBCModuleManager(moduleBasicManager) rootCmd := &cobra.Command{ Use: app.Name + "d", From 46209b149c86f6f86b9fbd7d288c1bf0020fe944 Mon Sep 17 00:00:00 2001 From: Pantani Date: Wed, 22 Nov 2023 02:58:17 +0100 Subject: [PATCH 3/8] add changelog --- changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.md b/changelog.md index cc5032b2cc..d7f1dfbe1c 100644 --- a/changelog.md +++ b/changelog.md @@ -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) From 68839a8f7bd0a7fdccdc144797bcd73d90e2c9a8 Mon Sep 17 00:00:00 2001 From: Pantani Date: Wed, 22 Nov 2023 03:15:43 +0100 Subject: [PATCH 4/8] register additional IBC types --- ignite/templates/app/files/app/ibc.go.plush | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ignite/templates/app/files/app/ibc.go.plush b/ignite/templates/app/files/app/ibc.go.plush index 257d9d261c..2a67abf8c6 100644 --- a/ignite/templates/app/files/app/ibc.go.plush +++ b/ignite/templates/app/files/app/ibc.go.plush @@ -30,6 +30,8 @@ import ( porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" + solomachine "github.com/cosmos/ibc-go/v8/modules/light-clients/06-solomachine" + ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" // this line is used by starport scaffolding # ibc/app/import ) @@ -163,6 +165,10 @@ func (app *App) registerIBCModules() { app.ScopedICAHostKeeper = scopedICAHostKeeper app.ScopedICAControllerKeeper = scopedICAControllerKeeper + // register additional types + ibctm.AppModuleBasic{}.RegisterInterfaces(app.interfaceRegistry) + solomachine.AppModuleBasic{}.RegisterInterfaces(app.interfaceRegistry) + // register IBC modules if err := app.RegisterModules( ibc.NewAppModule(app.IBCKeeper), From 8afc49a680112383bdc44422f07690aa62476266 Mon Sep 17 00:00:00 2001 From: Pantani Date: Wed, 22 Nov 2023 03:31:03 +0100 Subject: [PATCH 5/8] fix comment ident --- ignite/templates/app/files/app/ibc.go.plush | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ignite/templates/app/files/app/ibc.go.plush b/ignite/templates/app/files/app/ibc.go.plush index 2a67abf8c6..70577872a6 100644 --- a/ignite/templates/app/files/app/ibc.go.plush +++ b/ignite/templates/app/files/app/ibc.go.plush @@ -169,7 +169,7 @@ func (app *App) registerIBCModules() { ibctm.AppModuleBasic{}.RegisterInterfaces(app.interfaceRegistry) solomachine.AppModuleBasic{}.RegisterInterfaces(app.interfaceRegistry) - // register IBC modules + // register IBC modules if err := app.RegisterModules( ibc.NewAppModule(app.IBCKeeper), ibctransfer.NewAppModule(app.TransferKeeper), From 4554f3b232fce448e8bff8e60e7063dc25e18d6c Mon Sep 17 00:00:00 2001 From: Danilo Pantani Date: Wed, 22 Nov 2023 12:16:09 +0100 Subject: [PATCH 6/8] improve AddIBCModuleManager function comment --- ignite/templates/app/files/app/ibc.go.plush | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ignite/templates/app/files/app/ibc.go.plush b/ignite/templates/app/files/app/ibc.go.plush index 70577872a6..2528a42fdc 100644 --- a/ignite/templates/app/files/app/ibc.go.plush +++ b/ignite/templates/app/files/app/ibc.go.plush @@ -181,7 +181,7 @@ func (app *App) registerIBCModules() { } } -// AddIBCModuleManager add the missing ibc modules into the module manager. +// 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{} From 0dba5f12e54bc58161e368fe7fe5707614d27079 Mon Sep 17 00:00:00 2001 From: Pantani Date: Wed, 22 Nov 2023 13:58:33 +0100 Subject: [PATCH 7/8] improve template comments --- ignite/templates/app/files/app/app.go.plush | 6 +++--- .../app/files/cmd/{{binaryNamePrefix}}d/cmd/root.go.plush | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ignite/templates/app/files/app/app.go.plush b/ignite/templates/app/files/app/app.go.plush index 5bcefa966b..cbcb43e814 100644 --- a/ignite/templates/app/files/app/app.go.plush +++ b/ignite/templates/app/files/app/app.go.plush @@ -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 diff --git a/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/root.go.plush b/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/root.go.plush index 2d3b88996a..9015b89c31 100644 --- a/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/root.go.plush +++ b/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/root.go.plush @@ -55,6 +55,9 @@ 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{ From 8c638960d907403f9200661b73617a3d5e9e84ce Mon Sep 17 00:00:00 2001 From: Pantani Date: Wed, 22 Nov 2023 14:00:26 +0100 Subject: [PATCH 8/8] rollback ibctm and solomachine to RegisterModules --- ignite/templates/app/files/app/ibc.go.plush | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ignite/templates/app/files/app/ibc.go.plush b/ignite/templates/app/files/app/ibc.go.plush index 2528a42fdc..2fa1ea3766 100644 --- a/ignite/templates/app/files/app/ibc.go.plush +++ b/ignite/templates/app/files/app/ibc.go.plush @@ -165,10 +165,6 @@ func (app *App) registerIBCModules() { app.ScopedICAHostKeeper = scopedICAHostKeeper app.ScopedICAControllerKeeper = scopedICAControllerKeeper - // register additional types - ibctm.AppModuleBasic{}.RegisterInterfaces(app.interfaceRegistry) - solomachine.AppModuleBasic{}.RegisterInterfaces(app.interfaceRegistry) - // register IBC modules if err := app.RegisterModules( ibc.NewAppModule(app.IBCKeeper), @@ -176,6 +172,8 @@ func (app *App) registerIBCModules() { ibcfee.NewAppModule(app.IBCFeeKeeper), icamodule.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper), capability.NewAppModule(app.appCodec, *app.CapabilityKeeper, false), + ibctm.AppModule{}, + solomachine.AppModule{}, ); err != nil { panic(err) }