disable deprecated BPF loader deploys (#23757)

This commit is contained in:
Jack May
2022-03-18 14:29:49 -07:00
committed by GitHub
parent 7e358c654f
commit 1f052c6234
3 changed files with 25 additions and 13 deletions

View File

@ -44,8 +44,8 @@ use {
entrypoint::{HEAP_LENGTH, SUCCESS},
feature_set::{
cap_accounts_data_len, disable_bpf_deprecated_load_instructions,
disable_bpf_unresolved_symbols_at_runtime, do_support_realloc,
reduce_required_deploy_balance, requestable_heap_size,
disable_bpf_unresolved_symbols_at_runtime, disable_deprecated_loader,
do_support_realloc, reduce_required_deploy_balance, requestable_heap_size,
},
instruction::{AccountMeta, InstructionError},
keyed_account::{keyed_account_at_index, KeyedAccount},
@ -387,6 +387,10 @@ fn process_instruction_common(
)
} else {
debug_assert_eq!(first_instruction_account, 1);
let disable_deprecated_loader = invoke_context
.feature_set
.is_active(&disable_deprecated_loader::id());
if bpf_loader_upgradeable::check_id(program_id) {
process_loader_upgradeable_instruction(
first_instruction_account,
@ -394,13 +398,18 @@ fn process_instruction_common(
invoke_context,
use_jit,
)
} else if bpf_loader::check_id(program_id) || bpf_loader_deprecated::check_id(program_id) {
} else if bpf_loader::check_id(program_id)
|| (!disable_deprecated_loader && bpf_loader_deprecated::check_id(program_id))
{
process_loader_instruction(
first_instruction_account,
instruction_data,
invoke_context,
use_jit,
)
} else if disable_deprecated_loader && bpf_loader_deprecated::check_id(program_id) {
ic_logger_msg!(log_collector, "Deprecated loader is no longer supported");
Err(InstructionError::UnsupportedProgramId)
} else {
ic_logger_msg!(log_collector, "Invalid BPF loader id");
Err(InstructionError::IncorrectProgramId)