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

Fix deployment of program-v4 in freshly started test validator #33583

Merged
merged 1 commit into from
Oct 9, 2023
Merged
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
6 changes: 5 additions & 1 deletion programs/loader-v4/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,11 @@ pub fn process_instruction_deploy(
authority_address,
)?;
let current_slot = invoke_context.get_sysvar_cache().get_clock()?.slot;
if state.slot.saturating_add(DEPLOYMENT_COOLDOWN_IN_SLOTS) > current_slot {

// Slot = 0 indicates that the program hasn't been deployed yet. So no need to check for the cooldown slots.
// (Without this check, the program deployment is failing in freshly started test validators. That's
// because at startup current_slot is 0, which is < DEPLOYMENT_COOLDOWN_IN_SLOTS).
if state.slot != 0 && state.slot.saturating_add(DEPLOYMENT_COOLDOWN_IN_SLOTS) > current_slot {
ic_logger_msg!(
log_collector,
"Program was deployed recently, cooldown still in effect"
Expand Down