Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit 09e0300

Browse files
authored
Feature - disable_bpf_loader_instructions (#35104)
* Remove feature gate for disable_bpf_loader_instructions. * Disables related tests.
1 parent 4f00402 commit 09e0300

File tree

1 file changed

+13
-31
lines changed

1 file changed

+13
-31
lines changed

programs/bpf_loader/src/lib.rs

+13-31
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,9 @@ use {
3636
feature_set::{
3737
bpf_account_data_direct_mapping, cap_accounts_data_allocations_per_transaction,
3838
cap_bpf_program_instruction_accounts, delay_visibility_of_program_deployment,
39-
disable_bpf_loader_instructions, enable_bpf_loader_extend_program_ix,
40-
enable_bpf_loader_set_authority_checked_ix, enable_program_redeployment_cooldown,
41-
limit_max_instruction_trace_length, native_programs_consume_cu,
42-
remove_bpf_loader_incorrect_program_id,
39+
enable_bpf_loader_extend_program_ix, enable_bpf_loader_set_authority_checked_ix,
40+
enable_program_redeployment_cooldown, limit_max_instruction_trace_length,
41+
native_programs_consume_cu, remove_bpf_loader_incorrect_program_id,
4342
},
4443
instruction::{AccountMeta, InstructionError},
4544
loader_instruction::LoaderInstruction,
@@ -510,20 +509,11 @@ pub fn process_instruction_inner(
510509
if native_programs_consume_cu {
511510
invoke_context.consume_checked(DEFAULT_LOADER_COMPUTE_UNITS)?;
512511
}
513-
// Return `UnsupportedProgramId` error for bpf_loader when
514-
// `disable_bpf_loader_instruction` feature is activated.
515-
if invoke_context
516-
.feature_set
517-
.is_active(&disable_bpf_loader_instructions::id())
518-
{
519-
ic_logger_msg!(
520-
log_collector,
521-
"BPF loader management instructions are no longer supported"
522-
);
523-
Err(InstructionError::UnsupportedProgramId)
524-
} else {
525-
process_loader_instruction(invoke_context)
526-
}
512+
ic_logger_msg!(
513+
log_collector,
514+
"BPF loader management instructions are no longer supported"
515+
);
516+
Err(InstructionError::UnsupportedProgramId)
527517
} else if bpf_loader_deprecated::check_id(program_id) {
528518
if native_programs_consume_cu {
529519
invoke_context.consume_checked(DEPRECATED_LOADER_COMPUTE_UNITS)?;
@@ -1486,7 +1476,7 @@ fn common_close_account(
14861476
Ok(())
14871477
}
14881478

1489-
fn process_loader_instruction(invoke_context: &mut InvokeContext) -> Result<(), InstructionError> {
1479+
fn _process_loader_instruction(invoke_context: &mut InvokeContext) -> Result<(), InstructionError> {
14901480
let transaction_context = &invoke_context.transaction_context;
14911481
let instruction_context = transaction_context.get_current_instruction_context()?;
14921482
let instruction_data = instruction_context.get_instruction_data();
@@ -1787,7 +1777,6 @@ mod tests {
17871777
},
17881778
account_utils::StateMut,
17891779
clock::Clock,
1790-
feature_set::FeatureSet,
17911780
instruction::{AccountMeta, InstructionError},
17921781
pubkey::Pubkey,
17931782
rent::Rent,
@@ -1826,9 +1815,6 @@ mod tests {
18261815
expected_result,
18271816
Entrypoint::vm,
18281817
|invoke_context| {
1829-
let mut features = FeatureSet::all_enabled();
1830-
features.deactivate(&disable_bpf_loader_instructions::id());
1831-
invoke_context.feature_set = Arc::new(features);
18321818
test_utils::load_all_invoked_programs(invoke_context);
18331819
},
18341820
|_invoke_context| {},
@@ -1847,6 +1833,7 @@ mod tests {
18471833
program_account
18481834
}
18491835

1836+
#[ignore]
18501837
#[test]
18511838
fn test_bpf_loader_write() {
18521839
let loader_id = bpf_loader::id();
@@ -1914,6 +1901,7 @@ mod tests {
19141901
);
19151902
}
19161903

1904+
#[ignore]
19171905
#[test]
19181906
fn test_bpf_loader_finalize() {
19191907
let loader_id = bpf_loader::id();
@@ -1978,6 +1966,7 @@ mod tests {
19781966
);
19791967
}
19801968

1969+
#[ignore]
19811970
#[test]
19821971
fn test_bpf_loader_invoke_main() {
19831972
let loader_id = bpf_loader::id();
@@ -2048,9 +2037,6 @@ mod tests {
20482037
Err(InstructionError::ProgramFailedToComplete),
20492038
Entrypoint::vm,
20502039
|invoke_context| {
2051-
let mut features = FeatureSet::all_enabled();
2052-
features.deactivate(&disable_bpf_loader_instructions::id());
2053-
invoke_context.feature_set = Arc::new(features);
20542040
invoke_context.mock_set_remaining(0);
20552041
test_utils::load_all_invoked_programs(invoke_context);
20562042
},
@@ -2596,11 +2582,7 @@ mod tests {
25962582
instruction_accounts,
25972583
expected_result,
25982584
Entrypoint::vm,
2599-
|invoke_context| {
2600-
let mut features = FeatureSet::all_enabled();
2601-
features.deactivate(&disable_bpf_loader_instructions::id());
2602-
invoke_context.feature_set = Arc::new(features);
2603-
},
2585+
|_invoke_context| {},
26042586
|_invoke_context| {},
26052587
)
26062588
}

0 commit comments

Comments
 (0)