Refactor - Remove parameter `feature_set` from `load_program_from_bytes()` (#33395)
Replaces parameter feature_set with delay_visibility_of_program_deployment in load_program_from_bytes().
This commit is contained in:
parent
def8b8fc62
commit
7ff797bcef
|
@ -27,6 +27,7 @@ use {
|
||||||
account::AccountSharedData,
|
account::AccountSharedData,
|
||||||
account_utils::StateMut,
|
account_utils::StateMut,
|
||||||
bpf_loader_upgradeable::{self, UpgradeableLoaderState},
|
bpf_loader_upgradeable::{self, UpgradeableLoaderState},
|
||||||
|
feature_set,
|
||||||
pubkey::Pubkey,
|
pubkey::Pubkey,
|
||||||
slot_history::Slot,
|
slot_history::Slot,
|
||||||
transaction_context::{IndexOfAccount, InstructionAccount},
|
transaction_context::{IndexOfAccount, InstructionAccount},
|
||||||
|
@ -357,7 +358,9 @@ fn load_program<'a>(
|
||||||
#[allow(unused_mut)]
|
#[allow(unused_mut)]
|
||||||
let mut verified_executable = if is_elf {
|
let mut verified_executable = if is_elf {
|
||||||
let result = load_program_from_bytes(
|
let result = load_program_from_bytes(
|
||||||
&invoke_context.feature_set,
|
invoke_context
|
||||||
|
.feature_set
|
||||||
|
.is_active(&feature_set::delay_visibility_of_program_deployment::id()),
|
||||||
log_collector,
|
log_collector,
|
||||||
&mut load_program_metrics,
|
&mut load_program_metrics,
|
||||||
&contents,
|
&contents,
|
||||||
|
|
|
@ -35,7 +35,7 @@ use {
|
||||||
cap_bpf_program_instruction_accounts, delay_visibility_of_program_deployment,
|
cap_bpf_program_instruction_accounts, delay_visibility_of_program_deployment,
|
||||||
enable_bpf_loader_extend_program_ix, enable_bpf_loader_set_authority_checked_ix,
|
enable_bpf_loader_extend_program_ix, enable_bpf_loader_set_authority_checked_ix,
|
||||||
enable_program_redeployment_cooldown, limit_max_instruction_trace_length,
|
enable_program_redeployment_cooldown, limit_max_instruction_trace_length,
|
||||||
native_programs_consume_cu, remove_bpf_loader_incorrect_program_id, FeatureSet,
|
native_programs_consume_cu, remove_bpf_loader_incorrect_program_id,
|
||||||
},
|
},
|
||||||
instruction::{AccountMeta, InstructionError},
|
instruction::{AccountMeta, InstructionError},
|
||||||
loader_instruction::LoaderInstruction,
|
loader_instruction::LoaderInstruction,
|
||||||
|
@ -67,7 +67,7 @@ pub const UPGRADEABLE_LOADER_COMPUTE_UNITS: u64 = 2_370;
|
||||||
|
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub fn load_program_from_bytes(
|
pub fn load_program_from_bytes(
|
||||||
feature_set: &FeatureSet,
|
delay_visibility_of_program_deployment: bool,
|
||||||
log_collector: Option<Rc<RefCell<LogCollector>>>,
|
log_collector: Option<Rc<RefCell<LogCollector>>>,
|
||||||
load_program_metrics: &mut LoadProgramMetrics,
|
load_program_metrics: &mut LoadProgramMetrics,
|
||||||
programdata: &[u8],
|
programdata: &[u8],
|
||||||
|
@ -77,7 +77,7 @@ pub fn load_program_from_bytes(
|
||||||
program_runtime_environment: Arc<BuiltinProgram<InvokeContext<'static>>>,
|
program_runtime_environment: Arc<BuiltinProgram<InvokeContext<'static>>>,
|
||||||
reloading: bool,
|
reloading: bool,
|
||||||
) -> Result<LoadedProgram, InstructionError> {
|
) -> Result<LoadedProgram, InstructionError> {
|
||||||
let effective_slot = if feature_set.is_active(&delay_visibility_of_program_deployment::id()) {
|
let effective_slot = if delay_visibility_of_program_deployment {
|
||||||
deployment_slot.saturating_add(DELAY_VISIBILITY_SLOT_OFFSET)
|
deployment_slot.saturating_add(DELAY_VISIBILITY_SLOT_OFFSET)
|
||||||
} else {
|
} else {
|
||||||
deployment_slot
|
deployment_slot
|
||||||
|
@ -132,7 +132,7 @@ macro_rules! deploy_program {
|
||||||
register_syscalls_time.stop();
|
register_syscalls_time.stop();
|
||||||
load_program_metrics.register_syscalls_us = register_syscalls_time.as_us();
|
load_program_metrics.register_syscalls_us = register_syscalls_time.as_us();
|
||||||
let executor = load_program_from_bytes(
|
let executor = load_program_from_bytes(
|
||||||
&$invoke_context.feature_set,
|
$invoke_context.feature_set.is_active(&delay_visibility_of_program_deployment::id()),
|
||||||
$invoke_context.get_log_collector(),
|
$invoke_context.get_log_collector(),
|
||||||
&mut load_program_metrics,
|
&mut load_program_metrics,
|
||||||
$new_programdata,
|
$new_programdata,
|
||||||
|
@ -1707,7 +1707,7 @@ pub mod test_utils {
|
||||||
.expect("Failed to get account key");
|
.expect("Failed to get account key");
|
||||||
|
|
||||||
if let Ok(loaded_program) = load_program_from_bytes(
|
if let Ok(loaded_program) = load_program_from_bytes(
|
||||||
&FeatureSet::all_enabled(),
|
true,
|
||||||
None,
|
None,
|
||||||
&mut load_program_metrics,
|
&mut load_program_metrics,
|
||||||
account.data(),
|
account.data(),
|
||||||
|
|
|
@ -4684,7 +4684,8 @@ impl Bank {
|
||||||
|
|
||||||
ProgramAccountLoadResult::ProgramOfLoaderV1orV2(program_account) => {
|
ProgramAccountLoadResult::ProgramOfLoaderV1orV2(program_account) => {
|
||||||
solana_bpf_loader_program::load_program_from_bytes(
|
solana_bpf_loader_program::load_program_from_bytes(
|
||||||
&self.feature_set,
|
self.feature_set
|
||||||
|
.is_active(&feature_set::delay_visibility_of_program_deployment::id()),
|
||||||
None,
|
None,
|
||||||
&mut load_program_metrics,
|
&mut load_program_metrics,
|
||||||
program_account.data(),
|
program_account.data(),
|
||||||
|
@ -4706,7 +4707,8 @@ impl Bank {
|
||||||
.ok_or(InstructionError::InvalidAccountData)
|
.ok_or(InstructionError::InvalidAccountData)
|
||||||
.and_then(|programdata| {
|
.and_then(|programdata| {
|
||||||
solana_bpf_loader_program::load_program_from_bytes(
|
solana_bpf_loader_program::load_program_from_bytes(
|
||||||
&self.feature_set,
|
self.feature_set
|
||||||
|
.is_active(&feature_set::delay_visibility_of_program_deployment::id()),
|
||||||
None,
|
None,
|
||||||
&mut load_program_metrics,
|
&mut load_program_metrics,
|
||||||
programdata,
|
programdata,
|
||||||
|
|
Loading…
Reference in New Issue