Instruction sysvar fixes, additions (backport #20958) (#21001)

* Instruction sysvar fixes, additions (#20958)

(cherry picked from commit 4fe3354c8f)

# Conflicts:
#	programs/bpf/rust/sysvar/src/lib.rs
#	programs/bpf/tests/programs.rs
#	sdk/program/src/sysvar/instructions.rs

* resolve conflicts

Co-authored-by: Jack May <jack@solana.com>
This commit is contained in:
mergify[bot]
2021-10-27 01:00:01 +00:00
committed by GitHub
parent 1666fc5483
commit 0a698fc48f
3 changed files with 219 additions and 19 deletions

View File

@@ -29,11 +29,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);