validator

package
v1.3.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2024 License: GPL-3.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDutyExecuteMsg added in v1.1.0

func CreateDutyExecuteMsg(duty *spectypes.Duty, pubKey phase0.BLSPubKey, domain spectypes.DomainType) (*spectypes.SSVMessage, error)

CreateDutyExecuteMsg returns ssvMsg with event type of duty execute

func SetupRunners added in v0.4.0

func SetupRunners(ctx context.Context, logger *zap.Logger, options validator.Options) runner.DutyRunners

SetupRunners initializes duty runners for the given validator

Types

type Controller

type Controller interface {
	StartValidators()
	CommitteeActiveIndices(epoch phase0.Epoch) []phase0.ValidatorIndex
	AllActiveIndices(epoch phase0.Epoch, afterInit bool) []phase0.ValidatorIndex
	GetValidator(pubKey string) (*validator.Validator, bool)
	ExecuteDuty(logger *zap.Logger, duty *spectypes.Duty)
	UpdateValidatorMetaDataLoop()
	StartNetworkHandlers()
	GetOperatorShares() []*ssvtypes.SSVShare
	// GetValidatorStats returns stats of validators, including the following:
	//  - the amount of validators in the network
	//  - the amount of active validators (i.e. not slashed or existed)
	//  - the amount of validators assigned to this operator
	GetValidatorStats() (uint64, uint64, uint64, error)
	IndicesChangeChan() chan struct{}
	ValidatorExitChan() <-chan duties.ExitDescriptor

	StartValidator(share *ssvtypes.SSVShare) error
	StopValidator(pubKey spectypes.ValidatorPK) error
	LiquidateCluster(owner common.Address, operatorIDs []uint64, toLiquidate []*ssvtypes.SSVShare) error
	ReactivateCluster(owner common.Address, operatorIDs []uint64, toReactivate []*ssvtypes.SSVShare) error
	UpdateFeeRecipient(owner, recipient common.Address) error
	ExitValidator(pubKey phase0.BLSPubKey, blockNumber uint64, validatorIndex phase0.ValidatorIndex) error
}

Controller represent the validators controller, it takes care of bootstrapping, updating and managing existing validators and their shares

func NewController

func NewController(logger *zap.Logger, options ControllerOptions) Controller

NewController creates a new validator controller instance

type ControllerOptions

type ControllerOptions struct {
	Context                    context.Context
	DB                         basedb.Database
	SignatureCollectionTimeout time.Duration `` /* 152-byte string literal not displayed */
	MetadataUpdateInterval     time.Duration `` /* 127-byte string literal not displayed */
	HistorySyncBatchSize       int           `` /* 145-byte string literal not displayed */
	MinPeers                   int           `yaml:"MinimumPeers" env:"MINIMUM_PEERS" env-default:"2" env-description:"The required minimum peers for sync"`
	BeaconNetwork              beaconprotocol.Network
	Network                    P2PNetwork
	Beacon                     beaconprotocol.BeaconNode
	FullNode                   bool `yaml:"FullNode" env:"FULLNODE" env-default:"false" env-description:"Save decided history rather than just highest messages"`
	Exporter                   bool `yaml:"Exporter" env:"EXPORTER" env-default:"false" env-description:""`
	BuilderProposals           bool `yaml:"BuilderProposals" env:"BUILDER_PROPOSALS" env-default:"false" env-description:"Use external builders to produce blocks"`
	KeyManager                 spectypes.KeyManager
	OperatorDataStore          operatordatastore.OperatorDataStore
	RegistryStorage            nodestorage.Storage
	RecipientsStorage          Recipients
	NewDecidedHandler          qbftcontroller.NewDecidedHandler
	DutyRoles                  []spectypes.BeaconRole
	StorageMap                 *storage.QBFTStores
	Metrics                    validator.Metrics
	MessageValidator           validation.MessageValidator
	ValidatorsMap              *validatorsmap.ValidatorsMap

	// worker flags
	WorkersCount    int `` /* 130-byte string literal not displayed */
	QueueBufferSize int `yaml:"MsgWorkerBufferSize" env:"MSG_WORKER_BUFFER_SIZE" env-default:"1024" env-description:"Buffer size for message workers"`
	GasLimit        uint64
}

ControllerOptions for creating a validator controller

type GetRecipientDataFunc added in v0.4.7

type GetRecipientDataFunc func(r basedb.Reader, owner common.Address) (*registrystorage.RecipientData, bool, error)

type Nonce added in v1.3.0

type Nonce uint16

type P2PNetwork added in v1.3.0

type P2PNetwork interface {
	Broadcast(message *spectypes.SSVMessage) error
	UseMessageRouter(router network.MessageRouter)
	Peers(pk spectypes.ValidatorPK) ([]peer.ID, error)
	SubscribeRandoms(logger *zap.Logger, numSubnets int) error
	RegisterHandlers(logger *zap.Logger, handlers ...*p2pprotocol.SyncHandler)
}

type Recipients added in v1.3.0

type Recipients interface {
	GetRecipientData(r basedb.Reader, owner common.Address) (*registrystorage.RecipientData, bool, error)
}

type ShareEventHandlerFunc

type ShareEventHandlerFunc func(share *ssvtypes.SSVShare)

ShareEventHandlerFunc is a function that handles event in an extended mode

type SharesStorage added in v1.3.0

type SharesStorage interface {
	Get(txn basedb.Reader, pubKey []byte) *types.SSVShare
	List(txn basedb.Reader, filters ...registrystorage.SharesFilter) []*types.SSVShare
	Range(txn basedb.Reader, fn func(*types.SSVShare) bool)
	UpdateValidatorMetadata(pk string, metadata *beaconprotocol.ValidatorMetadata) error
}

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL