pub struct ConsensusConstants {Show 13 fields
pub block_confirmation_depth: BlockNumber,
pub shard_confirmation_depth: BlockNumber,
pub block_authoring_delay: SlotNumber,
pub pot: PotConsensusConstants,
pub retarget_interval: BlockNumber,
pub slot_probability: (u64, u64),
pub slot_duration: SlotDuration,
pub recent_segments: HistorySize,
pub recent_history_fraction: (HistorySize, HistorySize),
pub min_sector_lifetime: HistorySize,
pub max_block_timestamp_drift: BlockTimestamp,
pub shard_rotation_interval: BlockNumber,
pub shard_rotation_delay: BlockNumber,
}Expand description
Consensus constants
Fields§
§block_confirmation_depth: BlockNumberDepth at which a block is confirmed and enters the recorded history.
When block n is built, the block at n - block_confirmation_depth is confirmed, so the
largest possible reorg is block_confirmation_depth - 1 blocks. Importing the next best
block (block number best_number + 1) confirms the block at
best_number + 1 - block_confirmation_depth, so fork blocks must be above it, and blocks
up to it are the same on every chain that can still be extended. This is why they can
be referenced by block number alone.
With block_confirmation_depth = 5 and shard_confirmation_depth = 2:
block number
best_number + 1 next best block
best_number best block
best_number - 3 deepest fork blocks
best_number - 4 confirmed once the next best block is imported -+ read by the super
best_number - 5 confirmed | segment derivation of
best_number - 6 confirmed -+ the next best blockThe block lifecycle in the database is shown on ClientDatabaseOptions in
ab-client-database.
This is from the perspective of the individual shard, with additional confirmation on the
beacon chain required for intermediate and leaf shards (see shard_confirmation_depth).
shard_confirmation_depth: BlockNumberDepth on the beacon chain in addition to block_confirmation_depth after intermediate or
leaf shard information on the beacon chain is confirmed and corresponding segment roots
become a part of the super segment.
Segment roots included in the beacon chain block at
n - block_confirmation_depth - shard_confirmation_depth become a part of the super
segment of block n unless later beacon chain blocks up to n - block_confirmation_depth
show that their shard reorged them (see the diagram on block_confirmation_depth).
This is separate from the block confirmation on the corresponding shard itself, which
happens much sooner (see block_confirmation_depth), but can’t be immediately trusted by
the beacon chain.
Number of slots between slot arrival and when the corresponding block can be produced
pot: PotConsensusConstantsProof-of-time consensus constants
retarget_interval: BlockNumberPeriod of time in blocks after which the solution range is adjusted
slot_probability: (u64, u64)Slot probability
slot_duration: SlotDurationThe slot duration in milliseconds
recent_segments: HistorySizeNumber of latest archived segments that are considered “recent history”
recent_history_fraction: (HistorySize, HistorySize)Fraction of pieces from the “recent history” (recent_segments) in each sector
min_sector_lifetime: HistorySizeMinimum lifetime of a plotted sector, measured in archived segments
max_block_timestamp_drift: BlockTimestampMax block timestamp drift allowed
shard_rotation_interval: BlockNumberNumber of beacon chain blocks between shard rotations.
Every this number of beacon chain blocks PoT entropy is taken to calculate the next shard assignment.
shard_rotation_delay: BlockNumberDelay in beacon chain blocks for the next shard rotation.
Delay after shard assignment is revealed before it actually takes effect (essentially the amount of time for a node to sync the corresponding shard).
Trait Implementations§
Source§impl Clone for ConsensusConstants
impl Clone for ConsensusConstants
impl Copy for ConsensusConstants
Source§impl Debug for ConsensusConstants
impl Debug for ConsensusConstants
impl Eq for ConsensusConstants
Source§impl PartialEq for ConsensusConstants
impl PartialEq for ConsensusConstants
impl StructuralPartialEq for ConsensusConstants
Auto Trait Implementations§
impl Forget for ConsensusConstants
impl Freeze for ConsensusConstants
impl RefUnwindSafe for ConsensusConstants
impl Send for ConsensusConstants
impl Sync for ConsensusConstants
impl Unpin for ConsensusConstants
impl UnsafeUnpin for ConsensusConstants
impl UnwindSafe for ConsensusConstants
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more