validator

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2019 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	Ctx                context.Context
	BeaconDB           db.Database
	HeadFetcher        blockchain.HeadFetcher
	ForkFetcher        blockchain.ForkFetcher
	CanonicalStateChan chan *pbp2p.BeaconState
	BlockFetcher       powchain.POWBlockFetcher
	DepositFetcher     depositcache.DepositFetcher
	ChainStartFetcher  powchain.ChainStartFetcher
	Eth1InfoFetcher    powchain.ChainInfoFetcher
	SyncChecker        sync.Checker
	StateFeedListener  blockchain.ChainFeeds
	ChainStartChan     chan time.Time
}

Server defines a server implementation of the gRPC Validator service, providing RPC endpoints for obtaining validator assignments per epoch, the slots and committees in which particular validators need to perform their responsibilities, and more.

func (*Server) CanonicalHead

func (vs *Server) CanonicalHead(ctx context.Context, req *ptypes.Empty) (*ethpb.BeaconBlock, error)

CanonicalHead of the current beacon chain. This method is requested on-demand by a validator when it is their time to propose or attest.

func (*Server) CommitteeAssignment

func (vs *Server) CommitteeAssignment(ctx context.Context, req *pb.AssignmentRequest) (*pb.AssignmentResponse, error)

CommitteeAssignment returns the committee assignment response from a given validator public key. The committee assignment response contains the following fields for the current and previous epoch:

1.) The list of validators in the committee.
2.) The shard to which the committee is assigned.
3.) The slot at which the committee is assigned.
4.) The bool signaling if the validator is expected to propose a block at the assigned slot.

func (*Server) DomainData

func (vs *Server) DomainData(ctx context.Context, request *pb.DomainRequest) (*pb.DomainResponse, error)

DomainData fetches the current domain version information from the beacon state.

func (*Server) ExitedValidators

func (vs *Server) ExitedValidators(
	ctx context.Context,
	req *pb.ExitedValidatorsRequest) (*pb.ExitedValidatorsResponse, error)

ExitedValidators queries validator statuses for a give list of validators and returns a filtered list of validator keys that are exited.

func (*Server) ValidatorIndex

func (vs *Server) ValidatorIndex(ctx context.Context, req *pb.ValidatorIndexRequest) (*pb.ValidatorIndexResponse, error)

ValidatorIndex is called by a validator to get its index location in the beacon state.

func (*Server) ValidatorPerformance

func (vs *Server) ValidatorPerformance(
	ctx context.Context, req *pb.ValidatorPerformanceRequest,
) (*pb.ValidatorPerformanceResponse, error)

ValidatorPerformance reports the validator's latest balance along with other important metrics on rewards and penalties throughout its lifecycle in the beacon chain.

func (*Server) ValidatorStatus

func (vs *Server) ValidatorStatus(
	ctx context.Context,
	req *pb.ValidatorIndexRequest) (*pb.ValidatorStatusResponse, error)

ValidatorStatus returns the validator status of the current epoch. The status response can be one of the following:

PENDING_ACTIVE - validator is waiting to get activated.
ACTIVE - validator is active.
INITIATED_EXIT - validator has initiated an an exit request.
WITHDRAWABLE - validator's deposit can be withdrawn after lock up period.
EXITED - validator has exited, means the deposit has been withdrawn.
EXITED_SLASHED - validator was forcefully exited due to slashing.

func (*Server) WaitForActivation

WaitForActivation checks if a validator public key exists in the active validator registry of the current beacon state, if not, then it creates a stream which listens for canonical states which contain the validator with the public key as an active validator record.

func (*Server) WaitForChainStart

func (vs *Server) WaitForChainStart(req *ptypes.Empty, stream pb.ValidatorService_WaitForChainStartServer) error

WaitForChainStart queries the logs of the Deposit Contract in order to verify the beacon chain has started its runtime and validators begin their responsibilities. If it has not, it then subscribes to an event stream triggered by the powchain service whenever the ChainStart log does occur in the Deposit Contract on ETH 1.0.

Jump to

Keyboard shortcuts

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