Documentation ¶
Overview ¶
Package rpc defines the services that the beacon-chain uses to communicate via gRPC.
Index ¶
- type AttesterServer
- type BeaconChainServer
- func (bs *BeaconChainServer) AttestationPool(ctx context.Context, _ *ptypes.Empty) (*ethpb.AttestationPoolResponse, error)
- func (bs *BeaconChainServer) GetChainHead(ctx context.Context, _ *ptypes.Empty) (*ethpb.ChainHead, error)
- func (bs *BeaconChainServer) GetValidatorActiveSetChanges(ctx context.Context, req *ethpb.GetValidatorActiveSetChangesRequest) (*ethpb.ActiveSetChanges, error)
- func (bs *BeaconChainServer) GetValidatorParticipation(ctx context.Context, req *ethpb.GetValidatorParticipationRequest) (*ethpb.ValidatorParticipationResponse, error)
- func (bs *BeaconChainServer) GetValidatorQueue(ctx context.Context, _ *ptypes.Empty) (*ethpb.ValidatorQueue, error)
- func (bs *BeaconChainServer) GetValidators(ctx context.Context, req *ethpb.GetValidatorsRequest) (*ethpb.Validators, error)
- func (bs *BeaconChainServer) ListAttestations(ctx context.Context, req *ethpb.ListAttestationsRequest) (*ethpb.ListAttestationsResponse, error)
- func (bs *BeaconChainServer) ListBlocks(ctx context.Context, req *ethpb.ListBlocksRequest) (*ethpb.ListBlocksResponse, error)
- func (bs *BeaconChainServer) ListValidatorAssignments(ctx context.Context, req *ethpb.ListValidatorAssignmentsRequest) (*ethpb.ValidatorAssignments, error)
- func (bs *BeaconChainServer) ListValidatorBalances(ctx context.Context, req *ethpb.GetValidatorBalancesRequest) (*ethpb.ValidatorBalances, error)
- type Config
- type NodeServer
- func (ns *NodeServer) GetGenesis(ctx context.Context, _ *ptypes.Empty) (*ethpb.Genesis, error)
- func (ns *NodeServer) GetSyncStatus(ctx context.Context, _ *ptypes.Empty) (*ethpb.SyncStatus, error)
- func (ns *NodeServer) GetVersion(ctx context.Context, _ *ptypes.Empty) (*ethpb.Version, error)
- func (ns *NodeServer) ListImplementedServices(ctx context.Context, _ *ptypes.Empty) (*ethpb.ImplementedServices, error)
- type ProposerServer
- type Service
- type ValidatorServer
- func (vs *ValidatorServer) CanonicalHead(ctx context.Context, req *ptypes.Empty) (*ethpb.BeaconBlock, error)
- func (vs *ValidatorServer) CommitteeAssignment(ctx context.Context, req *pb.AssignmentRequest) (*pb.AssignmentResponse, error)
- func (vs *ValidatorServer) DomainData(ctx context.Context, request *pb.DomainRequest) (*pb.DomainResponse, error)
- func (vs *ValidatorServer) ExitedValidators(ctx context.Context, req *pb.ExitedValidatorsRequest) (*pb.ExitedValidatorsResponse, error)
- func (vs *ValidatorServer) ValidatorIndex(ctx context.Context, req *pb.ValidatorIndexRequest) (*pb.ValidatorIndexResponse, error)
- func (vs *ValidatorServer) ValidatorPerformance(ctx context.Context, req *pb.ValidatorPerformanceRequest) (*pb.ValidatorPerformanceResponse, error)
- func (vs *ValidatorServer) ValidatorStatus(ctx context.Context, req *pb.ValidatorIndexRequest) (*pb.ValidatorStatusResponse, error)
- func (vs *ValidatorServer) WaitForActivation(req *pb.ValidatorActivationRequest, ...) error
- func (vs *ValidatorServer) WaitForChainStart(req *ptypes.Empty, stream pb.ValidatorService_WaitForChainStartServer) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AttesterServer ¶
type AttesterServer struct {
// contains filtered or unexported fields
}
AttesterServer defines a server implementation of the gRPC Attester service, providing RPC methods for validators acting as attesters to broadcast votes on beacon blocks.
func (*AttesterServer) RequestAttestation ¶
func (as *AttesterServer) RequestAttestation(ctx context.Context, req *pb.AttestationRequest) (*ethpb.AttestationData, error)
RequestAttestation requests that the beacon node produce an IndexedAttestation, with a blank signature field, which the validator will then sign.
func (*AttesterServer) SubmitAttestation ¶
func (as *AttesterServer) SubmitAttestation(ctx context.Context, att *ethpb.Attestation) (*pb.AttestResponse, error)
SubmitAttestation is a function called by an attester in a sharding validator to vote on a block via an attestation object as defined in the Ethereum Serenity specification.
type BeaconChainServer ¶
type BeaconChainServer struct {
// contains filtered or unexported fields
}
BeaconChainServer defines a server implementation of the gRPC Beacon Chain service, providing RPC endpoints to access data relevant to the Ethereum 2.0 phase 0 beacon chain.
func (*BeaconChainServer) AttestationPool ¶
func (bs *BeaconChainServer) AttestationPool( ctx context.Context, _ *ptypes.Empty, ) (*ethpb.AttestationPoolResponse, error)
AttestationPool retrieves pending attestations.
The server returns a list of attestations that have been seen but not yet processed. Pool attestations eventually expire as the slot advances, so an attestation missing from this request does not imply that it was included in a block. The attestation may have expired. Refer to the ethereum 2.0 specification for more details on how attestations are processed and when they are no longer valid. https://github.com/ethereum/eth2.0-specs/blob/dev/specs/core/0_beacon-chain.md#attestations
func (*BeaconChainServer) GetChainHead ¶
func (bs *BeaconChainServer) GetChainHead(ctx context.Context, _ *ptypes.Empty) (*ethpb.ChainHead, error)
GetChainHead retrieves information about the head of the beacon chain from the view of the beacon chain node.
This includes the head block slot and root as well as information about the most recent finalized and justified slots.
func (*BeaconChainServer) GetValidatorActiveSetChanges ¶
func (bs *BeaconChainServer) GetValidatorActiveSetChanges( ctx context.Context, req *ethpb.GetValidatorActiveSetChangesRequest, ) (*ethpb.ActiveSetChanges, error)
GetValidatorActiveSetChanges retrieves the active set changes for a given epoch.
This data includes any activations, voluntary exits, and involuntary ejections.
func (*BeaconChainServer) GetValidatorParticipation ¶
func (bs *BeaconChainServer) GetValidatorParticipation( ctx context.Context, req *ethpb.GetValidatorParticipationRequest, ) (*ethpb.ValidatorParticipationResponse, error)
GetValidatorParticipation retrieves the validator participation information for a given epoch, it returns the information about validator's participation rate in voting on the proof of stake rules based on their balance compared to the total active validator balance.
func (*BeaconChainServer) GetValidatorQueue ¶
func (bs *BeaconChainServer) GetValidatorQueue( ctx context.Context, _ *ptypes.Empty, ) (*ethpb.ValidatorQueue, error)
GetValidatorQueue retrieves the current validator queue information.
func (*BeaconChainServer) GetValidators ¶
func (bs *BeaconChainServer) GetValidators( ctx context.Context, req *ethpb.GetValidatorsRequest, ) (*ethpb.Validators, error)
GetValidators retrieves the current list of active validators with an optional historical epoch flag to to retrieve validator set in time.
func (*BeaconChainServer) ListAttestations ¶
func (bs *BeaconChainServer) ListAttestations( ctx context.Context, req *ethpb.ListAttestationsRequest, ) (*ethpb.ListAttestationsResponse, error)
ListAttestations retrieves attestations by block root, slot, or epoch. Attestations are sorted by crosslink shard by default.
The server may return an empty list when no attestations match the given filter criteria. This RPC should not return NOT_FOUND. Only one filter criteria should be used.
func (*BeaconChainServer) ListBlocks ¶
func (bs *BeaconChainServer) ListBlocks( ctx context.Context, req *ethpb.ListBlocksRequest, ) (*ethpb.ListBlocksResponse, error)
ListBlocks retrieves blocks by root, slot, or epoch.
The server may return multiple blocks in the case that a slot or epoch is provided as the filter criteria. The server may return an empty list when no blocks in their database match the filter criteria. This RPC should not return NOT_FOUND. Only one filter criteria should be used.
func (*BeaconChainServer) ListValidatorAssignments ¶
func (bs *BeaconChainServer) ListValidatorAssignments( ctx context.Context, req *ethpb.ListValidatorAssignmentsRequest, ) (*ethpb.ValidatorAssignments, error)
ListValidatorAssignments retrieves the validator assignments for a given epoch, optional validator indices or public keys may be included to filter validator assignments.
func (*BeaconChainServer) ListValidatorBalances ¶
func (bs *BeaconChainServer) ListValidatorBalances( ctx context.Context, req *ethpb.GetValidatorBalancesRequest) (*ethpb.ValidatorBalances, error)
ListValidatorBalances retrieves the validator balances for a given set of public keys. An optional Epoch parameter is provided to request historical validator balances from archived, persistent data.
type Config ¶
type Config struct { Port string CertFlag string KeyFlag string BeaconDB db.Database StateFeedListener blockchain.ChainFeeds HeadFetcher blockchain.HeadFetcher ForkFetcher blockchain.ForkFetcher FinalizationFetcher blockchain.FinalizationFetcher AttestationReceiver blockchain.AttestationReceiver BlockReceiver blockchain.BlockReceiver POWChainService powchain.Chain ChainStartFetcher powchain.ChainStartFetcher GenesisTimeFetcher blockchain.GenesisTimeFetcher MockEth1Votes bool OperationsHandler operations.Handler AttestationsPool operations.Pool SyncService sync.Checker Broadcaster p2p.Broadcaster DepositFetcher depositcache.DepositFetcher PendingDepositFetcher depositcache.PendingDepositsFetcher }
Config options for the beacon node RPC server.
type NodeServer ¶
type NodeServer struct {
// contains filtered or unexported fields
}
NodeServer defines a server implementation of the gRPC Node service, providing RPC endpoints for verifying a beacon node's sync status, genesis and version information, and services the node implements and runs.
func (*NodeServer) GetGenesis ¶
GetGenesis fetches genesis chain information of Ethereum 2.0.
func (*NodeServer) GetSyncStatus ¶
func (ns *NodeServer) GetSyncStatus(ctx context.Context, _ *ptypes.Empty) (*ethpb.SyncStatus, error)
GetSyncStatus checks the current network sync status of the node.
func (*NodeServer) GetVersion ¶
GetVersion checks the version information of the beacon node.
func (*NodeServer) ListImplementedServices ¶
func (ns *NodeServer) ListImplementedServices(ctx context.Context, _ *ptypes.Empty) (*ethpb.ImplementedServices, error)
ListImplementedServices lists the services implemented and enabled by this node.
Any service not present in this list may return UNIMPLEMENTED or PERMISSION_DENIED. The server may also support fetching services by grpc reflection.
type ProposerServer ¶
type ProposerServer struct {
// contains filtered or unexported fields
}
ProposerServer defines a server implementation of the gRPC Proposer service, providing RPC endpoints for computing state transitions and state roots, proposing beacon blocks to a beacon node, and more.
func (*ProposerServer) ProposeBlock ¶
func (ps *ProposerServer) ProposeBlock(ctx context.Context, blk *ethpb.BeaconBlock) (*pb.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 (*ProposerServer) RequestBlock ¶
func (ps *ProposerServer) RequestBlock(ctx context.Context, req *pb.BlockRequest) (*ethpb.BeaconBlock, error)
RequestBlock 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.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service defining an RPC server for a beacon node.
func NewService ¶
NewService instantiates a new RPC service instance that will be registered into a running beacon node.
type ValidatorServer ¶
type ValidatorServer struct {
// contains filtered or unexported fields
}
ValidatorServer defines a server implementation of the gRPC Validator service, providing RPC endpoints for obtaining validator assignments per epoch, the slots and shards in which particular validators need to perform their responsibilities, and more.
func (*ValidatorServer) CanonicalHead ¶
func (vs *ValidatorServer) 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 (*ValidatorServer) CommitteeAssignment ¶
func (vs *ValidatorServer) 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 (*ValidatorServer) DomainData ¶
func (vs *ValidatorServer) DomainData(ctx context.Context, request *pb.DomainRequest) (*pb.DomainResponse, error)
DomainData fetches the current domain version information from the beacon state.
func (*ValidatorServer) ExitedValidators ¶
func (vs *ValidatorServer) 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 (*ValidatorServer) ValidatorIndex ¶
func (vs *ValidatorServer) 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 (*ValidatorServer) ValidatorPerformance ¶
func (vs *ValidatorServer) 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 (*ValidatorServer) ValidatorStatus ¶
func (vs *ValidatorServer) 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 (*ValidatorServer) WaitForActivation ¶
func (vs *ValidatorServer) WaitForActivation(req *pb.ValidatorActivationRequest, stream pb.ValidatorService_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 (*ValidatorServer) WaitForChainStart ¶
func (vs *ValidatorServer) 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.