From 6fe4e8c4c19b61d0d333800a2c98bd2400097dbd Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 12 Mar 2024 08:48:49 +0100 Subject: [PATCH] feat: prepare for wasm app (backport #3956) (#4009) * feat: prepare for wasm app (#3956) ### Description - Pass the `servertypes.AppOptions` to the `registerIBCModules` function so we can use it in the wasm integration app; - Return an error for `registerIBCModules` instead panic; (cherry picked from commit 1e63bb67687206ffc8e3f1a89ee38e2200af744a) * changelog fix --------- Co-authored-by: Danilo Pantani Co-authored-by: Julien Robert --- changelog.md | 1 + ignite/templates/app/files/app/app.go.plush | 4 +++- ignite/templates/app/files/app/ibc.go.plush | 12 +++++++----- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/changelog.md b/changelog.md index b723765c81..d9b9de294e 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,7 @@ ### Features - [#3985](https://github.com/ignite/cli/pull/3985) Make some `cmd` pkg functions public +- [#3956](https://github.com/ignite/cli/pull/3956) Prepare for wasm app ### Changes diff --git a/ignite/templates/app/files/app/app.go.plush b/ignite/templates/app/files/app/app.go.plush index 3a904ab6c5..00d39212b3 100644 --- a/ignite/templates/app/files/app/app.go.plush +++ b/ignite/templates/app/files/app/app.go.plush @@ -318,7 +318,9 @@ func New( app.App = appBuilder.Build(db, traceStore, baseAppOptions...) // Register legacy modules - app.registerIBCModules() + if err := app.registerIBCModules(appOpts); err != nil { + return nil, err + } // register streaming services if err := app.RegisterStreamingServices(appOpts, app.kvStoreKeys()); err != nil { diff --git a/ignite/templates/app/files/app/ibc.go.plush b/ignite/templates/app/files/app/ibc.go.plush index 9a5441eed6..acbfd23c34 100644 --- a/ignite/templates/app/files/app/ibc.go.plush +++ b/ignite/templates/app/files/app/ibc.go.plush @@ -39,7 +39,7 @@ import ( ) // registerIBCModules register IBC keepers and non dependency inject modules. -func (app *App) registerIBCModules() { +func (app *App) registerIBCModules(appOpts servertypes.AppOptions) error { // set up non depinject support modules store keys if err := app.RegisterStores( storetypes.NewKVStoreKey(capabilitytypes.StoreKey), @@ -51,7 +51,7 @@ func (app *App) registerIBCModules() { storetypes.NewMemoryStoreKey(capabilitytypes.MemStoreKey), storetypes.NewTransientStoreKey(paramstypes.TStoreKey), ); err != nil { - panic(err) + return err } // register the key tables for legacy param subspaces @@ -177,12 +177,14 @@ func (app *App) registerIBCModules() { ibctm.AppModule{}, solomachine.AppModule{}, ); err != nil { - panic(err) + return err } + + return nil } -// Since the IBC modules don't support dependency injection, we need to -// manually register the modules on the client side. +// RegisterIBC Since the IBC modules don't support dependency injection, +// we need to manually register the modules on the client side. // This needs to be removed after IBC supports App Wiring. func RegisterIBC(registry cdctypes.InterfaceRegistry) map[string]appmodule.AppModule { modules := map[string]appmodule.AppModule{