Module types

Module types 

Source
Expand description

Consensus types shared across the crate.

This module defines the core types used throughout the consensus implementation:

  • Epoch: Represents a distinct segment of a contiguous sequence of views. When the validator set changes, the epoch increments. Epochs provide reconfiguration boundaries for the consensus protocol.

  • View: A monotonically increasing counter within a single epoch, representing individual consensus rounds. Views advance as the protocol progresses through proposals and votes.

  • Round: Combines an epoch and view into a single identifier for a consensus round. Provides ordering across epoch boundaries.

  • Delta: A generic type representing offsets or durations for consensus types. Provides type safety to prevent mixing epoch and view deltas. Type aliases EpochDelta and ViewDelta are provided for convenience.

  • Epocher: Mechanism for determining epoch boundaries.

§Arithmetic Safety

Arithmetic operations avoid silent errors. Only next() panics on overflow. All other operations either saturate or return Option.

§Type Conversions

Explicit type constructors (Epoch::new(), View::new()) are required to create instances from raw integers. Implicit conversions via, e.g. From<u64> are intentionally not provided to prevent accidental type misuse.

Structs§

Delta
A generic type representing offsets or durations for consensus types.
Epoch
Represents a distinct segment of a contiguous sequence of views.
EpochInfo
Information about an epoch relative to a specific height.
FixedEpocher
Implementation of Epocher for fixed epoch lengths.
Round
A unique identifier combining epoch and view for a consensus round.
View
A monotonically increasing counter within a single epoch.
ViewRange
An iterator over a range of views.

Enums§

EpochPhase
Represents the relative position within an epoch.

Traits§

Epocher
Mechanism for determining epoch boundaries.

Type Aliases§

EpochDelta
Type alias for epoch offsets and durations.
ViewDelta
Type alias for view offsets and durations.