From f27418df41d35afdd29b5c7b77466b7ad52e831f Mon Sep 17 00:00:00 2001 From: testinginprod Date: Tue, 20 Feb 2024 13:13:46 +0100 Subject: [PATCH] update --- core/appmodule/module.go | 10 ++-------- core/appmodule/v2/comet.go | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 core/appmodule/v2/comet.go diff --git a/core/appmodule/module.go b/core/appmodule/module.go index 8936c121c1c4..cb676226e975 100644 --- a/core/appmodule/module.go +++ b/core/appmodule/module.go @@ -48,17 +48,11 @@ type HasPrecommit interface { // It can modify consensus parameters in storage and signal the caller through the return value. // When it returns ConsensusParamsChanged=true, the caller must refresh the consensus parameter in the finalize context. // The new context (ctx) must be passed to all the other lifecycle methods. -type ResponsePreBlock interface { - IsConsensusParamsChanged() bool -} +type ResponsePreBlock = appmodule.ResponsePreBlock // HasPreBlocker is the extension interface that modules should implement to run // custom logic before BeginBlock. -type HasPreBlocker interface { - AppModule - // PreBlock is method that will be run before BeginBlock. - PreBlock(context.Context) (ResponsePreBlock, error) -} +type HasPreBlocker = appmodule.HasPreBlocker // HasServices is the extension interface that modules should implement to register // implementations of services defined in .proto files. diff --git a/core/appmodule/v2/comet.go b/core/appmodule/v2/comet.go new file mode 100644 index 000000000000..055c2597a24d --- /dev/null +++ b/core/appmodule/v2/comet.go @@ -0,0 +1,19 @@ +package appmodule + +import "context" + +// ResponsePreBlock represents the response from the PreBlock method. +// It can modify consensus parameters in storage and signal the caller through the return value. +// When it returns ConsensusParamsChanged=true, the caller must refresh the consensus parameter in the finalize context. +// The new context (ctx) must be passed to all the other lifecycle methods. +type ResponsePreBlock interface { + IsConsensusParamsChanged() bool +} + +// HasPreBlocker is the extension interface that modules should implement to run +// custom logic before BeginBlock. +type HasPreBlocker interface { + AppModule + // PreBlock is method that will be run before BeginBlock. + PreBlock(context.Context) (ResponsePreBlock, error) +}