Clean up demote program write lock feature (backport #21949) (#21969)

* Clean up demote program write lock feature (#21949)

* Clean up demote program write lock feature

* fix test

(cherry picked from commit 6ff0be6a82)

# Conflicts:
#	programs/bpf_loader/src/syscalls.rs
#	runtime/src/accounts.rs

* resolve conflicts

Co-authored-by: Justin Starry <justin@solana.com>
This commit is contained in:
mergify[bot]
2021-12-17 04:45:22 +00:00
committed by GitHub
parent 0c5a2bcd5a
commit f4521002b9
19 changed files with 98 additions and 203 deletions

View File

@ -19,8 +19,6 @@ fn make_instructions() -> Vec<Instruction> {
vec![inst; 4]
}
const DEMOTE_PROGRAM_WRITE_LOCKS: bool = true;
#[bench]
fn bench_bincode_instruction_serialize(b: &mut Bencher) {
let instructions = make_instructions();
@ -36,7 +34,7 @@ fn bench_manual_instruction_serialize(b: &mut Bencher) {
SanitizedMessage::try_from(Message::new(&instructions, Some(&Pubkey::new_unique())))
.unwrap();
b.iter(|| {
test::black_box(message.serialize_instructions(DEMOTE_PROGRAM_WRITE_LOCKS));
test::black_box(message.serialize_instructions());
});
}
@ -55,7 +53,7 @@ fn bench_manual_instruction_deserialize(b: &mut Bencher) {
let message =
SanitizedMessage::try_from(Message::new(&instructions, Some(&Pubkey::new_unique())))
.unwrap();
let serialized = message.serialize_instructions(DEMOTE_PROGRAM_WRITE_LOCKS);
let serialized = message.serialize_instructions();
b.iter(|| {
for i in 0..instructions.len() {
#[allow(deprecated)]
@ -70,7 +68,7 @@ fn bench_manual_instruction_deserialize_single(b: &mut Bencher) {
let message =
SanitizedMessage::try_from(Message::new(&instructions, Some(&Pubkey::new_unique())))
.unwrap();
let serialized = message.serialize_instructions(DEMOTE_PROGRAM_WRITE_LOCKS);
let serialized = message.serialize_instructions();
b.iter(|| {
#[allow(deprecated)]
test::black_box(instructions::load_instruction_at(3, &serialized).unwrap());