Skip to main content

Module sysvar

Module sysvar 

Source
Expand description

Sysvar access via direct syscalls.

Provides zero-alloc, zero-deserialization access to Solana sysvars by reading them directly into stack buffers via syscalls, including the epoch schedule sysvar.

Structs§

Clock
Clock sysvar data, read directly from the runtime.
EpochRewards
EpochRewards sysvar data (SIMD-0118).
EpochSchedule
Epoch schedule sysvar data.
Rent
Rent sysvar data.
SlotHash
One (slot, hash) entry from the SlotHashes sysvar.
StakeHistoryEntry
One epoch’s stake-history entry.

Constants§

ACCOUNT_STORAGE_OVERHEAD
Fixed per-account storage overhead charged by the cluster.
CLOCK_ID
Clock sysvar address.
EPOCH_REWARDS_ID
EpochRewards sysvar address (SIMD-0118).
EPOCH_SCHEDULE_ID
Epoch schedule sysvar address.
EXEMPTION_THRESHOLD_YEARS
Years of rent an account must prepay to be rent-exempt.
INSTRUCTIONS_ID
Instructions sysvar address (for instruction introspection).
LAMPORTS_PER_BYTE_YEAR
Lamports charged per byte of account storage per year.
LAST_RESTART_SLOT_ID
LastRestartSlot sysvar address.
RENT_ID
Rent sysvar address.
SLOT_HASHES_ID
SlotHashes sysvar address.
STAKE_HISTORY_ID
StakeHistory sysvar address.

Functions§

get_clock
Read the Clock sysvar.
get_epoch_rewards
Read the EpochRewards sysvar (SIMD-0118).
get_epoch_schedule
Read the EpochSchedule sysvar.
get_epoch_stake
Get the current-epoch activated stake of the vote account at vote.
get_last_restart_slot
Read the slot of the last cluster restart (hard fork), or 0 if the cluster has never been restarted.
get_rent
Read the Rent sysvar.
get_sysvar_into
Copy dst.len() bytes starting at offset from the sysvar identified by sysvar_id into dst.
get_total_epoch_stake
Get the cluster-wide total activated stake for the current epoch.
rent_exempt_minimum
Minimum balance for rent exemption assuming the launch-era rent constants (LAMPORTS_PER_BYTE_YEAR, EXEMPTION_THRESHOLD_YEARS, ACCOUNT_STORAGE_OVERHEAD).
saturating_mul_u64
a * b, saturating at u64::MAX, without the 128-bit multiply helper.
scale_by_exemption_threshold
Apply the rent exemption_threshold (given as its IEEE-754 bit pattern) to an integer lamport amount without any floating-point instruction.
slot_hashes_latest
Read the most recent (slot, hash) from the SlotHashes sysvar.
stake_history_latest
Read the most recent stake-history entry.