Remove unused pubkey::Pubkey imports
This commit is contained in:
parent
17c391121a
commit
959880db60
|
@ -134,7 +134,6 @@ impl From<Delegation> for UiDelegation {
|
|||
mod test {
|
||||
use super::*;
|
||||
use bincode::serialize;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
|
||||
#[test]
|
||||
fn test_parse_stake() {
|
||||
|
|
|
@ -20,7 +20,6 @@ use solana_perf::packet::to_packets_chunked;
|
|||
use solana_runtime::{bank::Bank, bank_forks::BankForks};
|
||||
use solana_sdk::{
|
||||
hash::Hash,
|
||||
pubkey::Pubkey,
|
||||
signature::Keypair,
|
||||
signature::Signature,
|
||||
system_transaction,
|
||||
|
|
|
@ -213,7 +213,7 @@ mod tests {
|
|||
use super::*;
|
||||
use solana_banks_server::banks_server::start_local_server;
|
||||
use solana_runtime::{bank::Bank, bank_forks::BankForks, genesis_utils::create_genesis_config};
|
||||
use solana_sdk::{message::Message, pubkey::Pubkey, signature::Signer, system_instruction};
|
||||
use solana_sdk::{message::Message, signature::Signer, system_instruction};
|
||||
use std::sync::{Arc, RwLock};
|
||||
use tarpc::transport;
|
||||
use tokio::{runtime::Runtime, time::delay_for};
|
||||
|
|
|
@ -2409,7 +2409,10 @@ mod tests {
|
|||
.unwrap();
|
||||
assert_eq!(signer_info.signers.len(), 1);
|
||||
assert_eq!(signer_info.index_of(None), Some(0));
|
||||
assert_eq!(signer_info.index_of(Some(solana_sdk::pubkey::new_rand())), None);
|
||||
assert_eq!(
|
||||
signer_info.index_of(Some(solana_sdk::pubkey::new_rand())),
|
||||
None
|
||||
);
|
||||
|
||||
let keypair0 = keypair_from_seed(&[1u8; 32]).unwrap();
|
||||
let keypair0_pubkey = keypair0.pubkey();
|
||||
|
|
|
@ -12,7 +12,6 @@ use solana_faucet::faucet::run_local_faucet;
|
|||
use solana_sdk::{
|
||||
account_utils::StateMut,
|
||||
commitment_config::CommitmentConfig,
|
||||
pubkey::Pubkey,
|
||||
signature::{Keypair, Signer},
|
||||
};
|
||||
use solana_vote_program::vote_state::{VoteAuthorize, VoteState, VoteStateVersions};
|
||||
|
|
|
@ -20,7 +20,7 @@ use solana_runtime::bank::Bank;
|
|||
use solana_sdk::genesis_config::GenesisConfig;
|
||||
use solana_sdk::hash::Hash;
|
||||
use solana_sdk::message::Message;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::pubkey;
|
||||
use solana_sdk::signature::Keypair;
|
||||
use solana_sdk::signature::Signature;
|
||||
use solana_sdk::signature::Signer;
|
||||
|
@ -56,7 +56,7 @@ fn bench_consume_buffered(bencher: &mut Bencher) {
|
|||
let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(100_000);
|
||||
let bank = Arc::new(Bank::new(&genesis_config));
|
||||
let ledger_path = get_tmp_ledger_path!();
|
||||
let my_pubkey = solana_sdk::pubkey::new_rand();
|
||||
let my_pubkey = pubkey::new_rand();
|
||||
{
|
||||
let blockstore = Arc::new(
|
||||
Blockstore::open(&ledger_path).expect("Expected to be able to open database ledger"),
|
||||
|
@ -94,15 +94,15 @@ fn bench_consume_buffered(bencher: &mut Bencher) {
|
|||
}
|
||||
|
||||
fn make_accounts_txs(txes: usize, mint_keypair: &Keypair, hash: Hash) -> Vec<Transaction> {
|
||||
let to_pubkey = solana_sdk::pubkey::new_rand();
|
||||
let to_pubkey = pubkey::new_rand();
|
||||
let dummy = system_transaction::transfer(mint_keypair, &to_pubkey, 1, hash);
|
||||
(0..txes)
|
||||
.into_par_iter()
|
||||
.map(|_| {
|
||||
let mut new = dummy.clone();
|
||||
let sig: Vec<u8> = (0..64).map(|_| thread_rng().gen()).collect();
|
||||
new.message.account_keys[0] = solana_sdk::pubkey::new_rand();
|
||||
new.message.account_keys[1] = solana_sdk::pubkey::new_rand();
|
||||
new.message.account_keys[0] = pubkey::new_rand();
|
||||
new.message.account_keys[1] = pubkey::new_rand();
|
||||
new.signatures = vec![Signature::new(&sig[0..64])];
|
||||
new
|
||||
})
|
||||
|
@ -117,7 +117,7 @@ fn make_programs_txs(txes: usize, hash: Hash) -> Vec<Transaction> {
|
|||
let mut instructions = vec![];
|
||||
let from_key = Keypair::new();
|
||||
for _ in 1..progs {
|
||||
let to_key = solana_sdk::pubkey::new_rand();
|
||||
let to_key = pubkey::new_rand();
|
||||
instructions.push(system_instruction::transfer(&from_key.pubkey(), &to_key, 1));
|
||||
}
|
||||
let message = Message::new(&instructions, Some(&from_key.pubkey()));
|
||||
|
|
|
@ -8,7 +8,7 @@ use solana_core::broadcast_stage::{broadcast_shreds, get_broadcast_peers};
|
|||
use solana_core::cluster_info::{ClusterInfo, Node};
|
||||
use solana_core::contact_info::ContactInfo;
|
||||
use solana_ledger::shred::Shred;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::pubkey;
|
||||
use solana_sdk::timing::timestamp;
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
|
@ -20,7 +20,7 @@ use test::Bencher;
|
|||
#[bench]
|
||||
fn broadcast_shreds_bench(bencher: &mut Bencher) {
|
||||
solana_logger::setup();
|
||||
let leader_pubkey = solana_sdk::pubkey::new_rand();
|
||||
let leader_pubkey = pubkey::new_rand();
|
||||
let leader_info = Node::new_localhost_with_pubkey(&leader_pubkey);
|
||||
let cluster_info = ClusterInfo::new_with_invalid_keypair(leader_info.info);
|
||||
let socket = UdpSocket::bind("0.0.0.0:0").unwrap();
|
||||
|
@ -30,7 +30,7 @@ fn broadcast_shreds_bench(bencher: &mut Bencher) {
|
|||
let mut stakes = HashMap::new();
|
||||
const NUM_PEERS: usize = 200;
|
||||
for _ in 0..NUM_PEERS {
|
||||
let id = solana_sdk::pubkey::new_rand();
|
||||
let id = pubkey::new_rand();
|
||||
let contact_info = ContactInfo::new_localhost(&id, timestamp());
|
||||
cluster_info.insert_info(contact_info);
|
||||
stakes.insert(id, thread_rng().gen_range(1, NUM_PEERS) as u64);
|
||||
|
|
|
@ -8,13 +8,13 @@ use solana_core::cluster_info::MAX_BLOOM_SIZE;
|
|||
use solana_core::crds::Crds;
|
||||
use solana_core::crds_gossip_pull::{CrdsFilter, CrdsGossipPull};
|
||||
use solana_core::crds_value::CrdsValue;
|
||||
use solana_sdk::hash::Hash;
|
||||
use solana_sdk::hash;
|
||||
use test::Bencher;
|
||||
|
||||
#[bench]
|
||||
fn bench_hash_as_u64(bencher: &mut Bencher) {
|
||||
let mut rng = thread_rng();
|
||||
let hashes: Vec<_> = std::iter::repeat_with(|| solana_sdk::hash::new_rand(&mut rng))
|
||||
let hashes: Vec<_> = std::iter::repeat_with(|| hash::new_rand(&mut rng))
|
||||
.take(1000)
|
||||
.collect();
|
||||
bencher.iter(|| {
|
||||
|
|
|
@ -7,14 +7,14 @@ use solana_core::contact_info::ContactInfo;
|
|||
use solana_core::crds::VersionedCrdsValue;
|
||||
use solana_core::crds_shards::CrdsShards;
|
||||
use solana_core::crds_value::{CrdsData, CrdsValue};
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::pubkey;
|
||||
use solana_sdk::timing::timestamp;
|
||||
use test::Bencher;
|
||||
|
||||
const CRDS_SHARDS_BITS: u32 = 8;
|
||||
|
||||
fn new_test_crds_value() -> VersionedCrdsValue {
|
||||
let data = CrdsData::ContactInfo(ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), timestamp()));
|
||||
let data = CrdsData::ContactInfo(ContactInfo::new_localhost(&pubkey::new_rand(), timestamp()));
|
||||
VersionedCrdsValue::new(timestamp(), CrdsValue::new_unsigned(data))
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ use solana_perf::packet::to_packets_chunked;
|
|||
use solana_perf::test_tx::test_tx;
|
||||
use solana_runtime::bank::Bank;
|
||||
use solana_runtime::bank_forks::BankForks;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::pubkey;
|
||||
use solana_sdk::timing::timestamp;
|
||||
use std::net::UdpSocket;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
|
@ -34,7 +34,7 @@ fn bench_retransmitter(bencher: &mut Bencher) {
|
|||
const NUM_PEERS: usize = 4;
|
||||
let mut peer_sockets = Vec::new();
|
||||
for _ in 0..NUM_PEERS {
|
||||
let id = solana_sdk::pubkey::new_rand();
|
||||
let id = pubkey::new_rand();
|
||||
let socket = UdpSocket::bind("0.0.0.0:0").unwrap();
|
||||
let mut contact_info = ContactInfo::new_localhost(&id, timestamp());
|
||||
contact_info.tvu = socket.local_addr().unwrap();
|
||||
|
|
|
@ -140,7 +140,6 @@ impl BroadcastRun for BroadcastFakeShredsRun {
|
|||
mod tests {
|
||||
use super::*;
|
||||
use crate::contact_info::ContactInfo;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -2736,8 +2736,11 @@ mod tests {
|
|||
//check that a gossip nodes always show up as spies
|
||||
let (node, _, _) = ClusterInfo::spy_node(&solana_sdk::pubkey::new_rand(), 0);
|
||||
assert!(ClusterInfo::is_spy_node(&node));
|
||||
let (node, _, _) =
|
||||
ClusterInfo::gossip_node(&solana_sdk::pubkey::new_rand(), &"1.1.1.1:1111".parse().unwrap(), 0);
|
||||
let (node, _, _) = ClusterInfo::gossip_node(
|
||||
&solana_sdk::pubkey::new_rand(),
|
||||
&"1.1.1.1:1111".parse().unwrap(),
|
||||
0,
|
||||
);
|
||||
assert!(ClusterInfo::is_spy_node(&node));
|
||||
}
|
||||
|
||||
|
@ -2955,8 +2958,12 @@ mod tests {
|
|||
|
||||
let ip = IpAddr::V4(Ipv4Addr::from(0));
|
||||
let port = bind_in_range(ip, port_range).expect("Failed to bind").0;
|
||||
let node =
|
||||
Node::new_with_external_ip(&solana_sdk::pubkey::new_rand(), &socketaddr!(0, port), port_range, ip);
|
||||
let node = Node::new_with_external_ip(
|
||||
&solana_sdk::pubkey::new_rand(),
|
||||
&socketaddr!(0, port),
|
||||
port_range,
|
||||
ip,
|
||||
);
|
||||
|
||||
check_node_sockets(&node, ip, port_range);
|
||||
|
||||
|
|
|
@ -377,17 +377,20 @@ mod tests {
|
|||
|
||||
let sk1 = solana_sdk::pubkey::new_rand();
|
||||
let pk1 = solana_sdk::pubkey::new_rand();
|
||||
let mut vote_account1 = vote_state::create_account(&pk1, &solana_sdk::pubkey::new_rand(), 0, 100);
|
||||
let mut vote_account1 =
|
||||
vote_state::create_account(&pk1, &solana_sdk::pubkey::new_rand(), 0, 100);
|
||||
let stake_account1 =
|
||||
stake_state::create_account(&sk1, &pk1, &vote_account1, &genesis_config.rent, 100);
|
||||
let sk2 = solana_sdk::pubkey::new_rand();
|
||||
let pk2 = solana_sdk::pubkey::new_rand();
|
||||
let mut vote_account2 = vote_state::create_account(&pk2, &solana_sdk::pubkey::new_rand(), 0, 50);
|
||||
let mut vote_account2 =
|
||||
vote_state::create_account(&pk2, &solana_sdk::pubkey::new_rand(), 0, 50);
|
||||
let stake_account2 =
|
||||
stake_state::create_account(&sk2, &pk2, &vote_account2, &genesis_config.rent, 50);
|
||||
let sk3 = solana_sdk::pubkey::new_rand();
|
||||
let pk3 = solana_sdk::pubkey::new_rand();
|
||||
let mut vote_account3 = vote_state::create_account(&pk3, &solana_sdk::pubkey::new_rand(), 0, 1);
|
||||
let mut vote_account3 =
|
||||
vote_state::create_account(&pk3, &solana_sdk::pubkey::new_rand(), 0, 1);
|
||||
let stake_account3 = stake_state::create_account(
|
||||
&sk3,
|
||||
&pk3,
|
||||
|
@ -397,7 +400,8 @@ mod tests {
|
|||
);
|
||||
let sk4 = solana_sdk::pubkey::new_rand();
|
||||
let pk4 = solana_sdk::pubkey::new_rand();
|
||||
let mut vote_account4 = vote_state::create_account(&pk4, &solana_sdk::pubkey::new_rand(), 0, 1);
|
||||
let mut vote_account4 =
|
||||
vote_state::create_account(&pk4, &solana_sdk::pubkey::new_rand(), 0, 1);
|
||||
let stake_account4 = stake_state::create_account(
|
||||
&sk4,
|
||||
&pk4,
|
||||
|
|
|
@ -361,7 +361,9 @@ mod test {
|
|||
}
|
||||
|
||||
let mut crds = Crds::default();
|
||||
let pubkeys: Vec<_> = std::iter::repeat_with(solana_sdk::pubkey::new_rand).take(256).collect();
|
||||
let pubkeys: Vec<_> = std::iter::repeat_with(solana_sdk::pubkey::new_rand)
|
||||
.take(256)
|
||||
.collect();
|
||||
let mut rng = thread_rng();
|
||||
let mut num_inserts = 0;
|
||||
for _ in 0..4096 {
|
||||
|
|
|
@ -135,14 +135,15 @@ mod test {
|
|||
use crate::contact_info::ContactInfo;
|
||||
use crate::crds_value::{CrdsData, CrdsValue};
|
||||
use rand::{thread_rng, Rng};
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::timing::timestamp;
|
||||
use std::collections::HashSet;
|
||||
use std::ops::Index;
|
||||
|
||||
fn new_test_crds_value() -> VersionedCrdsValue {
|
||||
let data =
|
||||
CrdsData::ContactInfo(ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), timestamp()));
|
||||
let data = CrdsData::ContactInfo(ContactInfo::new_localhost(
|
||||
&solana_sdk::pubkey::new_rand(),
|
||||
timestamp(),
|
||||
));
|
||||
VersionedCrdsValue::new(timestamp(), CrdsValue::new_unsigned(data))
|
||||
}
|
||||
|
||||
|
|
|
@ -2596,7 +2596,11 @@ pub(crate) mod tests {
|
|||
.is_none());
|
||||
|
||||
let bank1 = Bank::new_from_parent(&arc_bank0, &Pubkey::default(), arc_bank0.slot() + 1);
|
||||
let _res = bank1.transfer(10, &genesis_config_info.mint_keypair, &solana_sdk::pubkey::new_rand());
|
||||
let _res = bank1.transfer(
|
||||
10,
|
||||
&genesis_config_info.mint_keypair,
|
||||
&solana_sdk::pubkey::new_rand(),
|
||||
);
|
||||
for _ in 0..genesis_config.ticks_per_slot {
|
||||
bank1.register_tick(&Hash::default());
|
||||
}
|
||||
|
@ -2612,7 +2616,11 @@ pub(crate) mod tests {
|
|||
);
|
||||
|
||||
let bank2 = Bank::new_from_parent(&arc_bank1, &Pubkey::default(), arc_bank1.slot() + 1);
|
||||
let _res = bank2.transfer(10, &genesis_config_info.mint_keypair, &solana_sdk::pubkey::new_rand());
|
||||
let _res = bank2.transfer(
|
||||
10,
|
||||
&genesis_config_info.mint_keypair,
|
||||
&solana_sdk::pubkey::new_rand(),
|
||||
);
|
||||
for _ in 0..genesis_config.ticks_per_slot {
|
||||
bank2.register_tick(&Hash::default());
|
||||
}
|
||||
|
|
|
@ -504,7 +504,6 @@ mod tests {
|
|||
use solana_ledger::genesis_utils::{create_genesis_config, GenesisConfigInfo};
|
||||
use solana_net_utils::find_available_port_in_range;
|
||||
use solana_perf::packet::{Meta, Packet, Packets};
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use std::net::{IpAddr, Ipv4Addr};
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -4271,8 +4271,12 @@ pub mod tests {
|
|||
);
|
||||
SendTransactionService::new(tpu_address, &bank_forks, None, receiver);
|
||||
|
||||
let mut bad_transaction =
|
||||
system_transaction::transfer(&mint_keypair, &solana_sdk::pubkey::new_rand(), 42, Hash::default());
|
||||
let mut bad_transaction = system_transaction::transfer(
|
||||
&mint_keypair,
|
||||
&solana_sdk::pubkey::new_rand(),
|
||||
42,
|
||||
Hash::default(),
|
||||
);
|
||||
|
||||
// sendTransaction will fail because the blockhash is invalid
|
||||
let req = format!(
|
||||
|
@ -4302,8 +4306,12 @@ pub mod tests {
|
|||
r#"{"jsonrpc":"2.0","error":{"code":-32002,"message":"Transaction simulation failed: Transaction failed to sanitize accounts offsets correctly","data":{"err":"SanitizeFailure","logs":[]}},"id":1}"#.to_string(),
|
||||
)
|
||||
);
|
||||
let mut bad_transaction =
|
||||
system_transaction::transfer(&mint_keypair, &solana_sdk::pubkey::new_rand(), 42, recent_blockhash);
|
||||
let mut bad_transaction = system_transaction::transfer(
|
||||
&mint_keypair,
|
||||
&solana_sdk::pubkey::new_rand(),
|
||||
42,
|
||||
recent_blockhash,
|
||||
);
|
||||
|
||||
// sendTransaction will fail due to poor node health
|
||||
health.stub_set_health_status(Some(RpcHealthStatus::Behind));
|
||||
|
@ -4397,7 +4405,12 @@ pub mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_rpc_verify_signature() {
|
||||
let tx = system_transaction::transfer(&Keypair::new(), &solana_sdk::pubkey::new_rand(), 20, hash(&[0]));
|
||||
let tx = system_transaction::transfer(
|
||||
&Keypair::new(),
|
||||
&solana_sdk::pubkey::new_rand(),
|
||||
20,
|
||||
hash(&[0]),
|
||||
);
|
||||
assert_eq!(
|
||||
verify_signature(&tx.signatures[0].to_string()).unwrap(),
|
||||
tx.signatures[0]
|
||||
|
@ -5192,7 +5205,8 @@ pub mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_token_rpcs() {
|
||||
let RpcHandler { io, meta, bank, .. } = start_rpc_handler_with_tx(&solana_sdk::pubkey::new_rand());
|
||||
let RpcHandler { io, meta, bank, .. } =
|
||||
start_rpc_handler_with_tx(&solana_sdk::pubkey::new_rand());
|
||||
|
||||
let mut account_data = vec![0; TokenAccount::get_packed_len()];
|
||||
let mint = SplTokenPubkey::new(&[2; 32]);
|
||||
|
@ -5588,7 +5602,8 @@ pub mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_token_parsing() {
|
||||
let RpcHandler { io, meta, bank, .. } = start_rpc_handler_with_tx(&solana_sdk::pubkey::new_rand());
|
||||
let RpcHandler { io, meta, bank, .. } =
|
||||
start_rpc_handler_with_tx(&solana_sdk::pubkey::new_rand());
|
||||
|
||||
let mut account_data = vec![0; TokenAccount::get_packed_len()];
|
||||
let mint = SplTokenPubkey::new(&[2; 32]);
|
||||
|
|
|
@ -550,7 +550,11 @@ mod tests {
|
|||
let cluster_info = Arc::new(ClusterInfo::default());
|
||||
let health_check_slot_distance = 123;
|
||||
let override_health_check = Arc::new(AtomicBool::new(false));
|
||||
let trusted_validators = vec![solana_sdk::pubkey::new_rand(), solana_sdk::pubkey::new_rand(), solana_sdk::pubkey::new_rand()];
|
||||
let trusted_validators = vec![
|
||||
solana_sdk::pubkey::new_rand(),
|
||||
solana_sdk::pubkey::new_rand(),
|
||||
solana_sdk::pubkey::new_rand(),
|
||||
];
|
||||
|
||||
let health = Arc::new(RpcHealth::new(
|
||||
cluster_info.clone(),
|
||||
|
|
|
@ -1249,8 +1249,11 @@ pub(crate) mod tests {
|
|||
.process_transaction(&past_bank_tx)
|
||||
.unwrap();
|
||||
|
||||
let next_bank =
|
||||
Bank::new_from_parent(&bank_forks.banks[&0].clone(), &solana_sdk::pubkey::new_rand(), 1);
|
||||
let next_bank = Bank::new_from_parent(
|
||||
&bank_forks.banks[&0].clone(),
|
||||
&solana_sdk::pubkey::new_rand(),
|
||||
1,
|
||||
);
|
||||
bank_forks.insert(next_bank);
|
||||
|
||||
bank_forks
|
||||
|
|
|
@ -971,8 +971,10 @@ mod tests {
|
|||
let cluster_info = Arc::new(ClusterInfo::new_with_invalid_keypair(me.clone()));
|
||||
|
||||
// Insert two peers on the network
|
||||
let contact_info2 = ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), timestamp());
|
||||
let contact_info3 = ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), timestamp());
|
||||
let contact_info2 =
|
||||
ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), timestamp());
|
||||
let contact_info3 =
|
||||
ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), timestamp());
|
||||
cluster_info.insert_info(contact_info2.clone());
|
||||
cluster_info.insert_info(contact_info3.clone());
|
||||
let serve_repair = ServeRepair::new(cluster_info);
|
||||
|
|
|
@ -59,7 +59,6 @@ mod tests {
|
|||
use crate::result::Error;
|
||||
use crossbeam_channel::{unbounded, RecvTimeoutError};
|
||||
use solana_perf::packet::{Meta, Packet};
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
|
||||
#[test]
|
||||
fn test_get_latest_votes() {
|
||||
|
|
|
@ -12,8 +12,7 @@ use solana_runtime::{
|
|||
genesis_utils::{create_genesis_config, GenesisConfigInfo},
|
||||
};
|
||||
use solana_sdk::{
|
||||
commitment_config::CommitmentConfig, pubkey::Pubkey, rpc_port, signature::Signer,
|
||||
system_transaction,
|
||||
commitment_config::CommitmentConfig, rpc_port, signature::Signer, system_transaction,
|
||||
};
|
||||
use std::{
|
||||
fs::remove_dir_all,
|
||||
|
|
|
@ -15,8 +15,8 @@ use solana_client::{
|
|||
use solana_core::contact_info::ContactInfo;
|
||||
use solana_core::{rpc_pubsub::gen_client::Client as PubsubClient, test_validator::TestValidator};
|
||||
use solana_sdk::{
|
||||
commitment_config::CommitmentConfig, hash::Hash, pubkey::Pubkey, signature::Signer,
|
||||
system_transaction, transaction::Transaction,
|
||||
commitment_config::CommitmentConfig, hash::Hash, signature::Signer, system_transaction,
|
||||
transaction::Transaction,
|
||||
};
|
||||
use std::{
|
||||
collections::HashSet,
|
||||
|
@ -173,7 +173,9 @@ fn test_rpc_subscriptions() {
|
|||
|
||||
// Create transaction signatures to subscribe to
|
||||
let transactions: Vec<Transaction> = (0..1000)
|
||||
.map(|_| system_transaction::transfer(&alice, &solana_sdk::pubkey::new_rand(), 1, genesis_hash))
|
||||
.map(|_| {
|
||||
system_transaction::transfer(&alice, &solana_sdk::pubkey::new_rand(), 1, genesis_hash)
|
||||
})
|
||||
.collect();
|
||||
let mut signature_set: HashSet<String> = transactions
|
||||
.iter()
|
||||
|
|
|
@ -253,7 +253,10 @@ pub mod test {
|
|||
|
||||
#[test]
|
||||
fn test_dos() {
|
||||
let nodes = [ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), timestamp())];
|
||||
let nodes = [ContactInfo::new_localhost(
|
||||
&solana_sdk::pubkey::new_rand(),
|
||||
timestamp(),
|
||||
)];
|
||||
let entrypoint_addr = nodes[0].gossip;
|
||||
run_dos(
|
||||
&nodes,
|
||||
|
|
|
@ -2,7 +2,6 @@ use solana_faucet::faucet::{request_airdrop_transaction, run_local_faucet};
|
|||
use solana_sdk::{
|
||||
hash::Hash,
|
||||
message::Message,
|
||||
pubkey::Pubkey,
|
||||
signature::{Keypair, Signer},
|
||||
system_instruction,
|
||||
transaction::Transaction,
|
||||
|
|
|
@ -615,7 +615,6 @@ fn main() -> Result<(), Box<dyn error::Error>> {
|
|||
mod tests {
|
||||
use super::*;
|
||||
use solana_sdk::genesis_config::GenesisConfig;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use std::collections::HashMap;
|
||||
use std::fs::remove_file;
|
||||
use std::io::Write;
|
||||
|
|
|
@ -8,7 +8,7 @@ use solana_ledger::{
|
|||
get_tmp_ledger_path,
|
||||
};
|
||||
use solana_runtime::bank::RewardType;
|
||||
use solana_sdk::{clock::Slot, pubkey::Pubkey};
|
||||
use solana_sdk::{clock::Slot, pubkey};
|
||||
use solana_transaction_status::{Reward, Rewards};
|
||||
use std::path::Path;
|
||||
use test::Bencher;
|
||||
|
@ -16,7 +16,7 @@ use test::Bencher;
|
|||
fn create_rewards() -> Rewards {
|
||||
(0..100)
|
||||
.map(|i| Reward {
|
||||
pubkey: solana_sdk::pubkey::new_rand().to_string(),
|
||||
pubkey: pubkey::new_rand().to_string(),
|
||||
lamports: 42 + i,
|
||||
post_balance: std::u64::MAX,
|
||||
reward_type: Some(RewardType::Fee),
|
||||
|
|
|
@ -2872,8 +2872,12 @@ pub mod tests {
|
|||
let keypair = Keypair::new();
|
||||
|
||||
// Create array of two transactions which throw different errors
|
||||
let account_not_found_tx =
|
||||
system_transaction::transfer(&keypair, &solana_sdk::pubkey::new_rand(), 42, bank.last_blockhash());
|
||||
let account_not_found_tx = system_transaction::transfer(
|
||||
&keypair,
|
||||
&solana_sdk::pubkey::new_rand(),
|
||||
42,
|
||||
bank.last_blockhash(),
|
||||
);
|
||||
let account_not_found_sig = account_not_found_tx.signatures[0];
|
||||
let mut account_loaded_twice = system_transaction::transfer(
|
||||
&mint_keypair,
|
||||
|
@ -2925,7 +2929,11 @@ pub mod tests {
|
|||
let bank0 = Arc::new(Bank::new(&genesis_config));
|
||||
bank0.freeze();
|
||||
|
||||
let bank1 = Arc::new(Bank::new_from_parent(&bank0, &solana_sdk::pubkey::new_rand(), 1));
|
||||
let bank1 = Arc::new(Bank::new_from_parent(
|
||||
&bank0,
|
||||
&solana_sdk::pubkey::new_rand(),
|
||||
1,
|
||||
));
|
||||
|
||||
// The new blockhash is going to be the hash of the last tick in the block
|
||||
let bank_1_blockhash = bank1.last_blockhash();
|
||||
|
|
|
@ -2,7 +2,6 @@ pub use solana_runtime::genesis_utils::{
|
|||
create_genesis_config_with_leader, create_genesis_config_with_leader_ex, GenesisConfigInfo,
|
||||
BOOTSTRAP_VALIDATOR_LAMPORTS,
|
||||
};
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
|
||||
// same as genesis_config::create_genesis_config, but with bootstrap_validator staking logic
|
||||
// for the core crate tests
|
||||
|
|
|
@ -77,7 +77,9 @@ mod tests {
|
|||
#[test]
|
||||
fn test_leader_schedule_basic() {
|
||||
let num_keys = 10;
|
||||
let stakes: Vec<_> = (0..num_keys).map(|i| (solana_sdk::pubkey::new_rand(), i)).collect();
|
||||
let stakes: Vec<_> = (0..num_keys)
|
||||
.map(|i| (solana_sdk::pubkey::new_rand(), i))
|
||||
.collect();
|
||||
|
||||
let seed = solana_sdk::pubkey::new_rand();
|
||||
let mut seed_bytes = [0u8; 32];
|
||||
|
@ -93,7 +95,9 @@ mod tests {
|
|||
#[test]
|
||||
fn test_repeated_leader_schedule() {
|
||||
let num_keys = 10;
|
||||
let stakes: Vec<_> = (0..num_keys).map(|i| (solana_sdk::pubkey::new_rand(), i)).collect();
|
||||
let stakes: Vec<_> = (0..num_keys)
|
||||
.map(|i| (solana_sdk::pubkey::new_rand(), i))
|
||||
.collect();
|
||||
|
||||
let seed = solana_sdk::pubkey::new_rand();
|
||||
let mut seed_bytes = [0u8; 32];
|
||||
|
|
|
@ -162,8 +162,12 @@ fn test_local_cluster_signature_subscribe() {
|
|||
.get_recent_blockhash_with_commitment(CommitmentConfig::recent())
|
||||
.unwrap();
|
||||
|
||||
let mut transaction =
|
||||
system_transaction::transfer(&cluster.funding_keypair, &solana_sdk::pubkey::new_rand(), 10, blockhash);
|
||||
let mut transaction = system_transaction::transfer(
|
||||
&cluster.funding_keypair,
|
||||
&solana_sdk::pubkey::new_rand(),
|
||||
10,
|
||||
blockhash,
|
||||
);
|
||||
|
||||
let (mut sig_subscribe_client, receiver) = PubsubClient::signature_subscribe(
|
||||
&format!("ws://{}", &non_bootstrap_info.rpc_pubsub.to_string()),
|
||||
|
@ -815,7 +819,12 @@ fn generate_frozen_account_panic(mut cluster: LocalCluster, frozen_account: Arc<
|
|||
.get_recent_blockhash_with_commitment(CommitmentConfig::recent())
|
||||
.unwrap();
|
||||
client
|
||||
.async_transfer(1, &frozen_account, &solana_sdk::pubkey::new_rand(), blockhash)
|
||||
.async_transfer(
|
||||
1,
|
||||
&frozen_account,
|
||||
&solana_sdk::pubkey::new_rand(),
|
||||
blockhash,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
sleep(Duration::from_secs(1));
|
||||
|
|
|
@ -264,7 +264,12 @@ mod tests {
|
|||
fn test_serialize_parameters() {
|
||||
let program_id = solana_sdk::pubkey::new_rand();
|
||||
let dup_key = solana_sdk::pubkey::new_rand();
|
||||
let keys = vec![dup_key, dup_key, solana_sdk::pubkey::new_rand(), solana_sdk::pubkey::new_rand()];
|
||||
let keys = vec![
|
||||
dup_key,
|
||||
dup_key,
|
||||
solana_sdk::pubkey::new_rand(),
|
||||
solana_sdk::pubkey::new_rand(),
|
||||
];
|
||||
let accounts = [
|
||||
RefCell::new(Account {
|
||||
lamports: 1,
|
||||
|
|
|
@ -4,7 +4,6 @@ use solana_runtime::loader_utils::create_invoke_instruction;
|
|||
use solana_sdk::client::SyncClient;
|
||||
use solana_sdk::genesis_config::create_genesis_config;
|
||||
use solana_sdk::instruction::InstructionError;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::signature::Signer;
|
||||
use solana_sdk::transaction::TransactionError;
|
||||
|
||||
|
|
|
@ -4,13 +4,13 @@ extern crate test;
|
|||
|
||||
use rand::{thread_rng, Rng};
|
||||
use solana_runtime::{accounts_db::AccountInfo, accounts_index::AccountsIndex};
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::pubkey;
|
||||
use test::Bencher;
|
||||
|
||||
#[bench]
|
||||
fn bench_accounts_index(bencher: &mut Bencher) {
|
||||
const NUM_PUBKEYS: usize = 10_000;
|
||||
let pubkeys: Vec<_> = (0..NUM_PUBKEYS).map(|_| solana_sdk::pubkey::new_rand()).collect();
|
||||
let pubkeys: Vec<_> = (0..NUM_PUBKEYS).map(|_| pubkey::new_rand()).collect();
|
||||
|
||||
const NUM_FORKS: u64 = 16;
|
||||
|
||||
|
|
|
@ -4,17 +4,17 @@ extern crate test;
|
|||
|
||||
use log::*;
|
||||
use solana_runtime::message_processor::PreAccount;
|
||||
use solana_sdk::{account::Account, pubkey::Pubkey, rent::Rent};
|
||||
use solana_sdk::{account::Account, pubkey, rent::Rent};
|
||||
use test::Bencher;
|
||||
|
||||
#[bench]
|
||||
fn bench_verify_account_changes_data(bencher: &mut Bencher) {
|
||||
solana_logger::setup();
|
||||
|
||||
let owner = solana_sdk::pubkey::new_rand();
|
||||
let non_owner = solana_sdk::pubkey::new_rand();
|
||||
let owner = pubkey::new_rand();
|
||||
let non_owner = pubkey::new_rand();
|
||||
let pre = PreAccount::new(
|
||||
&solana_sdk::pubkey::new_rand(),
|
||||
&pubkey::new_rand(),
|
||||
&Account::new(0, BUFSIZE, &owner),
|
||||
true,
|
||||
false,
|
||||
|
@ -36,7 +36,7 @@ fn bench_verify_account_changes_data(bencher: &mut Bencher) {
|
|||
info!("data compare {} ns/iter", summary.median);
|
||||
|
||||
let pre = PreAccount::new(
|
||||
&solana_sdk::pubkey::new_rand(),
|
||||
&pubkey::new_rand(),
|
||||
&Account::new(0, BUFSIZE, &owner),
|
||||
true,
|
||||
false,
|
||||
|
|
|
@ -4830,7 +4830,9 @@ pub mod tests {
|
|||
let accounts = AccountsDB::new_single();
|
||||
|
||||
let pubkey_count = 100;
|
||||
let pubkeys: Vec<_> = (0..pubkey_count).map(|_| solana_sdk::pubkey::new_rand()).collect();
|
||||
let pubkeys: Vec<_> = (0..pubkey_count)
|
||||
.map(|_| solana_sdk::pubkey::new_rand())
|
||||
.collect();
|
||||
|
||||
let some_lamport = 223;
|
||||
let no_data = 0;
|
||||
|
@ -4894,7 +4896,9 @@ pub mod tests {
|
|||
let accounts = AccountsDB::new_single();
|
||||
|
||||
let pubkey_count = 100;
|
||||
let pubkeys: Vec<_> = (0..pubkey_count).map(|_| solana_sdk::pubkey::new_rand()).collect();
|
||||
let pubkeys: Vec<_> = (0..pubkey_count)
|
||||
.map(|_| solana_sdk::pubkey::new_rand())
|
||||
.collect();
|
||||
|
||||
let some_lamport = 223;
|
||||
let no_data = 0;
|
||||
|
@ -5076,7 +5080,11 @@ pub mod tests {
|
|||
);
|
||||
// any random program data accounts
|
||||
assert_eq!(
|
||||
AccountsDB::account_balance_for_capitalization(10, &solana_sdk::pubkey::new_rand(), false),
|
||||
AccountsDB::account_balance_for_capitalization(
|
||||
10,
|
||||
&solana_sdk::pubkey::new_rand(),
|
||||
false
|
||||
),
|
||||
10
|
||||
);
|
||||
}
|
||||
|
|
|
@ -610,7 +610,7 @@ mod tests {
|
|||
let root_slot = 0;
|
||||
|
||||
let mut pubkeys: Vec<Pubkey> = std::iter::repeat_with(|| {
|
||||
let new_pubkey = Pubkey::new_rand();
|
||||
let new_pubkey = solana_sdk::pubkey::new_rand();
|
||||
index.upsert(root_slot, &new_pubkey, true, &mut vec![]);
|
||||
new_pubkey
|
||||
})
|
||||
|
@ -742,7 +742,7 @@ mod tests {
|
|||
let mut iter = index.iter(None::<Range<Pubkey>>);
|
||||
assert!(iter.next().is_none());
|
||||
let mut gc = vec![];
|
||||
index.upsert(0, &Pubkey::new_rand(), true, &mut gc);
|
||||
index.upsert(0, &solana_sdk::pubkey::new_rand(), true, &mut gc);
|
||||
assert!(iter.next().is_none());
|
||||
}
|
||||
|
||||
|
|
|
@ -4275,7 +4275,12 @@ mod tests {
|
|||
fn test_bank_capitalization() {
|
||||
let bank = Arc::new(Bank::new(&GenesisConfig {
|
||||
accounts: (0..42)
|
||||
.map(|_| (solana_sdk::pubkey::new_rand(), Account::new(42, 0, &Pubkey::default())))
|
||||
.map(|_| {
|
||||
(
|
||||
solana_sdk::pubkey::new_rand(),
|
||||
Account::new(42, 0, &Pubkey::default()),
|
||||
)
|
||||
})
|
||||
.collect(),
|
||||
cluster_type: ClusterType::MainnetBeta,
|
||||
..GenesisConfig::default()
|
||||
|
@ -4852,7 +4857,11 @@ mod tests {
|
|||
};
|
||||
|
||||
let root_bank = Arc::new(Bank::new(&genesis_config));
|
||||
let bank = create_child_bank_for_rent_test(&root_bank, &genesis_config, solana_sdk::pubkey::new_rand());
|
||||
let bank = create_child_bank_for_rent_test(
|
||||
&root_bank,
|
||||
&genesis_config,
|
||||
solana_sdk::pubkey::new_rand(),
|
||||
);
|
||||
|
||||
let account_pubkey = solana_sdk::pubkey::new_rand();
|
||||
let account_balance = 1;
|
||||
|
@ -5941,7 +5950,8 @@ mod tests {
|
|||
assert!(bank.rewards.read().unwrap().is_empty());
|
||||
|
||||
let vote_id = solana_sdk::pubkey::new_rand();
|
||||
let mut vote_account = vote_state::create_account(&vote_id, &solana_sdk::pubkey::new_rand(), 50, 100);
|
||||
let mut vote_account =
|
||||
vote_state::create_account(&vote_id, &solana_sdk::pubkey::new_rand(), 50, 100);
|
||||
let (stake_id1, stake_account1) = crate::stakes::tests::create_stake_account(123, &vote_id);
|
||||
let (stake_id2, stake_account2) = crate::stakes::tests::create_stake_account(456, &vote_id);
|
||||
|
||||
|
@ -7391,7 +7401,11 @@ mod tests {
|
|||
let bank0 = Arc::new(Bank::new(&genesis_config));
|
||||
|
||||
// Bank 1
|
||||
let bank1 = Arc::new(Bank::new_from_parent(&bank0, &solana_sdk::pubkey::new_rand(), 1));
|
||||
let bank1 = Arc::new(Bank::new_from_parent(
|
||||
&bank0,
|
||||
&solana_sdk::pubkey::new_rand(),
|
||||
1,
|
||||
));
|
||||
// Bank 2
|
||||
let bank2 = Bank::new_from_parent(&bank0, &solana_sdk::pubkey::new_rand(), 2);
|
||||
|
||||
|
@ -8306,7 +8320,11 @@ mod tests {
|
|||
let nonce_tx = Transaction::new_signed_with_payer(
|
||||
&[
|
||||
system_instruction::advance_nonce_account(&nonce_pubkey, &nonce_pubkey),
|
||||
system_instruction::transfer(&custodian_pubkey, &solana_sdk::pubkey::new_rand(), 100_000),
|
||||
system_instruction::transfer(
|
||||
&custodian_pubkey,
|
||||
&solana_sdk::pubkey::new_rand(),
|
||||
100_000,
|
||||
),
|
||||
],
|
||||
Some(&custodian_pubkey),
|
||||
&[&custodian_keypair, &nonce_keypair],
|
||||
|
|
|
@ -318,9 +318,10 @@ mod test {
|
|||
assert!(bloom.contains(hash_value));
|
||||
}
|
||||
// Round trip, inserting new hash values.
|
||||
let more_hash_values: Vec<_> = std::iter::repeat_with(|| solana_sdk::hash::new_rand(&mut rng))
|
||||
.take(1000)
|
||||
.collect();
|
||||
let more_hash_values: Vec<_> =
|
||||
std::iter::repeat_with(|| solana_sdk::hash::new_rand(&mut rng))
|
||||
.take(1000)
|
||||
.collect();
|
||||
let bloom: AtomicBloom<_> = bloom.into();
|
||||
assert_eq!(bloom.num_bits, 9731);
|
||||
assert_eq!(bloom.bits.len(), (9731 + 63) / 64);
|
||||
|
|
|
@ -867,7 +867,10 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_verify_account_references() {
|
||||
let accounts = vec![(solana_sdk::pubkey::new_rand(), RefCell::new(Account::default()))];
|
||||
let accounts = vec![(
|
||||
solana_sdk::pubkey::new_rand(),
|
||||
RefCell::new(Account::default()),
|
||||
)];
|
||||
|
||||
assert!(MessageProcessor::verify_account_references(&accounts).is_ok());
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ mod tests {
|
|||
|
||||
// collect rent on a already-existing account
|
||||
let collected = rent_collector.collect_from_existing_account(
|
||||
&solana_sdk::pubkey::new_rand()
|
||||
&solana_sdk::pubkey::new_rand(),
|
||||
&mut existing_account,
|
||||
true,
|
||||
);
|
||||
|
|
|
@ -191,7 +191,8 @@ pub mod tests {
|
|||
// set up some dummies for a staked node (( vote ) ( stake ))
|
||||
pub fn create_staked_node_accounts(stake: u64) -> ((Pubkey, Account), (Pubkey, Account)) {
|
||||
let vote_pubkey = solana_sdk::pubkey::new_rand();
|
||||
let vote_account = vote_state::create_account(&vote_pubkey, &solana_sdk::pubkey::new_rand(), 0, 1);
|
||||
let vote_account =
|
||||
vote_state::create_account(&vote_pubkey, &solana_sdk::pubkey::new_rand(), 0, 1);
|
||||
(
|
||||
(vote_pubkey, vote_account),
|
||||
create_stake_account(stake, &vote_pubkey),
|
||||
|
@ -218,7 +219,8 @@ pub mod tests {
|
|||
epoch: Epoch,
|
||||
) -> ((Pubkey, Account), (Pubkey, Account)) {
|
||||
let vote_pubkey = solana_sdk::pubkey::new_rand();
|
||||
let vote_account = vote_state::create_account(&vote_pubkey, &solana_sdk::pubkey::new_rand(), 0, 1);
|
||||
let vote_account =
|
||||
vote_state::create_account(&vote_pubkey, &solana_sdk::pubkey::new_rand(), 0, 1);
|
||||
(
|
||||
(vote_pubkey, vote_account),
|
||||
create_warming_stake_account(stake, epoch, &vote_pubkey),
|
||||
|
|
|
@ -62,7 +62,7 @@ impl<'a, 'b> Drop for TransactionBatch<'a, 'b> {
|
|||
mod tests {
|
||||
use super::*;
|
||||
use crate::genesis_utils::{create_genesis_config_with_leader, GenesisConfigInfo};
|
||||
use solana_sdk::{pubkey::Pubkey, signature::Keypair, system_transaction};
|
||||
use solana_sdk::{signature::Keypair, system_transaction};
|
||||
|
||||
#[test]
|
||||
fn test_transaction_batch() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use solana_runtime::bank::Bank;
|
||||
use solana_sdk::{genesis_config::create_genesis_config, hash::hash, pubkey::Pubkey};
|
||||
use solana_sdk::{genesis_config::create_genesis_config, hash::hash};
|
||||
use std::{sync::Arc, thread::Builder};
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
use solana_runtime::{
|
||||
bank::Bank, bank_client::BankClient, loader_utils::create_invoke_instruction,
|
||||
};
|
||||
use solana_sdk::{
|
||||
client::SyncClient, genesis_config::create_genesis_config, pubkey::Pubkey, signature::Signer,
|
||||
};
|
||||
use solana_sdk::{client::SyncClient, genesis_config::create_genesis_config, signature::Signer};
|
||||
|
||||
#[test]
|
||||
fn test_program_native_noop() {
|
||||
|
|
|
@ -105,7 +105,11 @@ fn test_stake_create_and_split_single_signature() {
|
|||
genesis_config,
|
||||
mint_keypair: staker_keypair,
|
||||
..
|
||||
} = create_genesis_config_with_leader(100_000_000_000, &solana_sdk::pubkey::new_rand(), 1_000_000);
|
||||
} = create_genesis_config_with_leader(
|
||||
100_000_000_000,
|
||||
&solana_sdk::pubkey::new_rand(),
|
||||
1_000_000,
|
||||
);
|
||||
|
||||
let staker_pubkey = staker_keypair.pubkey();
|
||||
|
||||
|
@ -172,7 +176,11 @@ fn test_stake_create_and_split_to_existing_system_account() {
|
|||
genesis_config,
|
||||
mint_keypair: staker_keypair,
|
||||
..
|
||||
} = create_genesis_config_with_leader(100_000_000_000, &solana_sdk::pubkey::new_rand(), 1_000_000);
|
||||
} = create_genesis_config_with_leader(
|
||||
100_000_000_000,
|
||||
&solana_sdk::pubkey::new_rand(),
|
||||
1_000_000,
|
||||
);
|
||||
|
||||
let staker_pubkey = staker_keypair.pubkey();
|
||||
|
||||
|
@ -255,7 +263,11 @@ fn test_stake_account_lifetime() {
|
|||
genesis_config,
|
||||
mint_keypair,
|
||||
..
|
||||
} = create_genesis_config_with_leader(100_000_000_000, &solana_sdk::pubkey::new_rand(), 1_000_000);
|
||||
} = create_genesis_config_with_leader(
|
||||
100_000_000_000,
|
||||
&solana_sdk::pubkey::new_rand(),
|
||||
1_000_000,
|
||||
);
|
||||
let bank = Bank::new(&genesis_config);
|
||||
let mint_pubkey = mint_keypair.pubkey();
|
||||
let mut bank = Arc::new(bank);
|
||||
|
@ -495,7 +507,11 @@ fn test_create_stake_account_from_seed() {
|
|||
genesis_config,
|
||||
mint_keypair,
|
||||
..
|
||||
} = create_genesis_config_with_leader(100_000_000_000, &solana_sdk::pubkey::new_rand(), 1_000_000);
|
||||
} = create_genesis_config_with_leader(
|
||||
100_000_000_000,
|
||||
&solana_sdk::pubkey::new_rand(),
|
||||
1_000_000,
|
||||
);
|
||||
let bank = Bank::new(&genesis_config);
|
||||
let mint_pubkey = mint_keypair.pubkey();
|
||||
let bank = Arc::new(bank);
|
||||
|
|
|
@ -4,13 +4,13 @@ extern crate test;
|
|||
use bincode::{deserialize, serialize};
|
||||
use solana_sdk::instruction::{AccountMeta, Instruction};
|
||||
use solana_sdk::message::Message;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::pubkey;
|
||||
use solana_sdk::sysvar::instructions;
|
||||
use test::Bencher;
|
||||
|
||||
fn make_instructions() -> Vec<Instruction> {
|
||||
let meta = AccountMeta::new(solana_sdk::pubkey::new_rand(), false);
|
||||
let inst = Instruction::new(solana_sdk::pubkey::new_rand(), &[0; 10], vec![meta; 4]);
|
||||
let meta = AccountMeta::new(pubkey::new_rand(), false);
|
||||
let inst = Instruction::new(pubkey::new_rand(), &[0; 10], vec![meta; 4]);
|
||||
vec![inst; 4]
|
||||
}
|
||||
|
||||
|
|
|
@ -310,7 +310,10 @@ mod tests {
|
|||
faucet_keypair.pubkey(),
|
||||
Account::new(10_000, 0, &Pubkey::default()),
|
||||
);
|
||||
config.add_account(solana_sdk::pubkey::new_rand(), Account::new(1, 0, &Pubkey::default()));
|
||||
config.add_account(
|
||||
solana_sdk::pubkey::new_rand(),
|
||||
Account::new(1, 0, &Pubkey::default()),
|
||||
);
|
||||
config.add_native_instruction_processor("hi".to_string(), solana_sdk::pubkey::new_rand());
|
||||
|
||||
assert_eq!(config.accounts.len(), 2);
|
||||
|
|
|
@ -301,7 +301,12 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_create_with_seed() {
|
||||
assert!(Pubkey::create_with_seed(&solana_sdk::pubkey::new_rand(), "☉", &solana_sdk::pubkey::new_rand()).is_ok());
|
||||
assert!(Pubkey::create_with_seed(
|
||||
&solana_sdk::pubkey::new_rand(),
|
||||
"☉",
|
||||
&solana_sdk::pubkey::new_rand()
|
||||
)
|
||||
.is_ok());
|
||||
assert_eq!(
|
||||
Pubkey::create_with_seed(
|
||||
&solana_sdk::pubkey::new_rand(),
|
||||
|
@ -337,7 +342,12 @@ mod tests {
|
|||
)
|
||||
.is_ok());
|
||||
|
||||
assert!(Pubkey::create_with_seed(&solana_sdk::pubkey::new_rand(), "", &solana_sdk::pubkey::new_rand(),).is_ok());
|
||||
assert!(Pubkey::create_with_seed(
|
||||
&solana_sdk::pubkey::new_rand(),
|
||||
"",
|
||||
&solana_sdk::pubkey::new_rand(),
|
||||
)
|
||||
.is_ok());
|
||||
|
||||
assert_eq!(
|
||||
Pubkey::create_with_seed(
|
||||
|
|
|
@ -635,7 +635,7 @@ mod tests {
|
|||
use super::*;
|
||||
use crate::StoredConfirmedBlock;
|
||||
use prost::Message;
|
||||
use solana_sdk::{hash::Hash, pubkey::Pubkey, signature::Keypair, system_transaction};
|
||||
use solana_sdk::{hash::Hash, signature::Keypair, system_transaction};
|
||||
use solana_storage_proto::convert::generated;
|
||||
use solana_transaction_status::{
|
||||
ConfirmedBlock, TransactionStatusMeta, TransactionWithStatusMeta,
|
||||
|
|
|
@ -23,7 +23,7 @@ pub fn parse_accounts(message: &Message) -> Vec<ParsedAccount> {
|
|||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use solana_sdk::{message::MessageHeader, pubkey::Pubkey};
|
||||
use solana_sdk::message::MessageHeader;
|
||||
|
||||
#[test]
|
||||
fn test_parse_accounts() {
|
||||
|
|
|
@ -37,15 +37,15 @@ pub fn parse_bpf_loader(
|
|||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use solana_sdk::{message::Message, pubkey::Pubkey};
|
||||
use solana_sdk::{message::Message, pubkey};
|
||||
|
||||
#[test]
|
||||
fn test_parse_bpf_loader_instructions() {
|
||||
let account_pubkey = solana_sdk::pubkey::new_rand();
|
||||
let program_id = solana_sdk::pubkey::new_rand();
|
||||
let account_pubkey = pubkey::new_rand();
|
||||
let program_id = pubkey::new_rand();
|
||||
let offset = 4242;
|
||||
let bytes = vec![8; 99];
|
||||
let fee_payer = solana_sdk::pubkey::new_rand();
|
||||
let fee_payer = pubkey::new_rand();
|
||||
let account_keys = vec![fee_payer, account_pubkey];
|
||||
let missing_account_keys = vec![account_pubkey];
|
||||
|
||||
|
|
Loading…
Reference in New Issue