Skip to content

Commit

Permalink
clarify comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jstarry committed Mar 5, 2024
1 parent 43502ec commit 34f90e6
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions sdk/src/reserved_account_keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,13 @@ use {
std::collections::HashSet,
};

// Temporary until a zk token program module is added to the sdk
// Inline zk token program id since it isn't available in the sdk
mod zk_token_proof_program {
solana_sdk::declare_id!("ZkTokenProof1111111111111111111111111111111");
}

pub struct ReservedAccountKeys;
impl ReservedAccountKeys {
/// Compute a set of all reserved keys, regardless of if they are active or not
pub fn active_and_inactive() -> HashSet<Pubkey> {
RESERVED_ACCOUNT_KEYS
.iter()
.map(|reserved_key| reserved_key.key)
.collect()
}

/// Compute the active set of reserved keys based on activated features
pub fn active(feature_set: &FeatureSet) -> HashSet<Pubkey> {
Self::compute_active(&RESERVED_ACCOUNT_KEYS, feature_set)
Expand All @@ -49,6 +41,16 @@ impl ReservedAccountKeys {
.collect()
}

/// Compute a set of all reserved keys, regardless of if they are active or not.
/// Since this method doesn't take into account which reserved keys are active,
/// it should not be used by the runtime.
pub fn active_and_inactive() -> HashSet<Pubkey> {
RESERVED_ACCOUNT_KEYS
.iter()
.map(|reserved_key| reserved_key.key)
.collect()
}

/// Return an empty list of reserved keys for visibility when using in
/// places where the dynamic reserved key set is not available
pub fn empty() -> HashSet<Pubkey> {
Expand Down

0 comments on commit 34f90e6

Please sign in to comment.