Use feature gate to set effective slot of loaded programs (#30950)
This commit is contained in:
parent
2646fb72ed
commit
f198d7426a
|
@ -132,6 +132,7 @@ impl LoadedProgram {
|
||||||
loader_key: &Pubkey,
|
loader_key: &Pubkey,
|
||||||
loader: Arc<BuiltInProgram<InvokeContext<'static>>>,
|
loader: Arc<BuiltInProgram<InvokeContext<'static>>>,
|
||||||
deployment_slot: Slot,
|
deployment_slot: Slot,
|
||||||
|
effective_slot: Slot,
|
||||||
elf_bytes: &[u8],
|
elf_bytes: &[u8],
|
||||||
account_size: usize,
|
account_size: usize,
|
||||||
use_jit: bool,
|
use_jit: bool,
|
||||||
|
@ -176,7 +177,7 @@ impl LoadedProgram {
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
deployment_slot,
|
deployment_slot,
|
||||||
account_size,
|
account_size,
|
||||||
effective_slot: deployment_slot.saturating_add(1),
|
effective_slot,
|
||||||
usage_counter: AtomicU64::new(0),
|
usage_counter: AtomicU64::new(0),
|
||||||
program,
|
program,
|
||||||
})
|
})
|
||||||
|
|
|
@ -119,10 +119,17 @@ pub fn load_program_from_bytes(
|
||||||
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 effective_slot = if feature_set.is_active(&delay_visibility_of_program_deployment::id()) {
|
||||||
|
deployment_slot.saturating_add(1)
|
||||||
|
} else {
|
||||||
|
deployment_slot
|
||||||
|
};
|
||||||
|
|
||||||
let loaded_program = LoadedProgram::new(
|
let loaded_program = LoadedProgram::new(
|
||||||
loader_key,
|
loader_key,
|
||||||
loader,
|
loader,
|
||||||
deployment_slot,
|
deployment_slot,
|
||||||
|
effective_slot,
|
||||||
programdata,
|
programdata,
|
||||||
account_size,
|
account_size,
|
||||||
use_jit,
|
use_jit,
|
||||||
|
|
|
@ -114,6 +114,7 @@ pub fn load_program_from_account(
|
||||||
&loader_v3::id(),
|
&loader_v3::id(),
|
||||||
Arc::new(loader),
|
Arc::new(loader),
|
||||||
state.slot,
|
state.slot,
|
||||||
|
state.slot.saturating_add(1),
|
||||||
programdata,
|
programdata,
|
||||||
program.get_data().len(),
|
program.get_data().len(),
|
||||||
use_jit,
|
use_jit,
|
||||||
|
|
Loading…
Reference in New Issue