Skip to content

Commit

Permalink
Feature - disable account loader special case (#3548)
Browse files Browse the repository at this point in the history
Feature gate disable_account_loader_special_case.

(cherry picked from commit f0d7e4f)
  • Loading branch information
Lichtso committed Nov 8, 2024
1 parent b6fc167 commit 01eb852
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions sdk/feature-set/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,10 @@ pub mod reenable_sbpf_v1_execution {
solana_pubkey::declare_id!("TestFeature21111111111111111111111111111111");
}

pub mod disable_account_loader_special_case {
solana_pubkey::declare_id!("EQUMpNFr7Nacb1sva56xn1aLfBxppEoSBH8RRVdkcD1x");
}

lazy_static! {
/// Map of feature identifiers to user-visible description
pub static ref FEATURE_NAMES: HashMap<Pubkey, &'static str> = [
Expand Down Expand Up @@ -1081,6 +1085,7 @@ lazy_static! {
(partitioned_epoch_rewards_superfeature::id(), "replaces enable_partitioned_epoch_reward to enable partitioned rewards at epoch boundary SIMD-0118"),
(disable_sbpf_v1_execution::id(), "Disables execution of SBPFv1 programs"),
(reenable_sbpf_v1_execution::id(), "Re-enables execution of SBPFv1 programs"),
(disable_account_loader_special_case::id(), "Disable account loader special case #3513"),
/*************** ADD NEW FEATURES HERE ***************/
]
.iter()
Expand Down
9 changes: 6 additions & 3 deletions svm/src/account_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,8 @@ fn load_transaction_account<CB: TransactionProcessingCallback>(
loaded_programs: &ProgramCacheForTxBatch,
) -> Result<(LoadedTransactionAccount, bool)> {
let mut account_found = true;
let disable_account_loader_special_case =
feature_set.is_active(&feature_set::disable_account_loader_special_case::id());
let is_instruction_account = u8::try_from(account_index)
.map(|i| instruction_accounts.contains(&&i))
.unwrap_or(false);
Expand All @@ -444,9 +446,10 @@ fn load_transaction_account<CB: TransactionProcessingCallback>(
account: account_override.clone(),
rent_collected: 0,
}
} else if let Some(program) = (!is_instruction_account && !is_writable)
.then_some(())
.and_then(|_| loaded_programs.find(account_key))
} else if let Some(program) =
(!disable_account_loader_special_case && !is_instruction_account && !is_writable)
.then_some(())
.and_then(|_| loaded_programs.find(account_key))
{
// Optimization to skip loading of accounts which are only used as
// programs in top-level instructions and not passed as instruction accounts.
Expand Down

0 comments on commit 01eb852

Please sign in to comment.