Refactor: Cleanup InstructionProcessor (#21404)

* Moves create_message(), native_invoke() and process_cross_program_instruction()
from the InstructionProcessor to the InvokeContext so that they can have a useful "self" parameter.

* Moves InstructionProcessor into InvokeContext and Bank.

* Moves ExecuteDetailsTimings into its own file.

* Moves Executor into invoke_context.rs

* Moves PreAccount into its own file.

* impl AbiExample for BuiltinPrograms
This commit is contained in:
Alexander Meißner
2021-12-01 08:54:42 +01:00
committed by GitHub
parent e922c2da9d
commit b78f5b6032
17 changed files with 548 additions and 623 deletions

View File

@ -9,10 +9,7 @@ use {
log::*,
solana_banks_client::start_client,
solana_banks_server::banks_server::start_local_server,
solana_program_runtime::{
ic_msg, instruction_processor::InstructionProcessor,
invoke_context::ProcessInstructionWithContext, stable_log,
},
solana_program_runtime::{ic_msg, invoke_context::ProcessInstructionWithContext, stable_log},
solana_runtime::{
bank::{Bank, ExecuteTimings},
bank_forks::BankForks,
@ -323,14 +320,14 @@ impl solana_sdk::program_stubs::SyscallStubs for SyscallStubs {
invoke_context.record_instruction(instruction);
InstructionProcessor::process_cross_program_instruction(
&message,
&program_indices,
&account_indices,
&caller_privileges,
invoke_context,
)
.map_err(|err| ProgramError::try_from(err).unwrap_or_else(|err| panic!("{}", err)))?;
invoke_context
.process_cross_program_instruction(
&message,
&program_indices,
&account_indices,
&caller_privileges,
)
.map_err(|err| ProgramError::try_from(err).unwrap_or_else(|err| panic!("{}", err)))?;
// Copy writeable account modifications back into the caller's AccountInfos
for (account, account_info) in accounts.iter() {