diff --git a/runtime/src/bank/tests.rs b/runtime/src/bank/tests.rs index 9903b3c3d6..128ec740d2 100644 --- a/runtime/src/bank/tests.rs +++ b/runtime/src/bank/tests.rs @@ -7229,10 +7229,7 @@ fn test_bpf_loader_upgradeable_deploy_with_max_len() { ); assert_eq!( bank.process_transaction(&transaction), - Err(TransactionError::InstructionError( - 0, - InstructionError::InvalidAccountData - )), + Err(TransactionError::InvalidProgramForExecution), ); { let program_cache = bank.transaction_processor.program_cache.read().unwrap(); @@ -7253,10 +7250,7 @@ fn test_bpf_loader_upgradeable_deploy_with_max_len() { let transaction = Transaction::new(&[&binding], message, bank.last_blockhash()); assert_eq!( bank.process_transaction(&transaction), - Err(TransactionError::InstructionError( - 0, - InstructionError::InvalidAccountData, - )), + Err(TransactionError::InvalidProgramForExecution), ); { let program_cache = bank.transaction_processor.program_cache.read().unwrap(); diff --git a/sdk/feature-set/src/lib.rs b/sdk/feature-set/src/lib.rs index 83d5974975..91ed7ae78f 100644 --- a/sdk/feature-set/src/lib.rs +++ b/sdk/feature-set/src/lib.rs @@ -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 = [ @@ -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() diff --git a/svm/src/account_loader.rs b/svm/src/account_loader.rs index fbaa222e93..2af7322b8f 100644 --- a/svm/src/account_loader.rs +++ b/svm/src/account_loader.rs @@ -424,6 +424,8 @@ fn load_transaction_account( 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); @@ -444,9 +446,10 @@ fn load_transaction_account( 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.