validator

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: GPL-3.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateNodes

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

GenerateNodes generates randomly nodes

func ReportValidatorStatus added in v0.0.20

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

ReportValidatorStatus reports the current status of validator

func ShareFromValidatorAddedEvent added in v0.0.4

func ShareFromValidatorAddedEvent(
	validatorAddedEvent abiparser.ValidatorAddedEvent,
	operatorPubKey string,
) (*validatorstorage.Share, *bls.SecretKey, error)

ShareFromValidatorAddedEvent takes the contract event data and creates the corresponding validator share. share could return nil in case operator key is not present/ different

func UpdateShareMetadata added in v0.1.5

func UpdateShareMetadata(share *validatorstorage.Share, bc beacon.Beacon) (bool, error)

UpdateShareMetadata will update the given share object w/o involving storage, it will be called only when a new share is created

Types

type Controller added in v0.1.7

type Controller interface {
	ListenToEth1Events(feed *event.Feed)
	StartValidators()
	GetValidatorsIndices() []spec.ValidatorIndex
	GetValidator(pubKey string) (*Validator, bool)
	UpdateValidatorMetaDataLoop()
	StartNetworkMediators()
	Eth1EventHandler(handlers ...ShareEventHandlerFunc) eth1.SyncEventHandler
	GetAllValidatorShares() ([]*validatorstorage.Share, error)
}

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

func NewController

func NewController(options ControllerOptions) Controller

NewController creates a new validator controller instance

type ControllerOptions

type ControllerOptions struct {
	Context                    context.Context
	DB                         basedb.IDb
	Logger                     *zap.Logger
	SignatureCollectionTimeout time.Duration `` /* 152-byte string literal not displayed */
	MetadataUpdateInterval     time.Duration `` /* 127-byte string literal not displayed */
	HistorySyncRateLimit       time.Duration `yaml:"HistorySyncRateLimit" env:"HISTORY_SYNC_BACKOFF" env-default:"200ms" env-description:"Interval for updating metadata"`
	ETHNetwork                 *core.Network
	Network                    network.Network
	Beacon                     beacon.Beacon
	Shares                     []validatorstorage.ShareOptions `yaml:"Shares"`
	ShareEncryptionKeyProvider eth1.ShareEncryptionKeyProvider
	CleanRegistryData          bool
	Fork                       forks.Fork
	KeyManager                 beacon.KeyManager
	OperatorPubKey             string
	RegistryStorage            registrystorage.OperatorsCollection
}

ControllerOptions for creating a validator controller

type Options

type Options struct {
	Context                    context.Context
	Logger                     *zap.Logger
	Share                      *storage.Share
	SignatureCollectionTimeout time.Duration
	Network                    network.Network
	Beacon                     beacon.Beacon
	ETHNetwork                 *core.Network
	DB                         basedb.IDb
	Fork                       forks.Fork
	Signer                     beacon.Signer
	SyncRateLimit              time.Duration
	// contains filtered or unexported fields
}

Options to add in validator struct creation

type ShareEventHandlerFunc added in v0.1.11

type ShareEventHandlerFunc func(share *validatorstorage.Share)

ShareEventHandlerFunc is a function that handles event in an extended mode

type Validator

type Validator struct {
	Share *storage.Share
	// contains filtered or unexported fields
}

Validator represents a running validator, it holds the corresponding ibft controllers to trigger consensus layer (see ExecuteDuty())

func New

func New(opt Options) *Validator

New creates a new validator instance and the corresponding ibft controller in addition, warms up beacon client and update operator ids owned by validator controller

func (*Validator) ExecuteDuty

func (v *Validator) ExecuteDuty(ctx context.Context, slot uint64, duty *beacon.Duty)

ExecuteDuty executes the given duty

func (*Validator) GetMsgResolver added in v0.1.9

func (v *Validator) GetMsgResolver(networkMsg network.NetworkMsg) func(msg *proto.SignedMessage)

GetMsgResolver returns proper handler for msg based on msg type

func (*Validator) Start

func (v *Validator) Start() error

Start validator

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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