feat: add valset change and block info service to runtime (#15811)

Co-authored-by: Aaron Craelius <aaron@regen.network>
This commit is contained in:
Marko
2023-04-12 21:45:02 +00:00
committed by GitHub
co-authored by Aaron Craelius
parent 70436fa5ec
commit f82cbbbeeb
2 changed files with 67 additions and 22 deletions
+24
View File
@@ -1,9 +1,12 @@
package runtime
import (
"context"
appv1alpha1 "cosmossdk.io/api/cosmos/app/v1alpha1"
autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cosmos/cosmos-sdk/runtime/services"
"github.com/cosmos/cosmos-sdk/types/module"
@@ -21,3 +24,24 @@ func (a *App) registerRuntimeServices(cfg module.Configurator) error {
return nil
}
// ======================================================
// ValidatorUpdateService & BlockInfoService
// ======================================================
// ValidatorUpdateService is the service that runtime will provide to the module that sets validator updates.
type ValidatorUpdateService interface {
SetValidatorUpdates(context.Context, []abci.ValidatorUpdate)
}
// BlockInfoService is the service that runtime will provide to modules which need Comet block information.
type BlockInfoService interface {
GetHeight() int64 // GetHeight returns the height of the block
Misbehavior() []abci.Misbehavior // Misbehavior returns the misbehavior of the block
GetHeaderHash() []byte // GetHeaderHash returns the hash of the block header
// GetValidatorsHash returns the hash of the validators
// For Comet, it is the hash of the next validators
GetValidatorsHash() []byte
GetProposerAddress() []byte // GetProposerAddress returns the address of the block proposer
GetDecidedLastCommit() abci.CommitInfo // GetDecidedLastCommit returns the last commit info
}