Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions program-runtime/src/invoke_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ use {
std::{cell::RefCell, collections::HashMap, fmt::Debug, rc::Rc, sync::Arc},
};

pub type TransactionAccountRefCell = (Pubkey, Rc<RefCell<AccountSharedData>>);
pub type TransactionAccountRefCells = Vec<TransactionAccountRefCell>;

pub type ProcessInstructionWithContext =
fn(usize, &[u8], &mut InvokeContext) -> Result<(), InstructionError>;

Expand Down Expand Up @@ -138,7 +141,7 @@ pub struct InvokeContext<'a> {
invoke_stack: Vec<StackFrame<'a>>,
rent: Rent,
pre_accounts: Vec<PreAccount>,
accounts: &'a [(Pubkey, Rc<RefCell<AccountSharedData>>)],
accounts: &'a [TransactionAccountRefCell],
builtin_programs: &'a [BuiltinProgram],
pub sysvars: &'a [(Pubkey, Vec<u8>)],
log_collector: Option<Rc<RefCell<LogCollector>>>,
Expand All @@ -158,7 +161,7 @@ impl<'a> InvokeContext<'a> {
#[allow(clippy::too_many_arguments)]
pub fn new(
rent: Rent,
accounts: &'a [(Pubkey, Rc<RefCell<AccountSharedData>>)],
accounts: &'a [TransactionAccountRefCell],
builtin_programs: &'a [BuiltinProgram],
sysvars: &'a [(Pubkey, Vec<u8>)],
log_collector: Option<Rc<RefCell<LogCollector>>>,
Expand Down Expand Up @@ -190,7 +193,7 @@ impl<'a> InvokeContext<'a> {
}

pub fn new_mock(
accounts: &'a [(Pubkey, Rc<RefCell<AccountSharedData>>)],
accounts: &'a [TransactionAccountRefCell],
builtin_programs: &'a [BuiltinProgram],
) -> Self {
Self::new(
Expand Down Expand Up @@ -828,7 +831,7 @@ impl<'a> InvokeContext<'a> {
}

pub struct MockInvokeContextPreparation {
pub accounts: Vec<(Pubkey, Rc<RefCell<AccountSharedData>>)>,
pub accounts: TransactionAccountRefCells,
pub message: Message,
pub account_indices: Vec<usize>,
}
Expand All @@ -839,10 +842,7 @@ pub fn prepare_mock_invoke_context(
keyed_accounts: &[(bool, bool, Pubkey, Rc<RefCell<AccountSharedData>>)],
) -> MockInvokeContextPreparation {
#[allow(clippy::type_complexity)]
let (accounts, mut metas): (
Vec<(Pubkey, Rc<RefCell<AccountSharedData>>)>,
Vec<AccountMeta>,
) = keyed_accounts
let (accounts, mut metas): (TransactionAccountRefCells, Vec<AccountMeta>) = keyed_accounts
.iter()
.map(|(is_signer, is_writable, pubkey, account)| {
(
Expand Down
7 changes: 4 additions & 3 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,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,
},
Expand Down Expand Up @@ -238,8 +241,6 @@ impl ExecuteTimings {
type BankStatusCache = StatusCache<Result<()>>;
#[frozen_abi(digest = "32EjVUc6shHHVPpsnBAVfyBziMgyFzH8qxisLwmwwdS1")]
pub type BankSlotDelta = SlotDelta<Result<()>>;
pub(crate) type TransactionAccountRefCell = (Pubkey, Rc<RefCell<AccountSharedData>>);
type TransactionAccountRefCells = Vec<TransactionAccountRefCell>;

// Eager rent collection repeats in cyclic manner.
// Each cycle is composed of <partition_count> number of tiny pubkey subranges
Expand Down
3 changes: 1 addition & 2 deletions runtime/src/message_processor.rs
Original file line number Diff line number Diff line change
@@ -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,
},
Expand Down