compliance

package
v0.29.6 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2023 License: AGPL-3.0 Imports: 26 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Core added in v0.15.0

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

Core contains the central business logic for the main consensus' compliance engine. It is responsible for handling communication for the embedded consensus algorithm. CAUTION with CONCURRENCY:

  • At the moment, compliance.Core _can not_ process blocks concurrently. Callers of `OnBlockProposal` need to ensure single-threaded access.
  • The only exception is calls to `ProcessFinalizedView`, which is the only concurrency-safe method of compliance.Core

func NewCore added in v0.15.0

func NewCore(
	log zerolog.Logger,
	collector module.EngineMetrics,
	mempool module.MempoolMetrics,
	hotstuffMetrics module.HotstuffMetrics,
	complianceMetrics module.ComplianceMetrics,
	tracer module.Tracer,
	cleaner storage.Cleaner,
	headers storage.Headers,
	payloads storage.Payloads,
	state protocol.MutableState,
	pending module.PendingBlockBuffer,
	sync module.BlockRequester,
	validator hotstuff.Validator,
	hotstuff module.HotStuff,
	voteAggregator hotstuff.VoteAggregator,
	timeoutAggregator hotstuff.TimeoutAggregator,
	opts ...compliance.Opt,
) (*Core, error)

NewCore instantiates the business logic for the main consensus' compliance engine.

func (*Core) OnBlockProposal added in v0.15.0

func (c *Core) OnBlockProposal(originID flow.Identifier, proposal *messages.BlockProposal) error

OnBlockProposal handles incoming block proposals. No errors are expected during normal operation. All returned exceptions are potential symptoms of internal state corruption and should be fatal.

func (*Core) ProcessFinalizedBlock added in v0.29.0

func (c *Core) ProcessFinalizedBlock(finalized *flow.Header)

ProcessFinalizedBlock performs pruning of stale data based on finalization event removes pending blocks below the finalized view

type Engine

type Engine struct {
	*component.ComponentManager
	// contains filtered or unexported fields
}

Engine is a wrapper around `compliance.Core`. The Engine queues inbound messages, relevant node-internal notifications, and manages the worker routines processing the inbound events, and forwards outbound messages to the networking layer. `compliance.Core` implements the actual compliance logic. Implements consensus.Compliance interface.

func NewEngine added in v0.15.0

func NewEngine(
	log zerolog.Logger,
	me module.Local,
	core *Core,
) (*Engine, error)

func (*Engine) OnBlockProposal added in v0.29.0

func (e *Engine) OnBlockProposal(proposal flow.Slashable[messages.BlockProposal])

OnBlockProposal feeds a new block proposal into the processing pipeline. Incoming proposals are queued and eventually dispatched by worker.

func (*Engine) OnFinalizedBlock added in v0.25.0

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

OnFinalizedBlock implements the `OnFinalizedBlock` callback from the `hotstuff.FinalizationConsumer` It informs compliance.Core about finalization of the 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) OnSyncedBlock added in v0.29.0

func (e *Engine) OnSyncedBlock(syncedBlock flow.Slashable[messages.BlockProposal])

OnSyncedBlock feeds a block obtained from sync proposal into the processing pipeline. Incoming proposals are queued and eventually dispatched by worker.

Jump to

Keyboard shortcuts

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