feat: introduce PreBlock (backport #17421) (#17712)

Co-authored-by: mmsqe <mavis@crypto.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>
This commit is contained in:
mergify[bot]
2023-09-13 19:40:08 +02:00
committed by GitHub
co-authored by mmsqe Julien Robert
parent 92d1d9a106
commit 4c083c6f23
41 changed files with 476 additions and 94 deletions
+10
View File
@@ -114,6 +114,11 @@ func (a *App) Load(loadLatest bool) error {
a.ModuleManager.SetOrderExportGenesis(a.config.InitGenesis...)
}
if len(a.config.PreBlockers) != 0 {
a.ModuleManager.SetOrderPreBlockers(a.config.PreBlockers...)
a.SetPreBlocker(a.PreBlocker)
}
if len(a.config.BeginBlockers) != 0 {
a.ModuleManager.SetOrderBeginBlockers(a.config.BeginBlockers...)
a.SetBeginBlocker(a.BeginBlocker)
@@ -147,6 +152,11 @@ func (a *App) Load(loadLatest bool) error {
return nil
}
// PreBlocker application updates every pre block
func (a *App) PreBlocker(ctx sdk.Context) (sdk.ResponsePreBlock, error) {
return a.ModuleManager.PreBlock(ctx)
}
// BeginBlocker application updates every begin block
func (a *App) BeginBlocker(ctx sdk.Context) (sdk.BeginBlock, error) {
return a.ModuleManager.BeginBlock(ctx)
+1
View File
@@ -35,6 +35,7 @@ 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())