Documentation ¶
Overview ¶
Package beaconclient defines a service that interacts with a beacon node via a gRPC client to listen for streamed blocks, attestations, and to submit proposer/attester slashings to the node in case they are detected.
Index ¶
- type ChainFetcher
- type Config
- type Notifier
- type Service
- func (s *Service) AttestationFeed() *event.Feed
- func (s *Service) BlockFeed() *event.Feed
- func (s *Service) ChainHead(ctx context.Context) (*ethpb.ChainHead, error)
- func (s *Service) ClientReadyFeed() *event.Feed
- func (s *Service) FindOrGetPublicKeys(ctx context.Context, validatorIndices []types.ValidatorIndex) (map[types.ValidatorIndex][]byte, error)
- func (s *Service) GenesisValidatorsRoot(ctx context.Context) ([]byte, error)
- func (s *Service) ReceiveAttestations(ctx context.Context)
- func (s *Service) ReceiveBlocks(ctx context.Context)
- func (s *Service) RequestHistoricalAttestations(ctx context.Context, epoch types.Epoch) ([]*ethpb.IndexedAttestation, error)
- func (s *Service) Start()
- func (s *Service) Status() error
- func (s *Service) Stop() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChainFetcher ¶
ChainFetcher defines a struct which can retrieve chain information from a beacon node such as the latest chain head.
type Config ¶
type Config struct { BeaconProvider string BeaconCert string SlasherDB db.Database ProposerSlashingsFeed *event.Feed AttesterSlashingsFeed *event.Feed BeaconClient ethpb.BeaconChainClient NodeClient ethpb.NodeClient }
Config options for the beaconclient service.
type Notifier ¶
type Notifier interface { BlockFeed() *event.Feed AttestationFeed() *event.Feed ClientReadyFeed() *event.Feed }
Notifier defines a struct which exposes event feeds regarding beacon blocks, attestations, and more information received from a beacon node.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service struct for the beaconclient service of the slasher.
func NewService ¶ added in v1.0.0
NewService instantiation.
func (*Service) AttestationFeed ¶
AttestationFeed returns a feed other services in slasher can subscribe to attestations received via the beacon node through gRPC.
func (*Service) BlockFeed ¶
BlockFeed returns a feed other services in slasher can subscribe to blocks received via the beacon node through gRPC.
func (*Service) ChainHead ¶
ChainHead requests the latest beacon chain head from a beacon node via gRPC.
func (*Service) ClientReadyFeed ¶
ClientReadyFeed returns a feed other services in slasher can subscribe to to indicate when the gRPC connection is ready.
func (*Service) FindOrGetPublicKeys ¶ added in v0.3.10
func (s *Service) FindOrGetPublicKeys( ctx context.Context, validatorIndices []types.ValidatorIndex, ) (map[types.ValidatorIndex][]byte, error)
FindOrGetPublicKeys gets public keys from cache or request validators public keys from a beacon node via gRPC.
func (*Service) GenesisValidatorsRoot ¶ added in v1.0.0
GenesisValidatorsRoot requests or fetch from memory the beacon chain genesis validators root via gRPC.
func (*Service) ReceiveAttestations ¶ added in v1.0.0
ReceiveAttestations starts a gRPC client stream listener to obtain attestations from the beacon node. Upon receiving an attestation, the service broadcasts it to a feed for other services in slasher to subscribe to.
func (*Service) ReceiveBlocks ¶ added in v1.0.0
ReceiveBlocks starts a gRPC client stream listener to obtain blocks from the beacon node. Upon receiving a block, the service broadcasts it to a feed for other services in slasher to subscribe to.
func (*Service) RequestHistoricalAttestations ¶
func (s *Service) RequestHistoricalAttestations( ctx context.Context, epoch types.Epoch, ) ([]*ethpb.IndexedAttestation, error)
RequestHistoricalAttestations requests all indexed attestations for a given epoch from a beacon node via gRPC.
func (*Service) Start ¶
func (s *Service) Start()
Start the main runtime of the beaconclient service, initializing a gRPC client connection with a beacon node, listening for streamed blocks/attestations, and submitting slashing operations after they are detected by other services in the slasher.