Store versioned transactions in the ledger, disabled by default (#19139)

* Add support for versioned transactions, but disable by default

* merge conflicts

* trent's feedback

* bump Cargo.lock

* Fix transaction error encoding

* Rename legacy_transaction method

* cargo clippy

* Clean up casts, int arithmetic, and unused methods

* Check for duplicates in sanitized message conversion

* fix clippy

* fix new test

* Fix bpf conditional compilation for message module
This commit is contained in:
Justin Starry
2021-08-17 15:17:56 -07:00
committed by GitHub
parent 098e2b2de3
commit c50b01cb60
47 changed files with 2373 additions and 1049 deletions

View File

@ -3,9 +3,10 @@
extern crate test;
use bincode::{deserialize, serialize};
use solana_sdk::instruction::{AccountMeta, Instruction};
use solana_sdk::message::Message;
use solana_sdk::pubkey;
use solana_sdk::message::{Message, SanitizedMessage};
use solana_sdk::pubkey::{self, Pubkey};
use solana_sdk::sysvar::instructions;
use std::convert::TryFrom;
use test::Bencher;
fn make_instructions() -> Vec<Instruction> {
@ -25,7 +26,9 @@ fn bench_bincode_instruction_serialize(b: &mut Bencher) {
#[bench]
fn bench_manual_instruction_serialize(b: &mut Bencher) {
let instructions = make_instructions();
let message = Message::new(&instructions, None);
let message =
SanitizedMessage::try_from(Message::new(&instructions, Some(&Pubkey::new_unique())))
.unwrap();
b.iter(|| {
test::black_box(message.serialize_instructions());
});
@ -43,7 +46,9 @@ fn bench_bincode_instruction_deserialize(b: &mut Bencher) {
#[bench]
fn bench_manual_instruction_deserialize(b: &mut Bencher) {
let instructions = make_instructions();
let message = Message::new(&instructions, None);
let message =
SanitizedMessage::try_from(Message::new(&instructions, Some(&Pubkey::new_unique())))
.unwrap();
let serialized = message.serialize_instructions();
b.iter(|| {
for i in 0..instructions.len() {
@ -55,7 +60,9 @@ fn bench_manual_instruction_deserialize(b: &mut Bencher) {
#[bench]
fn bench_manual_instruction_deserialize_single(b: &mut Bencher) {
let instructions = make_instructions();
let message = Message::new(&instructions, None);
let message =
SanitizedMessage::try_from(Message::new(&instructions, Some(&Pubkey::new_unique())))
.unwrap();
let serialized = message.serialize_instructions();
b.iter(|| {
test::black_box(instructions::load_instruction_at(3, &serialized).unwrap());