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:
Ryo Onodera
2021-03-25 15:23:20 +09:00
committed by GitHub
parent 7f0ac6a67c
commit 6d5c6c17c5
16 changed files with 206 additions and 104 deletions

View File

@ -884,7 +884,9 @@ mod tests {
message_processor::{Executors, ThisInvokeContext},
};
use solana_sdk::{
account::{create_account_shared_data as create_account, AccountSharedData},
account::{
create_account_shared_data_for_test as create_account_for_test, AccountSharedData,
},
account_utils::StateMut,
client::SyncClient,
clock::Clock,
@ -2215,15 +2217,12 @@ mod tests {
file.read_to_end(&mut elf_new).unwrap();
assert_ne!(elf_orig.len(), elf_new.len());
let rent = Rent::default();
let rent_account = RefCell::new(create_account(&Rent::default(), 1));
let rent_account = RefCell::new(create_account_for_test(&Rent::default()));
let slot = 42;
let clock_account = RefCell::new(create_account(
&Clock {
slot,
..Clock::default()
},
1,
));
let clock_account = RefCell::new(create_account_for_test(&Clock {
slot,
..Clock::default()
}));
let min_program_balance =
1.max(rent.minimum_balance(UpgradeableLoaderState::program_len().unwrap()));
let min_programdata_balance = 1.max(rent.minimum_balance(