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