Refactor: Move sdk::process_instruction in program-runtime-crate (#21180)

* Moves the Executor dyn Trait to instruction_processor.rs

* Moves the Logger dyn Trait as well as the ic_msg and ic_logger_msg macros to log_collector.rs,
and moves the stable_log to stable_log.rs

* Moves the ComputeMeter dyn Trait to invoke_context.rs

* Moves the InvokeContext dyn Trait and the ProcessInstructionWithContext type to invoke_context.rs

* Updates cargo files.

* Re-export InvokeContext in program-test

Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
This commit is contained in:
Alexander Meißner
2021-11-17 19:35:07 +01:00
committed by GitHub
parent c3e5927d16
commit e540b1cf3c
35 changed files with 319 additions and 317 deletions

View File

@@ -70,8 +70,9 @@ use rayon::{
use solana_measure::measure::Measure;
use solana_metrics::{inc_new_counter_debug, inc_new_counter_info};
use solana_program_runtime::{
instruction_processor::{ExecuteDetailsTimings, Executors, InstructionProcessor},
instruction_processor::{ExecuteDetailsTimings, Executor, Executors, InstructionProcessor},
instruction_recorder::InstructionRecorder,
invoke_context::{ComputeMeter, ProcessInstructionWithContext},
log_collector::LogCollector,
};
#[allow(deprecated)]
@@ -109,7 +110,6 @@ use solana_sdk::{
nonce, nonce_account,
packet::PACKET_DATA_SIZE,
precompiles::get_precompiles,
process_instruction::{ComputeMeter, Executor, ProcessInstructionWithContext},
program_utils::limited_deserialize,
pubkey::Pubkey,
secp256k1_program,
@@ -6469,6 +6469,7 @@ pub(crate) mod tests {
status_cache::MAX_CACHE_ENTRIES,
};
use crossbeam_channel::{bounded, unbounded};
use solana_program_runtime::invoke_context::InvokeContext;
#[allow(deprecated)]
use solana_sdk::sysvar::fees::Fees;
use solana_sdk::{
@@ -6484,7 +6485,6 @@ pub(crate) mod tests {
message::{Message, MessageHeader},
nonce,
poh_config::PohConfig,
process_instruction::InvokeContext,
rent::Rent,
signature::{keypair_from_seed, Keypair, Signer},
stake::{

View File

@@ -1,10 +1,10 @@
use crate::system_instruction_processor;
use solana_program_runtime::{
invoke_context::{InvokeContext, ProcessInstructionWithContext},
stable_log,
};
use solana_sdk::{
feature_set,
instruction::InstructionError,
process_instruction::{stable_log, InvokeContext, ProcessInstructionWithContext},
pubkey::Pubkey,
stake, system_program,
feature_set, instruction::InstructionError, pubkey::Pubkey, stake, system_program,
};
use std::fmt;

View File

@@ -3,7 +3,7 @@ use solana_measure::measure::Measure;
use solana_program_runtime::{
instruction_processor::{ExecuteDetailsTimings, Executors, InstructionProcessor},
instruction_recorder::InstructionRecorder,
invoke_context::ThisInvokeContext,
invoke_context::{ComputeMeter, InvokeContext, ThisInvokeContext},
log_collector::LogCollector,
};
use solana_sdk::{
@@ -13,7 +13,6 @@ use solana_sdk::{
hash::Hash,
message::Message,
precompiles::is_precompile,
process_instruction::{ComputeMeter, InvokeContext},
pubkey::Pubkey,
rent::Rent,
sysvar::instructions,

View File

@@ -1,12 +1,11 @@
use solana_program_runtime::{ic_msg, invoke_context::InvokeContext};
use solana_sdk::{
account::{ReadableAccount, WritableAccount},
account_utils::State as AccountUtilsState,
feature_set::{self, nonce_must_be_writable},
ic_msg,
instruction::{checked_add, InstructionError},
keyed_account::KeyedAccount,
nonce::{self, state::Versions, State},
process_instruction::InvokeContext,
pubkey::Pubkey,
system_instruction::{nonce_to_instruction_error, NonceError},
sysvar::rent::Rent,

View File

@@ -1,13 +1,13 @@
use crate::nonce_keyed_account::NonceKeyedAccount;
use log::*;
use solana_program_runtime::{ic_msg, invoke_context::InvokeContext};
use solana_sdk::{
account::{AccountSharedData, ReadableAccount, WritableAccount},
account_utils::StateMut,
feature_set, ic_msg,
feature_set,
instruction::InstructionError,
keyed_account::{from_keyed_account, get_signers, keyed_account_at_index, KeyedAccount},
nonce,
process_instruction::InvokeContext,
program_utils::limited_deserialize,
pubkey::Pubkey,
system_instruction::{NonceError, SystemError, SystemInstruction, MAX_PERMITTED_DATA_LENGTH},