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 (bs *Service) AttestationFeed() *event.Feed
- func (bs *Service) BlockFeed() *event.Feed
- func (bs *Service) ChainHead(ctx context.Context) (*ethpb.ChainHead, error)
- func (bs *Service) ClientReadyFeed() *event.Feed
- func (bs *Service) FindOrGetPublicKeys(ctx context.Context, validatorIndices []uint64) (map[uint64][]byte, error)
- func (bs *Service) GenesisValidatorsRoot(ctx context.Context) ([]byte, error)
- func (bs *Service) RequestHistoricalAttestations(ctx context.Context, epoch uint64) ([]*ethpb.IndexedAttestation, error)
- func (bs *Service) Start()
- func (bs *Service) Status() error
- func (bs *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 NewBeaconClientService ¶
NewBeaconClientService 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 (bs *Service) FindOrGetPublicKeys( ctx context.Context, validatorIndices []uint64, ) (map[uint64][]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) RequestHistoricalAttestations ¶
func (bs *Service) RequestHistoricalAttestations( ctx context.Context, epoch uint64, ) ([]*ethpb.IndexedAttestation, error)
RequestHistoricalAttestations requests all indexed attestations for a given epoch from a beacon node via gRPC.
func (*Service) Start ¶
func (bs *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.