validator

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2023 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultQueueSize = 32
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MessageHandler

type MessageHandler func(logger *zap.Logger, msg *queue.DecodedSSVMessage) error

MessageHandler process the msg. return error if exist

type NonCommitteeValidator

type NonCommitteeValidator struct {
	Share   *types.SSVShare
	Storage *storage.QBFTStores
	// contains filtered or unexported fields
}

func NewNonCommitteeValidator

func NewNonCommitteeValidator(logger *zap.Logger, identifier spectypes.MessageID, opts Options) *NonCommitteeValidator

func (*NonCommitteeValidator) ProcessMessage

func (ncv *NonCommitteeValidator) ProcessMessage(logger *zap.Logger, msg *spectypes.SSVMessage)

type Options

type Options struct {
	Network           specqbft.Network
	Beacon            specssv.BeaconNode
	Storage           *storage.QBFTStores
	SSVShare          *types.SSVShare
	Signer            spectypes.KeyManager
	DutyRunners       runner.DutyRunners
	NewDecidedHandler qbftctrl.NewDecidedHandler
	FullNode          bool
	Exporter          bool
	QueueSize         int
}

Options represents options that should be passed to a new instance of Validator.

type State

type State uint32

State of the validator

const (
	// NotStarted the validator hasn't started
	NotStarted State = iota
	// Started validator is running
	Started
)

type Validator

type Validator struct {
	DutyRunners runner.DutyRunners
	Network     specqbft.Network
	Beacon      specssv.BeaconNode
	Share       *types.SSVShare
	Signer      spectypes.KeyManager

	Storage *storage.QBFTStores
	Queues  map[spectypes.BeaconRole]queueContainer
	// contains filtered or unexported fields
}

Validator represents an SSV ETH consensus validator Share assigned, coordinates duty execution and more. Every validator has a validatorID which is validator's public key. Each validator has multiple DutyRunners, for each duty type.

func NewValidator

func NewValidator(pctx context.Context, cancel func(), options Options) *Validator

NewValidator creates a new instance of Validator.

func (*Validator) ConsumeQueue

func (v *Validator) ConsumeQueue(logger *zap.Logger, msgID spectypes.MessageID, handler MessageHandler) error

ConsumeQueue consumes messages from the queue.Queue of the controller it checks for current state

func (*Validator) GetLastHeight

func (v *Validator) GetLastHeight(identifier spectypes.MessageID) specqbft.Height

GetLastHeight returns the last height for the given identifier

func (*Validator) GetLastRound

func (v *Validator) GetLastRound(identifier spectypes.MessageID) specqbft.Round

GetLastRound returns the last height for the given identifier

func (*Validator) HandleMessage

func (v *Validator) HandleMessage(logger *zap.Logger, msg *spectypes.SSVMessage)

HandleMessage handles a spectypes.SSVMessage. TODO: accept DecodedSSVMessage once p2p is upgraded to decode messages during validation.

func (*Validator) OnExecuteDuty

func (v *Validator) OnExecuteDuty(logger *zap.Logger, msg types.EventMsg) error

func (*Validator) ProcessMessage

func (v *Validator) ProcessMessage(logger *zap.Logger, msg *queue.DecodedSSVMessage) error

ProcessMessage processes Network Message of all types

func (*Validator) Start

func (v *Validator) Start(logger *zap.Logger) error

Start starts a Validator.

func (*Validator) StartDuty

func (v *Validator) StartDuty(logger *zap.Logger, duty *spectypes.Duty) error

StartDuty starts a duty for the validator

func (*Validator) StartQueueConsumer

func (v *Validator) StartQueueConsumer(logger *zap.Logger, msgID spectypes.MessageID, handler MessageHandler)

StartQueueConsumer start ConsumeQueue with handler

func (*Validator) Stop

func (v *Validator) Stop()

Stop stops a Validator.

Jump to

Keyboard shortcuts

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