diff --git a/program-runtime/src/invoke_context.rs b/program-runtime/src/invoke_context.rs index bcff3fa61..3285eddb7 100644 --- a/program-runtime/src/invoke_context.rs +++ b/program-runtime/src/invoke_context.rs @@ -25,6 +25,9 @@ use { std::{cell::RefCell, collections::HashMap, fmt::Debug, rc::Rc, sync::Arc}, }; +pub type TransactionAccountRefCell = (Pubkey, Rc>); +pub type TransactionAccountRefCells = Vec; + pub type ProcessInstructionWithContext = fn(usize, &[u8], &mut InvokeContext) -> Result<(), InstructionError>; @@ -138,7 +141,7 @@ pub struct InvokeContext<'a> { invoke_stack: Vec>, rent: Rent, pre_accounts: Vec, - accounts: &'a [(Pubkey, Rc>)], + accounts: &'a [TransactionAccountRefCell], builtin_programs: &'a [BuiltinProgram], pub sysvars: &'a [(Pubkey, Vec)], log_collector: Option>>, @@ -158,7 +161,7 @@ impl<'a> InvokeContext<'a> { #[allow(clippy::too_many_arguments)] pub fn new( rent: Rent, - accounts: &'a [(Pubkey, Rc>)], + accounts: &'a [TransactionAccountRefCell], builtin_programs: &'a [BuiltinProgram], sysvars: &'a [(Pubkey, Vec)], log_collector: Option>>, @@ -190,7 +193,7 @@ impl<'a> InvokeContext<'a> { } pub fn new_mock( - accounts: &'a [(Pubkey, Rc>)], + accounts: &'a [TransactionAccountRefCell], builtin_programs: &'a [BuiltinProgram], ) -> Self { Self::new( @@ -828,7 +831,7 @@ impl<'a> InvokeContext<'a> { } pub struct MockInvokeContextPreparation { - pub accounts: Vec<(Pubkey, Rc>)>, + pub accounts: TransactionAccountRefCells, pub message: Message, pub account_indices: Vec, } @@ -839,10 +842,7 @@ pub fn prepare_mock_invoke_context( keyed_accounts: &[(bool, bool, Pubkey, Rc>)], ) -> MockInvokeContextPreparation { #[allow(clippy::type_complexity)] - let (accounts, mut metas): ( - Vec<(Pubkey, Rc>)>, - Vec, - ) = keyed_accounts + let (accounts, mut metas): (TransactionAccountRefCells, Vec) = keyed_accounts .iter() .map(|(is_signer, is_writable, pubkey, account)| { ( diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index f7f3b1fa4..7fc596e6d 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -74,7 +74,10 @@ use { solana_metrics::{inc_new_counter_debug, inc_new_counter_info}, solana_program_runtime::{ instruction_recorder::InstructionRecorder, - invoke_context::{BuiltinProgram, Executor, Executors, ProcessInstructionWithContext}, + invoke_context::{ + BuiltinProgram, Executor, Executors, ProcessInstructionWithContext, + TransactionAccountRefCells, + }, log_collector::LogCollector, timings::ExecuteDetailsTimings, }, @@ -236,8 +239,6 @@ impl ExecuteTimings { type BankStatusCache = StatusCache>; #[frozen_abi(digest = "32EjVUc6shHHVPpsnBAVfyBziMgyFzH8qxisLwmwwdS1")] pub type BankSlotDelta = SlotDelta>; -pub(crate) type TransactionAccountRefCell = (Pubkey, Rc>); -type TransactionAccountRefCells = Vec; // Eager rent collection repeats in cyclic manner. // Each cycle is composed of number of tiny pubkey subranges diff --git a/runtime/src/message_processor.rs b/runtime/src/message_processor.rs index 655fd49c0..45a7d76a4 100644 --- a/runtime/src/message_processor.rs +++ b/runtime/src/message_processor.rs @@ -1,10 +1,9 @@ use { - crate::bank::TransactionAccountRefCell, serde::{Deserialize, Serialize}, solana_measure::measure::Measure, solana_program_runtime::{ instruction_recorder::InstructionRecorder, - invoke_context::{BuiltinProgram, Executors, InvokeContext}, + invoke_context::{BuiltinProgram, Executors, InvokeContext, TransactionAccountRefCell}, log_collector::LogCollector, timings::ExecuteDetailsTimings, },