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.
Re-exports§
pub use crate::arith::saturating_mul_u64;
Structs§
- Clock
- Clock sysvar data, read directly from the runtime.
- Epoch
Rewards - EpochRewards sysvar data (SIMD-0118).
- Epoch
Schedule - Epoch schedule sysvar data.
- Rent
- Rent sysvar data.
- Slot
Hash - One
(slot, hash)entry from the SlotHashes sysvar. - Stake
History Entry - 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.
- EPOCH_
SCHEDULE_ IMAGE_ LEN - Length of the EpochSchedule sysvar’s account image.
- 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.
- RENT_
IMAGE_ LEN - Length of the Rent sysvar’s account image:
u64 + f64 + u8. - SLOT_
HASHES_ ID - SlotHashes sysvar address.
- STAKE_
HISTORY_ ID - StakeHistory sysvar address.
Functions§
- decode_
epoch_ schedule - Decode the EpochSchedule account image (
epoch_schedule_decodes_canonical_imagepins the offsets). - 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
0if the cluster has never been restarted. - get_
rent - Read the Rent sysvar.
- get_
sysvar_ into - Copy
dst.len()bytes starting atoffsetfrom the sysvar identified bysysvar_idintodst. - get_
sysvar_ prefix_ at get_sysvar_intothat reports a read past the sysvar’s end asOk(false)instead of an error, so a caller can read an optimistic prefix (a length word plus the first entry) in one syscall and fall back only when the sysvar is shorter than that.- 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). - 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.