Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(runtime): PreBlocker getting overwritten if set as a baseapp option #17944

Merged
merged 3 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions baseapp/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ func (app *BaseApp) SetInitChainer(initChainer sdk.InitChainer) {
app.initChainer = initChainer
}

func (app *BaseApp) PreBlocker() sdk.PreBlocker {
return app.preBlocker
}

func (app *BaseApp) SetPreBlocker(preBlocker sdk.PreBlocker) {
if app.sealed {
panic("SetPreBlocker() on sealed BaseApp")
Expand Down
4 changes: 3 additions & 1 deletion runtime/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ func (a *App) Load(loadLatest bool) error {

if len(a.config.PreBlockers) != 0 {
a.ModuleManager.SetOrderPreBlockers(a.config.PreBlockers...)
a.SetPreBlocker(a.PreBlocker)
if a.BaseApp.PreBlocker() == nil {
a.SetPreBlocker(a.PreBlocker)
}
}

if len(a.config.BeginBlockers) != 0 {
Expand Down
1 change: 0 additions & 1 deletion runtime/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ func (a *AppBuilder) Build(db dbm.DB, traceStore io.Writer, baseAppOptions ...fu
bApp.SetVersion(version.Version)
bApp.SetInterfaceRegistry(a.app.interfaceRegistry)
bApp.MountStores(a.app.storeKeys...)
bApp.SetPreBlocker(a.app.PreBlocker)

a.app.BaseApp = bApp
a.app.configurator = module.NewConfigurator(a.app.cdc, a.app.MsgServiceRouter(), a.app.GRPCQueryRouter())
Expand Down
2 changes: 1 addition & 1 deletion simapp/app_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ func NewSimApp(
// 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
Loading