Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use feature gate to set effective slot of loaded programs #30950

Merged
merged 1 commit into from
Mar 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion program-runtime/src/loaded_programs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ impl LoadedProgram {
loader_key: &Pubkey,
loader: Arc<BuiltInProgram<InvokeContext<'static>>>,
deployment_slot: Slot,
effective_slot: Slot,
elf_bytes: &[u8],
account_size: usize,
use_jit: bool,
Expand Down Expand Up @@ -176,7 +177,7 @@ impl LoadedProgram {
Ok(Self {
deployment_slot,
account_size,
effective_slot: deployment_slot.saturating_add(1),
effective_slot,
usage_counter: AtomicU64::new(0),
program,
})
Expand Down
7 changes: 7 additions & 0 deletions programs/bpf_loader/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,17 @@ pub fn load_program_from_bytes(
register_syscalls_time.stop();
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(
loader_key,
loader,
deployment_slot,
effective_slot,
programdata,
account_size,
use_jit,
Expand Down
1 change: 1 addition & 0 deletions programs/loader-v3/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ pub fn load_program_from_account(
&loader_v3::id(),
Arc::new(loader),
state.slot,
state.slot.saturating_add(1),
programdata,
program.get_data().len(),
use_jit,
Expand Down