Documentation ¶
Index ¶
- Constants
- type Config
- type Core
- func (c *Core) ProcessApproval(approval *flow.ResultApproval) error
- func (c *Core) ProcessFinalizedBlock(finalizedBlockID flow.Identifier) error
- func (c *Core) ProcessIncorporatedResult(result *flow.IncorporatedResult) error
- func (c *Core) RepopulateAssignmentCollectorTree(payloads storage.Payloads) error
- type Engine
- func (e *Engine) Done() <-chan struct{}
- func (e *Engine) OnBlockIncorporated(incorporatedBlock *model.Block)
- func (e *Engine) OnFinalizedBlock(*model.Block)
- func (e *Engine) Process(channel network.Channel, originID flow.Identifier, event interface{}) error
- func (e *Engine) ProcessLocal(event interface{}) error
- func (e *Engine) Ready() <-chan struct{}
- func (e *Engine) Submit(channel network.Channel, originID flow.Identifier, event interface{})
- func (e *Engine) SubmitLocal(event interface{})
- type Event
- type EventSink
Constants ¶
const DefaultEmergencySealingActive = false
DefaultEmergencySealingActive is a flag which indicates when emergency sealing is active, this is a temporary measure to make fire fighting easier while seal & verification is under development.
const DefaultRequiredApprovalsForSealConstruction = 1
DefaultRequiredApprovalsForSealConstruction is the default number of approvals required to construct a candidate seal for subsequent inclusion in block. when set to 1, it requires at least 1 approval to build a seal when set to 0, it can build seal without any approval
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v0.17.6
type Config struct { EmergencySealingActive bool // flag which indicates if emergency sealing is active or not. NOTE: this is temporary while sealing & verification is under development RequiredApprovalsForSealConstruction uint // min number of approvals required for constructing a candidate seal ApprovalRequestsThreshold uint64 // threshold for re-requesting approvals: min height difference between the latest finalized block and the block incorporating a result }
Config is a structure of values that configure behavior of sealing engine
func DefaultConfig ¶ added in v0.17.6
func DefaultConfig() Config
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, config Config, ) (*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
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.Network, 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, options Config, ) (*Engine, error)
NewEngine constructs new `Engine` which runs on it's own unit.
func (*Engine) OnBlockIncorporated ¶ added in v0.17.6
OnBlockIncorporated implements `OnBlockIncorporated` from the `hotstuff.FinalizationConsumer`
(1) 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
OnFinalizedBlock implements the `OnFinalizedBlock` callback from the `hotstuff.FinalizationConsumer`
(1) 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 network.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 ¶
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 network.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{} }