Skip to content

Commit

Permalink
feat: Implement RegisterServices for CoreAPI in module manager (cosmo…
Browse files Browse the repository at this point in the history
…s#15133)

Co-authored-by: Marko <[email protected]>
  • Loading branch information
facundomedica and tac0turtle authored Mar 2, 2023
1 parent b65553a commit 1d3e6a1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,10 @@ func NewSimApp(

app.ModuleManager.RegisterInvariants(app.CrisisKeeper)
app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter())
app.ModuleManager.RegisterServices(app.configurator)
err := app.ModuleManager.RegisterServices(app.configurator)
if err != nil {
panic(err)
}

// RegisterUpgradeHandlers is used for registering any on-chain upgrades.
// Make sure it's called after `app.ModuleManager` and `app.configurator` are set.
Expand Down
8 changes: 8 additions & 0 deletions app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/require"

"cosmossdk.io/core/appmodule"
"cosmossdk.io/log"
feegrantmodule "cosmossdk.io/x/feegrant/module"
"github.com/cosmos/cosmos-sdk/baseapp"
Expand Down Expand Up @@ -97,6 +98,13 @@ func TestRunMigrations(t *testing.T) {
if mod, ok := mod.(module.HasServices); ok {
mod.RegisterServices(configurator)
}

if mod, ok := mod.(appmodule.HasServices); ok {
err := mod.RegisterServices(configurator)
require.NoError(t, err)
}

require.NoError(t, configurator.Error())
}

// Initialize the chain
Expand Down

0 comments on commit 1d3e6a1

Please sign in to comment.