matching

package
v0.29.6 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

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

func DefaultConfig() Config

type Core

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

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

func (c *Core) OnBlockFinalization() error

func (*Core) ProcessReceipt

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

func NewEngine(
	log zerolog.Logger,
	net network.Network,
	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

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

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