Skip to content

Commit

Permalink
Deactivates the feature in the tests and benches.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lichtso committed Feb 6, 2024
1 parent f83c2ae commit ac6b9f5
Show file tree
Hide file tree
Showing 3 changed files with 255 additions and 34 deletions.
13 changes: 12 additions & 1 deletion programs/bpf_loader/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1786,6 +1786,7 @@ mod tests {
},
account_utils::StateMut,
clock::Clock,
feature_set::FeatureSet,
instruction::{AccountMeta, InstructionError},
pubkey::Pubkey,
rent::Rent,
Expand Down Expand Up @@ -1824,6 +1825,9 @@ mod tests {
expected_result,
Entrypoint::vm,
|invoke_context| {
let mut features = FeatureSet::all_enabled();
features.deactivate(&disable_bpf_loader_instructions::id());
invoke_context.feature_set = Arc::new(features);
test_utils::load_all_invoked_programs(invoke_context);
},
|_invoke_context| {},
Expand Down Expand Up @@ -2043,6 +2047,9 @@ mod tests {
Err(InstructionError::ProgramFailedToComplete),
Entrypoint::vm,
|invoke_context| {
let mut features = FeatureSet::all_enabled();
features.deactivate(&disable_bpf_loader_instructions::id());
invoke_context.feature_set = Arc::new(features);
invoke_context.mock_set_remaining(0);
test_utils::load_all_invoked_programs(invoke_context);
},
Expand Down Expand Up @@ -2588,7 +2595,11 @@ mod tests {
instruction_accounts,
expected_result,
Entrypoint::vm,
|_invoke_context| {},
|invoke_context| {
let mut features = FeatureSet::all_enabled();
features.deactivate(&disable_bpf_loader_instructions::id());
invoke_context.feature_set = Arc::new(features);
},
|_invoke_context| {},
)
}
Expand Down
11 changes: 9 additions & 2 deletions programs/sbf/benches/bpf_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use {
bpf_loader,
client::SyncClient,
entrypoint::SUCCESS,
feature_set::FeatureSet,
feature_set::{self, FeatureSet},
instruction::{AccountMeta, Instruction},
message::Message,
native_loader,
Expand Down Expand Up @@ -183,10 +183,17 @@ fn bench_program_alu(bencher: &mut Bencher) {
#[bench]
fn bench_program_execute_noop(bencher: &mut Bencher) {
let GenesisConfigInfo {
genesis_config,
mut genesis_config,
mint_keypair,
..
} = create_genesis_config(50);

// deactivate `disable_bpf_loader_instructions` feature so that the program
// can be loaded, finalized and benched.
genesis_config
.accounts
.remove(&feature_set::disable_bpf_loader_instructions::id());

let bank = Bank::new_for_benches(&genesis_config);
let bank = Arc::new(bank);
let mut bank_client = BankClient::new_shared(bank.clone());
Expand Down
Loading

0 comments on commit ac6b9f5

Please sign in to comment.