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

feature gate: init program with RevokePendingActivation instruction #5510

Merged
merged 3 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 3 additions & 3 deletions feature-gate/program/src/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ pub enum FeatureGateInstruction {
/// Revoke a pending feature activation.
///
/// A "pending" feature activation is a feature account that has been
/// allocated and assigned, but hasn't been processed by the network yet.
/// allocated and assigned, but hasn't yet been updated by the runtime
/// with an `activation_slot`.
///
/// Features that _have_ been processed by the network are activated, and
/// cannot be revoked.
/// Features that _have_ been activated by the runtime cannot be revoked.
///
/// Accounts expected by this instruction:
///
Expand Down
9 changes: 3 additions & 6 deletions feature-gate/program/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ use {
},
};

/// Processes an [RevokePendingActivation](enum.FeatureGateInstruction.html)
/// Processes a [RevokePendingActivation](enum.FeatureGateInstruction.html)
/// instruction.
pub fn process_revoke_pending_activation(
program_id: &Pubkey,
_program_id: &Pubkey,
accounts: &[AccountInfo],
) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
Expand All @@ -28,10 +28,7 @@ pub fn process_revoke_pending_activation(
return Err(ProgramError::MissingRequiredSignature);
}

if feature_info.owner != program_id {
return Err(ProgramError::IllegalOwner);
}

// This will also check the program ID
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

if Feature::from_account_info(feature_info)?
.activated_at
.is_some()
Expand Down
Loading