Move type alias and use it more broadly (#21763)
This commit is contained in:
parent
65194c7ae8
commit
350845c513
|
@ -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>;
|
||||
|
||||
|
@ -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>>>,
|
||||
|
@ -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>>>,
|
||||
|
@ -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(
|
||||
|
@ -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>,
|
||||
}
|
||||
|
@ -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)| {
|
||||
(
|
||||
|
|
|
@ -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<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
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue