cluster

package
v0.37.22-verify-backwa... Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: AGPL-3.0 Imports: 3 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanonicalClusterID

func CanonicalClusterID(epoch uint64, participants flow.IdentifierList) flow.ChainID

CanonicalClusterID returns the canonical chain ID for the given cluster in the given epoch.

func CanonicalRootBlock

func CanonicalRootBlock(epoch uint64, participants flow.IdentitySkeletonList) *cluster.Block

CanonicalRootBlock returns the canonical root block for the given cluster in the given epoch. It contains an empty collection referencing

Types

type MutableState added in v0.14.0

type MutableState interface {
	State
	// Extend introduces the given block into the cluster state as a pending
	// without modifying the current finalized state.
	// The block's parent must have already been successfully inserted.
	// Expected errors during normal operations:
	//   - state.OutdatedExtensionError if the candidate block is outdated (e.g. orphaned)
	//   - state.UnverifiableExtensionError if the reference block is _not_ a known finalized block
	//   - state.InvalidExtensionError if the candidate block is invalid
	Extend(candidate *cluster.Block) error
}

MutableState allows extending the cluster state in a consistent manner that preserves integrity, validity, and functionality of the database. It enforces a number of invariants on the input data to ensure internal bookkeeping mechanisms remain functional and valid.

type Params added in v0.9.6

type Params interface {
	// ChainID returns the chain ID for this cluster.
	ChainID() flow.ChainID
}

Params contains constant information about this cluster state.

type Snapshot

type Snapshot interface {

	// Collection returns the collection generated in this step of the cluster
	// state history.
	Collection() (*flow.Collection, error)

	// Head returns the latest block at the selected point of the cluster state
	// history. If the snapshot was selected by block ID, returns the header
	// with that block ID. If the snapshot was selected as final, returns the
	// latest finalized block.
	Head() (*flow.Header, error)

	// Pending returns all children IDs for the snapshot head, which thus were
	// potential extensions of the protocol state at this snapshot. The result
	// is ordered such that parents are included before their children. These
	// are NOT guaranteed to have been validated by HotStuff.
	Pending() ([]flow.Identifier, error)
}

Snapshot represents an immutable snapshot at a specific point in the cluster state history.

type State

type State interface {

	// Params returns constant information about the cluster state.
	Params() Params

	// Final returns the snapshot of the cluster state at the latest finalized
	// block. The returned snapshot is therefore immutable over time.
	Final() Snapshot

	// AtBlockID returns the snapshot of the persistent cluster at the given
	// block ID. It is available for any block that was introduced into the
	// the cluster state, and can thus represent an ambiguous state that was or
	// will never be finalized.
	AtBlockID(blockID flow.Identifier) Snapshot
}

State represents the chain state for collection node cluster consensus. It tracks which blocks are finalized and indexes blocks by number and ID. The purpose of cluster consensus is to agree on collections of transactions, so each block within the cluster state corresponds to a proposed collection.

NOTE: This is modelled after, and is a simpler version of, protocol.State.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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