Documentation ¶
Index ¶
- func NewCollection(options CollectionOptions) validator.ICollection
- func ReportValidatorStatus(pk string, meta *beacon.ValidatorMetadata, logger *zap.Logger)
- func SetOperatorPublicKeys(registryStorage registrystorage.OperatorsCollection, ...) error
- func ShareFromValidatorEvent(validatorRegistrationEvent abiparser.ValidatorRegistrationEvent, ...) (*beaconprotocol.Share, *bls.SecretKey, error)
- func UpdateShareMetadata(share *beaconprotocol.Share, bc beaconprotocol.Beacon) (bool, error)
- type Collection
- func (s *Collection) CleanRegistryData() error
- func (s *Collection) DeleteValidatorShare(key []byte) error
- func (s *Collection) GetAllValidatorShares() ([]*beaconprotocol.Share, error)
- func (s *Collection) GetOperatorIDValidatorShares(operatorID uint32, enabled bool) ([]*beaconprotocol.Share, error)
- func (s *Collection) GetOperatorValidatorShares(operatorPubKey string, enabled bool) ([]*beaconprotocol.Share, error)
- func (s *Collection) GetValidatorShare(key []byte) (*beaconprotocol.Share, bool, error)
- func (s *Collection) GetValidatorSharesByOwnerAddress(ownerAddress string) ([]*beaconprotocol.Share, error)
- func (s *Collection) SaveValidatorShare(share *beaconprotocol.Share) error
- func (s *Collection) UpdateValidatorMetadata(pk string, metadata *beaconprotocol.ValidatorMetadata) error
- type CollectionOptions
- type Controller
- type ControllerOptions
- type ICollection
- type ShareEncryptionKeyProvider
- type ShareEventHandlerFunc
- type ShareOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCollection ¶
func NewCollection(options CollectionOptions) validator.ICollection
NewCollection creates new share storage
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 ShareFromValidatorEvent ¶
func ShareFromValidatorEvent( validatorRegistrationEvent abiparser.ValidatorRegistrationEvent, registryStorage registrystorage.OperatorsCollection, shareEncryptionKeyProvider ShareEncryptionKeyProvider, operatorPubKey string, ) (*beaconprotocol.Share, *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 *beaconprotocol.Share, bc beaconprotocol.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 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() ([]*beaconprotocol.Share, error)
GetAllValidatorShares returns all shares
func (*Collection) GetOperatorIDValidatorShares ¶ added in v0.3.3
func (s *Collection) GetOperatorIDValidatorShares(operatorID uint32, enabled bool) ([]*beaconprotocol.Share, error)
GetOperatorIDValidatorShares returns all not liquidated validator shares belongs to operator ID. TODO: check regards returning a slice of public keys instead of share objects
func (*Collection) GetOperatorValidatorShares ¶ added in v0.3.0
func (s *Collection) GetOperatorValidatorShares(operatorPubKey string, enabled bool) ([]*beaconprotocol.Share, error)
GetOperatorValidatorShares returns all not liquidated validator shares belongs to operator
func (*Collection) GetValidatorShare ¶
func (s *Collection) GetValidatorShare(key []byte) (*beaconprotocol.Share, bool, error)
GetValidatorShare by key
func (*Collection) GetValidatorSharesByOwnerAddress ¶
func (s *Collection) GetValidatorSharesByOwnerAddress(ownerAddress string) ([]*beaconprotocol.Share, error)
GetValidatorSharesByOwnerAddress returns all validator shares belongs to owner address
func (*Collection) SaveValidatorShare ¶
func (s *Collection) SaveValidatorShare(share *beaconprotocol.Share) 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() []spec.ValidatorIndex GetValidator(pubKey string) (validator.IValidator, bool) UpdateValidatorMetaDataLoop() StartNetworkHandlers() Eth1EventHandler(ongoingSync bool) eth1.SyncEventHandler OnFork(forkVersion forksprotocol.ForkVersion) error // 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 `` /* 155-byte string literal not displayed */ 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
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 *beaconprotocol.Share)
ShareEventHandlerFunc is a function that handles event in an extended mode
type ShareOptions ¶
type ShareOptions struct {}
ShareOptions - used to load validator share from config