matching

package
v0.38.0-preview.0.0.7 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: AGPL-3.0 Imports: 24 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v0.17.6

type Config struct {
	SealingThreshold    uint // threshold between sealed and finalized blocks
	MaxResultsToRequest uint // maximum number of receipts to request
}

Config is a structure of values that configure behavior of matching engine

func DefaultConfig added in v0.17.6

func DefaultConfig() Config

type Core added in v0.15.0

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

Core represents the matching business logic, used to process receipts received from p2p network. Performs processing of pending receipts, storing of receipts and re-requesting missing execution receipts.

func NewCore added in v0.15.0

func NewCore(
	log zerolog.Logger,
	tracer module.Tracer,
	metrics module.ConsensusMetrics,
	mempool module.MempoolMetrics,
	state protocol.State,
	headersDB storage.Headers,
	receiptsDB storage.ExecutionReceipts,
	receipts mempool.ExecutionTree,
	pendingReceipts mempool.PendingReceipts,
	seals mempool.IncorporatedResultSeals,
	receiptValidator module.ReceiptValidator,
	receiptRequester module.Requester,
	config Config,
) *Core

func (*Core) OnBlockFinalization added in v0.19.0

func (c *Core) OnBlockFinalization() error

func (*Core) ProcessReceipt added in v0.17.6

func (c *Core) ProcessReceipt(receipt *flow.ExecutionReceipt) error

ProcessReceipt processes a new execution receipt. Any error indicates an unexpected problem in the protocol logic. The node's internal state might be corrupted. Hence, returned errors should be treated as fatal.

type Engine

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

Engine is a wrapper struct for `Core` which implements consensus algorithm. Engine is responsible for handling incoming messages, queueing for processing, broadcasting proposals.

func NewEngine added in v0.15.0

func NewEngine(
	log zerolog.Logger,
	net network.EngineRegistry,
	me module.Local,
	engineMetrics module.EngineMetrics,
	mempool module.MempoolMetrics,
	state protocol.State,
	receipts storage.ExecutionReceipts,
	index storage.Index,
	core sealing.MatchingCore) (*Engine, error)

func (*Engine) Done

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

Done returns a done channel that is closed once the engine has fully stopped. For the consensus engine, we wait for hotstuff to finish.

func (*Engine) HandleReceipt

func (e *Engine) HandleReceipt(originID flow.Identifier, receipt flow.Entity)

HandleReceipt ingests receipts from the Requester module.

func (*Engine) OnBlockIncorporated added in v0.14.3

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

OnBlockIncorporated implements the `OnBlockIncorporated` callback from the `hotstuff.FinalizationConsumer` 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.14.1

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

OnFinalizedBlock implements the `OnFinalizedBlock` callback from the `hotstuff.FinalizationConsumer` 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 processes the given event from the node with the given origin ID in a blocking manner. It returns the potential processing error when done.

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 consensus engine, this is true once the underlying consensus algorithm has started.

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.

Jump to

Keyboard shortcuts

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