validator

package
v0.2.1-rc.7 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: GPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateNodes

func GenerateNodes(cnt int) (map[message.OperatorID]*bls.SecretKey, map[message.OperatorID]*proto.Node)

GenerateNodes generates randomly nodes

func ReportValidatorStatus

func ReportValidatorStatus(pk string, meta *beaconprotocol.ValidatorMetadata, logger *zap.Logger)

ReportValidatorStatus reports the current status of validator

Types

type ICollection

type ICollection interface {
	eth1.RegistryStore

	SaveValidatorShare(share *beacon.Share) error
	GetValidatorShare(key []byte) (*beacon.Share, bool, error)
	GetAllValidatorShares() ([]*beacon.Share, error)
	GetOperatorValidatorShares(operatorPubKey string, enabled bool) ([]*beacon.Share, error)
	GetValidatorSharesByOwnerAddress(ownerAddress string) ([]*beacon.Share, error)
	DeleteValidatorShare(key []byte) error
}

ICollection interface for validator storage

type IValidator

type IValidator interface {
	Start() error
	ExecuteDuty(slot uint64, duty *beaconprotocol.Duty)
	ProcessMsg(msg *message.SSVMessage) error // TODO need to be as separate interface?
	GetShare() *beaconprotocol.Share

	forksprotocol.ForkHandler
	io.Closer
}

IValidator is the interface for validator

func NewValidator

func NewValidator(opt *Options) IValidator

NewValidator creates a new validator

type Options

type Options struct {
	Context                    context.Context
	Logger                     *zap.Logger
	IbftStorage                qbftstorage.QBFTStore
	Network                    beaconprotocol.Network
	P2pNetwork                 p2pprotocol.Network
	Beacon                     beaconprotocol.Beacon
	Share                      *beaconprotocol.Share
	ForkVersion                forksprotocol.ForkVersion
	Signer                     beaconprotocol.Signer
	SyncRateLimit              time.Duration
	SignatureCollectionTimeout time.Duration
	ReadMode                   bool
	FullNode                   bool
	NewDecidedHandler          controller.NewDecidedHandler
}

Options is the validator options

type Validator

type Validator struct {
	Share *beaconprotocol.Share // var is exported to validator ctrl tests reasons
	// contains filtered or unexported fields
}

Validator represents the validator

func (*Validator) Close

func (v *Validator) Close() error

Close implements io.Closer

func (*Validator) ExecuteDuty

func (v *Validator) ExecuteDuty(slot uint64, duty *beaconprotocol.Duty)

ExecuteDuty executes the given duty

func (*Validator) GetShare

func (v *Validator) GetShare() *beaconprotocol.Share

GetShare returns the validator share

func (*Validator) Ibfts

func (v *Validator) Ibfts() controller.Controllers

Ibfts returns the ibft controllers

func (*Validator) OnFork

func (v *Validator) OnFork(forkVersion forksprotocol.ForkVersion) error

OnFork updates all QFBT controllers with the new fork version

func (*Validator) ProcessMsg

func (v *Validator) ProcessMsg(msg *message.SSVMessage) error

ProcessMsg processes a new msg

func (*Validator) Start

func (v *Validator) Start() error

Start starts the validator

Jump to

Keyboard shortcuts

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