Skip to content

Commit 39aadea

Browse files
committed
Disables new deployments on loader-v3 when the feature enable_loader_v4 is enabled.
1 parent 710e0ea commit 39aadea

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

programs/bpf_loader/src/lib.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ use {
3636
entrypoint::{MAX_PERMITTED_DATA_INCREASE, SUCCESS},
3737
feature_set::{
3838
bpf_account_data_direct_mapping, enable_bpf_loader_set_authority_checked_ix,
39+
enable_loader_v4,
3940
},
4041
instruction::{AccountMeta, InstructionError},
4142
loader_upgradeable_instruction::UpgradeableLoaderInstruction,
@@ -525,6 +526,14 @@ fn process_loader_upgradeable_instruction(
525526
)?;
526527
}
527528
UpgradeableLoaderInstruction::DeployWithMaxDataLen { max_data_len } => {
529+
if invoke_context
530+
.get_feature_set()
531+
.is_active(&enable_loader_v4::id())
532+
{
533+
ic_logger_msg!(log_collector, "Unsupported instruction");
534+
return Err(InstructionError::InvalidInstructionData);
535+
}
536+
528537
instruction_context.check_number_of_instruction_accounts(4)?;
529538
let payer_key = *transaction_context.get_key_of_account_at_index(
530539
instruction_context.get_index_of_instruction_account_in_transaction(0)?,
@@ -1614,6 +1623,9 @@ mod tests {
16141623
expected_result,
16151624
Entrypoint::vm,
16161625
|invoke_context| {
1626+
let mut feature_set = invoke_context.get_feature_set().clone();
1627+
feature_set.deactivate(&enable_loader_v4::id());
1628+
invoke_context.mock_set_feature_set(Arc::new(feature_set));
16171629
test_utils::load_all_invoked_programs(invoke_context);
16181630
},
16191631
|_invoke_context| {},

0 commit comments

Comments
 (0)