Sigil documentation
ReferenceRust referencesigil-tower

sigil-tower · slot

Source declarations, signatures and documentation for slot.

Source: sigil/node/sigil-tower/src/slot.rs. SHA-256: 522b4cb6ae50e40f48b825aa18d78c5fb9735c43cde89a0549cb2e0749202d84.

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.

slot::SLOT_DURATION_SECS

Duration of a single slot in seconds.

pub const SLOT_DURATION_SECS: u64;

Source line: 12.

slot::SLOTS_PER_EPOCH

Number of slots per epoch (~24 hours at 12s/slot).

pub const SLOTS_PER_EPOCH: u64;

Source line: 15.

slot::SlotClock

Slot clock that derives all timing from a genesis timestamp.

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct SlotClock {

}

Source line: 19.

slot::SlotClock::new

Create a new slot clock anchored to the given genesis timestamp.

pub fn new(genesis_time: u64) -> Self;

Source line: 26.

slot::SlotClock::genesis_time

Returns the genesis time.

pub fn genesis_time(&self) -> u64;

Source line: 31.

slot::SlotClock::current_slot

Returns the current slot number given the current Unix timestamp.

If now is before genesis, returns 0.

pub fn current_slot(&self, now: u64) -> u64;

Source line: 38.

slot::SlotClock::slot_start_time

Returns the start time (Unix timestamp) of the given slot.

SECURITY: Uses saturating arithmetic to prevent overflow for very large slot numbers. Without this, an attacker could supply a slot value that overflows slot * SLOT_DURATION_SECS, wrapping the timestamp to a past value and confusing consensus timing checks.

pub fn slot_start_time(&self, slot: u64) -> u64;

Source line: 51.

slot::SlotClock::slot_epoch

Returns the epoch number that the given slot belongs to.

pub fn slot_epoch(&self, slot: u64) -> u64;

Source line: 57.

slot::SlotClock::epoch_start_slot

Returns the first slot of the given epoch.

pub fn epoch_start_slot(&self, epoch: u64) -> u64;

Source line: 62.

slot::SlotClock::is_first_slot_of_epoch

Returns true if the given slot is the first slot of its epoch.

pub fn is_first_slot_of_epoch(&self, slot: u64) -> bool;

Source line: 67.

slot::SlotClock::slots_since_epoch_start

Returns how many slots have elapsed since the start of the given slot's epoch.

pub fn slots_since_epoch_start(&self, slot: u64) -> u64;

Source line: 72.

slot::SlotClock::is_slot_missed

Returns true if the given slot has been missed (its time window has passed).

A slot is considered missed if now is past the end of the slot's time window (i.e., past slot_start_time(slot) + SLOT_DURATION_SECS).

pub fn is_slot_missed(&self, slot: u64, now: u64) -> bool;

Source line: 80.

slot::SlotClock::slot_info

Build a SlotInfo for the given slot.

pub fn slot_info(&self, slot: u64) -> SlotInfo;

Source line: 87.

On this page