Skip to content
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
11 changes: 0 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,6 @@ solana-derivation-path = "2.2.1"
solana-download-utils = { path = "download-utils", version = "=2.2.9" }
solana-ed25519-program = "2.2.2"
solana-entry = { path = "entry", version = "=2.2.9" }
solana-feature-set-interface = "=4.0.0"
solana-program-entrypoint = "2.2.1"
solana-epoch-info = "2.2.1"
solana-epoch-rewards = "2.2.1"
Expand Down
1 change: 0 additions & 1 deletion feature-set/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ readme = false
[dependencies]
ahash = { workspace = true }
solana-epoch-schedule = { workspace = true }
solana-feature-set-interface = { workspace = true }
solana-frozen-abi = { workspace = true, optional = true, features = [
"frozen-abi",
] }
Expand Down
45 changes: 18 additions & 27 deletions feature-set/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
use {
ahash::{AHashMap, AHashSet},
solana_epoch_schedule::EpochSchedule,
solana_feature_set_interface::FeatureSet as SdkFeatureSet,
solana_hash::Hash,
solana_pubkey::Pubkey,
solana_sha256_hasher::Hasher,
Expand All @@ -13,60 +12,59 @@ use {
#[cfg_attr(feature = "frozen-abi", derive(solana_frozen_abi_macro::AbiExample))]
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct FeatureSet {
feature_set: SdkFeatureSet,
active: AHashMap<Pubkey, u64>,
inactive: AHashSet<Pubkey>,
}

impl Default for FeatureSet {
fn default() -> Self {
// All features disabled
Self {
feature_set: SdkFeatureSet {
active: AHashMap::new(),
inactive: AHashSet::from_iter((*FEATURE_NAMES).keys().cloned()),
},
// All features disabled
active: AHashMap::new(),
inactive: AHashSet::from_iter((*FEATURE_NAMES).keys().cloned()),
}
}
}

impl FeatureSet {
pub fn new(active: AHashMap<Pubkey, u64>, inactive: AHashSet<Pubkey>) -> Self {
Self {
feature_set: SdkFeatureSet { active, inactive },
}
Self { active, inactive }
}

pub fn active(&self) -> &AHashMap<Pubkey, u64> {
&self.feature_set.active
&self.active
}

pub fn active_mut(&mut self) -> &mut AHashMap<Pubkey, u64> {
&mut self.feature_set.active
&mut self.active
}

pub fn inactive(&self) -> &AHashSet<Pubkey> {
&self.feature_set.inactive
&self.inactive
}

pub fn inactive_mut(&mut self) -> &mut AHashSet<Pubkey> {
&mut self.feature_set.inactive
&mut self.inactive
}

pub fn is_active(&self, feature_id: &Pubkey) -> bool {
self.feature_set.is_active(feature_id)
self.active.contains_key(feature_id)
}

pub fn activated_slot(&self, feature_id: &Pubkey) -> Option<u64> {
self.feature_set.activated_slot(feature_id)
self.active.get(feature_id).copied()
}

/// Activate a feature
pub fn activate(&mut self, feature_id: &Pubkey, slot: u64) {
self.feature_set.activate(feature_id, slot)
self.inactive.remove(feature_id);
self.active.insert(*feature_id, slot);
}

/// Deactivate a feature
pub fn deactivate(&mut self, feature_id: &Pubkey) {
self.feature_set.deactivate(feature_id)
self.active.remove(feature_id);
self.inactive.insert(*feature_id);
}

/// List of enabled features that trigger full inflation
Expand All @@ -91,10 +89,8 @@ impl FeatureSet {
/// All features enabled, useful for testing
pub fn all_enabled() -> Self {
Self {
feature_set: SdkFeatureSet {
active: AHashMap::from_iter((*FEATURE_NAMES).keys().cloned().map(|key| (key, 0))),
inactive: AHashSet::new(),
},
active: AHashMap::from_iter((*FEATURE_NAMES).keys().cloned().map(|key| (key, 0))),
inactive: AHashSet::new(),
}
}

Expand Down Expand Up @@ -1296,7 +1292,6 @@ mod test {
let mut feature_set = FeatureSet::default();
assert!(feature_set.full_inflation_features_enabled().is_empty());
feature_set
.feature_set
.active
.insert(full_inflation::devnet_and_testnet::id(), 42);
assert_eq!(
Expand All @@ -1314,12 +1309,10 @@ mod test {
let mut feature_set = FeatureSet::default();
assert!(feature_set.full_inflation_features_enabled().is_empty());
feature_set
.feature_set
.active
.insert(full_inflation::mainnet::certusone::vote::id(), 42);
assert!(feature_set.full_inflation_features_enabled().is_empty());
feature_set
.feature_set
.active
.insert(full_inflation::mainnet::certusone::enable::id(), 42);
assert_eq!(
Expand All @@ -1334,12 +1327,10 @@ mod test {
let mut feature_set = FeatureSet::default();
assert!(feature_set.full_inflation_features_enabled().is_empty());
feature_set
.feature_set
.active
.insert(full_inflation::mainnet::certusone::enable::id(), 42);
assert!(feature_set.full_inflation_features_enabled().is_empty());
feature_set
.feature_set
.active
.insert(full_inflation::mainnet::certusone::vote::id(), 42);
assert_eq!(
Expand Down
11 changes: 0 additions & 11 deletions programs/sbf/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 0 additions & 11 deletions svm/examples/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading