Skip to main content

get_sysvar_into

Function get_sysvar_into 

Source
pub fn get_sysvar_into(
    sysvar_id: &Address,
    offset: u64,
    dst: &mut [u8],
) -> Result<(), ProgramError>
Expand description

Copy dst.len() bytes starting at offset from the sysvar identified by sysvar_id into dst.

This wraps the modern sol_get_sysvar syscall, the only zero-copy way to read large sysvars (SlotHashes, StakeHistory) without passing them as instruction accounts. Returns Err(UnsupportedSysvar) on syscall failure (e.g. reading past the sysvar’s length).