move Account to solana-sdk (#13198)

This commit is contained in:
Jack May
2020-10-28 22:01:07 -07:00
committed by GitHub
parent d5e439037b
commit c458d4b213
38 changed files with 460 additions and 459 deletions

View File

@@ -356,14 +356,14 @@ mod tests {
use crate::{bank::Bank, bank_client::BankClient};
use bincode::serialize;
use solana_sdk::{
account::Account,
account::{self, Account},
client::SyncClient,
fee_calculator::FeeCalculator,
genesis_config::create_genesis_config,
hash::{hash, Hash},
instruction::{AccountMeta, Instruction, InstructionError},
message::Message,
nonce,
nonce, nonce_account, recent_blockhashes_account,
signature::{Keypair, Signer},
system_instruction, system_program, sysvar,
sysvar::recent_blockhashes::IterItem,
@@ -385,7 +385,7 @@ mod tests {
RefCell::new(Account::default())
}
fn create_default_recent_blockhashes_account() -> RefCell<Account> {
RefCell::new(sysvar::recent_blockhashes::create_account_with_data(
RefCell::new(recent_blockhashes_account::create_account_with_data(
1,
vec![
IterItem(0u64, &Hash::default(), &FeeCalculator::default());
@@ -395,7 +395,7 @@ mod tests {
))
}
fn create_default_rent_account() -> RefCell<Account> {
RefCell::new(sysvar::rent::create_account(1, &Rent::free()))
RefCell::new(account::create_account(&Rent::free(), 1))
}
#[test]
@@ -1180,7 +1180,7 @@ mod tests {
RefCell::new(if sysvar::recent_blockhashes::check_id(&meta.pubkey) {
create_default_recent_blockhashes_account().into_inner()
} else if sysvar::rent::check_id(&meta.pubkey) {
sysvar::rent::create_account(1, &Rent::free())
account::create_account(&Rent::free(), 1)
} else {
Account::default()
})
@@ -1258,7 +1258,7 @@ mod tests {
#[test]
fn test_process_nonce_ix_ok() {
let nonce_acc = nonce::create_account(1_000_000);
let nonce_acc = nonce_account::create_account(1_000_000);
super::process_instruction(
&Pubkey::default(),
&[
@@ -1273,8 +1273,8 @@ mod tests {
&serialize(&SystemInstruction::InitializeNonceAccount(Pubkey::default())).unwrap(),
)
.unwrap();
let new_recent_blockhashes_account =
RefCell::new(sysvar::recent_blockhashes::create_account_with_data(
let new_recent_blockhashes_account = RefCell::new(
solana_sdk::recent_blockhashes_account::create_account_with_data(
1,
vec![
IterItem(
@@ -1285,7 +1285,8 @@ mod tests {
sysvar::recent_blockhashes::MAX_ENTRIES
]
.into_iter(),
));
),
);
assert_eq!(
super::process_instruction(
&Pubkey::default(),
@@ -1370,7 +1371,11 @@ mod tests {
super::process_instruction(
&Pubkey::default(),
&[
KeyedAccount::new(&Pubkey::default(), true, &nonce::create_account(1_000_000),),
KeyedAccount::new(
&Pubkey::default(),
true,
&nonce_account::create_account(1_000_000),
),
KeyedAccount::new(&Pubkey::default(), true, &create_default_account()),
KeyedAccount::new(
&sysvar::recent_blockhashes::id(),
@@ -1391,7 +1396,11 @@ mod tests {
super::process_instruction(
&Pubkey::default(),
&[
KeyedAccount::new(&Pubkey::default(), true, &nonce::create_account(1_000_000),),
KeyedAccount::new(
&Pubkey::default(),
true,
&nonce_account::create_account(1_000_000),
),
KeyedAccount::new(&Pubkey::default(), true, &create_default_account()),
KeyedAccount::new(
&sysvar::recent_blockhashes::id(),
@@ -1426,7 +1435,7 @@ mod tests {
&[KeyedAccount::new(
&Pubkey::default(),
true,
&nonce::create_account(1_000_000),
&nonce_account::create_account(1_000_000),
),],
&serialize(&SystemInstruction::InitializeNonceAccount(Pubkey::default())).unwrap(),
),
@@ -1440,7 +1449,11 @@ mod tests {
super::process_instruction(
&Pubkey::default(),
&[
KeyedAccount::new(&Pubkey::default(), true, &nonce::create_account(1_000_000),),
KeyedAccount::new(
&Pubkey::default(),
true,
&nonce_account::create_account(1_000_000),
),
KeyedAccount::new(
&sysvar::recent_blockhashes::id(),
false,
@@ -1459,7 +1472,11 @@ mod tests {
super::process_instruction(
&Pubkey::default(),
&[
KeyedAccount::new(&Pubkey::default(), true, &nonce::create_account(1_000_000),),
KeyedAccount::new(
&Pubkey::default(),
true,
&nonce_account::create_account(1_000_000),
),
KeyedAccount::new(
&sysvar::recent_blockhashes::id(),
false,
@@ -1479,7 +1496,11 @@ mod tests {
super::process_instruction(
&Pubkey::default(),
&[
KeyedAccount::new(&Pubkey::default(), true, &nonce::create_account(1_000_000),),
KeyedAccount::new(
&Pubkey::default(),
true,
&nonce_account::create_account(1_000_000),
),
KeyedAccount::new(
&sysvar::recent_blockhashes::id(),
false,
@@ -1495,7 +1516,7 @@ mod tests {
#[test]
fn test_process_authorize_ix_ok() {
let nonce_acc = nonce::create_account(1_000_000);
let nonce_acc = nonce_account::create_account(1_000_000);
super::process_instruction(
&Pubkey::default(),
&[
@@ -1560,7 +1581,7 @@ mod tests {
#[test]
fn test_get_system_account_kind_uninitialized_nonce_account_fail() {
assert_eq!(
get_system_account_kind(&nonce::create_account(42).borrow()),
get_system_account_kind(&nonce_account::create_account(42).borrow()),
None
);
}