recovery

package
v0.36.1 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2024 License: AGPL-3.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Recover

func Recover(log zerolog.Logger, pending []*flow.Header, scanners ...BlockScanner) error

Recover is a utility method for recovering the HotStuff state after a restart. It receives the list `pending` containing _all_ blocks that

  • have passed the compliance layer and stored in the protocol state
  • descend from the latest finalized block
  • are listed in ancestor-first order (i.e. for any block B ∈ pending, B's parent must be listed before B, unless B's parent is the latest finalized block)

CAUTION: all pending blocks are required to be valid (guaranteed if the block passed the compliance layer)

Types

type BlockScanner added in v0.31.0

type BlockScanner func(proposal *model.Proposal) error

BlockScanner describes a function for ingesting pending blocks. Any returned errors are considered fatal.

func CollectParentQCs added in v0.31.0

func CollectParentQCs(collector Collector[*flow.QuorumCertificate]) BlockScanner

CollectParentQCs collects all parent QCs included in the blocks descending from the latest finalized block. Caution, input blocks must be valid.

func CollectTCs added in v0.31.0

func CollectTCs(collector Collector[*flow.TimeoutCertificate]) BlockScanner

CollectTCs collect all TCs included in the blocks descending from the latest finalized block. Caution, input blocks must be valid.

func ForksState added in v0.31.0

func ForksState(forks hotstuff.Forks) BlockScanner

ForksState recovers Forks' internal state of blocks descending from the latest finalized block. Caution, input blocks must be valid and in parent-first order (unless parent is the latest finalized block).

func VoteAggregatorState added in v0.31.0

func VoteAggregatorState(voteAggregator hotstuff.VoteAggregator) BlockScanner

VoteAggregatorState recovers the VoteAggregator's internal state as follows:

  • Add all blocks descending from the latest finalized block to accept votes. Those blocks should be rapidly pruned as the node catches up.

Caution: input blocks must be valid.

type Collector added in v0.31.0

type Collector[T any] struct {
	// contains filtered or unexported fields
}

Collector for objects of generic type. Essentially, it is a stateful list. Safe to be passed by value. Retrieve() returns the current state of the list and is unaffected by subsequent appends.

func NewCollector added in v0.31.0

func NewCollector[T any]() Collector[T]

func (Collector[T]) Append added in v0.31.0

func (c Collector[T]) Append(t ...T)

Append adds new elements to the end of the list.

func (Collector[T]) Retrieve added in v0.31.0

func (c Collector[T]) Retrieve() []T

Retrieve returns the current state of the list (unaffected by subsequent append)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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