ab_client_consensus_common/
lib.rs

1pub mod consensus_parameters;
2
3use ab_core_primitives::block::{BlockNumber, BlockTimestamp};
4use ab_core_primitives::pot::{SlotDuration, SlotNumber};
5use ab_core_primitives::segments::HistorySize;
6
7/// Proof-of-time consensus constants
8#[derive(Debug, PartialEq, Eq, Clone, Copy)]
9pub struct PotConsensusConstants {
10    /// Interval, in blocks, between blockchain entropy injection into proof of time chain.
11    pub entropy_injection_interval: BlockNumber,
12    /// Interval, in entropy injection intervals, where to take entropy for injection from.
13    pub entropy_injection_lookback_depth: u8,
14    /// Delay after block, in slots, when entropy injection takes effect.
15    pub entropy_injection_delay: SlotNumber,
16}
17
18/// Consensus constants
19#[derive(Debug, PartialEq, Eq, Clone, Copy)]
20pub struct ConsensusConstants {
21    /// Depth `K` after which a block enters the recorded history
22    pub confirmation_depth_k: BlockNumber,
23    /// Number of slots between slot arrival and when corresponding block can be produced
24    pub block_authoring_delay: SlotNumber,
25    /// Proof-of-time consensus constants
26    pub pot: PotConsensusConstants,
27    /// Era duration in blocks
28    pub era_duration: BlockNumber,
29    /// Slot probability
30    pub slot_probability: (u64, u64),
31    /// The slot duration in milliseconds
32    pub slot_duration: SlotDuration,
33    /// Number of latest archived segments that are considered "recent history"
34    pub recent_segments: HistorySize,
35    /// Fraction of pieces from the "recent history" (`recent_segments`) in each sector
36    pub recent_history_fraction: (HistorySize, HistorySize),
37    /// Minimum lifetime of a plotted sector, measured in archived segment
38    pub min_sector_lifetime: HistorySize,
39    /// Max block timestamp drift allowed
40    pub max_block_timestamp_drift: BlockTimestamp,
41}