Module utils

Source
Expand description

Utility functions, type aliases, helper structs and enum definitions.

Structs§

BuilderCommitment
Commitment that builders use to sign block options. A thin wrapper around a Sha256 digest.
RoundFinishedEvent
A struct containing information about a finished round.
View
This exists so we can perform state transitions mutably

Enums§

EpochTransitionIndicator
A helper enum to indicate whether a node is in the epoch transition A node is in epoch transition when its high QC is for the last block in an epoch
Terminator
Whether or not to stop inclusively or exclusively when walking
ViewInner
A view’s state

Functions§

bincode_opts
For the wire format, we use bincode with the following options:
epoch_from_block_number
Returns an epoch number given a block number and an epoch height
genesis_epoch_from_version
Returns Some(1) if epochs are enabled by V::Base, otherwise returns None
is_epoch_root
Returns true if the given block number is the third from the last in the epoch based on the given epoch height.
is_epoch_transition
Returns true if the block is part of the epoch transition (including the last non null block)
is_first_transition_block
returns true if it’s the first transition block (epoch height - 2)
is_ge_epoch_root
Returns true if the given block number is equal or greater than the epoch root block
is_gt_epoch_root
Returns true if the given block number is strictly greater than the epoch root block
is_last_block
Returns true if the block is the last block in the epoch
is_middle_transition_block
Returns true if the block number is in trasntion but not the transition block or the last block in the epoch.
is_transition_block
Return true if the given block number is the final full block, the “transition block”
mnemonic
A function for generating a cute little user mnemonic from a hash
option_epoch_from_block_number
Returns an Option<Epoch> based on a boolean condition of whether or not epochs are enabled, a block number, and the epoch height. If epochs are disabled or the epoch height is zero, returns None.
root_block_in_epoch
Returns the block number of the epoch root in the given epoch
transition_block_for_epoch
Get the block height of the transition block for the given epoch
verify_leaf_chain

Type Aliases§

LeafCommitment
The hash of a leaf.
Sha256Digest 🔒
Type alias for byte array of SHA256 digest length
StateAndDelta
Optional validated state and state delta.