Rename active() to is_active()
This commit is contained in:
@ -151,7 +151,7 @@ impl Accounts {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if solana_sdk::sysvar::instructions::check_id(key)
|
if solana_sdk::sysvar::instructions::check_id(key)
|
||||||
&& feature_set.active(&feature_set::instructions_sysvar_enabled::id())
|
&& feature_set.is_active(&feature_set::instructions_sysvar_enabled::id())
|
||||||
{
|
{
|
||||||
if message.is_writable(i) {
|
if message.is_writable(i) {
|
||||||
return Err(TransactionError::InvalidAccountIndex);
|
return Err(TransactionError::InvalidAccountIndex);
|
||||||
@ -307,7 +307,7 @@ impl Accounts {
|
|||||||
|
|
||||||
let fee_config = FeeConfig {
|
let fee_config = FeeConfig {
|
||||||
secp256k1_program_enabled: feature_set
|
secp256k1_program_enabled: feature_set
|
||||||
.active(&feature_set::secp256k1_program_enabled::id()),
|
.is_active(&feature_set::secp256k1_program_enabled::id()),
|
||||||
};
|
};
|
||||||
OrderedIterator::new(txs, txs_iteration_order)
|
OrderedIterator::new(txs, txs_iteration_order)
|
||||||
.zip(lock_results.into_iter())
|
.zip(lock_results.into_iter())
|
||||||
|
@ -3465,7 +3465,7 @@ impl Bank {
|
|||||||
|
|
||||||
pub fn secp256k1_program_enabled(&self) -> bool {
|
pub fn secp256k1_program_enabled(&self) -> bool {
|
||||||
self.feature_set
|
self.feature_set
|
||||||
.active(&feature_set::secp256k1_program_enabled::id())
|
.is_active(&feature_set::secp256k1_program_enabled::id())
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is called from snapshot restore AND for each epoch boundary
|
// This is called from snapshot restore AND for each epoch boundary
|
||||||
@ -3531,7 +3531,7 @@ impl Bank {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (program, feature) in get_feature_builtins() {
|
for (program, feature) in get_feature_builtins() {
|
||||||
let should_populate = init_or_warp && self.feature_set.active(&feature)
|
let should_populate = init_or_warp && self.feature_set.is_active(&feature)
|
||||||
|| !init_or_warp && new_feature_activations.contains(&feature);
|
|| !init_or_warp && new_feature_activations.contains(&feature);
|
||||||
if should_populate {
|
if should_populate {
|
||||||
self.add_builtin(&program.name, program.id, program.entrypoint);
|
self.add_builtin(&program.name, program.id, program.entrypoint);
|
||||||
@ -9009,13 +9009,13 @@ mod tests {
|
|||||||
|
|
||||||
let new_activations = bank.compute_active_feature_set(true);
|
let new_activations = bank.compute_active_feature_set(true);
|
||||||
assert!(new_activations.is_empty());
|
assert!(new_activations.is_empty());
|
||||||
assert!(!bank.feature_set.active(&test_feature));
|
assert!(!bank.feature_set.is_active(&test_feature));
|
||||||
|
|
||||||
// Depositing into the `test_feature` account should do nothing
|
// Depositing into the `test_feature` account should do nothing
|
||||||
bank.deposit(&test_feature, 42);
|
bank.deposit(&test_feature, 42);
|
||||||
let new_activations = bank.compute_active_feature_set(true);
|
let new_activations = bank.compute_active_feature_set(true);
|
||||||
assert!(new_activations.is_empty());
|
assert!(new_activations.is_empty());
|
||||||
assert!(!bank.feature_set.active(&test_feature));
|
assert!(!bank.feature_set.is_active(&test_feature));
|
||||||
|
|
||||||
// Request `test_feature` activation
|
// Request `test_feature` activation
|
||||||
let feature = Feature::default();
|
let feature = Feature::default();
|
||||||
@ -9025,7 +9025,7 @@ mod tests {
|
|||||||
// Run `compute_active_feature_set` disallowing new activations
|
// Run `compute_active_feature_set` disallowing new activations
|
||||||
let new_activations = bank.compute_active_feature_set(false);
|
let new_activations = bank.compute_active_feature_set(false);
|
||||||
assert!(new_activations.is_empty());
|
assert!(new_activations.is_empty());
|
||||||
assert!(!bank.feature_set.active(&test_feature));
|
assert!(!bank.feature_set.is_active(&test_feature));
|
||||||
let feature = Feature::from_account(&bank.get_account(&test_feature).expect("get_account"))
|
let feature = Feature::from_account(&bank.get_account(&test_feature).expect("get_account"))
|
||||||
.expect("from_account");
|
.expect("from_account");
|
||||||
assert_eq!(feature.activated_at, None);
|
assert_eq!(feature.activated_at, None);
|
||||||
@ -9033,19 +9033,19 @@ mod tests {
|
|||||||
// Run `compute_active_feature_set` allowing new activations
|
// Run `compute_active_feature_set` allowing new activations
|
||||||
let new_activations = bank.compute_active_feature_set(true);
|
let new_activations = bank.compute_active_feature_set(true);
|
||||||
assert_eq!(new_activations.len(), 1);
|
assert_eq!(new_activations.len(), 1);
|
||||||
assert!(bank.feature_set.active(&test_feature));
|
assert!(bank.feature_set.is_active(&test_feature));
|
||||||
let feature = Feature::from_account(&bank.get_account(&test_feature).expect("get_account"))
|
let feature = Feature::from_account(&bank.get_account(&test_feature).expect("get_account"))
|
||||||
.expect("from_account");
|
.expect("from_account");
|
||||||
assert_eq!(feature.activated_at, Some(1));
|
assert_eq!(feature.activated_at, Some(1));
|
||||||
|
|
||||||
// Reset the bank's feature set
|
// Reset the bank's feature set
|
||||||
bank.feature_set = Arc::new(feature_set);
|
bank.feature_set = Arc::new(feature_set);
|
||||||
assert!(!bank.feature_set.active(&test_feature));
|
assert!(!bank.feature_set.is_active(&test_feature));
|
||||||
|
|
||||||
// Running `compute_active_feature_set` will not cause new activations, but
|
// Running `compute_active_feature_set` will not cause new activations, but
|
||||||
// `test_feature` is now be active
|
// `test_feature` is now be active
|
||||||
let new_activations = bank.compute_active_feature_set(true);
|
let new_activations = bank.compute_active_feature_set(true);
|
||||||
assert!(new_activations.is_empty());
|
assert!(new_activations.is_empty());
|
||||||
assert!(bank.feature_set.active(&test_feature));
|
assert!(bank.feature_set.is_active(&test_feature));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ pub struct FeatureSet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl FeatureSet {
|
impl FeatureSet {
|
||||||
pub fn active(&self, feature_id: &Pubkey) -> bool {
|
pub fn is_active(&self, feature_id: &Pubkey) -> bool {
|
||||||
self.active.contains(feature_id)
|
self.active.contains(feature_id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -685,7 +685,7 @@ impl MessageProcessor {
|
|||||||
) -> Result<(), InstructionError> {
|
) -> Result<(), InstructionError> {
|
||||||
// Fixup the special instructions key if present
|
// Fixup the special instructions key if present
|
||||||
// before the account pre-values are taken care of
|
// before the account pre-values are taken care of
|
||||||
if feature_set.active(&feature_set::instructions_sysvar_enabled::id()) {
|
if feature_set.is_active(&feature_set::instructions_sysvar_enabled::id()) {
|
||||||
for (i, key) in message.account_keys.iter().enumerate() {
|
for (i, key) in message.account_keys.iter().enumerate() {
|
||||||
if solana_sdk::sysvar::instructions::check_id(key) {
|
if solana_sdk::sysvar::instructions::check_id(key) {
|
||||||
let mut mut_account_ref = accounts[i].borrow_mut();
|
let mut mut_account_ref = accounts[i].borrow_mut();
|
||||||
|
Reference in New Issue
Block a user