Instruction sysvar fixes, additions (#20958)
This commit is contained in:
@ -36,11 +36,9 @@ fn process_instruction(
|
||||
let instruction = instructions::load_instruction_at_checked(
|
||||
secp_instruction_index as usize,
|
||||
instruction_accounts,
|
||||
)
|
||||
.map_err(|_| ProgramError::InvalidAccountData)?;
|
||||
)?;
|
||||
|
||||
let current_instruction =
|
||||
instructions::load_current_index(&instruction_accounts.try_borrow_data()?);
|
||||
let current_instruction = instructions::load_current_index_checked(instruction_accounts)?;
|
||||
let my_index = instruction_data[1] as u16;
|
||||
assert_eq!(current_instruction, my_index);
|
||||
|
||||
|
@ -48,7 +48,7 @@ pub fn process_instruction(
|
||||
msg!("Instructions identifier:");
|
||||
sysvar::instructions::id().log();
|
||||
assert_eq!(*accounts[4].owner, sysvar::id());
|
||||
let index = instructions::load_current_index(&accounts[4].try_borrow_data()?);
|
||||
let index = instructions::load_current_index_checked(&accounts[4])?;
|
||||
let instruction = instructions::load_instruction_at_checked(index as usize, &accounts[4])?;
|
||||
assert_eq!(0, index);
|
||||
assert_eq!(
|
||||
|
Reference in New Issue
Block a user