Documentation
¶
Index ¶
- Constants
- func IsValidRootSnapshot(snap protocol.Snapshot, verifyResultID bool) error
- func IsValidRootSnapshotQCs(snap protocol.Snapshot) error
- func NewVersionedInstanceParams(version uint64, finalizedRootID flow.Identifier, sealedRootID flow.Identifier, ...) (*flow.VersionedInstanceParams, error)
- func ValidRootSnapshotContainsEntityExpiryRange(snapshot protocol.Snapshot) error
- type InstanceParams
- type InstanceParamsV0
- type Params
Constants ¶
const DefaultInstanceParamsVersion = 0
Variables ¶
This section is empty.
Functions ¶
func IsValidRootSnapshot ¶
IsValidRootSnapshot checks internal consistency of root state snapshot if verifyResultID allows/disallows Result ID verification
func IsValidRootSnapshotQCs ¶
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 NewVersionedInstanceParams ¶
func NewVersionedInstanceParams( version uint64, finalizedRootID flow.Identifier, sealedRootID flow.Identifier, sporkRootBlockID flow.Identifier, ) (*flow.VersionedInstanceParams, error)
NewVersionedInstanceParams constructs a versioned binary blob representing the `InstanceParams`. Conceptually, the values in the `InstanceParams` are immutable during the lifetime of a node. However, versioning allows extending `InstanceParams` with new fields in the future.
No errors are expected during normal operation.
func ValidRootSnapshotContainsEntityExpiryRange ¶
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:
- This is a snapshot build from a first block of spork -> there is no earlier history which transactions/collections could reference
- 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.
- 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 values are cached after construction and do not incur database reads.
func ReadInstanceParams ¶
func ReadInstanceParams( r storage.Reader, headers storage.Headers, seals storage.Seals, blocks storage.Blocks, ) (*InstanceParams, error)
ReadInstanceParams reads the instance parameters from the database and returns them as in-memory representation. It serves as a constructor for InstanceParams and only requires read-only access to the database (we never write). This information is immutable for the lifetime of a node and may be cached. 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.
func (*InstanceParams) SporkRootBlock ¶
func (p *InstanceParams) SporkRootBlock() *flow.Block
SporkRootBlock returns the root block for the present spork.
type InstanceParamsV0 ¶
type InstanceParamsV0 struct { // FinalizedRootID is the ID of the finalized root block. FinalizedRootID flow.Identifier // SealedRootID is the ID of the sealed root block. SealedRootID flow.Identifier // SporkRootBlockID is the root block's ID for the present spork this node participates in. SporkRootBlockID flow.Identifier }
InstanceParamsV0 is the consolidated, serializable form of protocol instance parameters that are constant throughout the lifetime of a node.
type Params ¶
type Params struct { protocol.GlobalParams protocol.InstanceParams }