Documentation ¶
Overview ¶
Package detection defines a service that reacts to incoming blocks/attestations by running slashing detection for double proposals, double votes, and surround votes according to the eth2 specification. As soon as slashing objects are found, they are sent over a feed for the beaconclient service to submit to a beacon node via gRPC.
Index ¶
- type Config
- type Service
- func (s *Service) DetectAttesterSlashings(ctx context.Context, att *ethpb.IndexedAttestation) ([]*ethpb.AttesterSlashing, error)
- func (s *Service) DetectDoubleProposals(ctx context.Context, incomingBlock *ethpb.SignedBeaconBlockHeader) (*ethpb.ProposerSlashing, error)
- func (s *Service) DetectDoubleProposeNoUpdate(ctx context.Context, incomingBlock *ethpb.BeaconBlockHeader) (bool, error)
- func (s *Service) Start()
- func (s *Service) Status() error
- func (s *Service) Stop() error
- func (s *Service) UpdateHighestAttestation(ctx context.Context, att *ethpb.IndexedAttestation) error
- func (s *Service) UpdateSpans(ctx context.Context, att *ethpb.IndexedAttestation) error
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Notifier beaconclient.Notifier SlasherDB db.Database ChainFetcher beaconclient.ChainFetcher BeaconClient *beaconclient.Service AttesterSlashingsFeed *event.Feed ProposerSlashingsFeed *event.Feed HistoricalDetection bool }
Config options for the detection service.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service struct for the detection service of the slasher.
func NewService ¶ added in v1.0.0
NewService instantiation.
func (*Service) DetectAttesterSlashings ¶ added in v0.3.8
func (s *Service) DetectAttesterSlashings( ctx context.Context, att *ethpb.IndexedAttestation, ) ([]*ethpb.AttesterSlashing, error)
DetectAttesterSlashings detects double, surround and surrounding attestation offences given an attestation.
func (*Service) DetectDoubleProposals ¶ added in v0.3.8
func (s *Service) DetectDoubleProposals(ctx context.Context, incomingBlock *ethpb.SignedBeaconBlockHeader) (*ethpb.ProposerSlashing, error)
DetectDoubleProposals checks if the given signed beacon block is a slashable offense and returns the slashing.
func (*Service) DetectDoubleProposeNoUpdate ¶ added in v1.0.0
func (s *Service) DetectDoubleProposeNoUpdate(ctx context.Context, incomingBlock *ethpb.BeaconBlockHeader) (bool, error)
DetectDoubleProposeNoUpdate checks if the given beacon block header is a slashable offense.
func (*Service) UpdateHighestAttestation ¶ added in v1.0.0
func (s *Service) UpdateHighestAttestation(ctx context.Context, att *ethpb.IndexedAttestation) error
UpdateHighestAttestation updates to the db the highest source and target attestations for a each validator.
func (*Service) UpdateSpans ¶ added in v0.3.9
UpdateSpans passthrough function that updates span maps given an indexed attestation.
type Status ¶ added in v1.0.0
type Status int
Status detection statuses type.
const ( // None slasher was not initialised. None Status = iota // Started service start has been called, Started // Syncing beacon client is still syncing. Syncing // HistoricalDetection slasher is replaying all attestations that // were included in the canonical chain. HistoricalDetection // Ready slasher is ready to detect requests. Ready )
Directories ¶
Path | Synopsis |
---|---|
Package attestations defines an implementation of a slashable attestation detector using min-max surround vote checking.
|
Package attestations defines an implementation of a slashable attestation detector using min-max surround vote checking. |
iface
Package iface defines an interface for a slashable attestation detector struct.
|
Package iface defines an interface for a slashable attestation detector struct. |
types
Package types includes important type definitions for slashable objects detected by slasher.
|
Package types includes important type definitions for slashable objects detected by slasher. |
Package proposals defines an implementation of a double-propose detector in the slasher runtime.
|
Package proposals defines an implementation of a double-propose detector in the slasher runtime. |
iface
Package iface defines an interface for a double-proposal detector struct.
|
Package iface defines an interface for a double-proposal detector struct. |
Package testing includes useful helpers for slasher-related unit tests.
|
Package testing includes useful helpers for slasher-related unit tests. |