rpc

package
v0.0.0-...-c85edb6 Latest Latest
Warning

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

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

Documentation

Overview

Package rpc defines the services that the beacon-chain uses to communicate via gRPC.

Index

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) AttestHead

func (as *AttesterServer) AttestHead(ctx context.Context, att *pbp2p.Attestation) (*pb.AttestResponse, error)

AttestHead 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.

func (*AttesterServer) AttestationInfoAtSlot

func (as *AttesterServer) AttestationInfoAtSlot(ctx context.Context, req *pb.AttestationInfoRequest) (*pb.AttestationInfoResponse, error)

AttestationInfoAtSlot --

TODO(#1505): WIP.

func (*AttesterServer) CrosslinkCommitteesAtSlot

func (as *AttesterServer) CrosslinkCommitteesAtSlot(ctx context.Context, req *pb.CrosslinkCommitteeRequest) (*pb.CrosslinkCommitteeResponse, error)

CrosslinkCommitteesAtSlot --

TODO(#1505): WIP.

type BeaconServer

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

BeaconServer defines a server implementation of the gRPC Beacon service, providing RPC endpoints for obtaining the canonical beacon chain head, fetching latest observed attestations, and more.

func (*BeaconServer) CanonicalHead

func (bs *BeaconServer) CanonicalHead(ctx context.Context, req *ptypes.Empty) (*pbp2p.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 (*BeaconServer) Eth1Data

func (bs *BeaconServer) Eth1Data(ctx context.Context, _ *ptypes.Empty) (*pb.Eth1DataResponse, error)

Eth1Data fetches the current ETH 1 data which should be used when voting via block proposal. TODO(1463): Implement this.

func (*BeaconServer) LatestAttestation

func (bs *BeaconServer) LatestAttestation(req *ptypes.Empty, stream pb.BeaconService_LatestAttestationServer) error

LatestAttestation streams the latest processed attestations to the rpc clients.

func (*BeaconServer) PendingDeposits

func (bs *BeaconServer) PendingDeposits(ctx context.Context, _ *ptypes.Empty) (*pb.PendingDepositsResponse, error)

PendingDeposits returns a list of pending deposits that are ready for inclusion in the next beacon block.

func (*BeaconServer) WaitForChainStart

func (bs *BeaconServer) WaitForChainStart(req *ptypes.Empty, stream pb.BeaconService_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.

type Config

type Config struct {
	Port             string
	CertFlag         string
	KeyFlag          string
	SubscriptionBuf  int
	BeaconDB         *db.BeaconDB
	ChainService     chainService
	POWChainService  powChainService
	OperationService operationService
}

Config options for the beacon node RPC server.

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) ComputeStateRoot

func (ps *ProposerServer) ComputeStateRoot(ctx context.Context, req *pbp2p.BeaconBlock) (*pb.StateRootResponse, error)

ComputeStateRoot computes the state root after a block has been processed through a state transition and returns it to the validator client.

func (*ProposerServer) ProposeBlock

func (ps *ProposerServer) ProposeBlock(ctx context.Context, blk *pbp2p.BeaconBlock) (*pb.ProposeResponse, error)

ProposeBlock is called by a proposer in a sharding validator and a full beacon node sends the request into a beacon block that can then be included in a canonical chain.

func (*ProposerServer) ProposerIndex

ProposerIndex sends a response to the client which returns the proposer index for a given slot. Validators are shuffled and assigned slots to attest/propose to. This method will look for the validator that is assigned to propose a beacon block at the given slot.

type Service

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

Service defining an RPC server for a beacon node.

func NewRPCService

func NewRPCService(ctx context.Context, cfg *Config) *Service

NewRPCService creates a new instance of a struct implementing the BeaconServiceServer interface.

func (*Service) Start

func (s *Service) Start()

Start the gRPC server.

func (*Service) Status

func (s *Service) Status() error

Status returns nil or credentialError

func (*Service) Stop

func (s *Service) Stop() error

Stop the service.

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) ValidatorEpochAssignments

ValidatorEpochAssignments fetches an assignment object for a validator by public key such as the slot the validator needs to attest in during the epoch as well as a slot in which the validator may need to propose during the epoch in addition to the assigned shard.

func (*ValidatorServer) ValidatorIndex

ValidatorIndex is called by a validator to get its index location that corresponds to the attestation bit fields.

Jump to

Keyboard shortcuts

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