add test for is_partitioned_rewards_feature_enabled (#32158)

* add set_partitioned_rewards_enabled_for_test fn

* reveiws

---------

Co-authored-by: HaoranYi <haoran.yi@solana.com>
This commit is contained in:
HaoranYi 2023-06-16 11:07:07 -05:00 committed by GitHub
parent ec9fdbf2c3
commit d06b099ecb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -1492,7 +1492,8 @@ impl Bank {
#[allow(dead_code)]
fn is_partitioned_rewards_feature_enabled(&self) -> bool {
false // Will be feature later. It is convenient to have a constant fn at the moment.
self.feature_set
.is_active(&feature_set::enable_partitioned_epoch_reward::id())
}
#[allow(dead_code)]

View File

@ -12604,6 +12604,17 @@ fn test_rewards_point_calculation_empty() {
assert!(point_value.is_none());
}
/// Test partitioned_reward feature enable/disable
#[test]
fn test_is_partitioned_reward_enable() {
let (genesis_config, _mint_keypair) = create_genesis_config(1_000_000 * LAMPORTS_PER_SOL);
let mut bank = Bank::new_for_tests(&genesis_config);
assert!(!bank.is_partitioned_rewards_feature_enabled());
bank.activate_feature(&feature_set::enable_partitioned_epoch_reward::id());
assert!(bank.is_partitioned_rewards_feature_enabled());
}
#[test]
fn test_deactivate_epoch_reward_status() {
let (genesis_config, _mint_keypair) = create_genesis_config(1_000_000 * LAMPORTS_PER_SOL);