blocks

package
v0.2.26-beta.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateRewards added in v1.0.0

func ValidateRewards(rewards []types.AnyReward) error

ValidateRewards syntactically validates rewards.

Types

type CertConfig added in v1.0.0

type CertConfig struct {
	CommitteeSize    int
	CertifyThreshold int
	LayerBuffer      uint32
	NumLayersToKeep  uint32
}

CertConfig is the config for Certifier.

type Certifier added in v1.0.0

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

Certifier collects enough CertifyMessage for a given hare output and generate certificate.

func NewCertifier added in v1.0.0

func NewCertifier(
	db *datastore.CachedDB,
	o hare.Rolacle,
	n types.NodeID,
	s *signing.EdSigner,
	pke *signing.PubKeyExtractor,
	p pubsub.Publisher,
	lc layerClock,
	b system.BeaconGetter,
	tortoise system.Tortoise,
	opts ...CertifierOpt,
) *Certifier

NewCertifier creates new block certifier.

func (*Certifier) CertifyIfEligible added in v1.0.0

func (c *Certifier) CertifyIfEligible(ctx context.Context, logger log.Log, lid types.LayerID, bid types.BlockID) error

CertifyIfEligible signs the hare output, along with its role proof as a certifier, and gossip the CertifyMessage if the node is eligible to be a certifier.

func (*Certifier) HandleCertifyMessage added in v1.0.0

func (c *Certifier) HandleCertifyMessage(ctx context.Context, peer p2p.Peer, msg []byte) pubsub.ValidationResult

HandleCertifyMessage is the gossip receiver for certify message.

func (*Certifier) HandleSyncedCertificate added in v1.0.0

func (c *Certifier) HandleSyncedCertificate(ctx context.Context, lid types.LayerID, cert *types.Certificate) error

HandleSyncedCertificate handles Certificate from sync.

func (*Certifier) NumCached added in v1.0.0

func (c *Certifier) NumCached() int

NumCached returns the number of layers being cached in memory.

func (*Certifier) RegisterForCert added in v1.0.0

func (c *Certifier) RegisterForCert(ctx context.Context, lid types.LayerID, bid types.BlockID) error

RegisterForCert register to generate a certificate for the specified layer/block.

func (*Certifier) Start added in v1.0.0

func (c *Certifier) Start()

Start starts the background goroutine for periodic pruning.

func (*Certifier) Stop added in v1.0.0

func (c *Certifier) Stop()

Stop stops the outstanding goroutines.

type CertifierOpt added in v1.0.0

type CertifierOpt func(*Certifier)

CertifierOpt for configuring Certifier.

func WithCertConfig added in v1.0.0

func WithCertConfig(cfg CertConfig) CertifierOpt

WithCertConfig defines cfg for Certifier.

func WithCertContext added in v1.0.0

func WithCertContext(ctx context.Context) CertifierOpt

WithCertContext modifies parent context for Certifier.

func WithCertifierLogger added in v1.0.0

func WithCertifierLogger(logger log.Log) CertifierOpt

WithCertifierLogger defines logger for Certifier.

type Config

type Config struct {
	LayerSize          uint32
	LayersPerEpoch     uint32
	GenBlockInterval   time.Duration
	BlockGasLimit      uint64
	OptFilterThreshold int
}

Config is the config for Generator.

type Generator added in v1.0.0

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

Generator generates a block from proposals.

func NewGenerator added in v1.0.0

func NewGenerator(
	cdb *datastore.CachedDB,
	exec executor,
	m meshProvider,
	f system.ProposalFetcher,
	c certifier,
	p layerPatrol,
	opts ...GeneratorOpt,
) *Generator

NewGenerator creates new block generator.

func (*Generator) Start added in v1.0.0

func (g *Generator) Start()

Start starts listening to hare output.

func (*Generator) Stop added in v1.0.0

func (g *Generator) Stop()

Stop stops listening to hare output.

type GeneratorOpt added in v1.0.0

type GeneratorOpt func(*Generator)

GeneratorOpt for configuring Generator.

func WithConfig added in v1.0.0

func WithConfig(cfg Config) GeneratorOpt

WithConfig defines cfg for Generator.

func WithContext added in v1.0.0

func WithContext(ctx context.Context) GeneratorOpt

WithContext modifies default context.

func WithGeneratorLogger added in v1.0.0

func WithGeneratorLogger(logger log.Log) GeneratorOpt

WithGeneratorLogger defines logger for Generator.

func WithHareOutputChan added in v1.0.0

func WithHareOutputChan(ch chan hare.LayerOutput) GeneratorOpt

WithHareOutputChan sets the chan to listen to hare output.

type Handler added in v1.0.0

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

Handler processes Block fetched from peers during sync.

func NewHandler added in v1.0.0

func NewHandler(f system.Fetcher, db *sql.Database, m meshProvider, opts ...Opt) *Handler

NewHandler creates new Handler.

func (*Handler) HandleSyncedBlock added in v1.0.0

func (h *Handler) HandleSyncedBlock(ctx context.Context, peer p2p.Peer, data []byte) error

HandleSyncedBlock handles Block data from sync.

type Opt added in v1.0.0

type Opt func(*Handler)

Opt for configuring BlockHandler.

func WithLogger added in v1.0.0

func WithLogger(logger log.Log) Opt

WithLogger defines logger for Handler.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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