validator

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeKeyStore

type FakeKeyStore struct{}

FakeKeyStore should be assumed to be insecure.

func NewFakeKeyStore

func NewFakeKeyStore() FakeKeyStore

NewFakeKeyStore creates a new fake key store.

func (FakeKeyStore) GetKeyForValidator

func (f FakeKeyStore) GetKeyForValidator(v uint32) *bls.SecretKey

GetKeyForValidator gets the private key for the given validator ID.

func (FakeKeyStore) GetPublicKeyForValidator

func (f FakeKeyStore) GetPublicKeyForValidator(v uint32) *bls.PublicKey

GetPublicKeyForValidator gets the public key for the given validator ID.

type HDReader

type HDReader struct {
	// contains filtered or unexported fields
}

HDReader is a random reader from a hash.

func GetReaderForID

func GetReaderForID(rootKey string, validatorID uint32) *HDReader

GetReaderForID gets a reader for a specific root key and validator ID.

func (*HDReader) Read

func (r *HDReader) Read(p []byte) (n int, err error)

type Keystore

type Keystore interface {
	GetKeyForValidator(uint32) *bls.SecretKey
	GetPublicKeyForValidator(uint32) *bls.PublicKey
}

Keystore is an interface for retrieving keys from a keystore.

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager is a manager that keeps track of multiple validators.

func NewManager

func NewManager(ctx context.Context, blockchainRPC pb.BlockchainRPCClient, validators []uint32, keystore Keystore, c *config.Config) (*Manager, error)

NewManager creates a new validator manager to manage some validators.

func (*Manager) ListenForBlockAndCycle

func (vm *Manager) ListenForBlockAndCycle() error

ListenForBlockAndCycle listens for any new blocks or cycles and relays the information to validators.

func (*Manager) Start

func (vm *Manager) Start() error

Start starts goroutines for each validator

func (*Manager) UpdateSlotNumber

func (vm *Manager) UpdateSlotNumber() error

UpdateSlotNumber gets the slot number from RPC and runs validator actions as needed.

type RootKeyStore

type RootKeyStore struct {
	// contains filtered or unexported fields
}

RootKeyStore is a keystore where each validator is derived from a specific root key.

func NewRootKeyStore

func NewRootKeyStore(rootKey string) *RootKeyStore

NewRootKeyStore gets a new root key store from the root key.

func (*RootKeyStore) GetKeyForValidator

func (k *RootKeyStore) GetKeyForValidator(validatorID uint32) *bls.SecretKey

GetKeyForValidator gets a private key for a validator ID.

func (*RootKeyStore) GetPublicKeyForValidator

func (k *RootKeyStore) GetPublicKeyForValidator(validatorID uint32) *bls.PublicKey

GetPublicKeyForValidator gets a public key for a validator ID.

type Validator

type Validator struct {
	// contains filtered or unexported fields
}

Validator is a single validator to keep track of

func NewValidator

func NewValidator(ctx context.Context, keystore Keystore, blockchainRPC pb.BlockchainRPCClient, id uint32, c *config.Config, f *primitives.ForkData) (*Validator, error)

NewValidator gets a validator

func (*Validator) RunValidator

func (v *Validator) RunValidator() error

RunValidator keeps track of assignments and creates/signs attestations as needed.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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