Documentation ¶
Overview ¶
Package beacon defines a gRPC beacon service implementation, providing useful endpoints for checking fetching chain-specific data such as blocks, committees, validators, assignments, and more.
Index ¶
- type Server
- func (bs *Server) AttestationPool(_ context.Context, req *zondpb.AttestationPoolRequest) (*zondpb.AttestationPoolResponse, error)
- func (_ *Server) GetBeaconConfig(_ context.Context, _ *emptypb.Empty) (*zondpb.BeaconConfig, error)
- func (bs *Server) GetChainHead(ctx context.Context, _ *emptypb.Empty) (*zondpb.ChainHead, error)
- func (bs *Server) GetIndividualVotes(ctx context.Context, req *zondpb.IndividualVotesRequest) (*zondpb.IndividualVotesRespond, error)
- func (bs *Server) GetValidator(ctx context.Context, req *zondpb.GetValidatorRequest) (*zondpb.Validator, error)
- func (bs *Server) GetValidatorActiveSetChanges(ctx context.Context, req *zondpb.GetValidatorActiveSetChangesRequest) (*zondpb.ActiveSetChanges, error)
- func (bs *Server) GetValidatorParticipation(ctx context.Context, req *zondpb.GetValidatorParticipationRequest) (*zondpb.ValidatorParticipationResponse, error)
- func (bs *Server) GetValidatorPerformance(ctx context.Context, req *zondpb.ValidatorPerformanceRequest) (*zondpb.ValidatorPerformanceResponse, error)
- func (bs *Server) GetValidatorQueue(ctx context.Context, _ *emptypb.Empty) (*zondpb.ValidatorQueue, error)
- func (bs *Server) ListAttestations(ctx context.Context, req *zondpb.ListAttestationsRequest) (*zondpb.ListAttestationsResponse, error)
- func (bs *Server) ListBeaconBlocks(ctx context.Context, req *zondpb.ListBlocksRequest) (*zondpb.ListBeaconBlocksResponse, error)
- func (bs *Server) ListBeaconCommittees(ctx context.Context, req *zondpb.ListCommitteesRequest) (*zondpb.BeaconCommittees, error)
- func (bs *Server) ListIndexedAttestations(ctx context.Context, req *zondpb.ListIndexedAttestationsRequest) (*zondpb.ListIndexedAttestationsResponse, error)
- func (bs *Server) ListValidatorAssignments(ctx context.Context, req *zondpb.ListValidatorAssignmentsRequest) (*zondpb.ValidatorAssignments, error)
- func (bs *Server) ListValidatorBalances(ctx context.Context, req *zondpb.ListValidatorBalancesRequest) (*zondpb.ValidatorBalances, error)
- func (bs *Server) ListValidators(ctx context.Context, req *zondpb.ListValidatorsRequest) (*zondpb.Validators, error)
- func (bs *Server) StreamAttestations(_ *emptypb.Empty, stream zondpb.BeaconChain_StreamAttestationsServer) error
- func (bs *Server) StreamBlocks(req *zondpb.StreamBlocksRequest, stream zondpb.BeaconChain_StreamBlocksServer) error
- func (bs *Server) StreamChainHead(_ *emptypb.Empty, stream zondpb.BeaconChain_StreamChainHeadServer) error
- func (bs *Server) StreamIndexedAttestations(_ *emptypb.Empty, stream zondpb.BeaconChain_StreamIndexedAttestationsServer) error
- func (bs *Server) StreamValidatorsInfo(stream zondpb.BeaconChain_StreamValidatorsInfoServer) error
- func (bs *Server) SubmitAttesterSlashing(ctx context.Context, req *zondpb.AttesterSlashing) (*zondpb.SubmitSlashingResponse, error)
- func (bs *Server) SubmitProposerSlashing(ctx context.Context, req *zondpb.ProposerSlashing) (*zondpb.SubmitSlashingResponse, error)
- type SlotToCommiteesMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct { BeaconDB db.ReadOnlyDatabase Ctx context.Context ChainStartFetcher execution.ChainStartFetcher HeadFetcher blockchain.HeadFetcher CanonicalFetcher blockchain.CanonicalFetcher FinalizationFetcher blockchain.FinalizationFetcher DepositFetcher cache.DepositFetcher BlockFetcher execution.POWBlockFetcher GenesisTimeFetcher blockchain.TimeFetcher StateNotifier statefeed.Notifier BlockNotifier blockfeed.Notifier AttestationNotifier operation.Notifier Broadcaster p2p.Broadcaster AttestationsPool attestations.Pool SlashingsPool slashings.PoolManager ChainStartChan chan time.Time ReceivedAttestationsBuffer chan *zondpb.Attestation CollectedAttestationsBuffer chan []*zondpb.Attestation StateGen stategen.StateManager SyncChecker sync.Checker ReplayerBuilder stategen.ReplayerBuilder OptimisticModeFetcher blockchain.OptimisticModeFetcher CoreService *core.Service }
Server defines a server implementation of the gRPC Beacon Chain service, providing RPC endpoints to access data relevant to the Ethereum beacon chain.
func (*Server) AttestationPool ¶
func (bs *Server) AttestationPool( _ context.Context, req *zondpb.AttestationPoolRequest, ) (*zondpb.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 consensus specification for more details on how attestations are processed and when they are no longer valid. https://github.com/ethereum/consensus-specs/blob/dev/specs/core/0_beacon-chain.md#attestations
func (*Server) GetBeaconConfig ¶
GetBeaconConfig retrieves the current configuration parameters of the beacon chain.
func (*Server) GetChainHead ¶
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. DEPRECATED: This endpoint is superseded by the /zond/v1/beacon API endpoint
func (*Server) GetIndividualVotes ¶
func (bs *Server) GetIndividualVotes( ctx context.Context, req *zondpb.IndividualVotesRequest, ) (*zondpb.IndividualVotesRespond, error)
GetIndividualVotes retrieves individual voting status of validators.
func (*Server) GetValidator ¶
func (bs *Server) GetValidator( ctx context.Context, req *zondpb.GetValidatorRequest, ) (*zondpb.Validator, error)
GetValidator information from any validator in the registry by index or public key.
func (*Server) GetValidatorActiveSetChanges ¶
func (bs *Server) GetValidatorActiveSetChanges( ctx context.Context, req *zondpb.GetValidatorActiveSetChangesRequest, ) (*zondpb.ActiveSetChanges, error)
GetValidatorActiveSetChanges retrieves the active set changes for a given epoch.
This data includes any activations, voluntary exits, and involuntary ejections.
func (*Server) GetValidatorParticipation ¶
func (bs *Server) GetValidatorParticipation( ctx context.Context, req *zondpb.GetValidatorParticipationRequest, ) (*zondpb.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 (*Server) GetValidatorPerformance ¶
func (bs *Server) GetValidatorPerformance( ctx context.Context, req *zondpb.ValidatorPerformanceRequest, ) (*zondpb.ValidatorPerformanceResponse, error)
GetValidatorPerformance reports the validator's latest balance along with other important metrics on rewards and penalties throughout its lifecycle in the beacon chain.
func (*Server) GetValidatorQueue ¶
func (bs *Server) GetValidatorQueue( ctx context.Context, _ *emptypb.Empty, ) (*zondpb.ValidatorQueue, error)
GetValidatorQueue retrieves the current validator queue information.
func (*Server) ListAttestations ¶
func (bs *Server) ListAttestations( ctx context.Context, req *zondpb.ListAttestationsRequest, ) (*zondpb.ListAttestationsResponse, error)
ListAttestations retrieves attestations by block root, slot, or epoch. Attestations are sorted by data slot 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 (*Server) ListBeaconBlocks ¶
func (bs *Server) ListBeaconBlocks( ctx context.Context, req *zondpb.ListBlocksRequest, ) (*zondpb.ListBeaconBlocksResponse, error)
ListBeaconBlocks 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 (*Server) ListBeaconCommittees ¶
func (bs *Server) ListBeaconCommittees( ctx context.Context, req *zondpb.ListCommitteesRequest, ) (*zondpb.BeaconCommittees, error)
ListBeaconCommittees for a given epoch.
If no filter criteria is specified, the response returns all beacon committees for the current epoch. The results are paginated by default.
func (*Server) ListIndexedAttestations ¶
func (bs *Server) ListIndexedAttestations( ctx context.Context, req *zondpb.ListIndexedAttestationsRequest, ) (*zondpb.ListIndexedAttestationsResponse, error)
ListIndexedAttestations retrieves indexed attestations by block root. IndexedAttestationsForEpoch are sorted by data slot by default. Start-end epoch filter is used to retrieve blocks with.
The server may return an empty list when no attestations match the given filter criteria. This RPC should not return NOT_FOUND.
func (*Server) ListValidatorAssignments ¶
func (bs *Server) ListValidatorAssignments( ctx context.Context, req *zondpb.ListValidatorAssignmentsRequest, ) (*zondpb.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 (*Server) ListValidatorBalances ¶
func (bs *Server) ListValidatorBalances( ctx context.Context, req *zondpb.ListValidatorBalancesRequest, ) (*zondpb.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.
func (*Server) ListValidators ¶
func (bs *Server) ListValidators( ctx context.Context, req *zondpb.ListValidatorsRequest, ) (*zondpb.Validators, error)
ListValidators retrieves the current list of active validators with an optional historical epoch flag to retrieve validator set in time.
func (*Server) StreamAttestations ¶
func (bs *Server) StreamAttestations( _ *emptypb.Empty, stream zondpb.BeaconChain_StreamAttestationsServer, ) error
StreamAttestations to clients at the end of every slot. This method retrieves the aggregated attestations currently in the pool at the start of a slot and sends them over a gRPC stream. DEPRECATED: This endpoint is superseded by the /zond/v1/events Beacon API endpoint
func (*Server) StreamBlocks ¶
func (bs *Server) StreamBlocks(req *zondpb.StreamBlocksRequest, stream zondpb.BeaconChain_StreamBlocksServer) error
StreamBlocks to clients every single time a block is received by the beacon node. DEPRECATED: This endpoint is superseded by the /zond/v1/events Beacon API endpoint
func (*Server) StreamChainHead ¶
func (bs *Server) StreamChainHead(_ *emptypb.Empty, stream zondpb.BeaconChain_StreamChainHeadServer) error
StreamChainHead to clients every single time the head block and state of the chain change. DEPRECATED: This endpoint is superseded by the /zond/v1/events Beacon API endpoint
func (*Server) StreamIndexedAttestations ¶
func (bs *Server) StreamIndexedAttestations( _ *emptypb.Empty, stream zondpb.BeaconChain_StreamIndexedAttestationsServer, ) error
StreamIndexedAttestations to clients at the end of every slot. This method retrieves the aggregated attestations currently in the pool, converts them into indexed form, and sends them over a gRPC stream. DEPRECATED: This endpoint is superseded by the /zond/v1/events Beacon API endpoint
func (*Server) StreamValidatorsInfo ¶
func (bs *Server) StreamValidatorsInfo(stream zondpb.BeaconChain_StreamValidatorsInfoServer) error
StreamValidatorsInfo returns a stream of information for given validators. Validators are supplied dynamically by the client, and can be added, removed and reset at any time. Information about the current set of validators is supplied as soon as the end-of-epoch accounting has been processed, providing a near real-time view of the state of the validators. Note that this will stream information whilst syncing; this is intended, to allow for complete validator state capture over time. If this is not required then the client can either wait until the beacon node is synced, or filter results based on the epoch value in the returned validator info. DEPRECATED: Streaming Validator Info is no longer supported. The Beacon API /zond/v1/beacon/states/{state_id}/validators will provide validator info in unstreamed format.
func (*Server) SubmitAttesterSlashing ¶
func (bs *Server) SubmitAttesterSlashing( ctx context.Context, req *zondpb.AttesterSlashing, ) (*zondpb.SubmitSlashingResponse, error)
SubmitAttesterSlashing receives an attester slashing object via RPC and injects it into the beacon node's operations pool. Submission into this pool does not guarantee inclusion into a beacon block.
func (*Server) SubmitProposerSlashing ¶
func (bs *Server) SubmitProposerSlashing( ctx context.Context, req *zondpb.ProposerSlashing, ) (*zondpb.SubmitSlashingResponse, error)
SubmitProposerSlashing receives a proposer slashing object via RPC and injects it into the beacon node's operations pool. Submission into this pool does not guarantee inclusion into a beacon block.
type SlotToCommiteesMap ¶
type SlotToCommiteesMap map[primitives.Slot]*zondpb.BeaconCommittees_CommitteesList
SlotToCommiteesMap represents <slot, CommitteeList> map.
func (SlotToCommiteesMap) SlotToUint64 ¶
func (m SlotToCommiteesMap) SlotToUint64() map[uint64]*zondpb.BeaconCommittees_CommitteesList
SlotToUint64 updates map keys to slots (workaround which will be unnecessary if we can cast map<uint64, CommitteesList> correctly in beacon_chain.proto)