Transaction format changes toward Credit-Only accounts (#4386)
* Add num_readonly_accounts slice * Impl programs in account_keys * Emulate current account-loading functionality using program-account_keys (breaks exchange_program_api tests) * Fix test * Add temporary exchange faucet id * Update chacha golden * Split num_credit_only_accounts into separate fields * Improve readability * Move message field constants into Message * Add MessageHeader struct and fixup comments
This commit is contained in:
@ -154,7 +154,7 @@ mod tests {
|
||||
hasher.hash(&buf[..size]);
|
||||
|
||||
// golden needs to be updated if blob stuff changes....
|
||||
let golden: Hash = "5Pz5KQyNht2nqkJhVd8F9zTFxzoDvbQSzaxQbtCPiyCo"
|
||||
let golden: Hash = "9xb2Asf7UK5G8WqPwsvzo5xwLi4dixBSDiYKCtYRikA"
|
||||
.parse()
|
||||
.unwrap();
|
||||
|
||||
|
@ -6,7 +6,9 @@
|
||||
|
||||
use crate::packet::{Packet, Packets};
|
||||
use crate::result::Result;
|
||||
use bincode::serialized_size;
|
||||
use solana_metrics::inc_new_counter_debug;
|
||||
use solana_sdk::message::MessageHeader;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::short_vec::decode_len;
|
||||
use solana_sdk::signature::Signature;
|
||||
@ -16,9 +18,6 @@ use std::mem::size_of;
|
||||
|
||||
type TxOffsets = (Vec<u32>, Vec<u32>, Vec<u32>, Vec<u32>, Vec<Vec<u32>>);
|
||||
|
||||
// The serialized size of Message::num_required_signatures.
|
||||
const NUM_REQUIRED_SIGNATURES_SIZE: usize = 1;
|
||||
|
||||
#[cfg(feature = "cuda")]
|
||||
#[repr(C)]
|
||||
struct Elems {
|
||||
@ -116,7 +115,8 @@ pub fn get_packet_offsets(packet: &Packet, current_offset: u32) -> (u32, u32, u3
|
||||
|
||||
let sig_start = current_offset as usize + sig_size;
|
||||
let msg_start = current_offset as usize + msg_start_offset;
|
||||
let pubkey_start = msg_start + NUM_REQUIRED_SIGNATURES_SIZE + pubkey_size;
|
||||
let pubkey_start =
|
||||
msg_start + serialized_size(&MessageHeader::default()).unwrap() as usize + pubkey_size;
|
||||
|
||||
(
|
||||
sig_len as u32,
|
||||
@ -389,19 +389,19 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_get_packet_offsets() {
|
||||
assert_eq!(get_packet_offsets_from_tx(test_tx(), 0), (1, 1, 64, 2));
|
||||
assert_eq!(get_packet_offsets_from_tx(test_tx(), 100), (1, 1, 64, 2));
|
||||
assert_eq!(get_packet_offsets_from_tx(test_tx(), 0), (1, 1, 64, 4));
|
||||
assert_eq!(get_packet_offsets_from_tx(test_tx(), 100), (1, 1, 64, 4));
|
||||
|
||||
// Ensure we're not indexing packet by the `current_offset` parameter.
|
||||
assert_eq!(
|
||||
get_packet_offsets_from_tx(test_tx(), 1_000_000),
|
||||
(1, 1, 64, 2)
|
||||
(1, 1, 64, 4)
|
||||
);
|
||||
|
||||
// Ensure we're returning sig_len, not sig_size.
|
||||
assert_eq!(
|
||||
get_packet_offsets_from_tx(test_multisig_tx(), 0),
|
||||
(2, 1, 128, 2)
|
||||
(2, 1, 128, 4)
|
||||
);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user