- Implicitly fixes invoke_context.return_data not being reset between instructions in process_message. (#21671) (#21684)
- Lets InvokeContext::process_cross_program_instruction() handle the first invocation depth too.
- Marks InvokeContext::verify(), InvokeContext::verify_and_update() and InvokeContext::process_executable_chain() private.
- Renames InvokeContext::process_cross_program_instruction() to InvokeContext::process_instruction().
- Removes InvokeContext::new_mock_with_sysvars().
(cherry picked from commit 1df88837c8
)
Co-authored-by: Alexander Meißner <AlexanderMeissner@gmx.net>
This commit is contained in:
@ -104,31 +104,19 @@ impl MessageProcessor {
|
||||
invoke_context.instruction_recorder =
|
||||
Some(&instruction_recorders[instruction_index]);
|
||||
}
|
||||
let result = invoke_context
|
||||
.push(message, instruction, program_indices, None)
|
||||
.and_then(|_| {
|
||||
let pre_remaining_units =
|
||||
invoke_context.get_compute_meter().borrow().get_remaining();
|
||||
let mut time = Measure::start("execute_instruction");
|
||||
|
||||
invoke_context.process_instruction(&instruction.data)?;
|
||||
invoke_context.verify(message, instruction, program_indices)?;
|
||||
|
||||
time.stop();
|
||||
let post_remaining_units =
|
||||
invoke_context.get_compute_meter().borrow().get_remaining();
|
||||
timings.accumulate_program(
|
||||
instruction.program_id(&message.account_keys),
|
||||
time.as_us(),
|
||||
pre_remaining_units - post_remaining_units,
|
||||
);
|
||||
timings.accumulate(&invoke_context.timings);
|
||||
Ok(())
|
||||
})
|
||||
.map_err(|err| TransactionError::InstructionError(instruction_index as u8, err));
|
||||
invoke_context.pop();
|
||||
|
||||
result?;
|
||||
let pre_remaining_units = invoke_context.get_compute_meter().borrow().get_remaining();
|
||||
let mut time = Measure::start("execute_instruction");
|
||||
invoke_context
|
||||
.process_instruction(message, instruction, program_indices, &[], &[])
|
||||
.map_err(|err| TransactionError::InstructionError(instruction_index as u8, err))?;
|
||||
time.stop();
|
||||
let post_remaining_units = invoke_context.get_compute_meter().borrow().get_remaining();
|
||||
timings.accumulate_program(
|
||||
instruction.program_id(&message.account_keys),
|
||||
time.as_us(),
|
||||
pre_remaining_units - post_remaining_units,
|
||||
);
|
||||
timings.accumulate(&invoke_context.timings);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
Reference in New Issue
Block a user