Documentation ¶
Overview ¶
Package validator defines a gRPC validator service implementation, providing critical endpoints for validator clients to submit blocks/attestations to the beacon node, receive assignments, and more.
Index ¶
- type Server
- func (vs *Server) CanonicalHead(ctx context.Context, req *ptypes.Empty) (*ethpb.SignedBeaconBlock, error)
- func (vs *Server) DomainData(ctx context.Context, request *ethpb.DomainRequest) (*ethpb.DomainResponse, error)
- func (vs *Server) GetAttestationData(ctx context.Context, req *ethpb.AttestationDataRequest) (*ethpb.AttestationData, error)
- func (vs *Server) GetBlock(ctx context.Context, req *ethpb.BlockRequest) (*ethpb.BeaconBlock, error)
- func (vs *Server) GetDuties(ctx context.Context, req *ethpb.DutiesRequest) (*ethpb.DutiesResponse, error)
- func (vs *Server) MultipleValidatorStatus(ctx context.Context, req *ethpb.MultipleValidatorStatusRequest) (*ethpb.MultipleValidatorStatusResponse, error)
- func (vs *Server) ProposeAttestation(ctx context.Context, att *ethpb.Attestation) (*ethpb.AttestResponse, error)
- func (vs *Server) ProposeBlock(ctx context.Context, blk *ethpb.SignedBeaconBlock) (*ethpb.ProposeResponse, error)
- func (vs *Server) ProposeExit(ctx context.Context, req *ethpb.SignedVoluntaryExit) (*ethpb.ProposeExitResponse, error)
- func (vs *Server) StreamDuties(req *ethpb.DutiesRequest, stream ethpb.BeaconNodeValidator_StreamDutiesServer) error
- func (as *Server) SubmitAggregateSelectionProof(ctx context.Context, req *ethpb.AggregateSelectionRequest) (*ethpb.AggregateSelectionResponse, error)
- func (as *Server) SubmitSignedAggregateSelectionProof(ctx context.Context, req *ethpb.SignedAggregateSubmitRequest) (*ethpb.SignedAggregateSubmitResponse, error)
- func (vs *Server) SubscribeCommitteeSubnets(ctx context.Context, req *ethpb.CommitteeSubnetsSubscribeRequest) (*ptypes.Empty, error)
- func (vs *Server) ValidatorIndex(ctx context.Context, req *ethpb.ValidatorIndexRequest) (*ethpb.ValidatorIndexResponse, error)
- func (vs *Server) ValidatorStatus(ctx context.Context, req *ethpb.ValidatorStatusRequest) (*ethpb.ValidatorStatusResponse, error)
- func (vs *Server) WaitForActivation(req *ethpb.ValidatorActivationRequest, ...) error
- func (vs *Server) WaitForChainStart(req *ptypes.Empty, stream ethpb.BeaconNodeValidator_WaitForChainStartServer) error
- func (vs *Server) WaitForSynced(req *ptypes.Empty, stream ethpb.BeaconNodeValidator_WaitForSyncedServer) error
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.NoHeadAccessDatabase AttestationCache *cache.AttestationCache HeadFetcher blockchain.HeadFetcher ForkFetcher blockchain.ForkFetcher FinalizationFetcher blockchain.FinalizationFetcher TimeFetcher blockchain.TimeFetcher CanonicalStateChan chan *pbp2p.BeaconState BlockFetcher powchain.POWBlockFetcher DepositFetcher depositcache.DepositFetcher ChainStartFetcher powchain.ChainStartFetcher Eth1InfoFetcher powchain.ChainInfoFetcher GenesisTimeFetcher blockchain.TimeFetcher SyncChecker sync.Checker StateNotifier statefeed.Notifier BlockNotifier blockfeed.Notifier P2P p2p.Broadcaster AttPool attestations.Pool SlashingsPool *slashings.Pool ExitPool *voluntaryexits.Pool BlockReceiver blockchain.BlockReceiver MockEth1Votes bool Eth1BlockFetcher powchain.POWBlockFetcher PendingDepositsFetcher depositcache.PendingDepositsFetcher OperationNotifier opfeed.Notifier StateGen *stategen.State }
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.SignedBeaconBlock, 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) DomainData ¶
func (vs *Server) DomainData(ctx context.Context, request *ethpb.DomainRequest) (*ethpb.DomainResponse, error)
DomainData fetches the current domain version information from the beacon state.
func (*Server) GetAttestationData ¶ added in v0.3.0
func (vs *Server) GetAttestationData(ctx context.Context, req *ethpb.AttestationDataRequest) (*ethpb.AttestationData, error)
GetAttestationData requests that the beacon node produce an attestation data object, which the validator acting as an attester will then sign.
func (*Server) GetBlock ¶ added in v0.3.0
func (vs *Server) GetBlock(ctx context.Context, req *ethpb.BlockRequest) (*ethpb.BeaconBlock, error)
GetBlock is called by a proposer during its assigned slot to request a block to sign by passing in the slot and the signed randao reveal of the slot.
func (*Server) GetDuties ¶ added in v0.3.0
func (vs *Server) GetDuties(ctx context.Context, req *ethpb.DutiesRequest) (*ethpb.DutiesResponse, error)
GetDuties returns the duties assigned to a list of validators specified in the request object.
func (*Server) MultipleValidatorStatus ¶ added in v1.0.0
func (vs *Server) MultipleValidatorStatus( ctx context.Context, req *ethpb.MultipleValidatorStatusRequest, ) (*ethpb.MultipleValidatorStatusResponse, error)
MultipleValidatorStatus is the same as ValidatorStatus. Supports retrieval of multiple validator statuses. Takes a list of public keys or a list of validator indices.
func (*Server) ProposeAttestation ¶ added in v0.3.0
func (vs *Server) ProposeAttestation(ctx context.Context, att *ethpb.Attestation) (*ethpb.AttestResponse, error)
ProposeAttestation is a function called by an attester to vote on a block via an attestation object as defined in the Ethereum Serenity specification.
func (*Server) ProposeBlock ¶ added in v0.3.0
func (vs *Server) ProposeBlock(ctx context.Context, blk *ethpb.SignedBeaconBlock) (*ethpb.ProposeResponse, error)
ProposeBlock is called by a proposer during its assigned slot to create a block in an attempt to get it processed by the beacon node as the canonical head.
func (*Server) ProposeExit ¶ added in v0.3.0
func (vs *Server) ProposeExit(ctx context.Context, req *ethpb.SignedVoluntaryExit) (*ethpb.ProposeExitResponse, error)
ProposeExit proposes an exit for a validator.
func (*Server) StreamDuties ¶ added in v1.0.0
func (vs *Server) StreamDuties(req *ethpb.DutiesRequest, stream ethpb.BeaconNodeValidator_StreamDutiesServer) error
StreamDuties returns the duties assigned to a list of validators specified in the request object via a server-side stream. The stream sends out new assignments in case a chain re-org occurred.
func (*Server) SubmitAggregateSelectionProof ¶ added in v1.0.0
func (as *Server) SubmitAggregateSelectionProof(ctx context.Context, req *ethpb.AggregateSelectionRequest) (*ethpb.AggregateSelectionResponse, error)
SubmitAggregateSelectionProof is called by a validator when its assigned to be an aggregator. The aggregator submits the selection proof to obtain the aggregated attestation object to sign over.
func (*Server) SubmitSignedAggregateSelectionProof ¶ added in v1.0.0
func (as *Server) SubmitSignedAggregateSelectionProof(ctx context.Context, req *ethpb.SignedAggregateSubmitRequest) (*ethpb.SignedAggregateSubmitResponse, error)
SubmitSignedAggregateSelectionProof is called by a validator to broadcast a signed aggregated and proof object.
func (*Server) SubscribeCommitteeSubnets ¶ added in v1.0.0
func (vs *Server) SubscribeCommitteeSubnets(ctx context.Context, req *ethpb.CommitteeSubnetsSubscribeRequest) (*ptypes.Empty, error)
SubscribeCommitteeSubnets subscribes to the committee ID subnet given subscribe request.
func (*Server) ValidatorIndex ¶
func (vs *Server) ValidatorIndex(ctx context.Context, req *ethpb.ValidatorIndexRequest) (*ethpb.ValidatorIndexResponse, error)
ValidatorIndex is called by a validator to get its index location in the beacon state.
func (*Server) ValidatorStatus ¶
func (vs *Server) ValidatorStatus( ctx context.Context, req *ethpb.ValidatorStatusRequest, ) (*ethpb.ValidatorStatusResponse, error)
ValidatorStatus returns the validator status of the current epoch. The status response can be one of the following:
DEPOSITED - validator's deposit has been recognized by Ethereum 1, not yet recognized by Ethereum 2. PENDING - validator is in Ethereum 2's activation queue. ACTIVE - validator is active. EXITING - validator has initiated an an exit request, or has dropped below the ejection balance and is being kicked out. EXITED - validator is no longer validating. SLASHING - validator has been kicked out due to meeting a slashing condition. UNKNOWN_STATUS - validator does not have a known status in the network.
func (*Server) WaitForActivation ¶
func (vs *Server) WaitForActivation(req *ethpb.ValidatorActivationRequest, stream ethpb.BeaconNodeValidator_WaitForActivationServer) error
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 ethpb.BeaconNodeValidator_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.
func (*Server) WaitForSynced ¶
func (vs *Server) WaitForSynced(req *ptypes.Empty, stream ethpb.BeaconNodeValidator_WaitForSyncedServer) error
WaitForSynced subscribes to the state channel and ends the stream when the state channel indicates the beacon node has been initialized and is ready