sealing

package
v0.33.19 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: AGPL-3.0 Imports: 28 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Core

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

Core is an implementation of SealingCore interface This struct is responsible for:

  • collecting approvals for execution results
  • processing multiple incorporated results
  • pre-validating approvals (if they are outdated or non-verifiable)
  • pruning already processed collectorTree

func NewCore

func NewCore(
	log zerolog.Logger,
	workerPool *workerpool.WorkerPool,
	tracer module.Tracer,
	conMetrics module.ConsensusMetrics,
	sealingTracker consensus.SealingTracker,
	unit *engine.Unit,
	headers storage.Headers,
	state protocol.State,
	sealsDB storage.Seals,
	assigner module.ChunkAssigner,
	signatureHasher hash.Hasher,
	sealsMempool mempool.IncorporatedResultSeals,
	approvalConduit network.Conduit,
	sealingConfigsGetter module.SealingConfigsGetter,
) (*Core, error)

func (*Core) ProcessApproval added in v0.17.6

func (c *Core) ProcessApproval(approval *flow.ResultApproval) error

ProcessApproval processes approval in blocking way. Concurrency safe. Returns: * exception in case of unexpected error * nil - successfully processed result approval

func (*Core) ProcessFinalizedBlock added in v0.17.6

func (c *Core) ProcessFinalizedBlock(finalizedBlockID flow.Identifier) error

ProcessFinalizedBlock processes finalization events in blocking way. The entire business logic in this function can be executed completely concurrently. We only waste some work if multiple goroutines enter the following block. Returns: * exception in case of unexpected error * nil - successfully processed finalized block

func (*Core) ProcessIncorporatedResult added in v0.17.6

func (c *Core) ProcessIncorporatedResult(result *flow.IncorporatedResult) error

ProcessIncorporatedResult processes incorporated result in blocking way. Concurrency safe. Returns: * exception in case of unexpected error * nil - successfully processed incorporated result

func (*Core) RepopulateAssignmentCollectorTree added in v0.17.6

func (c *Core) RepopulateAssignmentCollectorTree(payloads storage.Payloads) error

RepopulateAssignmentCollectorTree restores latest state of assignment collector tree based on local chain state information. Repopulating is split into two parts: 1) traverse forward all finalized blocks starting from last sealed block till we reach last finalized block . (lastSealedHeight, lastFinalizedHeight] 2) traverse forward all unfinalized(pending) blocks starting from last finalized block. For each block that is being traversed we will collect execution results and process them using sealing.Core.

type Engine

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

Engine is a wrapper for approval processing `Core` which implements logic for queuing and filtering network messages which later will be processed by sealing engine. Purpose of this struct is to provide an efficient way how to consume messages from network layer and pass them to `Core`. Engine runs 2 separate gorourtines that perform pre-processing and consuming messages by Core.

func NewEngine

func NewEngine(log zerolog.Logger,
	tracer module.Tracer,
	conMetrics module.ConsensusMetrics,
	engineMetrics module.EngineMetrics,
	mempool module.MempoolMetrics,
	sealingTracker consensus.SealingTracker,
	net network.EngineRegistry,
	me module.Local,
	headers storage.Headers,
	payloads storage.Payloads,
	results storage.ExecutionResults,
	index storage.Index,
	state protocol.State,
	sealsDB storage.Seals,
	assigner module.ChunkAssigner,
	sealsMempool mempool.IncorporatedResultSeals,
	requiredApprovalsForSealConstructionGetter module.SealingConfigsGetter,
) (*Engine, error)

NewEngine constructs new `Engine` which runs on it's own unit.

func (*Engine) Done

func (e *Engine) Done() <-chan struct{}

func (*Engine) OnBlockIncorporated added in v0.17.6

func (e *Engine) OnBlockIncorporated(incorporatedBlock *model.Block)

OnBlockIncorporated implements `OnBlockIncorporated` from the `hotstuff.FinalizationConsumer` It processes all execution results that were incorporated in parent block payload.

CAUTION: the input to this callback is treated as trusted; precautions should be taken that messages from external nodes cannot be considered as inputs to this function

func (*Engine) OnFinalizedBlock added in v0.17.6

func (e *Engine) OnFinalizedBlock(*model.Block)

OnFinalizedBlock implements the `OnFinalizedBlock` callback from the `hotstuff.FinalizationConsumer` It informs sealing.Core about finalization of respective block.

CAUTION: the input to this callback is treated as trusted; precautions should be taken that messages from external nodes cannot be considered as inputs to this function

func (*Engine) Process

func (e *Engine) Process(channel channels.Channel, originID flow.Identifier, event interface{}) error

Process sends event into channel with pending events. Generally speaking shouldn't lock for too long.

func (*Engine) ProcessLocal

func (e *Engine) ProcessLocal(event interface{}) error

ProcessLocal processes an event originating on the local node.

func (*Engine) Ready

func (e *Engine) Ready() <-chan struct{}

Ready returns a ready channel that is closed once the engine has fully started. For the propagation engine, we consider the engine up and running upon initialization.

func (*Engine) Submit

func (e *Engine) Submit(channel channels.Channel, originID flow.Identifier, event interface{})

Submit submits the given event from the node with the given origin ID for processing in a non-blocking manner. It returns instantly and logs a potential processing error internally when done.

func (*Engine) SubmitLocal

func (e *Engine) SubmitLocal(event interface{})

SubmitLocal submits an event originating on the local node.

type Event

type Event struct {
	OriginID flow.Identifier
	Msg      interface{}
}

type EventSink

type EventSink chan *Event // Channel to push pending events

Jump to

Keyboard shortcuts

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