feat: add valset change and block info service to runtime (#15811)
Co-authored-by: Aaron Craelius <aaron@regen.network>
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user