Demote write locks on transaction program ids (backport #19593) (#19633)

* Demote write locks on transaction program ids (#19593)

* Add feature

* Demote write lock on program ids

* Fixup bpf tests

* Update MappedMessage::is_writable

* Comma nit

* Review comments

(cherry picked from commit decec3cd8b)

# Conflicts:
#	core/src/banking_stage.rs
#	core/src/cost_model.rs
#	core/src/cost_tracker.rs
#	ledger-tool/src/main.rs
#	program-runtime/src/instruction_processor.rs
#	programs/bpf/tests/programs.rs
#	programs/bpf_loader/src/syscalls.rs
#	rpc/src/transaction_status_service.rs
#	runtime/src/accounts.rs
#	runtime/src/bank.rs
#	runtime/src/message_processor.rs
#	sdk/benches/serialize_instructions.rs
#	sdk/program/src/message/mapped.rs
#	sdk/program/src/message/sanitized.rs
#	sdk/src/transaction/sanitized.rs

* Fix conflicts

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
Co-authored-by: Tyera Eulberg <tyera@solana.com>
This commit is contained in:
mergify[bot]
2021-09-04 06:46:09 +00:00
committed by GitHub
parent 2e4a2c15be
commit fcda5d4a7d
12 changed files with 227 additions and 160 deletions

View File

@@ -14,6 +14,8 @@ 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();
@@ -27,7 +29,7 @@ fn bench_manual_instruction_serialize(b: &mut Bencher) {
let instructions = make_instructions();
let message = Message::new(&instructions, None);
b.iter(|| {
test::black_box(message.serialize_instructions());
test::black_box(message.serialize_instructions(DEMOTE_PROGRAM_WRITE_LOCKS));
});
}
@@ -44,7 +46,7 @@ fn bench_bincode_instruction_deserialize(b: &mut Bencher) {
fn bench_manual_instruction_deserialize(b: &mut Bencher) {
let instructions = make_instructions();
let message = Message::new(&instructions, None);
let serialized = message.serialize_instructions();
let serialized = message.serialize_instructions(DEMOTE_PROGRAM_WRITE_LOCKS);
b.iter(|| {
for i in 0..instructions.len() {
test::black_box(instructions::load_instruction_at(i, &serialized).unwrap());
@@ -56,7 +58,7 @@ fn bench_manual_instruction_deserialize(b: &mut Bencher) {
fn bench_manual_instruction_deserialize_single(b: &mut Bencher) {
let instructions = make_instructions();
let message = Message::new(&instructions, None);
let serialized = message.serialize_instructions();
let serialized = message.serialize_instructions(DEMOTE_PROGRAM_WRITE_LOCKS);
b.iter(|| {
test::black_box(instructions::load_instruction_at(3, &serialized).unwrap());
});