validator

package
v0.5.5-jatov2-rc.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2023 License: GPL-3.0 Imports: 52 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadLocalEvents added in v0.4.0

func LoadLocalEvents(logger *zap.Logger, handler eth1.SyncEventHandler, path string) error

func ReportValidatorStatus

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

ReportValidatorStatus reports the current status of validator

func SetShareFeeRecipient added in v0.4.7

func SetShareFeeRecipient(logger *zap.Logger, share *types.SSVShare, getRecipientData GetRecipientDataFunc) error

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

func ShareFromValidatorEvent

func ShareFromValidatorEvent(
	event abiparser.ValidatorAddedEvent,
	shareEncryptionKeyProvider ShareEncryptionKeyProvider,
	operatorData *registrystorage.OperatorData,
) (*types.SSVShare, *bls.SecretKey, error)

ShareFromValidatorEvent 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

func UpdateShareMetadata(share *types.SSVShare, bc beaconprotocol.BeaconNode) (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

type Controller interface {
	ListenToEth1Events(logger *zap.Logger, feed *event.Feed)
	StartValidators(logger *zap.Logger)
	ActiveValidatorIndices(logger *zap.Logger) []phase0.ValidatorIndex
	GetValidator(pubKey string) (*validator.Validator, bool)
	UpdateValidatorMetaDataLoop(logger *zap.Logger)
	StartNetworkHandlers(logger *zap.Logger)
	Eth1EventHandler(logger *zap.Logger, ongoingSync bool) eth1.SyncEventHandler
	GetOperatorShares() []*types.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)
	GetOperatorData() *registrystorage.OperatorData
}

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.IDb
	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                    network.P2PNetwork
	Beacon                     beaconprotocol.BeaconNode
	ShareEncryptionKeyProvider ShareEncryptionKeyProvider
	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
	OperatorData               *registrystorage.OperatorData
	RegistryStorage            nodestorage.Storage
	ForkVersion                forksprotocol.ForkVersion
	NewDecidedHandler          qbftcontroller.NewDecidedHandler
	DutyRoles                  []spectypes.BeaconRole

	// 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 EventHandler

type EventHandler interface {
	GetEventData(txHash common.Hash) (*registrystorage.EventData, bool, error)
	SaveEventData(txHash common.Hash) error
	GetNextNonce(owner common.Address) (registrystorage.Nonce, error)
	BumpNonce(owner common.Address) error
}

EventHandler represents the interface for compatible storage event handlers

type GetRecipientDataFunc added in v0.4.7

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

type ShareEncryptionKeyProvider

type ShareEncryptionKeyProvider = func() (*rsa.PrivateKey, bool, error)

ShareEncryptionKeyProvider is a function that returns the operator private key

type ShareEventHandlerFunc

type ShareEventHandlerFunc func(share *types.SSVShare)

ShareEventHandlerFunc is a function that handles event in an extended mode

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