client

package
v1.0.0-alpha.10.4 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2020 License: GPL-3.0 Imports: 48 Imported by: 0

Documentation

Overview

Package client defines the entire lifecycle of a validator in eth2 – it is responsible for interacting with a beacon node to determine and perform validator duties.

Package client represents the functionality to act as a validator.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConstructDialOptions

func ConstructDialOptions(
	maxCallRecvMsgSize int,
	withCert string,
	grpcHeaders []string,
	grpcRetries uint,
	extraOpts ...grpc.DialOption,
) []grpc.DialOption

ConstructDialOptions constructs a list of grpc dial options

Types

type Config

type Config struct {
	Endpoint                   string
	DataDir                    string
	CertFlag                   string
	GraffitiFlag               string
	KeyManager                 keymanager.KeyManager
	LogValidatorBalances       bool
	EmitAccountMetrics         bool
	GrpcMaxCallRecvMsgSizeFlag int
	GrpcRetriesFlag            uint
	GrpcHeadersFlag            string
	Protector                  slashingprotection.Protector
}

Config for the validator service.

type Validator

type Validator interface {
	Done()
	WaitForChainStart(ctx context.Context) error
	WaitForSync(ctx context.Context) error
	WaitForSynced(ctx context.Context) error
	WaitForActivation(ctx context.Context) error
	CanonicalHeadSlot(ctx context.Context) (uint64, error)
	NextSlot() <-chan uint64
	SlotDeadline(slot uint64) time.Time
	LogValidatorGainsAndLosses(ctx context.Context, slot uint64) error
	UpdateDuties(ctx context.Context, slot uint64) error
	UpdateProtections(ctx context.Context, slot uint64) error
	RolesAt(ctx context.Context, slot uint64) (map[[48]byte][]validatorRole, error) // validator pubKey -> roles

	SubmitAttestation(ctx context.Context, slot uint64, pubKey [48]byte)
	ProposeBlock(ctx context.Context, slot uint64, pubKey [48]byte)
	SubmitAggregateAndProof(ctx context.Context, slot uint64, pubKey [48]byte)

	LogAttestationsSubmitted()
	SaveProtections(ctx context.Context) error
	UpdateDomainDataCaches(ctx context.Context, slot uint64)
}

Validator interface defines the primary methods of a validator client.

func NewValidatorImplementation

func NewValidatorImplementation(
	validatorClient ethpb.BeaconNodeValidatorClient,
	beaconClient ethpb.BeaconChainClient,
	node ethpb.NodeClient,
	keyManager keymanager.KeyManager,
) Validator

NewValidatorImplementation is the constructor of validator.

type ValidatorService

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

ValidatorService represents a service to manage the validator client routine.

func NewValidatorService

func NewValidatorService(ctx context.Context, cfg *Config) (*ValidatorService, error)

NewValidatorService creates a new validator service for the service registry.

func (*ValidatorService) Start

func (v *ValidatorService) Start()

Start the validator service. Launches the main go routine for the validator client.

func (*ValidatorService) Status

func (v *ValidatorService) Status() error

Status ...

WIP - not done.

func (*ValidatorService) Stop

func (v *ValidatorService) Stop() error

Stop the validator service.

Jump to

Keyboard shortcuts

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