slashingprotection

package
v1.0.0-beta.0.rc Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2020 License: GPL-3.0 Imports: 18 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Endpoint                   string
	CertFlag                   string
	GrpcMaxCallRecvMsgSizeFlag int
	GrpcRetriesFlag            uint
	GrpcRetryDelay             time.Duration
	GrpcHeadersFlag            string
}

Config for the validator service.

type Protector

type Protector interface {
	CheckAttestationSafety(ctx context.Context, attestation *eth.IndexedAttestation) bool
	CommitAttestation(ctx context.Context, attestation *eth.IndexedAttestation) bool
	CheckBlockSafety(ctx context.Context, blockHeader *eth.BeaconBlockHeader) bool
	CommitBlock(ctx context.Context, blockHeader *eth.SignedBeaconBlockHeader) (bool, error)
	Status() error
}

Protector interface defines the methods of the service that provides slashing protection.

type Service

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

Service represents a service to manage the validator �slashing protection.

func NewService

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

NewService creates a new validator service for the service registry.

func (*Service) CheckAttestationSafety

func (s *Service) CheckAttestationSafety(ctx context.Context, attestation *ethpb.IndexedAttestation) bool

CheckAttestationSafety implements the slashing protection for attestations without db update. To be used before signing.

func (*Service) CheckBlockSafety

func (s *Service) CheckBlockSafety(ctx context.Context, blockHeader *ethpb.BeaconBlockHeader) bool

CheckBlockSafety this function is part of slashing protection for block proposals it performs validation without db update. To be used before the block is signed.

func (*Service) CommitAttestation

func (s *Service) CommitAttestation(ctx context.Context, attestation *ethpb.IndexedAttestation) bool

CommitAttestation implements the slashing protection for attestations it performs validation and db update. To be used after the attestation is proposed.

func (*Service) CommitBlock

func (s *Service) CommitBlock(ctx context.Context, blockHeader *ethpb.SignedBeaconBlockHeader) (bool, error)

CommitBlock this function is part of slashing protection for block proposals it performs validation and db update. To be used after the block is proposed.

func (*Service) Start

func (s *Service) Start()

Start the slasher protection service and grpc client.

func (*Service) Status

func (s *Service) Status() error

Status checks if the connection to slasher server is ready, returns error otherwise.

func (*Service) Stop

func (s *Service) Stop() error

Stop the validator service.

Jump to

Keyboard shortcuts

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