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 aliasesEpochDeltaandViewDeltaare 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.
- Epoch
Info - Information about an epoch relative to a specific height.
- Fixed
Epocher - Implementation of
Epocherfor fixed epoch lengths. - Round
- A unique identifier combining epoch and view for a consensus round.
- View
- A monotonically increasing counter within a single epoch.
- View
Range - An iterator over a range of views.
Enums§
- Epoch
Phase - Represents the relative position within an epoch.
Traits§
- Epocher
- Mechanism for determining epoch boundaries.
Type Aliases§
- Epoch
Delta - Type alias for epoch offsets and durations.
- View
Delta - Type alias for view offsets and durations.