Account->AccountSharedData (#15691)

This commit is contained in:
Jeff Washington (jwash)
2021-03-09 15:06:07 -06:00
committed by GitHub
parent 61c7ce857e
commit 8a3135d17b
71 changed files with 2032 additions and 1161 deletions

View File

@@ -61,7 +61,7 @@ mod tests {
use crate::ownable_instruction;
use solana_runtime::{bank::Bank, bank_client::BankClient};
use solana_sdk::{
account::Account,
account::AccountSharedData,
client::SyncClient,
genesis_config::create_genesis_config,
message::Message,
@@ -156,7 +156,7 @@ mod tests {
let mut account_owner_pubkey = solana_sdk::pubkey::new_rand();
let owner_pubkey = account_owner_pubkey;
let new_owner_pubkey = solana_sdk::pubkey::new_rand();
let account = Account::new_ref(1, 0, &system_program::id());
let account = AccountSharedData::new_ref(1, 0, &system_program::id());
let owner_keyed_account = KeyedAccount::new(&owner_pubkey, false, &account); // <-- Attack! Setting owner without the original owner's signature.
let err = set_owner(
&mut account_owner_pubkey,
@@ -171,7 +171,7 @@ mod tests {
fn test_ownable_incorrect_owner() {
let mut account_owner_pubkey = solana_sdk::pubkey::new_rand();
let new_owner_pubkey = solana_sdk::pubkey::new_rand();
let account = Account::new_ref(1, 0, &system_program::id());
let account = AccountSharedData::new_ref(1, 0, &system_program::id());
let mallory_pubkey = solana_sdk::pubkey::new_rand(); // <-- Attack! Signing with wrong pubkey
let owner_keyed_account = KeyedAccount::new(&mallory_pubkey, true, &account);
let err = set_owner(