AccountSharedData construction (#15790)

This commit is contained in:
Jeff Washington (jwash)
2021-03-11 18:09:04 -06:00
committed by GitHub
parent 3419a5446e
commit 952c3bcbb7
21 changed files with 161 additions and 151 deletions

View File

@@ -251,7 +251,10 @@ pub fn deserialize_parameters_aligned(
mod tests {
use super::*;
use solana_sdk::{
account::AccountSharedData, account_info::AccountInfo, bpf_loader, entrypoint::deserialize,
account::{Account, AccountSharedData},
account_info::AccountInfo,
bpf_loader,
entrypoint::deserialize,
};
use std::{
cell::RefCell,
@@ -271,35 +274,35 @@ mod tests {
solana_sdk::pubkey::new_rand(),
];
let accounts = [
RefCell::new(AccountSharedData {
RefCell::new(AccountSharedData::from(Account {
lamports: 1,
data: vec![1u8, 2, 3, 4, 5],
owner: bpf_loader::id(),
executable: false,
rent_epoch: 100,
}),
})),
// dup of first
RefCell::new(AccountSharedData {
RefCell::new(AccountSharedData::from(Account {
lamports: 1,
data: vec![1u8, 2, 3, 4, 5],
owner: bpf_loader::id(),
executable: false,
rent_epoch: 100,
}),
RefCell::new(AccountSharedData {
})),
RefCell::new(AccountSharedData::from(Account {
lamports: 2,
data: vec![11u8, 12, 13, 14, 15, 16, 17, 18, 19],
owner: bpf_loader::id(),
executable: true,
rent_epoch: 200,
}),
RefCell::new(AccountSharedData {
})),
RefCell::new(AccountSharedData::from(Account {
lamports: 3,
data: vec![],
owner: bpf_loader::id(),
executable: false,
rent_epoch: 3100,
}),
})),
];
let keyed_accounts: Vec<_> = keys

View File

@@ -10,7 +10,7 @@ use solana_rbpf::{
};
use solana_runtime::message_processor::MessageProcessor;
use solana_sdk::{
account::{AccountSharedData, ReadableAccount},
account::{Account, AccountSharedData, ReadableAccount},
account_info::AccountInfo,
account_utils::StateMut,
bpf_loader, bpf_loader_deprecated,
@@ -1009,13 +1009,13 @@ impl<'a> SyscallInvokeSigned<'a> for SyscallInvokeSignedRust<'a> {
};
Ok((
Rc::new(RefCell::new(AccountSharedData {
Rc::new(RefCell::new(AccountSharedData::from(Account {
lamports: *lamports,
data: data.to_vec(),
executable: account_info.executable,
owner: *owner,
rent_epoch: account_info.rent_epoch,
})),
}))),
Some(AccountReferences {
lamports,
owner,
@@ -1294,13 +1294,13 @@ impl<'a> SyscallInvokeSigned<'a> for SyscallInvokeSignedC<'a> {
)?;
Ok((
Rc::new(RefCell::new(AccountSharedData {
Rc::new(RefCell::new(AccountSharedData::from(Account {
lamports: *lamports,
data: data.to_vec(),
executable: account_info.executable,
owner: *owner,
rent_epoch: account_info.rent_epoch,
})),
}))),
Some(AccountReferences {
lamports,
owner,