Sigil documentation
ReferenceRust referencesigil-consensus

sigil-consensus · epoch

Source declarations, signatures and documentation for epoch.

Source: sigil/node/sigil-consensus/src/epoch.rs. SHA-256: c9c4786c017569df296bfb09580bfb349458ce50254b7ec11c78079ef6c5bc8a.

This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.

epoch::EpochInfo

Information about a specific epoch.

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct EpochInfo {
/// Epoch number (0-indexed).

pub epoch: u64,
/// First block height in this epoch (inclusive).

pub start_height: u64,
/// Last block height in this epoch (inclusive).

pub end_height: u64,
/// The active validator set for this epoch.

pub validator_set: ValidatorSet,
/// Randomness beacon seed for proposer election and other protocol randomness.

pub epoch_seed: SigilHash
}

Source line: 16.

epoch::epoch_for_height

Returns the epoch number for a given block height.

Uses the constant BLOCKS_PER_EPOCH from sigil_core.

pub fn epoch_for_height(height: u64) -> u64;

Source line: 32.

epoch::start_height_for_epoch

Returns the first block height for a given epoch.

pub fn start_height_for_epoch(epoch: u64) -> u64;

Source line: 37.

epoch::end_height_for_epoch

Returns the last block height for a given epoch (inclusive).

pub fn end_height_for_epoch(epoch: u64) -> u64;

Source line: 42.

epoch::is_epoch_boundary

Returns true if the given height is the first block of a new epoch.

Height 0 (genesis) is always an epoch boundary.

pub fn is_epoch_boundary(height: u64) -> bool;

Source line: 49.

epoch::transition_epoch

Transition to a new epoch.

Derives a new epoch seed by hashing the current seed with the transition height, and creates a new EpochInfo with the provided validator set.

pub fn transition_epoch(
    current: &EpochInfo,
    new_validators: ValidatorSet,
) -> Result<EpochInfo, ConsensusError>;

Source line: 57.

epoch::genesis_epoch

Create the genesis epoch (epoch 0).

pub fn genesis_epoch(validator_set: ValidatorSet, genesis_seed: SigilHash) -> EpochInfo;

Source line: 88.

On this page