Simplify account.rent_epoch handling for sysvar rent (#16049)
* Add some code for special local testing * Add comment to store_account_and_update_capitalization * Simplify account.rent_epoch handling for sysvar rent * Introduce *_for_test functions * Add deprecation messages to existing api
This commit is contained in:
@@ -663,15 +663,17 @@ mod tests {
|
||||
.iter()
|
||||
.map(|meta| {
|
||||
RefCell::new(if sysvar::clock::check_id(&meta.pubkey) {
|
||||
account::create_account_shared_data(&sysvar::clock::Clock::default(), 1)
|
||||
account::create_account_shared_data_for_test(&sysvar::clock::Clock::default())
|
||||
} else if sysvar::rewards::check_id(&meta.pubkey) {
|
||||
account::create_account_shared_data(&sysvar::rewards::Rewards::new(0.0), 1)
|
||||
account::create_account_shared_data_for_test(&sysvar::rewards::Rewards::new(
|
||||
0.0,
|
||||
))
|
||||
} else if sysvar::stake_history::check_id(&meta.pubkey) {
|
||||
account::create_account_shared_data(&StakeHistory::default(), 1)
|
||||
account::create_account_shared_data_for_test(&StakeHistory::default())
|
||||
} else if config::check_id(&meta.pubkey) {
|
||||
config::create_account(0, &config::Config::default())
|
||||
} else if sysvar::rent::check_id(&meta.pubkey) {
|
||||
account::create_account_shared_data(&Rent::default(), 1)
|
||||
account::create_account_shared_data_for_test(&Rent::default())
|
||||
} else if meta.pubkey == invalid_stake_state_pubkey() {
|
||||
AccountSharedData::from(Account {
|
||||
owner: id(),
|
||||
@@ -973,7 +975,9 @@ mod tests {
|
||||
KeyedAccount::new(
|
||||
&sysvar::rent::id(),
|
||||
false,
|
||||
&RefCell::new(account::create_account_shared_data(&Rent::default(), 0))
|
||||
&RefCell::new(account::create_account_shared_data_for_test(
|
||||
&Rent::default()
|
||||
))
|
||||
)
|
||||
],
|
||||
&serialize(&StakeInstruction::Initialize(
|
||||
@@ -1028,17 +1032,15 @@ mod tests {
|
||||
KeyedAccount::new(
|
||||
&sysvar::clock::id(),
|
||||
false,
|
||||
&RefCell::new(account::create_account_shared_data(
|
||||
&RefCell::new(account::create_account_shared_data_for_test(
|
||||
&sysvar::clock::Clock::default(),
|
||||
1
|
||||
))
|
||||
),
|
||||
KeyedAccount::new(
|
||||
&sysvar::stake_history::id(),
|
||||
false,
|
||||
&RefCell::new(account::create_account_shared_data(
|
||||
&RefCell::new(account::create_account_shared_data_for_test(
|
||||
&sysvar::stake_history::StakeHistory::default(),
|
||||
1
|
||||
))
|
||||
),
|
||||
KeyedAccount::new(
|
||||
@@ -1063,17 +1065,15 @@ mod tests {
|
||||
KeyedAccount::new(
|
||||
&sysvar::rewards::id(),
|
||||
false,
|
||||
&RefCell::new(account::create_account_shared_data(
|
||||
&RefCell::new(account::create_account_shared_data_for_test(
|
||||
&sysvar::rewards::Rewards::new(0.0),
|
||||
1
|
||||
))
|
||||
),
|
||||
KeyedAccount::new(
|
||||
&sysvar::stake_history::id(),
|
||||
false,
|
||||
&RefCell::new(account::create_account_shared_data(
|
||||
&RefCell::new(account::create_account_shared_data_for_test(
|
||||
&StakeHistory::default(),
|
||||
1,
|
||||
))
|
||||
),
|
||||
],
|
||||
@@ -1107,9 +1107,8 @@ mod tests {
|
||||
KeyedAccount::new(
|
||||
&sysvar::rewards::id(),
|
||||
false,
|
||||
&RefCell::new(account::create_account_shared_data(
|
||||
&RefCell::new(account::create_account_shared_data_for_test(
|
||||
&sysvar::rewards::Rewards::new(0.0),
|
||||
1
|
||||
))
|
||||
),
|
||||
],
|
||||
|
Reference in New Issue
Block a user