CPI Account Reuse (#19762)
* Removes two account copy steps from InstructionProcessor::native_invoke(). * Moves gathering of keyed_accounts, caller_write_privileges and program_indices into InstructionProcessor::create_message(). * Explicitly routes the serialized account lengths to enable sharing of existing account structures. * Recycles existing account structs in CPI syscall.
This commit is contained in:
committed by
GitHub
parent
efd024510a
commit
36f46e1c31
@ -220,7 +220,7 @@ fn bench_instruction_count_tuner(_bencher: &mut Bencher) {
|
||||
|
||||
// Serialize account data
|
||||
let keyed_accounts = invoke_context.get_keyed_accounts().unwrap();
|
||||
let mut serialized = serialize_parameters(
|
||||
let (mut serialized, _account_lengths) = serialize_parameters(
|
||||
&bpf_loader::id(),
|
||||
&solana_sdk::pubkey::new_rand(),
|
||||
keyed_accounts,
|
||||
|
@ -198,7 +198,7 @@ fn run_program(
|
||||
let mut data = vec![];
|
||||
file.read_to_end(&mut data).unwrap();
|
||||
let loader_id = bpf_loader::id();
|
||||
let parameter_bytes = serialize_parameters(
|
||||
let (parameter_bytes, account_lengths) = serialize_parameters(
|
||||
&bpf_loader::id(),
|
||||
program_id,
|
||||
¶meter_accounts,
|
||||
@ -282,6 +282,7 @@ fn run_program(
|
||||
&bpf_loader::id(),
|
||||
parameter_accounts,
|
||||
parameter_bytes.as_slice(),
|
||||
&account_lengths,
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
|
Reference in New Issue
Block a user