|
13 | 13 | solana_stake_history::{StakeHistory, StakeHistoryGetEntry, sysvar::StakeHistorySysvar}, |
14 | 14 | solana_sysvar::{ |
15 | 15 | Sysvar, clock::Clock, epoch_rewards::EpochRewards, epoch_schedule::EpochSchedule, |
16 | | - rent::Rent, slot_hashes::PodSlotHashes, |
| 16 | + rent::Rent, slot_hashes::PodSlotHashes, slot_history::SlotHistory, |
17 | 17 | }, |
18 | 18 | solana_sysvar_id::SysvarId, |
19 | 19 | }; |
@@ -194,9 +194,14 @@ pub fn process_instruction( |
194 | 194 | { |
195 | 195 | msg!("SlotHashes identifier:"); |
196 | 196 | sysvar::slot_hashes::id().log(); |
197 | | - // Syscall `sol_get_sysvar`. |
198 | | - let pod_slot_hashes = PodSlotHashes::fetch()?; |
199 | | - assert!(pod_slot_hashes.get(/* slot */ &0)?.is_some()); |
| 197 | + // Account deserialization is unsupported. |
| 198 | + // Inspecting first entry and comparing with the syscall value. |
| 199 | + assert_eq!(accounts[7].data_len(), solana_sysvar::slot_hashes::SIZE); |
| 200 | + let data = accounts[7].data.borrow(); |
| 201 | + let account_slot = u64::from_le_bytes(data[8..16].try_into().unwrap()); |
| 202 | + let account_hash = &data[16..48]; |
| 203 | + let syscall_hash = PodSlotHashes::fetch()?.get(&account_slot)?.unwrap(); |
| 204 | + assert_eq!(syscall_hash.as_ref(), account_hash); |
200 | 205 | } |
201 | 206 |
|
202 | 207 | Ok(()) |
|
0 commit comments