update rent epoch max test (#35092)
* update rent epoch max test * invert diff
This commit is contained in:
parent
10defb161f
commit
d52b1ac795
|
@ -1656,7 +1656,6 @@ impl Bank {
|
||||||
#[test_case(false; "disable rent fees collection")]
|
#[test_case(false; "disable rent fees collection")]
|
||||||
fn test_rent_eager_collect_rent_in_partition(should_collect_rent: bool) {
|
fn test_rent_eager_collect_rent_in_partition(should_collect_rent: bool) {
|
||||||
solana_logger::setup();
|
solana_logger::setup();
|
||||||
|
|
||||||
let (mut genesis_config, _mint_keypair) = create_genesis_config(1_000_000);
|
let (mut genesis_config, _mint_keypair) = create_genesis_config(1_000_000);
|
||||||
for feature_id in FeatureSet::default().inactive {
|
for feature_id in FeatureSet::default().inactive {
|
||||||
if feature_id != solana_sdk::feature_set::set_exempt_rent_epoch_max::id()
|
if feature_id != solana_sdk::feature_set::set_exempt_rent_epoch_max::id()
|
||||||
|
@ -6481,49 +6480,83 @@ fn test_fuzz_instructions() {
|
||||||
info!("results: {:?}", results);
|
info!("results: {:?}", results);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test_case(true; "set_rent_epoch_max")]
|
||||||
fn test_bank_hash_consistency() {
|
#[test_case(false; "disable_set_rent_epoch_max")]
|
||||||
|
fn test_bank_hash_consistency(set_rent_epoch_max: bool) {
|
||||||
solana_logger::setup();
|
solana_logger::setup();
|
||||||
|
|
||||||
let mut genesis_config = GenesisConfig::new(
|
let account = AccountSharedData::new(1_000_000_000_000, 0, &system_program::id());
|
||||||
&[(
|
if !set_rent_epoch_max {
|
||||||
Pubkey::from([42; 32]),
|
assert_eq!(account.rent_epoch(), 0);
|
||||||
AccountSharedData::new(1_000_000_000_000, 0, &system_program::id()),
|
}
|
||||||
)],
|
let mut genesis_config = GenesisConfig::new(&[(Pubkey::from([42; 32]), account)], &[]);
|
||||||
&[],
|
|
||||||
);
|
|
||||||
genesis_config.creation_time = 0;
|
genesis_config.creation_time = 0;
|
||||||
genesis_config.cluster_type = ClusterType::MainnetBeta;
|
genesis_config.cluster_type = ClusterType::MainnetBeta;
|
||||||
genesis_config.rent.burn_percent = 100;
|
genesis_config.rent.burn_percent = 100;
|
||||||
|
if set_rent_epoch_max {
|
||||||
|
activate_feature(
|
||||||
|
&mut genesis_config,
|
||||||
|
solana_sdk::feature_set::set_exempt_rent_epoch_max::id(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
let mut bank = Arc::new(Bank::new_for_tests(&genesis_config));
|
let mut bank = Arc::new(Bank::new_for_tests(&genesis_config));
|
||||||
// Check a few slots, cross an epoch boundary
|
// Check a few slots, cross an epoch boundary
|
||||||
assert_eq!(bank.get_slots_in_epoch(0), 32);
|
assert_eq!(bank.get_slots_in_epoch(0), 32);
|
||||||
loop {
|
loop {
|
||||||
goto_end_of_slot(bank.clone());
|
goto_end_of_slot(bank.clone());
|
||||||
if bank.slot == 0 {
|
if !set_rent_epoch_max {
|
||||||
assert_eq!(
|
if bank.slot == 0 {
|
||||||
bank.hash().to_string(),
|
assert_eq!(
|
||||||
"trdzvRDTAXAqo1i2GX4JfK9ReixV1NYNG7DRaVq43Do",
|
bank.hash().to_string(),
|
||||||
);
|
"trdzvRDTAXAqo1i2GX4JfK9ReixV1NYNG7DRaVq43Do",
|
||||||
}
|
);
|
||||||
if bank.slot == 32 {
|
}
|
||||||
assert_eq!(
|
if bank.slot == 32 {
|
||||||
bank.hash().to_string(),
|
assert_eq!(
|
||||||
"2rdj8QEnDnBSyMv81rCmncss4UERACyXXB3pEvkep8eS",
|
bank.hash().to_string(),
|
||||||
);
|
"2rdj8QEnDnBSyMv81rCmncss4UERACyXXB3pEvkep8eS",
|
||||||
}
|
);
|
||||||
if bank.slot == 64 {
|
}
|
||||||
assert_eq!(
|
if bank.slot == 64 {
|
||||||
bank.hash().to_string(),
|
assert_eq!(
|
||||||
"7g3ofXVQB3reFt9ki8zLA8S4w1GdmEWsWuWrwkPN3SSv"
|
bank.hash().to_string(),
|
||||||
);
|
"7g3ofXVQB3reFt9ki8zLA8S4w1GdmEWsWuWrwkPN3SSv"
|
||||||
}
|
);
|
||||||
if bank.slot == 128 {
|
}
|
||||||
assert_eq!(
|
if bank.slot == 128 {
|
||||||
bank.hash().to_string(),
|
assert_eq!(
|
||||||
"4uX1AZFbqwjwWBACWbAW3V8rjbWH4N3ZRTbNysSLAzj2"
|
bank.hash().to_string(),
|
||||||
);
|
"4uX1AZFbqwjwWBACWbAW3V8rjbWH4N3ZRTbNysSLAzj2"
|
||||||
break;
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if bank.slot == 0 {
|
||||||
|
assert_eq!(
|
||||||
|
bank.hash().to_string(),
|
||||||
|
"3VqF5pMe3XABLqzUaYw2UVXfAokMJgMkrdfvneFQkHbB",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if bank.slot == 32 {
|
||||||
|
assert_eq!(
|
||||||
|
bank.hash().to_string(),
|
||||||
|
"B8GsaBJ9aJrQcbhTTfgNVuV4uwb4v8nKT86HUjDLvNgk",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if bank.slot == 64 {
|
||||||
|
assert_eq!(
|
||||||
|
bank.hash().to_string(),
|
||||||
|
"Eg9VRE3zUwarxWyHXhitX9wLkg1vfNeiVqVQxSif6qEC"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if bank.slot == 128 {
|
||||||
|
assert_eq!(
|
||||||
|
bank.hash().to_string(),
|
||||||
|
"5rLmK24zyxdeb8aLn5LDEnHLDQmxRd5gWZDVJGgsFX1c"
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
bank = Arc::new(new_from_parent(bank));
|
bank = Arc::new(new_from_parent(bank));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue