Skip to content

Commit 2f129ad

Browse files
committed
Cleans up the feature gate of disable_account_loader_special_case.
1 parent 91d0d0c commit 2f129ad

File tree

2 files changed

+0
-49
lines changed

2 files changed

+0
-49
lines changed

svm/src/account_loader.rs

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ use {
3434
solana_transaction_context::{IndexOfAccount, TransactionAccount},
3535
solana_transaction_error::{TransactionError, TransactionResult as Result},
3636
std::{
37-
collections::HashMap,
3837
num::{NonZeroU32, Saturating},
3938
sync::Arc,
4039
},
@@ -110,7 +109,6 @@ pub struct FeesOnlyTransaction {
110109
#[cfg_attr(feature = "dev-context-only-utils", derive(Clone))]
111110
pub(crate) struct AccountLoader<'a, CB: TransactionProcessingCallback> {
112111
pub(crate) program_cache: ProgramCacheForTxBatch,
113-
program_accounts: HashMap<Pubkey, (&'a Pubkey, u64)>,
114112
account_cache: AHashMap<Pubkey, AccountSharedData>,
115113
callbacks: &'a CB,
116114
pub(crate) feature_set: Arc<FeatureSet>,
@@ -119,7 +117,6 @@ impl<'a, CB: TransactionProcessingCallback> AccountLoader<'a, CB> {
119117
pub(crate) fn new_with_account_cache_capacity(
120118
account_overrides: Option<&'a AccountOverrides>,
121119
program_cache: ProgramCacheForTxBatch,
122-
program_accounts: HashMap<Pubkey, (&'a Pubkey, u64)>,
123120
callbacks: &'a CB,
124121
feature_set: Arc<FeatureSet>,
125122
capacity: usize,
@@ -138,7 +135,6 @@ impl<'a, CB: TransactionProcessingCallback> AccountLoader<'a, CB> {
138135
program_cache,
139136
account_cache,
140137
callbacks,
141-
program_accounts,
142138
feature_set,
143139
}
144140
}
@@ -149,24 +145,6 @@ impl<'a, CB: TransactionProcessingCallback> AccountLoader<'a, CB> {
149145
usage_pattern: AccountUsagePattern,
150146
) -> Option<LoadedTransactionAccount> {
151147
let is_writable = usage_pattern == AccountUsagePattern::Writable;
152-
let is_invisible_read = usage_pattern == AccountUsagePattern::ReadOnlyInvisible;
153-
let use_program_cache = !self
154-
.feature_set
155-
.is_active(&feature_set::disable_account_loader_special_case::id());
156-
157-
if let Some(program) = (use_program_cache && is_invisible_read)
158-
.then_some(())
159-
.and_then(|_| self.program_cache.find(account_key))
160-
{
161-
// Optimization to skip loading of accounts which are only used as
162-
// programs in top-level instructions and not passed as instruction accounts.
163-
return Some(LoadedTransactionAccount {
164-
loaded_size: program.account_size,
165-
account: account_shared_data_from_program(account_key, &self.program_accounts)
166-
.ok()?,
167-
rent_collected: 0,
168-
});
169-
}
170148

171149
let account = if let Some(account) = self.account_cache.get(account_key) {
172150
// If lamports is 0, a previous transaction deallocated this account.
@@ -625,22 +603,6 @@ fn load_transaction_account<CB: TransactionProcessingCallback>(
625603
loaded_account
626604
}
627605

628-
fn account_shared_data_from_program(
629-
key: &Pubkey,
630-
program_accounts: &HashMap<Pubkey, (&Pubkey, u64)>,
631-
) -> Result<AccountSharedData> {
632-
// It's an executable program account. The program is already loaded in the cache.
633-
// So the account data is not needed. Return a dummy AccountSharedData with meta
634-
// information.
635-
let mut program_account = AccountSharedData::default();
636-
let (program_owner, _count) = program_accounts
637-
.get(key)
638-
.ok_or(TransactionError::AccountNotFound)?;
639-
program_account.set_owner(**program_owner);
640-
program_account.set_executable(true);
641-
Ok(program_account)
642-
}
643-
644606
/// Accumulate loaded account data size into `accumulated_accounts_data_size`.
645607
/// Returns TransactionErr::MaxLoadedAccountsDataSizeExceeded if
646608
/// `accumulated_accounts_data_size` exceeds
@@ -780,7 +742,6 @@ mod tests {
780742
AccountLoader::new_with_account_cache_capacity(
781743
None,
782744
ProgramCacheForTxBatch::default(),
783-
HashMap::default(),
784745
callbacks,
785746
Arc::<FeatureSet>::default(),
786747
0,
@@ -1125,7 +1086,6 @@ mod tests {
11251086
let mut account_loader = AccountLoader::new_with_account_cache_capacity(
11261087
account_overrides,
11271088
ProgramCacheForTxBatch::default(),
1128-
HashMap::default(),
11291089
&callbacks,
11301090
Arc::new(FeatureSet::all_enabled()),
11311091
0,
@@ -1558,8 +1518,6 @@ mod tests {
15581518
Hash::default(),
15591519
));
15601520

1561-
let mut program_accounts = HashMap::new();
1562-
program_accounts.insert(program_keypair.pubkey(), (&loader_v2, 0));
15631521
let mut loaded_programs = ProgramCacheForTxBatch::default();
15641522
loaded_programs.replenish(
15651523
program_keypair.pubkey(),
@@ -1573,7 +1531,6 @@ mod tests {
15731531
let mut account_loader = AccountLoader::new_with_account_cache_capacity(
15741532
None,
15751533
loaded_programs,
1576-
program_accounts,
15771534
&mock_bank,
15781535
Arc::<FeatureSet>::default(),
15791536
0,
@@ -2550,9 +2507,6 @@ mod tests {
25502507

25512508
let (_program1_size, _) = make_account(program1, loader_v2, true);
25522509

2553-
let mut program_accounts = HashMap::new();
2554-
program_accounts.insert(program1, (&loader_v2, 0));
2555-
program_accounts.insert(program2, (&loader_v3, 0));
25562510
let mut program_cache = ProgramCacheForTxBatch::default();
25572511
let program1_entry = ProgramCacheEntry {
25582512
account_size: 0,
@@ -2573,7 +2527,6 @@ mod tests {
25732527
let mut account_loader = AccountLoader::new_with_account_cache_capacity(
25742528
None,
25752529
program_cache.clone(),
2576-
program_accounts.clone(),
25772530
&mock_bank,
25782531
Arc::<FeatureSet>::default(),
25792532
0,

svm/src/transaction_processor.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,6 @@ impl<FG: ForkGraph> TransactionBatchProcessor<FG> {
397397
let mut account_loader = AccountLoader::new_with_account_cache_capacity(
398398
config.account_overrides,
399399
program_cache_for_tx_batch,
400-
program_accounts_map,
401400
callbacks,
402401
environment.feature_set.clone(),
403402
account_keys_in_batch,
@@ -1312,7 +1311,6 @@ mod tests {
13121311
AccountLoader::new_with_account_cache_capacity(
13131312
None,
13141313
ProgramCacheForTxBatch::default(),
1315-
HashMap::default(),
13161314
callbacks,
13171315
Arc::<FeatureSet>::default(),
13181316
0,

0 commit comments

Comments
 (0)