Documentation
¶
Index ¶
- func ByOperatorID(operatorID spectypes.OperatorID) func(share *types.SSVShare) bool
- func ByOwnerAddress(ownerAddress string) func(share *types.SSVShare) bool
- func LoadLocalEvents(logger *zap.Logger, handler eth1.SyncEventHandler, path string) error
- func NotLiquidated() func(share *types.SSVShare) bool
- func NotLiquidatedAndByOperatorPubKey(operatorPubKey string) func(share *types.SSVShare) bool
- func ReportValidatorStatus(pk string, meta *beacon.ValidatorMetadata, logger *zap.Logger)
- func SetOperatorPublicKeys(registryStorage registrystorage.OperatorsCollection, ...) error
- func SetupRunners(ctx context.Context, logger *zap.Logger, options validator.Options) runner.DutyRunners
- func ShareFromValidatorEvent(validatorRegistrationEvent abiparser.ValidatorRegistrationEvent, ...) (*types.SSVShare, *bls.SecretKey, error)
- func UpdateShareMetadata(share *types.SSVShare, bc beaconprotocol.Beacon) (bool, error)
- type Collection
- func (s *Collection) CleanRegistryData() error
- func (s *Collection) DeleteValidatorShare(key []byte) error
- func (s *Collection) GetAllValidatorShares() ([]*types.SSVShare, error)
- func (s *Collection) GetFilteredValidatorShares(filter func(share *types.SSVShare) bool) ([]*types.SSVShare, error)
- func (s *Collection) GetValidatorShare(key []byte) (*types.SSVShare, bool, error)
- func (s *Collection) SaveValidatorShare(share *types.SSVShare) error
- func (s *Collection) UpdateValidatorMetadata(pk string, metadata *beaconprotocol.ValidatorMetadata) error
- type CollectionOptions
- type Controller
- type ControllerOptions
- type ICollection
- type ShareEncryptionKeyProvider
- type ShareEventHandlerFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ByOperatorID ¶ added in v0.4.0
func ByOperatorID(operatorID spectypes.OperatorID) func(share *types.SSVShare) bool
ByOperatorID filters by operator ID.
func ByOwnerAddress ¶ added in v0.4.0
ByOwnerAddress filters by owner address.
func LoadLocalEvents ¶ added in v0.4.0
func NotLiquidated ¶ added in v0.4.0
NotLiquidated filters not liquidated and by operator public key.
func NotLiquidatedAndByOperatorPubKey ¶ added in v0.4.0
NotLiquidatedAndByOperatorPubKey filters not liquidated and by operator public key.
func ReportValidatorStatus ¶
func ReportValidatorStatus(pk string, meta *beacon.ValidatorMetadata, logger *zap.Logger)
ReportValidatorStatus reports the current status of validator
func SetOperatorPublicKeys ¶
func SetOperatorPublicKeys( registryStorage registrystorage.OperatorsCollection, validatorRegistrationEvent *abiparser.ValidatorRegistrationEvent, ) error
SetOperatorPublicKeys extracts the operator public keys from the storage and fill the event
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( validatorRegistrationEvent abiparser.ValidatorRegistrationEvent, registryStorage registrystorage.OperatorsCollection, shareEncryptionKeyProvider ShareEncryptionKeyProvider, operatorPubKey string, ) (*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 ¶
UpdateShareMetadata will update the given share object w/o involving storage, it will be called only when a new share is created
Types ¶
type Collection ¶
type Collection struct {
// contains filtered or unexported fields
}
Collection struct
func (*Collection) CleanRegistryData ¶
func (s *Collection) CleanRegistryData() error
CleanRegistryData clears all registry data
func (*Collection) DeleteValidatorShare ¶
func (s *Collection) DeleteValidatorShare(key []byte) error
DeleteValidatorShare removes validator share by key
func (*Collection) GetAllValidatorShares ¶
func (s *Collection) GetAllValidatorShares() ([]*types.SSVShare, error)
GetAllValidatorShares returns all shares
func (*Collection) GetFilteredValidatorShares ¶ added in v0.4.0
func (s *Collection) GetFilteredValidatorShares(filter func(share *types.SSVShare) bool) ([]*types.SSVShare, error)
GetFilteredValidatorShares returns shares by a filter.
func (*Collection) GetValidatorShare ¶
GetValidatorShare by key
func (*Collection) SaveValidatorShare ¶
func (s *Collection) SaveValidatorShare(share *types.SSVShare) error
SaveValidatorShare save validator share to db
func (*Collection) UpdateValidatorMetadata ¶
func (s *Collection) UpdateValidatorMetadata(pk string, metadata *beaconprotocol.ValidatorMetadata) error
UpdateValidatorMetadata updates the metadata of the given validator
type CollectionOptions ¶
CollectionOptions struct
type Controller ¶
type Controller interface {
ListenToEth1Events(feed *event.Feed)
StartValidators()
GetValidatorsIndices() []phase0.ValidatorIndex
GetValidator(pubKey string) (*validator.Validator, bool)
UpdateValidatorMetaDataLoop()
StartNetworkHandlers()
Eth1EventHandler(ongoingSync bool) eth1.SyncEventHandler
// 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)
}
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"`
MinPeers int `yaml:"MinimumPeers" env:"MINIMUM_PEERS" env-default:"2" env-description:"The required minimum peers for sync"`
ETHNetwork beaconprotocol.Network
Network network.P2PNetwork
Beacon beaconprotocol.Beacon
CleanRegistryData bool
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:""`
KeyManager spectypes.KeyManager
OperatorPubKey string
RegistryStorage registrystorage.OperatorsCollection
ForkVersion forksprotocol.ForkVersion
NewDecidedHandler qbftcontroller.NewDecidedHandler
DutyRoles []spectypes.BeaconRole
// worker flags
WorkersCount int `` /* 131-byte string literal not displayed */
QueueBufferSize int `yaml:"MsgWorkerBufferSize" env:"MSG_WORKER_BUFFER_SIZE" env-default:"1024" env-description:"Buffer size for message workers"`
}
ControllerOptions for creating a validator controller
type ICollection ¶
type ICollection interface {
eth1.RegistryStore
}
ICollection interface for validator storage
func NewCollection ¶
func NewCollection(options CollectionOptions) ICollection
NewCollection creates new share storage
type ShareEncryptionKeyProvider ¶
type ShareEncryptionKeyProvider = func() (*rsa.PrivateKey, bool, error)
ShareEncryptionKeyProvider is a function that returns the operator private key
type ShareEventHandlerFunc ¶
ShareEventHandlerFunc is a function that handles event in an extended mode