Clean up demote program write lock feature (#21949)

* Clean up demote program write lock feature

* fix test
This commit is contained in:
Justin Starry
2021-12-16 17:27:22 -05:00
committed by GitHub
parent a5769c029f
commit 6ff0be6a82
19 changed files with 98 additions and 204 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());