Remove id field

This commit is contained in:
Michael Vines
2020-09-24 00:22:49 -07:00
parent 7526bb96f3
commit cc6ba1e131
3 changed files with 7 additions and 19 deletions

View File

@ -3517,11 +3517,7 @@ impl Bank {
inactive.insert(*feature_id);
}
self.feature_set = Arc::new(FeatureSet {
id: self.feature_set.id,
active,
inactive,
});
self.feature_set = Arc::new(FeatureSet { active, inactive });
newly_activated
}

View File

@ -14,6 +14,7 @@ pub mod secp256k1_program_enabled {
}
lazy_static! {
/// Map of feature identifiers to user-visible description
pub static ref FEATURE_NAMES: HashMap<Pubkey, &'static str> = [
(instructions_sysvar_enabled::id(), "instructions sysvar"),
(secp256k1_program_enabled::id(), "secp256k1 program")
@ -23,7 +24,8 @@ lazy_static! {
.cloned()
.collect();
static ref ID: Hash = {
/// Unique identifier of the current software's feature set
pub static ref ID: Hash = {
let mut hasher = Hasher::default();
let mut feature_ids = FEATURE_NAMES.keys().collect::<Vec<_>>();
feature_ids.sort();
@ -34,16 +36,10 @@ lazy_static! {
};
}
/// The `FeatureSet` struct tracks the set of available and currently active runtime features
/// `FeatureSet` holds the set of currently active/inactive runtime features
#[derive(AbiExample)]
pub struct FeatureSet {
/// Unique identifier of this feature set
pub id: Hash,
/// Features that are currently active
pub active: HashSet<Pubkey>,
/// Features that are currently inactive
pub inactive: HashSet<Pubkey>,
}
@ -54,10 +50,9 @@ impl FeatureSet {
}
impl Default for FeatureSet {
// By default all features are disabled
fn default() -> Self {
// All features disabled
Self {
id: *ID,
active: HashSet::new(),
inactive: FEATURE_NAMES.keys().cloned().collect(),
}
@ -67,7 +62,6 @@ impl Default for FeatureSet {
impl FeatureSet {
pub fn enabled() -> Self {
Self {
id: *ID,
active: FEATURE_NAMES.keys().cloned().collect(),
inactive: HashSet::new(),
}

View File

@ -51,9 +51,7 @@ fn compute_commit(sha1: Option<&'static str>) -> Option<u32> {
impl Default for Version {
fn default() -> Self {
let feature_set = u32::from_le_bytes(
solana_runtime::feature_set::FeatureSet::default()
.id
.as_ref()[..4]
solana_runtime::feature_set::ID.as_ref()[..4]
.try_into()
.unwrap(),
);