datastore

package
v0.40.1-unsafe-follower Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2025 License: AGPL-3.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidRootSnapshot

func IsValidRootSnapshot(snap protocol.Snapshot, verifyResultID bool) error

IsValidRootSnapshot checks internal consistency of root state snapshot if verifyResultID allows/disallows Result ID verification

func IsValidRootSnapshotQCs

func IsValidRootSnapshotQCs(snap protocol.Snapshot) error

IsValidRootSnapshotQCs checks internal consistency of QCs that are included in the root state snapshot It verifies QCs for main consensus and for each collection cluster.

func ReadFinalizedRoot

func ReadFinalizedRoot(db storage.DB) (*flow.Header, error)

ReadFinalizedRoot retrieves the root block's header from the database. This information is immutable for the runtime of the software and may be cached.

func ReadGlobalParams

func ReadGlobalParams(db storage.DB) (*inmem.Params, error)

ReadGlobalParams reads the global parameters from the database and returns them as in-memory representation. No errors are expected during normal operation.

func ValidRootSnapshotContainsEntityExpiryRange

func ValidRootSnapshotContainsEntityExpiryRange(snapshot protocol.Snapshot) error

ValidRootSnapshotContainsEntityExpiryRange performs a sanity check to make sure the root snapshot has enough history to encompass at least one full entity expiry window. Entities (in particular transactions and collections) may reference a block within the past `flow.DefaultTransactionExpiry` blocks, so a new node must begin with at least this many blocks worth of history leading up to the snapshot's root block.

Currently, Access Nodes and Consensus Nodes require root snapshots passing this validator function.

  • Consensus Nodes because they process guarantees referencing past blocks
  • Access Nodes because they index transactions referencing past blocks

One of the following conditions must be satisfied to pass this validation:

  1. This is a snapshot build from a first block of spork -> there is no earlier history which transactions/collections could reference
  2. This snapshot sealing segment contains at least one expiry window of blocks -> all possible reference blocks in future transactions/collections will be within the initial history.
  3. This snapshot sealing segment includes the spork root block -> there is no earlier history which transactions/collections could reference

Types

type InstanceParams

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

InstanceParams implements the interface protocol.InstanceParams. All functions are served on demand directly from the database, _without_ any caching.

func ReadInstanceParams

func ReadInstanceParams(db storage.DB, headers storage.Headers, seals storage.Seals) (*InstanceParams, error)

ReadInstanceParams reads the instance parameters from the database and returns them as in-memory representation. No errors are expected during normal operation.

func (*InstanceParams) FinalizedRoot

func (p *InstanceParams) FinalizedRoot() *flow.Header

FinalizedRoot returns the finalized root header of the current protocol state. This will be the head of the protocol state snapshot used to bootstrap this state and may differ from node to node for the same protocol state.

func (*InstanceParams) Seal

func (p *InstanceParams) Seal() *flow.Seal

Seal returns the root block seal of the current protocol state. This is the seal for the `SealedRoot` block that was used to bootstrap this state. It may differ from node to node.

func (*InstanceParams) SealedRoot

func (p *InstanceParams) SealedRoot() *flow.Header

SealedRoot returns the sealed root block. If it's different from FinalizedRoot() block, it means the node is bootstrapped from mid-spork.

type Params

type Params struct {
	protocol.GlobalParams
	protocol.InstanceParams
}

Jump to

Keyboard shortcuts

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