From 1e63bb67687206ffc8e3f1a89ee38e2200af744a Mon Sep 17 00:00:00 2001 From: Danilo Pantani Date: Thu, 8 Feb 2024 10:38:31 -0300 Subject: [PATCH] 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; --- 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 3be6d956e7..5a5e3e8ced 100644 --- a/changelog.md +++ b/changelog.md @@ -14,6 +14,7 @@ - [#3839](https://github.com/ignite/cli/pull/3839) New structure for app scaffolding - [#3835](https://github.com/ignite/cli/pull/3835) Add `--minimal` flag to `scaffold chain` to scaffold a chain with the least amount of sdk modules - [#3820](https://github.com/ignite/cli/pull/3820) Add integration tests for IBC chains +- [#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 7c76bc9506..5db3658b41 100644 --- a/ignite/templates/app/files/app/ibc.go.plush +++ b/ignite/templates/app/files/app/ibc.go.plush @@ -38,7 +38,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), @@ -50,7 +50,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 @@ -176,12 +176,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{