add checked instructions sysvar api (backport #20790) (#20816)

* add checked instructions sysvar api (#20790)

(cherry picked from commit a8098f37d0)

# Conflicts:
#	programs/bpf/rust/sysvar/src/lib.rs
#	runtime/src/accounts.rs

* resolve conflicts

Co-authored-by: Jack May <jack@solana.com>
This commit is contained in:
mergify[bot]
2021-10-20 18:11:51 +00:00
committed by GitHub
parent 232731e869
commit 53f4bde471
4 changed files with 102 additions and 4 deletions

View File

@@ -49,6 +49,7 @@ fn bench_manual_instruction_deserialize(b: &mut Bencher) {
let serialized = message.serialize_instructions(DEMOTE_PROGRAM_WRITE_LOCKS);
b.iter(|| {
for i in 0..instructions.len() {
#[allow(deprecated)]
test::black_box(instructions::load_instruction_at(i, &serialized).unwrap());
}
});
@@ -60,6 +61,7 @@ fn bench_manual_instruction_deserialize_single(b: &mut Bencher) {
let message = Message::new(&instructions, None);
let serialized = message.serialize_instructions(DEMOTE_PROGRAM_WRITE_LOCKS);
b.iter(|| {
#[allow(deprecated)]
test::black_box(instructions::load_instruction_at(3, &serialized).unwrap());
});
}