operations

package
v0.2.7 Latest Latest
Warning

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

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

Documentation

Overview

Package operations defines the life-cycle of beacon block operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	BeaconDB db.Database
}

Config options for the service.

type Handler

type Handler interface {
	HandleAttestation(context.Context, proto.Message) error
}

Handler defines an interface for a struct equipped for receiving block operations.

type OperationFeeds

type OperationFeeds interface {
	IncomingProcessedBlockFeed() *event.Feed
	Pool
}

OperationFeeds inteface defines the informational feeds from the operations service.

type Pool

type Pool interface {
	AttestationPool(ctx context.Context, requestedSlot uint64) ([]*ethpb.Attestation, error)
	AttestationPoolNoVerify(ctx context.Context) ([]*ethpb.Attestation, error)
	AttestationPoolForForkchoice(ctx context.Context) ([]*ethpb.Attestation, error)
	AttestationsBySlotCommittee(ctx context.Context, slot uint64, index uint64) ([]*ethpb.Attestation, error)
}

Pool defines an interface for fetching the list of attestations which have been observed by the beacon node but not yet included in a beacon block by a proposer.

type Service

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

Service represents a service that handles the internal logic of beacon block operations.

func NewService

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

NewService instantiates a new operation service instance that will be registered into a running beacon node.

func (*Service) AttestationPool

func (s *Service) AttestationPool(ctx context.Context, requestedSlot uint64) ([]*ethpb.Attestation, error)

AttestationPool returns the attestations that have not seen on the beacon chain, the attestations are returned in target epoch ascending order and up to MaxAttestations capacity. The attestations returned will be verified against the head state up to requested slot. When fails attestation, the attestation will be removed from the pool.

func (*Service) AttestationPoolForForkchoice added in v0.2.4

func (s *Service) AttestationPoolForForkchoice(ctx context.Context) ([]*ethpb.Attestation, error)

AttestationPoolForForkchoice returns the attestations that have not been processed by the fork choice service. It will not return the attestations which the validator vote has already been counted.

func (*Service) AttestationPoolNoVerify

func (s *Service) AttestationPoolNoVerify(ctx context.Context) ([]*ethpb.Attestation, error)

AttestationPoolNoVerify returns every attestation from the attestation pool.

func (*Service) AttestationsBySlotCommittee added in v0.2.7

func (s *Service) AttestationsBySlotCommittee(ctx context.Context, slot uint64, index uint64) ([]*ethpb.Attestation, error)

AttestationsBySlotCommittee returns the attestations from the attestations pool filtered by slot and committee index.

func (*Service) HandleAttestation

func (s *Service) HandleAttestation(ctx context.Context, message proto.Message) error

HandleAttestation processes a received attestation message.

func (*Service) HandleValidatorExits

func (s *Service) HandleValidatorExits(ctx context.Context, message proto.Message) error

HandleValidatorExits processes a validator exit operation.

func (*Service) IncomingProcessedBlockFeed

func (s *Service) IncomingProcessedBlockFeed() *event.Feed

IncomingProcessedBlockFeed returns a feed that any service can send incoming p2p beacon blocks into. The beacon block operation pool service will subscribe to this feed in order to receive incoming beacon blocks.

func (*Service) Start

func (s *Service) Start()

Start an beacon block operation pool service's main event loop.

func (*Service) Status

func (s *Service) Status() error

Status returns the current service error if there's any.

func (*Service) Stop

func (s *Service) Stop() error

Stop the beacon block operation pool service's main event loop and associated goroutines.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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