Skip to main content

Crate solana_clock

Crate solana_clock 

Source
Expand description

Information about the network’s clock, ticks, slots, etc.

Time in Solana is marked primarily by slots, which are numbered sequentially. For every slot, a leader is chosen from the validator set, and that leader is expected to produce a new block, though sometimes leaders may fail to do so. Blocks can be identified by their slot number, and some slots do not contain a block.

An approximation of the passage of real-world time can be calculated by multiplying a number of slots by DEFAULT_MS_PER_SLOT, which is the SDK’s default target time for the network to produce slots. Note though that this method suffers a variable amount of drift, as the network does not produce slots at exactly the target rate. Furthermore, the effective target is changed dynamically by SIMD-0525, so clients that require the cluster’s current value must not assume the SDK default reflects the cluster.

The network’s current view of the real-world time can always be accessed via Clock::unix_timestamp, which is produced by an oracle derived from the validator set.

Modules§

sysvarsysvar

Structs§

Clock
A representation of network time.

Constants§

DEFAULT_DEV_SLOTS_PER_EPOCH
DEFAULT_HASHES_PER_SECOND
DEFAULT_HASHES_PER_TICK
DEFAULT_HASHES_PER_TICK_200_MS
DEFAULT_HASHES_PER_TICK_250_MS
DEFAULT_HASHES_PER_TICK_300_MS
DEFAULT_HASHES_PER_TICK_350_MS
DEFAULT_HASHES_PER_TICK_400_MS
DEFAULT_MS_PER_SLOT
The SDK’s default expected duration of a slot (300 milliseconds).
DEFAULT_MS_PER_SLOT_200_MS
DEFAULT_MS_PER_SLOT_250_MS
DEFAULT_MS_PER_SLOT_300_MS
DEFAULT_MS_PER_SLOT_350_MS
DEFAULT_MS_PER_SLOT_400_MS
DEFAULT_NS_PER_SLOT
The SDK’s default expected duration of a slot, in nanoseconds.
DEFAULT_NS_PER_SLOT_200_MS
DEFAULT_NS_PER_SLOT_250_MS
DEFAULT_NS_PER_SLOT_300_MS
DEFAULT_NS_PER_SLOT_350_MS
DEFAULT_NS_PER_SLOT_400_MS
DEFAULT_NS_PER_TICK
The default duration of a tick, in nanoseconds.
DEFAULT_NS_PER_TICK_200_MS
DEFAULT_NS_PER_TICK_250_MS
DEFAULT_NS_PER_TICK_300_MS
DEFAULT_NS_PER_TICK_350_MS
DEFAULT_NS_PER_TICK_400_MS
DEFAULT_SLOTS_PER_EPOCH
The number of slots per epoch after initial network warmup.
DEFAULT_S_PER_SLOT
DEFAULT_S_PER_SLOT_200_MS
DEFAULT_S_PER_SLOT_250_MS
DEFAULT_S_PER_SLOT_300_MS
DEFAULT_S_PER_SLOT_350_MS
DEFAULT_S_PER_SLOT_400_MS
DEFAULT_TICKS_PER_SECOND
The default whole-number tick rate (213 per second).
DEFAULT_TICKS_PER_SECOND_200_MS
DEFAULT_TICKS_PER_SECOND_250_MS
DEFAULT_TICKS_PER_SECOND_300_MS
DEFAULT_TICKS_PER_SECOND_350_MS
DEFAULT_TICKS_PER_SECOND_400_MS
Whole ticks per second at each target slot time.
DEFAULT_TICKS_PER_SLOT
The number of ticks in a slot.
FORWARD_TRANSACTIONS_TO_LEADER_AT_SLOT_OFFSET
Transaction forwarding, which leader to forward to and how long to hold
GENESIS_EPOCH
HOLD_TRANSACTIONS_SLOT_OFFSET
INITIAL_RENT_EPOCH
MAX_HASH_AGE_IN_SECONDS
MAX_HASH_AGE_IN_SECONDS_200_MS
MAX_HASH_AGE_IN_SECONDS_250_MS
MAX_HASH_AGE_IN_SECONDS_300_MS
MAX_HASH_AGE_IN_SECONDS_350_MS
MAX_HASH_AGE_IN_SECONDS_400_MS
The time window of recent block hash values over which the bank will track signatures.
MAX_PROCESSING_AGE
MAX_RECENT_BLOCKHASHES
MAX_TRANSACTION_FORWARDING_DELAY
More delay is expected if CUDA is not enabled (as signature verification takes longer)
MAX_TRANSACTION_FORWARDING_DELAY_GPU
This is maximum time consumed in forwarding a transaction from one node to next, before it can be processed in the target node
MS_PER_TICK
The number of whole milliseconds per tick (4).
MS_PER_TICK_200_MS
MS_PER_TICK_250_MS
MS_PER_TICK_300_MS
MS_PER_TICK_350_MS
MS_PER_TICK_400_MS
SECONDS_PER_DAY
SIZE
Serialized size of the Clock sysvar account.
TICKS_PER_DAY
TICKS_PER_DAY_200_MS
TICKS_PER_DAY_250_MS
TICKS_PER_DAY_300_MS
TICKS_PER_DAY_350_MS
TICKS_PER_DAY_400_MS

Type Aliases§

BankId
Uniquely distinguishes every version of a slot.
Epoch
The unit of time a given leader schedule is honored.
Slot
The unit of time given to a leader for encoding a block.
SlotCount
The number of slots in a epoch.
SlotIndex
An index to the slots of a epoch.
UnixTimestamp
An approximate measure of real-world time.