owner -> owner() (#16782)

This commit is contained in:
Jeff Washington (jwash) 2021-04-23 17:49:47 -05:00 committed by GitHub
parent 1a4a7059af
commit ca14c18998
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 23 additions and 23 deletions

View File

@ -2,7 +2,7 @@ use solana_runtime::{
accounts_index::{AccountIndex, IndexKey},
bank::Bank,
};
use solana_sdk::pubkey::Pubkey;
use solana_sdk::{account::ReadableAccount, pubkey::Pubkey};
use solana_stake_program::stake_state::StakeState;
use std::{collections::HashSet, sync::Arc};
@ -34,7 +34,7 @@ pub fn calculate_non_circulating_supply(bank: &Arc<Bank>) -> NonCirculatingSuppl
// the current AccountsDb implementation, an account may remain in storage as a
// zero-lamport Account::Default() after being wiped and reinitialized in later
// updates. We include the redundant filter here to avoid returning these accounts.
|account| account.owner == solana_stake_program::id(),
|account| account.owner() == &solana_stake_program::id(),
)
} else {
bank.get_program_accounts(&solana_stake_program::id())

View File

@ -1458,7 +1458,7 @@ impl JsonRpcRequestProcessor {
Error::invalid_params("Invalid param: could not find account".to_string())
})?;
if account.owner != spl_token_id_v2_0() {
if account.owner() != &spl_token_id_v2_0() {
return Err(Error::invalid_params(
"Invalid param: not a v2.0 Token account".to_string(),
));
@ -1482,7 +1482,7 @@ impl JsonRpcRequestProcessor {
let mint_account = bank.get_account(mint).ok_or_else(|| {
Error::invalid_params("Invalid param: could not find account".to_string())
})?;
if mint_account.owner != spl_token_id_v2_0() {
if mint_account.owner() != &spl_token_id_v2_0() {
return Err(Error::invalid_params(
"Invalid param: not a v2.0 Token mint".to_string(),
));
@ -1660,7 +1660,7 @@ impl JsonRpcRequestProcessor {
// zero-lamport AccountSharedData::Default() after being wiped and reinitialized in later
// updates. We include the redundant filters here to avoid returning these
// accounts.
account.owner == *program_id && filter_closure(account)
account.owner() == program_id && filter_closure(account)
})
} else {
bank.get_filtered_program_accounts(program_id, filter_closure)
@ -1696,7 +1696,7 @@ impl JsonRpcRequestProcessor {
.contains(&AccountIndex::SplTokenOwner)
{
bank.get_filtered_indexed_accounts(&IndexKey::SplTokenOwner(*owner_key), |account| {
account.owner == spl_token_id_v2_0()
account.owner() == &spl_token_id_v2_0()
&& filters.iter().all(|filter_type| match filter_type {
RpcFilterType::DataSize(size) => account.data().len() as u64 == *size,
RpcFilterType::Memcmp(compare) => compare.bytes_match(&account.data()),
@ -1735,7 +1735,7 @@ impl JsonRpcRequestProcessor {
.contains(&AccountIndex::SplTokenMint)
{
bank.get_filtered_indexed_accounts(&IndexKey::SplTokenMint(*mint_key), |account| {
account.owner == spl_token_id_v2_0()
account.owner() == &spl_token_id_v2_0()
&& filters.iter().all(|filter_type| match filter_type {
RpcFilterType::DataSize(size) => account.data().len() as u64 == *size,
RpcFilterType::Memcmp(compare) => compare.bytes_match(&account.data()),
@ -1838,7 +1838,7 @@ fn get_encoded_account(
) -> Result<Option<UiAccount>> {
let mut response = None;
if let Some(account) = bank.get_account(pubkey) {
if account.owner == spl_token_id_v2_0() && encoding == UiAccountEncoding::JsonParsed {
if account.owner() == &spl_token_id_v2_0() && encoding == UiAccountEncoding::JsonParsed {
response = Some(get_parsed_token_account(bank.clone(), pubkey, account));
} else if (encoding == UiAccountEncoding::Binary || encoding == UiAccountEncoding::Base58)
&& account.data().len() > 128
@ -2008,7 +2008,7 @@ fn get_mint_owner_and_decimals(bank: &Arc<Bank>, mint: &Pubkey) -> Result<(Pubke
Error::invalid_params("Invalid param: could not find mint".to_string())
})?;
let decimals = get_mint_decimals(&mint_account.data())?;
Ok((mint_account.owner, decimals))
Ok((*mint_account.owner(), decimals))
}
}

View File

@ -290,7 +290,7 @@ fn filter_account_result(
// and should notify that the account state has been reverted.
let results: Box<dyn Iterator<Item = UiAccount>> = if last_modified_slot != last_notified_slot {
let encoding = encoding.unwrap_or(UiAccountEncoding::Binary);
if account.owner == spl_token_id_v2_0() && encoding == UiAccountEncoding::JsonParsed {
if account.owner() == &spl_token_id_v2_0() && encoding == UiAccountEncoding::JsonParsed {
Box::new(iter::once(get_parsed_token_account(bank, pubkey, account)))
} else {
Box::new(iter::once(UiAccount::encode(

View File

@ -2102,7 +2102,7 @@ fn main() {
let data_len = account.data().len();
println!("{}:", pubkey);
println!(" - balance: {} SOL", lamports_to_sol(account.lamports));
println!(" - owner: '{}'", account.owner);
println!(" - owner: '{}'", account.owner());
println!(" - executable: {}", account.executable);
println!(" - slot: {}", slot);
println!(" - rent_epoch: {}", account.rent_epoch);
@ -2449,7 +2449,7 @@ fn main() {
rewarded_accounts.sort_unstable_by_key(
|(pubkey, account, base_lamports)| {
(
account.owner,
account.owner(),
*base_lamports,
account.lamports - base_lamports,
*pubkey,
@ -2469,7 +2469,7 @@ fn main() {
.map(|pubkey| (**pubkey, warped_bank.get_account(pubkey).unwrap()))
.collect::<Vec<_>>();
unchanged_accounts.sort_unstable_by_key(|(pubkey, account)| {
(account.owner, account.lamports, *pubkey)
(*account.owner(), account.lamports, *pubkey)
});
let unchanged_accounts = unchanged_accounts.into_iter();
@ -2491,7 +2491,7 @@ fn main() {
println!(
"{:<45}({}): {} => {} (+{} {:>4.9}%) {:?}",
format!("{}", pubkey), // format! is needed to pad/justify correctly.
base_account.owner,
base_account.owner(),
Sol(base_account.lamports),
Sol(warped_account.lamports),
Sol(delta),
@ -2554,7 +2554,7 @@ fn main() {
cluster_type: format!("{:?}", base_bank.cluster_type()),
rewarded_epoch: base_bank.epoch(),
account: format!("{}", pubkey),
owner: format!("{}", base_account.owner),
owner: format!("{}", base_account.owner()),
old_balance: base_account.lamports,
new_balance: warped_account.lamports,
data_size: base_account.data().len(),

View File

@ -349,13 +349,13 @@ impl solana_sdk::program_stubs::SyscallStubs for SyscallStubs {
let mut data = account_info.try_borrow_mut_data()?;
let account_borrow = account.borrow();
let new_data = account_borrow.data();
if *account_info.owner != account.borrow().owner {
if account_info.owner != account.borrow().owner() {
// TODO Figure out a better way to allow the System Program to set the account owner
#[allow(clippy::transmute_ptr_to_ptr)]
#[allow(mutable_transmutes)]
let account_info_mut =
unsafe { transmute::<&Pubkey, &mut Pubkey>(account_info.owner) };
*account_info_mut = account.borrow().owner;
*account_info_mut = *account.borrow().owner();
}
if data.len() != new_data.len() {
// TODO: Figure out how to allow the System Program to resize the account data

View File

@ -1826,7 +1826,7 @@ fn get_upgradeable_executable(
program_account: &Rc<RefCell<AccountSharedData>>,
invoke_context: &Ref<&mut dyn InvokeContext>,
) -> Result<Option<(Pubkey, Rc<RefCell<AccountSharedData>>)>, EbpfError<BpfError>> {
if program_account.borrow().owner == bpf_loader_upgradeable::id() {
if program_account.borrow().owner() == &bpf_loader_upgradeable::id() {
match program_account.borrow().state() {
Ok(UpgradeableLoaderState::Program {
programdata_address,
@ -1992,7 +1992,7 @@ fn call<'a>(
if let Some(account_ref) = account_ref {
if message.is_writable(i, demote_sysvar_write_locks) && !account.executable {
*account_ref.lamports = account.lamports;
*account_ref.owner = account.owner;
*account_ref.owner = *account.owner();
if account_ref.data.len() != account.data().len() {
if !account_ref.data.is_empty() {
// Only support for `CreateAccount` at this time.

View File

@ -572,7 +572,7 @@ mod tests {
&bob_pubkey,
&budget_pubkey,
&game_pubkey,
&game_account.owner,
game_account.owner(),
game_hash,
41,
);

View File

@ -358,7 +358,7 @@ impl Accounts {
}
// Add loader to chain
let program_owner = program.owner;
let program_owner = *program.owner();
if bpf_loader_upgradeable::check_id(&program_owner) {
// The upgradeable loader requires the derived ProgramData account

View File

@ -111,7 +111,7 @@ fn assign(
invoke_context: &dyn InvokeContext,
) -> Result<(), InstructionError> {
// no work to do, just return
if account.owner == *owner {
if account.owner() == owner {
return Ok(());
}
@ -430,7 +430,7 @@ pub enum SystemAccountKind {
}
pub fn get_system_account_kind(account: &AccountSharedData) -> Option<SystemAccountKind> {
if system_program::check_id(&account.owner) {
if system_program::check_id(account.owner()) {
if account.data().is_empty() {
Some(SystemAccountKind::System)
} else if account.data().len() == nonce::State::size() {