Cleanup unsupported sysvars (backport #16390) (#16517)

* Cleanup unsupported sysvars (#16390)

* Cleanup unsupported sysvars

* fix ser description

(cherry picked from commit 92f4018b07)

# Conflicts:
#	runtime/src/bank.rs

* fix conflicts

Co-authored-by: Jack May <jack@solana.com>
This commit is contained in:
mergify[bot]
2021-04-13 23:28:08 +00:00
committed by GitHub
parent e8ca35f9ec
commit 97ba3cbeb0
12 changed files with 90 additions and 39 deletions

View File

@@ -400,15 +400,15 @@ impl Message {
// [0..2 - num_instructions
//
// Then a table of offsets of where to find them in the data
// 3..2*num_instructions table of instruction offsets
// 3..2 * num_instructions table of instruction offsets
//
// Each instruction is then encoded as:
// 0..2 - num_accounts
// 3 - meta_byte -> (bit 0 signer, bit 1 is_writable)
// 4..36 - pubkey - 32 bytes
// 36..64 - program_id
// 33..34 - data len - u16
// 35..data_len - data
// 2 - meta_byte -> (bit 0 signer, bit 1 is_writable)
// 3..35 - pubkey - 32 bytes
// 35..67 - program_id
// 67..69 - data len - u16
// 69..data_len - data
pub fn serialize_instructions(&self, demote_sysvar_write_locks: bool) -> Vec<u8> {
// 64 bytes is a reasonable guess, calculating exactly is slower in benchmarks
let mut data = Vec::with_capacity(self.instructions.len() * (32 * 2));