consensus

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2020 License: AGPL-3.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExecForkActor

type ExecForkActor func([]*flow.IncorporatedResultSeal)

func LogForkAndCrash

func LogForkAndCrash(log zerolog.Logger) ExecForkActor

type ExecForkSuppressor

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

ExecForkSuppressor is a wrapper around a conventional mempool.IncorporatedResultSeals mempool. It implements the following mitigation strategy for execution forks:

  • In case two conflicting results are considered sealable for the same block, sealing should halt. Specifically, two results are considered conflicting, if they differ in their start or end state.
  • Even after a restart, the sealing should not resume.
  • We rely on human intervention to resolve the conflict.

The ExecForkSuppressor implements this mitigation strategy as follows:

  • For each candidate seal inserted into the mempool, inspect the state transition for the respective block.
  • If this is the first seal for a block, store the seal as an archetype for the state transition into the internal map `sealsForBlock`.
  • If the mempool already knows about a state transition for a block, and a second seal for the same block is inserted, check whether the seal has the same state transition.
  • If conflicting state transitions for the same block are detected, ExecForkSuppressor sets an internal flag and thereafter reports the mempool as empty, which will lead to the respective consensus node not including any more seals.
  • Evidence for an execution fork stored in a database (persisted across restarts).

Implementation is concurrency safe.

func NewExecStateForkSuppressor

func NewExecStateForkSuppressor(onExecFork ExecForkActor, seals mempool.IncorporatedResultSeals, db *badger.DB, log zerolog.Logger) (*ExecForkSuppressor, error)

func (*ExecForkSuppressor) Add

Add adds the given seal to the mempool. Return value indicates whether or not seal was added to mempool. Error returns:

  • engine.InvalidInputError (sentinel error) In case a seal fails one of the required consistency checks;

func (*ExecForkSuppressor) All

All returns all the IncorporatedResultSeals in the mempool

func (*ExecForkSuppressor) ByID

ByID returns an IncorporatedResultSeal by its ID

func (*ExecForkSuppressor) Clear

func (s *ExecForkSuppressor) Clear()

Clear removes all entities from the pool. The wrapper clears the internal state as well as its local (additional) state.

func (*ExecForkSuppressor) Limit

func (s *ExecForkSuppressor) Limit() uint

Limit returns the size limit of the mempool

func (*ExecForkSuppressor) RegisterEjectionCallbacks

func (s *ExecForkSuppressor) RegisterEjectionCallbacks(callbacks ...mempool.OnEjection)

RegisterEjectionCallbacks adds the provided OnEjection callbacks

func (*ExecForkSuppressor) Rem

Rem removes the IncorporatedResultSeal with id from the mempool

func (*ExecForkSuppressor) Size

func (s *ExecForkSuppressor) Size() uint

Size returns the number of items in the mempool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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