validator

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: GPL-3.0 Imports: 26 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 Metrics added in v1.1.0

type Metrics interface {
	ValidatorInactive(publicKey []byte)
	ValidatorNoIndex(publicKey []byte)
	ValidatorError(publicKey []byte)
	ValidatorReady(publicKey []byte)
	ValidatorNotActivated(publicKey []byte)
	ValidatorExiting(publicKey []byte)
	ValidatorSlashed(publicKey []byte)
	ValidatorNotFound(publicKey []byte)
	ValidatorPending(publicKey []byte)
	ValidatorRemoved(publicKey []byte)
	ValidatorUnknown(publicKey []byte)

	queue.Metrics
}

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 *queue.DecodedSSVMessage)

type NopMetrics added in v1.1.0

type NopMetrics struct{}

func (NopMetrics) DroppedQueueMessage added in v1.1.0

func (n NopMetrics) DroppedQueueMessage(spectypes.MessageID)

func (NopMetrics) IncomingQueueMessage added in v1.1.0

func (n NopMetrics) IncomingQueueMessage(spectypes.MessageID)

func (NopMetrics) MessageQueueCapacity added in v1.1.0

func (n NopMetrics) MessageQueueCapacity(int)

func (NopMetrics) MessageQueueSize added in v1.1.0

func (n NopMetrics) MessageQueueSize(int)

func (NopMetrics) MessageTimeInQueue added in v1.1.0

func (n NopMetrics) MessageTimeInQueue(spectypes.MessageID, time.Duration)

func (NopMetrics) OutgoingQueueMessage added in v1.1.0

func (n NopMetrics) OutgoingQueueMessage(spectypes.MessageID)

func (NopMetrics) ValidatorError added in v1.1.0

func (n NopMetrics) ValidatorError([]byte)

func (NopMetrics) ValidatorExiting added in v1.1.0

func (n NopMetrics) ValidatorExiting([]byte)

func (NopMetrics) ValidatorInactive added in v1.1.0

func (n NopMetrics) ValidatorInactive([]byte)

func (NopMetrics) ValidatorNoIndex added in v1.1.0

func (n NopMetrics) ValidatorNoIndex([]byte)

func (NopMetrics) ValidatorNotActivated added in v1.1.0

func (n NopMetrics) ValidatorNotActivated([]byte)

func (NopMetrics) ValidatorNotFound added in v1.1.0

func (n NopMetrics) ValidatorNotFound([]byte)

func (NopMetrics) ValidatorPending added in v1.1.0

func (n NopMetrics) ValidatorPending([]byte)

func (NopMetrics) ValidatorReady added in v1.1.0

func (n NopMetrics) ValidatorReady([]byte)

func (NopMetrics) ValidatorRemoved added in v1.1.0

func (n NopMetrics) ValidatorRemoved([]byte)

func (NopMetrics) ValidatorSlashed added in v1.1.0

func (n NopMetrics) ValidatorSlashed([]byte)

func (NopMetrics) ValidatorUnknown added in v1.1.0

func (n NopMetrics) ValidatorUnknown([]byte)

type Options

type Options struct {
	Network           specqbft.Network
	Beacon            specssv.BeaconNode
	BeaconNetwork     beacon.BeaconNetwork
	Storage           *storage.QBFTStores
	SSVShare          *types.SSVShare
	Signer            spectypes.KeyManager
	DutyRunners       runner.DutyRunners
	NewDecidedHandler qbftctrl.NewDecidedHandler
	FullNode          bool
	Exporter          bool
	BuilderProposals  bool
	QueueSize         int
	GasLimit          uint64
	MessageValidator  validation.MessageValidator
	Metrics           Metrics
}

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
	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 *queue.DecodedSSVMessage)

HandleMessage handles a spectypes.SSVMessage. TODO: accept DecodedSSVMessage once p2p is upgraded to decode messages during validation. TODO: get rid of logger, add context

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) (started bool, err 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