solana_program/sysvar/
slot_hashes.rs1pub use crate::slot_hashes::SlotHashes;
6use crate::{account_info::AccountInfo, program_error::ProgramError, sysvar::Sysvar};
7
8crate::declare_sysvar_id!("SysvarS1otHashes111111111111111111111111111", SlotHashes);
9
10impl Sysvar for SlotHashes {
11 fn size_of() -> usize {
13 20_488 }
16 fn from_account_info(_account_info: &AccountInfo) -> Result<Self, ProgramError> {
17 Err(ProgramError::UnsupportedSysvar)
19 }
20}
21
22#[cfg(test)]
23mod tests {
24 use {
25 super::*,
26 crate::{clock::Slot, hash::Hash, slot_hashes::MAX_ENTRIES},
27 };
28
29 #[test]
30 fn test_size_of() {
31 assert_eq!(
32 SlotHashes::size_of(),
33 bincode::serialized_size(
34 &(0..MAX_ENTRIES)
35 .map(|slot| (slot as Slot, Hash::default()))
36 .collect::<SlotHashes>()
37 )
38 .unwrap() as usize
39 );
40 }
41}