Skip to content

Commit

Permalink
Ensure that the spl-token 2 native mint account is owned by the spl-t…
Browse files Browse the repository at this point in the history
…oken 2 program.

Workaround for solana-labs/solana-program-library#374 until spl-token 3 is shipped

(cherry picked from commit 7341e60)

# Conflicts:
#	core/src/rpc_service.rs
#	runtime/src/bank.rs
  • Loading branch information
mvines authored and mergify-bot committed Sep 1, 2020
1 parent b34f179 commit 4e366ac
Show file tree
Hide file tree
Showing 4 changed files with 378 additions and 7 deletions.
5 changes: 4 additions & 1 deletion core/src/non_circulating_supply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ solana_sdk::pubkeys!(
mod tests {
use super::*;
use solana_sdk::{
account::Account, epoch_schedule::EpochSchedule, genesis_config::GenesisConfig,
account::Account,
epoch_schedule::EpochSchedule,
genesis_config::{GenesisConfig, OperatingMode},
};
use solana_stake_program::stake_state::{Authorized, Lockup, Meta, StakeState};
use std::{collections::BTreeMap, sync::Arc};
Expand Down Expand Up @@ -147,6 +149,7 @@ mod tests {
let genesis_config = GenesisConfig {
accounts,
epoch_schedule: EpochSchedule::new(slots_per_epoch),
operating_mode: OperatingMode::Stable,
..GenesisConfig::default()
};
let mut bank = Arc::new(Bank::new(&genesis_config));
Expand Down
6 changes: 3 additions & 3 deletions core/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2855,7 +2855,7 @@ pub mod tests {
let largest_accounts: Vec<RpcAccountBalance> =
serde_json::from_value(json["result"]["value"].clone())
.expect("actual response deserialization");
assert_eq!(largest_accounts.len(), 19);
assert_eq!(largest_accounts.len(), 20);

// Get Alice balance
let req = format!(
Expand Down Expand Up @@ -2892,7 +2892,7 @@ pub mod tests {
let largest_accounts: Vec<RpcAccountBalance> =
serde_json::from_value(json["result"]["value"].clone())
.expect("actual response deserialization");
assert_eq!(largest_accounts.len(), 18);
assert_eq!(largest_accounts.len(), 19);
let req = r#"{"jsonrpc":"2.0","id":1,"method":"getLargestAccounts","params":[{"filter":"nonCirculating"}]}"#;
let res = io.handle_request_sync(&req, meta);
let json: Value = serde_json::from_str(&res.unwrap()).unwrap();
Expand Down Expand Up @@ -4853,7 +4853,7 @@ pub mod tests {
.expect("actual response deserialization");
let accounts: Vec<RpcKeyedAccount> =
serde_json::from_value(result["result"].clone()).unwrap();
assert_eq!(accounts.len(), 3);
assert_eq!(accounts.len(), 4);

// Test returns only mint accounts
let req = format!(
Expand Down
12 changes: 11 additions & 1 deletion core/src/rpc_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,15 @@ mod tests {
get_tmp_ledger_path,
snapshot_utils::SnapshotVersion,
};
<<<<<<< HEAD
use solana_runtime::bank::Bank;
use solana_sdk::signature::Signer;
=======
use solana_runtime::{
bank::Bank, bank_forks::CompressionType, snapshot_utils::SnapshotVersion,
};
use solana_sdk::{genesis_config::OperatingMode, signature::Signer};
>>>>>>> 7341e6004... Ensure that the spl-token 2 native mint account is owned by the spl-token 2 program.
use std::net::{IpAddr, Ipv4Addr};

#[test]
Expand Down Expand Up @@ -440,7 +447,10 @@ mod tests {
}

fn create_bank_forks() -> Arc<RwLock<BankForks>> {
let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(10_000);
let GenesisConfigInfo {
mut genesis_config, ..
} = create_genesis_config(10_000);
genesis_config.operating_mode = OperatingMode::Stable;
let bank = Bank::new(&genesis_config);
Arc::new(RwLock::new(BankForks::new(bank)))
}
Expand Down
Loading

0 comments on commit 4e366ac

Please sign in to comment.