From 3d1ec856052edf80f1b95272334de58a0f6a9b6a Mon Sep 17 00:00:00 2001 From: HaoranYi Date: Tue, 19 Dec 2023 20:57:04 +0000 Subject: [PATCH] more test fixes --- programs/sbf/benches/bpf_loader.rs | 4 ++ programs/sbf/tests/programs.rs | 110 +++++++++++++++++++++++++++++ 2 files changed, 114 insertions(+) diff --git a/programs/sbf/benches/bpf_loader.rs b/programs/sbf/benches/bpf_loader.rs index ead348c581ea1b..f433c8374d8e47 100644 --- a/programs/sbf/benches/bpf_loader.rs +++ b/programs/sbf/benches/bpf_loader.rs @@ -196,6 +196,10 @@ fn bench_program_execute_noop(bencher: &mut Bencher) { .accounts .remove(&feature_set::disable_bpf_loader_instructions::id()); + genesis_config + .accounts + .remove(&feature_set::deprecate_executable_meta_update_in_bpf_loader::id()); + let bank = Bank::new_for_benches(&genesis_config); let (bank, bank_forks) = bank.wrap_with_bank_forks_for_tests(); let mut bank_client = BankClient::new_shared(bank.clone()); diff --git a/programs/sbf/tests/programs.rs b/programs/sbf/tests/programs.rs index 592cf479650d64..2fad9632e6d52d 100644 --- a/programs/sbf/tests/programs.rs +++ b/programs/sbf/tests/programs.rs @@ -334,6 +334,10 @@ fn test_program_sbf_sanity() { .accounts .remove(&feature_set::disable_bpf_loader_instructions::id()); + genesis_config + .accounts + .remove(&feature_set::deprecate_executable_meta_update_in_bpf_loader::id()); + let (bank, bank_forks) = Bank::new_with_bank_forks_for_tests(&genesis_config); let mut bank_client = BankClient::new_shared(bank); @@ -420,6 +424,10 @@ fn test_sol_alloc_free_no_longer_deployable() { .accounts .remove(&feature_set::disable_bpf_loader_instructions::id()); + genesis_config + .accounts + .remove(&feature_set::deprecate_executable_meta_update_in_bpf_loader::id()); + let (bank, bank_forks) = Bank::new_with_bank_forks_for_tests(&genesis_config); // Populate loader account with elf that depends on _sol_alloc_free syscall @@ -540,6 +548,10 @@ fn test_program_sbf_duplicate_accounts() { .accounts .remove(&feature_set::disable_bpf_loader_instructions::id()); + genesis_config + .accounts + .remove(&feature_set::deprecate_executable_meta_update_in_bpf_loader::id()); + let (bank, bank_forks) = Bank::new_with_bank_forks_for_tests(&genesis_config); let mut bank_client = BankClient::new_shared(bank.clone()); let (bank, program_id) = load_program_and_advance_slot( @@ -651,6 +663,10 @@ fn test_program_sbf_error_handling() { .accounts .remove(&feature_set::disable_bpf_loader_instructions::id()); + genesis_config + .accounts + .remove(&feature_set::deprecate_executable_meta_update_in_bpf_loader::id()); + let (bank, bank_forks) = Bank::new_with_bank_forks_for_tests(&genesis_config); let mut bank_client = BankClient::new_shared(bank); let (_, program_id) = load_program_and_advance_slot( @@ -764,6 +780,10 @@ fn test_return_data_and_log_data_syscall() { .accounts .remove(&feature_set::disable_bpf_loader_instructions::id()); + genesis_config + .accounts + .remove(&feature_set::deprecate_executable_meta_update_in_bpf_loader::id()); + let (bank, bank_forks) = Bank::new_with_bank_forks_for_tests(&genesis_config); let mut bank_client = BankClient::new_shared(bank.clone()); @@ -839,6 +859,10 @@ fn test_program_sbf_invoke_sanity() { .accounts .remove(&feature_set::disable_bpf_loader_instructions::id()); + genesis_config + .accounts + .remove(&feature_set::deprecate_executable_meta_update_in_bpf_loader::id()); + let (bank, bank_forks) = Bank::new_with_bank_forks_for_tests(&genesis_config); let mut bank_client = BankClient::new_shared(bank.clone()); @@ -1242,6 +1266,9 @@ fn test_program_sbf_program_id_spoofing() { genesis_config .accounts .remove(&feature_set::disable_bpf_loader_instructions::id()); + genesis_config + .accounts + .remove(&feature_set::deprecate_executable_meta_update_in_bpf_loader::id()); let (bank, bank_forks) = Bank::new_with_bank_forks_for_tests(&genesis_config); let mut bank_client = BankClient::new_shared(bank.clone()); @@ -1300,6 +1327,9 @@ fn test_program_sbf_caller_has_access_to_cpi_program() { genesis_config .accounts .remove(&feature_set::disable_bpf_loader_instructions::id()); + genesis_config + .accounts + .remove(&feature_set::deprecate_executable_meta_update_in_bpf_loader::id()); let (bank, bank_forks) = Bank::new_with_bank_forks_for_tests(&genesis_config); let mut bank_client = BankClient::new_shared(bank.clone()); @@ -1345,6 +1375,9 @@ fn test_program_sbf_ro_modify() { genesis_config .accounts .remove(&feature_set::disable_bpf_loader_instructions::id()); + genesis_config + .accounts + .remove(&feature_set::deprecate_executable_meta_update_in_bpf_loader::id()); let (bank, bank_forks) = Bank::new_with_bank_forks_for_tests(&genesis_config); let mut bank_client = BankClient::new_shared(bank.clone()); @@ -1407,6 +1440,9 @@ fn test_program_sbf_call_depth() { genesis_config .accounts .remove(&feature_set::disable_bpf_loader_instructions::id()); + genesis_config + .accounts + .remove(&feature_set::deprecate_executable_meta_update_in_bpf_loader::id()); let (bank, bank_forks) = Bank::new_with_bank_forks_for_tests(&genesis_config); let mut bank_client = BankClient::new_shared(bank); @@ -1448,6 +1484,9 @@ fn test_program_sbf_compute_budget() { genesis_config .accounts .remove(&feature_set::disable_bpf_loader_instructions::id()); + genesis_config + .accounts + .remove(&feature_set::deprecate_executable_meta_update_in_bpf_loader::id()); let (bank, bank_forks) = Bank::new_with_bank_forks_for_tests(&genesis_config); let mut bank_client = BankClient::new_shared(bank); @@ -1583,6 +1622,9 @@ fn test_program_sbf_instruction_introspection() { genesis_config .accounts .remove(&feature_set::disable_bpf_loader_instructions::id()); + genesis_config + .accounts + .remove(&feature_set::deprecate_executable_meta_update_in_bpf_loader::id()); let (bank, bank_forks) = Bank::new_with_bank_forks_for_tests(&genesis_config); let mut bank_client = BankClient::new_shared(bank.clone()); @@ -1648,6 +1690,9 @@ fn test_program_sbf_test_use_latest_executor() { genesis_config .accounts .remove(&feature_set::disable_bpf_loader_instructions::id()); + genesis_config + .accounts + .remove(&feature_set::deprecate_executable_meta_update_in_bpf_loader::id()); let (bank, bank_forks) = Bank::new_with_bank_forks_for_tests(&genesis_config); let mut bank_client = BankClient::new_shared(bank); @@ -2348,6 +2393,10 @@ fn test_program_sbf_invoke_upgradeable_via_cpi() { .accounts .remove(&feature_set::disable_bpf_loader_instructions::id()); + genesis_config + .accounts + .remove(&feature_set::deprecate_executable_meta_update_in_bpf_loader::id()); + let (bank, bank_forks) = Bank::new_with_bank_forks_for_tests(&genesis_config); let mut bank_client = BankClient::new_shared(bank); let invoke_and_return = load_program( @@ -2483,6 +2532,7 @@ fn test_program_sbf_disguised_as_sbf_loader() { &solana_sdk::feature_set::remove_bpf_loader_incorrect_program_id::id(), ); bank.deactivate_feature(&feature_set::disable_bpf_loader_instructions::id()); + bank.deactivate_feature(&feature_set::deprecate_executable_meta_update_in_bpf_loader::id()); let bank = bank.wrap_with_bank_forks_for_tests().0; let bank_client = BankClient::new_shared(bank); @@ -2514,6 +2564,10 @@ fn test_program_reads_from_program_account() { .accounts .remove(&feature_set::disable_bpf_loader_instructions::id()); + genesis_config + .accounts + .remove(&feature_set::deprecate_executable_meta_update_in_bpf_loader::id()); + let (bank, bank_forks) = Bank::new_with_bank_forks_for_tests(&genesis_config); let mut bank_client = BankClient::new_shared(bank); @@ -2548,6 +2602,10 @@ fn test_program_sbf_c_dup() { .accounts .remove(&feature_set::disable_bpf_loader_instructions::id()); + genesis_config + .accounts + .remove(&feature_set::deprecate_executable_meta_update_in_bpf_loader::id()); + let (bank, bank_forks) = Bank::new_with_bank_forks_for_tests(&genesis_config); let account_address = Pubkey::new_unique(); @@ -2590,6 +2648,10 @@ fn test_program_sbf_upgrade_via_cpi() { .accounts .remove(&feature_set::disable_bpf_loader_instructions::id()); + genesis_config + .accounts + .remove(&feature_set::deprecate_executable_meta_update_in_bpf_loader::id()); + let (bank, bank_forks) = Bank::new_with_bank_forks_for_tests(&genesis_config); let mut bank_client = BankClient::new_shared(bank); let invoke_and_return = load_program( @@ -2707,6 +2769,10 @@ fn test_program_sbf_set_upgrade_authority_via_cpi() { .accounts .remove(&feature_set::disable_bpf_loader_instructions::id()); + genesis_config + .accounts + .remove(&feature_set::deprecate_executable_meta_update_in_bpf_loader::id()); + let (bank, bank_forks) = Bank::new_with_bank_forks_for_tests(&genesis_config); let mut bank_client = BankClient::new_shared(bank); @@ -2929,6 +2995,10 @@ fn test_program_sbf_finalize() { .accounts .remove(&feature_set::disable_bpf_loader_instructions::id()); + genesis_config + .accounts + .remove(&feature_set::deprecate_executable_meta_update_in_bpf_loader::id()); + let (bank, bank_forks) = Bank::new_with_bank_forks_for_tests(&genesis_config); let mut bank_client = BankClient::new_shared(bank.clone()); @@ -2984,6 +3054,10 @@ fn test_program_sbf_ro_account_modify() { .accounts .remove(&feature_set::disable_bpf_loader_instructions::id()); + genesis_config + .accounts + .remove(&feature_set::deprecate_executable_meta_update_in_bpf_loader::id()); + let (bank, bank_forks) = Bank::new_with_bank_forks_for_tests(&genesis_config); let mut bank_client = BankClient::new_shared(bank.clone()); @@ -3053,6 +3127,10 @@ fn test_program_sbf_realloc() { .accounts .remove(&feature_set::disable_bpf_loader_instructions::id()); + genesis_config + .accounts + .remove(&feature_set::deprecate_executable_meta_update_in_bpf_loader::id()); + let mint_pubkey = mint_keypair.pubkey(); let signer = &[&mint_keypair]; for direct_mapping in [false, true] { @@ -3395,6 +3473,10 @@ fn test_program_sbf_realloc_invoke() { .accounts .remove(&feature_set::disable_bpf_loader_instructions::id()); + genesis_config + .accounts + .remove(&feature_set::deprecate_executable_meta_update_in_bpf_loader::id()); + let mint_pubkey = mint_keypair.pubkey(); let signer = &[&mint_keypair]; @@ -3921,6 +4003,10 @@ fn test_program_sbf_processed_inner_instruction() { .accounts .remove(&feature_set::disable_bpf_loader_instructions::id()); + genesis_config + .accounts + .remove(&feature_set::deprecate_executable_meta_update_in_bpf_loader::id()); + let (bank, bank_forks) = Bank::new_with_bank_forks_for_tests(&genesis_config); let mut bank_client = BankClient::new_shared(bank.clone()); @@ -4004,6 +4090,10 @@ fn test_program_fees() { .accounts .remove(&feature_set::disable_bpf_loader_instructions::id()); + genesis_config + .accounts + .remove(&feature_set::deprecate_executable_meta_update_in_bpf_loader::id()); + genesis_config.fee_rate_governor = FeeRateGovernor::new(congestion_multiplier, 0); let mut bank = Bank::new_for_tests(&genesis_config); let fee_structure = @@ -4084,6 +4174,10 @@ fn test_get_minimum_delegation() { .accounts .remove(&feature_set::disable_bpf_loader_instructions::id()); + genesis_config + .accounts + .remove(&feature_set::deprecate_executable_meta_update_in_bpf_loader::id()); + let bank = Bank::new_for_tests(&genesis_config); let (bank, bank_forks) = bank.wrap_with_bank_forks_for_tests(); let mut bank_client = BankClient::new_shared(bank.clone()); @@ -4160,6 +4254,7 @@ fn test_cpi_account_ownership_writability() { // deactivate `disable_bpf_loader_instructions` feature so that the program // can be loaded, finalized and tested. feature_set.deactivate(&feature_set::disable_bpf_loader_instructions::id()); + feature_set.deactivate(&feature_set::deprecate_executable_meta_update_in_bpf_loader::id()); bank.feature_set = Arc::new(feature_set); let (bank, bank_forks) = bank.wrap_with_bank_forks_for_tests(); let mut bank_client = BankClient::new_shared(bank); @@ -4345,6 +4440,8 @@ fn test_cpi_account_data_updates() { // deactivate `disable_bpf_loader_instructions` feature so that the program // can be loaded, finalized and tested. feature_set.deactivate(&feature_set::disable_bpf_loader_instructions::id()); + feature_set.deactivate(&feature_set::deprecate_executable_meta_update_in_bpf_loader::id()); + bank.feature_set = Arc::new(feature_set); let (bank, bank_forks) = bank.wrap_with_bank_forks_for_tests(); let mut bank_client = BankClient::new_shared(bank); @@ -4498,6 +4595,7 @@ fn test_cpi_deprecated_loader_realloc() { // deactivate `disable_bpf_loader_instructions` feature so that the program // can be loaded, finalized and tested. feature_set.deactivate(&feature_set::disable_bpf_loader_instructions::id()); + feature_set.deactivate(&feature_set::deprecate_executable_meta_update_in_bpf_loader::id()); bank.feature_set = Arc::new(feature_set); let (bank, bank_forks) = bank.wrap_with_bank_forks_for_tests(); @@ -4614,6 +4712,10 @@ fn test_cpi_change_account_data_memory_allocation() { .accounts .remove(&feature_set::disable_bpf_loader_instructions::id()); + genesis_config + .accounts + .remove(&feature_set::deprecate_executable_meta_update_in_bpf_loader::id()); + let mut bank = Bank::new_for_tests(&genesis_config); declare_process_instruction!(MockBuiltin, 42, |invoke_context| { @@ -4705,6 +4807,10 @@ fn test_cpi_invalid_account_info_pointers() { .accounts .remove(&feature_set::disable_bpf_loader_instructions::id()); + genesis_config + .accounts + .remove(&feature_set::deprecate_executable_meta_update_in_bpf_loader::id()); + let bank = Bank::new_for_tests(&genesis_config); let (bank, bank_forks) = bank.wrap_with_bank_forks_for_tests(); let mut bank_client = BankClient::new_shared(bank); @@ -4773,6 +4879,10 @@ fn test_deny_executable_write() { .accounts .remove(&feature_set::disable_bpf_loader_instructions::id()); + genesis_config + .accounts + .remove(&feature_set::deprecate_executable_meta_update_in_bpf_loader::id()); + for direct_mapping in [false, true] { let mut bank = Bank::new_for_tests(&genesis_config); let feature_set = Arc::make_mut(&mut bank.feature_set);