Skip to content

Commit

Permalink
Replaces parameter feature_set with delay_visibility_of_program_deplo…
Browse files Browse the repository at this point in the history
…yment in load_program_from_bytes().
  • Loading branch information
Lichtso committed Aug 17, 2023
1 parent fb8dc87 commit cc305bd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
5 changes: 4 additions & 1 deletion ledger-tool/src/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use {
account::AccountSharedData,
account_utils::StateMut,
bpf_loader_upgradeable::{self, UpgradeableLoaderState},
feature_set,
pubkey::Pubkey,
slot_history::Slot,
transaction_context::{IndexOfAccount, InstructionAccount},
Expand Down Expand Up @@ -357,7 +358,9 @@ fn load_program<'a>(
#[allow(unused_mut)]
let mut verified_executable = if is_elf {
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,
&mut load_program_metrics,
&contents,
Expand Down
10 changes: 5 additions & 5 deletions programs/bpf_loader/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use {
cap_bpf_program_instruction_accounts, delay_visibility_of_program_deployment,
enable_bpf_loader_extend_program_ix, enable_bpf_loader_set_authority_checked_ix,
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},
loader_instruction::LoaderInstruction,
Expand Down Expand Up @@ -68,7 +68,7 @@ pub const UPGRADEABLE_LOADER_COMPUTE_UNITS: u64 = 2_370;

#[allow(clippy::too_many_arguments)]
pub fn load_program_from_bytes(
feature_set: &FeatureSet,
delay_visibility_of_program_deployment: bool,
log_collector: Option<Rc<RefCell<LogCollector>>>,
load_program_metrics: &mut LoadProgramMetrics,
programdata: &[u8],
Expand All @@ -77,7 +77,7 @@ pub fn load_program_from_bytes(
deployment_slot: Slot,
program_runtime_environment: Arc<BuiltinProgram<InvokeContext<'static>>>,
) -> 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)
} else {
deployment_slot
Expand Down Expand Up @@ -116,7 +116,7 @@ macro_rules! deploy_program {
register_syscalls_time.stop();
load_program_metrics.register_syscalls_us = register_syscalls_time.as_us();
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(),
&mut load_program_metrics,
$new_programdata,
Expand Down Expand Up @@ -1666,7 +1666,7 @@ pub mod test_utils {
.expect("Failed to get account key");

if let Ok(loaded_program) = load_program_from_bytes(
&FeatureSet::all_enabled(),
true,
None,
&mut load_program_metrics,
account.data(),
Expand Down
7 changes: 4 additions & 3 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1447,7 +1447,6 @@ impl Bank {
let (_epoch, slot_index) = new.get_epoch_and_slot_index(new.slot());
let loaded_programs_cache = new.loaded_programs_cache.write().unwrap();
if !loaded_programs_cache.programs_to_recompile.is_empty() {

} else if slot_index.saturating_add(
solana_program_runtime::loaded_programs::MAX_LOADED_ENTRY_COUNT
.checked_div(2)
Expand Down Expand Up @@ -4725,7 +4724,8 @@ impl Bank {

ProgramAccountLoadResult::ProgramOfLoaderV1orV2(program_account) => {
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,
&mut load_program_metrics,
program_account.data(),
Expand All @@ -4746,7 +4746,8 @@ impl Bank {
.ok_or(InstructionError::InvalidAccountData)
.and_then(|programdata| {
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,
&mut load_program_metrics,
programdata,
Expand Down

0 comments on commit cc305bd

Please sign in to comment.