asserts that cluster-info keypair is consistent with contact-info id (#29818)
This commit is contained in:
parent
cac52b0819
commit
1c7662a37f
|
@ -410,11 +410,11 @@ fn main() {
|
|||
let (non_vote_sender, non_vote_receiver) = unbounded();
|
||||
let (tpu_vote_sender, tpu_vote_receiver) = unbounded();
|
||||
let (gossip_vote_sender, gossip_vote_receiver) = unbounded();
|
||||
let cluster_info = ClusterInfo::new(
|
||||
Node::new_localhost().info,
|
||||
Arc::new(Keypair::new()),
|
||||
SocketAddrSpace::Unspecified,
|
||||
);
|
||||
let cluster_info = {
|
||||
let keypair = Arc::new(Keypair::new());
|
||||
let node = Node::new_localhost_with_pubkey(&keypair.pubkey());
|
||||
ClusterInfo::new(node.info, keypair, SocketAddrSpace::Unspecified)
|
||||
};
|
||||
let cluster_info = Arc::new(cluster_info);
|
||||
let tpu_use_quic = matches.is_present("tpu_use_quic");
|
||||
let connection_cache = match tpu_use_quic {
|
||||
|
|
|
@ -270,11 +270,11 @@ fn bench_banking(bencher: &mut Bencher, tx_type: TransactionType) {
|
|||
);
|
||||
let (exit, poh_recorder, poh_service, signal_receiver) =
|
||||
create_test_recorder(&bank, &blockstore, None, None);
|
||||
let cluster_info = ClusterInfo::new(
|
||||
Node::new_localhost().info,
|
||||
Arc::new(Keypair::new()),
|
||||
SocketAddrSpace::Unspecified,
|
||||
);
|
||||
let cluster_info = {
|
||||
let keypair = Arc::new(Keypair::new());
|
||||
let node = Node::new_localhost_with_pubkey(&keypair.pubkey());
|
||||
ClusterInfo::new(node.info, keypair, SocketAddrSpace::Unspecified)
|
||||
};
|
||||
let cluster_info = Arc::new(cluster_info);
|
||||
let (s, _r) = unbounded();
|
||||
let _banking_stage = BankingStage::new(
|
||||
|
|
|
@ -21,7 +21,7 @@ use {
|
|||
solana_runtime::{bank::Bank, bank_forks::BankForks},
|
||||
solana_sdk::{
|
||||
pubkey,
|
||||
signature::Keypair,
|
||||
signature::{Keypair, Signer},
|
||||
timing::{timestamp, AtomicInterval},
|
||||
},
|
||||
solana_streamer::socket::SocketAddrSpace,
|
||||
|
@ -37,11 +37,11 @@ use {
|
|||
#[bench]
|
||||
fn broadcast_shreds_bench(bencher: &mut Bencher) {
|
||||
solana_logger::setup();
|
||||
let leader_pubkey = pubkey::new_rand();
|
||||
let leader_info = Node::new_localhost_with_pubkey(&leader_pubkey);
|
||||
let leader_keypair = Arc::new(Keypair::new());
|
||||
let leader_info = Node::new_localhost_with_pubkey(&leader_keypair.pubkey());
|
||||
let cluster_info = ClusterInfo::new(
|
||||
leader_info.info,
|
||||
Arc::new(Keypair::new()),
|
||||
leader_keypair,
|
||||
SocketAddrSpace::Unspecified,
|
||||
);
|
||||
let socket = UdpSocket::bind("0.0.0.0:0").unwrap();
|
||||
|
|
|
@ -50,11 +50,11 @@ use {
|
|||
#[bench]
|
||||
fn bench_retransmitter(bencher: &mut Bencher) {
|
||||
solana_logger::setup();
|
||||
let cluster_info = ClusterInfo::new(
|
||||
Node::new_localhost().info,
|
||||
Arc::new(Keypair::new()),
|
||||
SocketAddrSpace::Unspecified,
|
||||
);
|
||||
let cluster_info = {
|
||||
let keypair = Arc::new(Keypair::new());
|
||||
let node = Node::new_localhost_with_pubkey(&keypair.pubkey());
|
||||
ClusterInfo::new(node.info, keypair, SocketAddrSpace::Unspecified)
|
||||
};
|
||||
const NUM_PEERS: usize = 4;
|
||||
let peer_sockets: Vec<_> = repeat_with(|| {
|
||||
let id = Pubkey::new_unique();
|
||||
|
|
|
@ -471,25 +471,21 @@ mod tests {
|
|||
solana_sdk::{
|
||||
hash::hash,
|
||||
signature::{Keypair, Signer},
|
||||
timing::timestamp,
|
||||
},
|
||||
solana_streamer::socket::SocketAddrSpace,
|
||||
std::str::FromStr,
|
||||
};
|
||||
|
||||
fn new_test_cluster_info(contact_info: ContactInfo) -> ClusterInfo {
|
||||
ClusterInfo::new(
|
||||
contact_info,
|
||||
Arc::new(Keypair::new()),
|
||||
SocketAddrSpace::Unspecified,
|
||||
)
|
||||
fn new_test_cluster_info() -> ClusterInfo {
|
||||
let keypair = Arc::new(Keypair::new());
|
||||
let contact_info = ContactInfo::new_localhost(&keypair.pubkey(), timestamp());
|
||||
ClusterInfo::new(contact_info, keypair, SocketAddrSpace::Unspecified)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_should_halt() {
|
||||
let keypair = Keypair::new();
|
||||
|
||||
let contact_info = ContactInfo::new_localhost(&keypair.pubkey(), 0);
|
||||
let cluster_info = new_test_cluster_info(contact_info);
|
||||
let cluster_info = new_test_cluster_info();
|
||||
let cluster_info = Arc::new(cluster_info);
|
||||
|
||||
let mut known_validators = HashSet::new();
|
||||
|
@ -520,10 +516,7 @@ mod tests {
|
|||
#[test]
|
||||
fn test_max_hashes() {
|
||||
solana_logger::setup();
|
||||
let keypair = Keypair::new();
|
||||
|
||||
let contact_info = ContactInfo::new_localhost(&keypair.pubkey(), 0);
|
||||
let cluster_info = new_test_cluster_info(contact_info);
|
||||
let cluster_info = new_test_cluster_info();
|
||||
let cluster_info = Arc::new(cluster_info);
|
||||
|
||||
let known_validators = HashSet::new();
|
||||
|
@ -562,7 +555,7 @@ mod tests {
|
|||
}
|
||||
cluster_info.flush_push_queue();
|
||||
let cluster_hashes = cluster_info
|
||||
.get_accounts_hash_for_node(&keypair.pubkey(), |c| c.clone())
|
||||
.get_accounts_hash_for_node(&cluster_info.id(), |c| c.clone())
|
||||
.unwrap();
|
||||
info!("{:?}", cluster_hashes);
|
||||
assert_eq!(hashes.len(), MAX_SNAPSHOT_HASHES);
|
||||
|
|
|
@ -1752,12 +1752,12 @@ mod tests {
|
|||
crossbeam_channel::{unbounded, Receiver},
|
||||
solana_address_lookup_table_program::state::{AddressLookupTable, LookupTableMeta},
|
||||
solana_entry::entry::{next_entry, next_versioned_entry, Entry, EntrySlice},
|
||||
solana_gossip::{
|
||||
cluster_info::Node, legacy_contact_info::LegacyContactInfo as ContactInfo,
|
||||
},
|
||||
solana_gossip::cluster_info::Node,
|
||||
solana_ledger::{
|
||||
blockstore::{entries_to_test_shreds, Blockstore},
|
||||
genesis_utils::{create_genesis_config, GenesisConfigInfo},
|
||||
genesis_utils::{
|
||||
create_genesis_config, create_genesis_config_with_leader, GenesisConfigInfo,
|
||||
},
|
||||
get_tmp_ledger_path_auto_delete,
|
||||
leader_schedule_cache::LeaderScheduleCache,
|
||||
},
|
||||
|
@ -1768,7 +1768,10 @@ mod tests {
|
|||
},
|
||||
solana_program_runtime::timings::ProgramTiming,
|
||||
solana_rpc::transaction_status_service::TransactionStatusService,
|
||||
solana_runtime::{bank_forks::BankForks, genesis_utils::activate_feature},
|
||||
solana_runtime::{
|
||||
bank_forks::BankForks,
|
||||
genesis_utils::{activate_feature, bootstrap_validator_stake_lamports},
|
||||
},
|
||||
solana_sdk::{
|
||||
account::AccountSharedData,
|
||||
hash::Hash,
|
||||
|
@ -1795,12 +1798,12 @@ mod tests {
|
|||
},
|
||||
};
|
||||
|
||||
fn new_test_cluster_info(contact_info: ContactInfo) -> ClusterInfo {
|
||||
ClusterInfo::new(
|
||||
contact_info,
|
||||
Arc::new(Keypair::new()),
|
||||
SocketAddrSpace::Unspecified,
|
||||
)
|
||||
fn new_test_cluster_info(keypair: Option<Arc<Keypair>>) -> (Node, ClusterInfo) {
|
||||
let keypair = keypair.unwrap_or_else(|| Arc::new(Keypair::new()));
|
||||
let node = Node::new_localhost_with_pubkey(&keypair.pubkey());
|
||||
let cluster_info =
|
||||
ClusterInfo::new(node.info.clone(), keypair, SocketAddrSpace::Unspecified);
|
||||
(node, cluster_info)
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1820,7 +1823,7 @@ mod tests {
|
|||
);
|
||||
let (exit, poh_recorder, poh_service, _entry_receiever) =
|
||||
create_test_recorder(&bank, &blockstore, None, None);
|
||||
let cluster_info = new_test_cluster_info(Node::new_localhost().info);
|
||||
let (_, cluster_info) = new_test_cluster_info(/*keypair:*/ None);
|
||||
let cluster_info = Arc::new(cluster_info);
|
||||
let (replay_vote_sender, _replay_vote_receiver) = unbounded();
|
||||
|
||||
|
@ -1873,7 +1876,7 @@ mod tests {
|
|||
};
|
||||
let (exit, poh_recorder, poh_service, entry_receiver) =
|
||||
create_test_recorder(&bank, &blockstore, Some(poh_config), None);
|
||||
let cluster_info = new_test_cluster_info(Node::new_localhost().info);
|
||||
let (_, cluster_info) = new_test_cluster_info(/*keypair:*/ None);
|
||||
let cluster_info = Arc::new(cluster_info);
|
||||
let (replay_vote_sender, _replay_vote_receiver) = unbounded();
|
||||
|
||||
|
@ -1951,7 +1954,7 @@ mod tests {
|
|||
};
|
||||
let (exit, poh_recorder, poh_service, entry_receiver) =
|
||||
create_test_recorder(&bank, &blockstore, Some(poh_config), None);
|
||||
let cluster_info = new_test_cluster_info(Node::new_localhost().info);
|
||||
let (_, cluster_info) = new_test_cluster_info(/*keypair:*/ None);
|
||||
let cluster_info = Arc::new(cluster_info);
|
||||
let (replay_vote_sender, _replay_vote_receiver) = unbounded();
|
||||
|
||||
|
@ -2107,7 +2110,7 @@ mod tests {
|
|||
};
|
||||
let (exit, poh_recorder, poh_service, entry_receiver) =
|
||||
create_test_recorder(&bank, &blockstore, Some(poh_config), None);
|
||||
let cluster_info = new_test_cluster_info(Node::new_localhost().info);
|
||||
let (_, cluster_info) = new_test_cluster_info(/*keypair:*/ None);
|
||||
let cluster_info = Arc::new(cluster_info);
|
||||
let _banking_stage = BankingStage::new_num_threads(
|
||||
&cluster_info,
|
||||
|
@ -2284,7 +2287,19 @@ mod tests {
|
|||
}
|
||||
|
||||
fn create_slow_genesis_config(lamports: u64) -> GenesisConfigInfo {
|
||||
let mut config_info = create_genesis_config(lamports);
|
||||
create_slow_genesis_config_with_leader(lamports, &solana_sdk::pubkey::new_rand())
|
||||
}
|
||||
|
||||
fn create_slow_genesis_config_with_leader(
|
||||
lamports: u64,
|
||||
validator_pubkey: &Pubkey,
|
||||
) -> GenesisConfigInfo {
|
||||
let mut config_info = create_genesis_config_with_leader(
|
||||
lamports,
|
||||
validator_pubkey,
|
||||
// See solana_ledger::genesis_utils::create_genesis_config.
|
||||
bootstrap_validator_stake_lamports(),
|
||||
);
|
||||
// For these tests there's only 1 slot, don't want to run out of ticks
|
||||
config_info.genesis_config.ticks_per_slot *= 8;
|
||||
config_info
|
||||
|
@ -3539,12 +3554,10 @@ mod tests {
|
|||
let packet = Packet::from_data(None, tx).unwrap();
|
||||
let deserialized_packet = DeserializedPacket::new(packet).unwrap();
|
||||
|
||||
let genesis_config_info = create_slow_genesis_config(10_000);
|
||||
let GenesisConfigInfo {
|
||||
genesis_config,
|
||||
validator_pubkey,
|
||||
..
|
||||
} = &genesis_config_info;
|
||||
let validator_keypair = Arc::new(Keypair::new());
|
||||
let genesis_config_info =
|
||||
create_slow_genesis_config_with_leader(10_000, &validator_keypair.pubkey());
|
||||
let GenesisConfigInfo { genesis_config, .. } = &genesis_config_info;
|
||||
|
||||
let bank = Bank::new_no_wallclock_throttle_for_tests(genesis_config);
|
||||
let bank_forks = Arc::new(RwLock::new(BankForks::new(bank)));
|
||||
|
@ -3565,8 +3578,7 @@ mod tests {
|
|||
let (exit, poh_recorder, poh_service, _entry_receiver) =
|
||||
create_test_recorder(&bank, &blockstore, Some(poh_config), None);
|
||||
|
||||
let local_node = Node::new_localhost_with_pubkey(validator_pubkey);
|
||||
let cluster_info = new_test_cluster_info(local_node.info);
|
||||
let (local_node, cluster_info) = new_test_cluster_info(Some(validator_keypair));
|
||||
let recv_socket = &local_node.sockets.tpu_forwards[0];
|
||||
|
||||
let test_cases = vec![
|
||||
|
@ -3647,12 +3659,10 @@ mod tests {
|
|||
ThreadType::Transactions,
|
||||
);
|
||||
|
||||
let genesis_config_info = create_slow_genesis_config(10_000);
|
||||
let GenesisConfigInfo {
|
||||
genesis_config,
|
||||
validator_pubkey,
|
||||
..
|
||||
} = &genesis_config_info;
|
||||
let validator_keypair = Arc::new(Keypair::new());
|
||||
let genesis_config_info =
|
||||
create_slow_genesis_config_with_leader(10_000, &validator_keypair.pubkey());
|
||||
let GenesisConfigInfo { genesis_config, .. } = &genesis_config_info;
|
||||
let bank = Bank::new_no_wallclock_throttle_for_tests(genesis_config);
|
||||
let bank_forks = Arc::new(RwLock::new(BankForks::new(bank)));
|
||||
let bank = Arc::new(bank_forks.read().unwrap().get(0).unwrap());
|
||||
|
@ -3672,8 +3682,7 @@ mod tests {
|
|||
let (exit, poh_recorder, poh_service, _entry_receiver) =
|
||||
create_test_recorder(&bank, &blockstore, Some(poh_config), None);
|
||||
|
||||
let local_node = Node::new_localhost_with_pubkey(validator_pubkey);
|
||||
let cluster_info = new_test_cluster_info(local_node.info);
|
||||
let (local_node, cluster_info) = new_test_cluster_info(Some(validator_keypair));
|
||||
let recv_socket = &local_node.sockets.tpu_forwards[0];
|
||||
let connection_cache = ConnectionCache::default();
|
||||
|
||||
|
@ -3788,7 +3797,7 @@ mod tests {
|
|||
};
|
||||
let (exit, poh_recorder, poh_service, _entry_receiver) =
|
||||
create_test_recorder(&bank, &blockstore, Some(poh_config), None);
|
||||
let cluster_info = new_test_cluster_info(Node::new_localhost().info);
|
||||
let (_, cluster_info) = new_test_cluster_info(/*keypair:*/ None);
|
||||
let cluster_info = Arc::new(cluster_info);
|
||||
let (replay_vote_sender, _replay_vote_receiver) = unbounded();
|
||||
|
||||
|
|
|
@ -449,7 +449,6 @@ pub mod test {
|
|||
solana_runtime::bank::Bank,
|
||||
solana_sdk::{
|
||||
hash::Hash,
|
||||
pubkey::Pubkey,
|
||||
signature::{Keypair, Signer},
|
||||
},
|
||||
std::{
|
||||
|
@ -577,7 +576,7 @@ pub mod test {
|
|||
}
|
||||
|
||||
fn setup_dummy_broadcast_service(
|
||||
leader_pubkey: &Pubkey,
|
||||
leader_keypair: Arc<Keypair>,
|
||||
ledger_path: &Path,
|
||||
entry_receiver: Receiver<WorkingBankEntry>,
|
||||
retransmit_slots_receiver: RetransmitSlotsReceiver,
|
||||
|
@ -586,7 +585,7 @@ pub mod test {
|
|||
let blockstore = Arc::new(Blockstore::open(ledger_path).unwrap());
|
||||
|
||||
// Make the leader node and scheduler
|
||||
let leader_info = Node::new_localhost_with_pubkey(leader_pubkey);
|
||||
let leader_info = Node::new_localhost_with_pubkey(&leader_keypair.pubkey());
|
||||
|
||||
// Make a node to broadcast to
|
||||
let buddy_keypair = Keypair::new();
|
||||
|
@ -595,7 +594,7 @@ pub mod test {
|
|||
// Fill the cluster_info with the buddy's info
|
||||
let cluster_info = ClusterInfo::new(
|
||||
leader_info.info.clone(),
|
||||
Arc::new(Keypair::new()),
|
||||
leader_keypair,
|
||||
SocketAddrSpace::Unspecified,
|
||||
);
|
||||
cluster_info.insert_info(broadcast_buddy.info);
|
||||
|
@ -634,12 +633,12 @@ pub mod test {
|
|||
|
||||
{
|
||||
// Create the leader scheduler
|
||||
let leader_keypair = Keypair::new();
|
||||
let leader_keypair = Arc::new(Keypair::new());
|
||||
|
||||
let (entry_sender, entry_receiver) = unbounded();
|
||||
let (retransmit_slots_sender, retransmit_slots_receiver) = unbounded();
|
||||
let broadcast_service = setup_dummy_broadcast_service(
|
||||
&leader_keypair.pubkey(),
|
||||
leader_keypair,
|
||||
&ledger_path,
|
||||
entry_receiver,
|
||||
retransmit_slots_receiver,
|
||||
|
|
|
@ -160,17 +160,18 @@ mod tests {
|
|||
use {
|
||||
super::*,
|
||||
solana_gossip::legacy_contact_info::LegacyContactInfo as ContactInfo,
|
||||
solana_sdk::signature::Signer,
|
||||
solana_streamer::socket::SocketAddrSpace,
|
||||
std::net::{IpAddr, Ipv4Addr, SocketAddr},
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn test_tvu_peers_ordering() {
|
||||
let cluster = ClusterInfo::new(
|
||||
ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), 0),
|
||||
Arc::new(Keypair::new()),
|
||||
SocketAddrSpace::Unspecified,
|
||||
);
|
||||
let cluster = {
|
||||
let keypair = Arc::new(Keypair::new());
|
||||
let contact_info = ContactInfo::new_localhost(&keypair.pubkey(), 0);
|
||||
ClusterInfo::new(contact_info, keypair, SocketAddrSpace::Unspecified)
|
||||
};
|
||||
cluster.insert_info(ContactInfo::new_with_socketaddr(&SocketAddr::new(
|
||||
IpAddr::V4(Ipv4Addr::new(192, 168, 1, 1)),
|
||||
8080,
|
||||
|
|
|
@ -518,7 +518,7 @@ mod test {
|
|||
let leader_info = Node::new_localhost_with_pubkey(&leader_pubkey);
|
||||
let cluster_info = Arc::new(ClusterInfo::new(
|
||||
leader_info.info,
|
||||
Arc::new(Keypair::new()),
|
||||
leader_keypair.clone(),
|
||||
SocketAddrSpace::Unspecified,
|
||||
));
|
||||
let socket = UdpSocket::bind("0.0.0.0:0").unwrap();
|
||||
|
|
|
@ -18,7 +18,7 @@ use {
|
|||
clock::{Epoch, Slot},
|
||||
feature_set,
|
||||
pubkey::Pubkey,
|
||||
signature::Keypair,
|
||||
signature::{Keypair, Signer},
|
||||
timing::timestamp,
|
||||
},
|
||||
solana_streamer::socket::SocketAddrSpace,
|
||||
|
@ -463,6 +463,8 @@ pub fn make_test_cluster<R: Rng>(
|
|||
.take(num_nodes)
|
||||
.collect();
|
||||
nodes.shuffle(rng);
|
||||
let keypair = Arc::new(Keypair::new());
|
||||
nodes[0].id = keypair.pubkey();
|
||||
let this_node = nodes[0].clone();
|
||||
let mut stakes: HashMap<Pubkey, u64> = nodes
|
||||
.iter()
|
||||
|
@ -476,11 +478,7 @@ pub fn make_test_cluster<R: Rng>(
|
|||
.collect();
|
||||
// Add some staked nodes with no contact-info.
|
||||
stakes.extend(repeat_with(|| (Pubkey::new_unique(), rng.gen_range(0, 20))).take(100));
|
||||
let cluster_info = ClusterInfo::new(
|
||||
this_node,
|
||||
Arc::new(Keypair::new()),
|
||||
SocketAddrSpace::Unspecified,
|
||||
);
|
||||
let cluster_info = ClusterInfo::new(this_node, keypair, SocketAddrSpace::Unspecified);
|
||||
{
|
||||
let now = timestamp();
|
||||
let mut gossip_crds = cluster_info.gossip.crds.write().unwrap();
|
||||
|
|
|
@ -182,19 +182,16 @@ mod test {
|
|||
use {
|
||||
super::*,
|
||||
solana_gossip::{cluster_info::Node, crds_value::LowestSlot},
|
||||
solana_sdk::{pubkey::Pubkey, signature::Keypair},
|
||||
solana_sdk::signature::{Keypair, Signer},
|
||||
solana_streamer::socket::SocketAddrSpace,
|
||||
};
|
||||
|
||||
#[test]
|
||||
pub fn test_update_lowest_slot() {
|
||||
let pubkey = Pubkey::new_unique();
|
||||
let keypair = Arc::new(Keypair::new());
|
||||
let pubkey = keypair.pubkey();
|
||||
let node_info = Node::new_localhost_with_pubkey(&pubkey);
|
||||
let cluster_info = ClusterInfo::new(
|
||||
node_info.info,
|
||||
Arc::new(Keypair::new()),
|
||||
SocketAddrSpace::Unspecified,
|
||||
);
|
||||
let cluster_info = ClusterInfo::new(node_info.info, keypair, SocketAddrSpace::Unspecified);
|
||||
ClusterSlotsService::update_lowest_slot(5, &cluster_info);
|
||||
cluster_info.flush_push_queue();
|
||||
let lowest = {
|
||||
|
|
|
@ -772,17 +772,18 @@ mod test {
|
|||
shred::max_ticks_per_n_shreds,
|
||||
},
|
||||
solana_runtime::bank::Bank,
|
||||
solana_sdk::signature::Keypair,
|
||||
solana_sdk::{
|
||||
signature::{Keypair, Signer},
|
||||
timing::timestamp,
|
||||
},
|
||||
solana_streamer::socket::SocketAddrSpace,
|
||||
std::collections::HashSet,
|
||||
};
|
||||
|
||||
fn new_test_cluster_info(contact_info: ContactInfo) -> ClusterInfo {
|
||||
ClusterInfo::new(
|
||||
contact_info,
|
||||
Arc::new(Keypair::new()),
|
||||
SocketAddrSpace::Unspecified,
|
||||
)
|
||||
fn new_test_cluster_info() -> ClusterInfo {
|
||||
let keypair = Arc::new(Keypair::new());
|
||||
let contact_info = ContactInfo::new_localhost(&keypair.pubkey(), timestamp());
|
||||
ClusterInfo::new(contact_info, keypair, SocketAddrSpace::Unspecified)
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1116,7 +1117,7 @@ mod test {
|
|||
let blockstore_path = get_tmp_ledger_path!();
|
||||
let blockstore = Blockstore::open(&blockstore_path).unwrap();
|
||||
let cluster_slots = ClusterSlots::default();
|
||||
let cluster_info = Arc::new(new_test_cluster_info(Node::new_localhost().info));
|
||||
let cluster_info = Arc::new(new_test_cluster_info());
|
||||
let identity_keypair = cluster_info.keypair().clone();
|
||||
let serve_repair = ServeRepair::new(
|
||||
cluster_info,
|
||||
|
@ -1216,7 +1217,7 @@ mod test {
|
|||
Pubkey::default(),
|
||||
UdpSocket::bind("0.0.0.0:0").unwrap().local_addr().unwrap(),
|
||||
));
|
||||
let cluster_info = Arc::new(new_test_cluster_info(Node::new_localhost().info));
|
||||
let cluster_info = Arc::new(new_test_cluster_info());
|
||||
let serve_repair = ServeRepair::new(
|
||||
cluster_info.clone(),
|
||||
bank_forks,
|
||||
|
|
|
@ -1301,8 +1301,7 @@ mod tests {
|
|||
let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(10_000);
|
||||
let bank = Bank::new_for_tests(&genesis_config);
|
||||
let bank_forks = Arc::new(RwLock::new(BankForks::new(bank)));
|
||||
let me = ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), timestamp());
|
||||
let cluster_info = Arc::new(new_test_cluster_info(me));
|
||||
let cluster_info = Arc::new(new_test_cluster_info());
|
||||
let serve_repair = ServeRepair::new(
|
||||
cluster_info.clone(),
|
||||
bank_forks,
|
||||
|
@ -1344,8 +1343,7 @@ mod tests {
|
|||
fn test_serialize_deserialize_ancestor_hashes_request() {
|
||||
let slot: Slot = 50;
|
||||
let nonce = 70;
|
||||
let me = ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), timestamp());
|
||||
let cluster_info = Arc::new(new_test_cluster_info(me));
|
||||
let cluster_info = Arc::new(new_test_cluster_info());
|
||||
let repair_peer_id = solana_sdk::pubkey::new_rand();
|
||||
let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(10_000);
|
||||
let keypair = cluster_info.keypair().clone();
|
||||
|
@ -1389,8 +1387,7 @@ mod tests {
|
|||
let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(10_000);
|
||||
let bank = Bank::new_for_tests(&genesis_config);
|
||||
let bank_forks = Arc::new(RwLock::new(BankForks::new(bank)));
|
||||
let me = ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), timestamp());
|
||||
let cluster_info = Arc::new(new_test_cluster_info(me));
|
||||
let cluster_info = Arc::new(new_test_cluster_info());
|
||||
let serve_repair = ServeRepair::new(
|
||||
cluster_info.clone(),
|
||||
bank_forks,
|
||||
|
@ -1706,12 +1703,10 @@ mod tests {
|
|||
Blockstore::destroy(&ledger_path).expect("Expected successful database destruction");
|
||||
}
|
||||
|
||||
fn new_test_cluster_info(contact_info: ContactInfo) -> ClusterInfo {
|
||||
ClusterInfo::new(
|
||||
contact_info,
|
||||
Arc::new(Keypair::new()),
|
||||
SocketAddrSpace::Unspecified,
|
||||
)
|
||||
fn new_test_cluster_info() -> ClusterInfo {
|
||||
let keypair = Arc::new(Keypair::new());
|
||||
let contact_info = ContactInfo::new_localhost(&keypair.pubkey(), timestamp());
|
||||
ClusterInfo::new(contact_info, keypair, SocketAddrSpace::Unspecified)
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1720,8 +1715,7 @@ mod tests {
|
|||
let bank = Bank::new_for_tests(&genesis_config);
|
||||
let bank_forks = Arc::new(RwLock::new(BankForks::new(bank)));
|
||||
let cluster_slots = ClusterSlots::default();
|
||||
let me = ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), timestamp());
|
||||
let cluster_info = Arc::new(new_test_cluster_info(me));
|
||||
let cluster_info = Arc::new(new_test_cluster_info());
|
||||
let serve_repair = ServeRepair::new(
|
||||
cluster_info.clone(),
|
||||
bank_forks,
|
||||
|
@ -2046,8 +2040,8 @@ mod tests {
|
|||
let bank = Bank::new_for_tests(&genesis_config);
|
||||
let bank_forks = Arc::new(RwLock::new(BankForks::new(bank)));
|
||||
let cluster_slots = ClusterSlots::default();
|
||||
let me = ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), timestamp());
|
||||
let cluster_info = Arc::new(new_test_cluster_info(me.clone()));
|
||||
let cluster_info = Arc::new(new_test_cluster_info());
|
||||
let me = cluster_info.my_contact_info();
|
||||
|
||||
// Insert two peers on the network
|
||||
let contact_info2 =
|
||||
|
|
|
@ -6,7 +6,7 @@ use {
|
|||
},
|
||||
solana_perf::{self, packet::PacketBatch, recycler_cache::RecyclerCache},
|
||||
solana_runtime::{bank::Bank, bank_forks::BankForks},
|
||||
solana_sdk::{clock::Slot, pubkey::Pubkey, signature::Signer},
|
||||
solana_sdk::{clock::Slot, pubkey::Pubkey},
|
||||
std::{
|
||||
collections::HashMap,
|
||||
sync::{
|
||||
|
@ -39,11 +39,10 @@ pub(crate) fn spawn_shred_sigverify(
|
|||
Builder::new()
|
||||
.name("solShredVerifr".to_string())
|
||||
.spawn(move || loop {
|
||||
// We can't store the pubkey outside the loop
|
||||
// because the identity might be hot swapped.
|
||||
let self_pubkey = cluster_info.keypair().pubkey();
|
||||
match run_shred_sigverify(
|
||||
&self_pubkey,
|
||||
// We can't store the pubkey outside the loop
|
||||
// because the identity might be hot swapped.
|
||||
&cluster_info.id(),
|
||||
&bank_forks,
|
||||
&leader_schedule_cache,
|
||||
&recycler_cache,
|
||||
|
|
|
@ -506,11 +506,14 @@ fn test_concurrent_snapshot_packaging(
|
|||
// channel hold hard links to these deleted snapshots. We verify this is the case below.
|
||||
let exit = Arc::new(AtomicBool::new(false));
|
||||
|
||||
let cluster_info = Arc::new(ClusterInfo::new(
|
||||
ContactInfo::default(),
|
||||
Arc::new(Keypair::new()),
|
||||
SocketAddrSpace::Unspecified,
|
||||
));
|
||||
let cluster_info = Arc::new({
|
||||
let keypair = Arc::new(Keypair::new());
|
||||
let contact_info = ContactInfo {
|
||||
id: keypair.pubkey(),
|
||||
..ContactInfo::default()
|
||||
};
|
||||
ClusterInfo::new(contact_info, keypair, SocketAddrSpace::Unspecified)
|
||||
});
|
||||
|
||||
let pending_snapshot_package = PendingSnapshotPackage::default();
|
||||
let snapshot_packager_service = SnapshotPackagerService::new(
|
||||
|
|
|
@ -406,6 +406,7 @@ impl ClusterInfo {
|
|||
keypair: Arc<Keypair>,
|
||||
socket_addr_space: SocketAddrSpace,
|
||||
) -> Self {
|
||||
assert_eq!(contact_info.id, keypair.pubkey());
|
||||
let id = contact_info.id;
|
||||
let me = Self {
|
||||
gossip: CrdsGossip::default(),
|
||||
|
@ -622,7 +623,7 @@ impl ClusterInfo {
|
|||
}
|
||||
|
||||
pub fn id(&self) -> Pubkey {
|
||||
self.my_contact_info.read().unwrap().id
|
||||
self.keypair.read().unwrap().pubkey()
|
||||
}
|
||||
|
||||
pub fn keypair(&self) -> RwLockReadGuard<Arc<Keypair>> {
|
||||
|
@ -3230,13 +3231,11 @@ RPC Enabled Nodes: 1"#;
|
|||
#[test]
|
||||
fn test_handle_pull() {
|
||||
solana_logger::setup();
|
||||
let node = Node::new_localhost();
|
||||
let cluster_info = Arc::new(ClusterInfo::new(
|
||||
node.info,
|
||||
Arc::new(Keypair::new()),
|
||||
SocketAddrSpace::Unspecified,
|
||||
));
|
||||
|
||||
let cluster_info = Arc::new({
|
||||
let keypair = Arc::new(Keypair::new());
|
||||
let node = Node::new_localhost_with_pubkey(&keypair.pubkey());
|
||||
ClusterInfo::new(node.info, keypair, SocketAddrSpace::Unspecified)
|
||||
});
|
||||
let entrypoint_pubkey = solana_sdk::pubkey::new_rand();
|
||||
let data = test_crds_values(entrypoint_pubkey);
|
||||
let timeouts = HashMap::new();
|
||||
|
@ -3542,13 +3541,12 @@ RPC Enabled Nodes: 1"#;
|
|||
fn test_cluster_spy_gossip() {
|
||||
let thread_pool = ThreadPoolBuilder::new().build().unwrap();
|
||||
//check that gossip doesn't try to push to invalid addresses
|
||||
let node = Node::new_localhost();
|
||||
let (spy, _, _) = ClusterInfo::spy_node(solana_sdk::pubkey::new_rand(), 0);
|
||||
let cluster_info = Arc::new(ClusterInfo::new(
|
||||
node.info,
|
||||
Arc::new(Keypair::new()),
|
||||
SocketAddrSpace::Unspecified,
|
||||
));
|
||||
let cluster_info = Arc::new({
|
||||
let keypair = Arc::new(Keypair::new());
|
||||
let node = Node::new_localhost_with_pubkey(&keypair.pubkey());
|
||||
ClusterInfo::new(node.info, keypair, SocketAddrSpace::Unspecified)
|
||||
});
|
||||
cluster_info.insert_info(spy);
|
||||
cluster_info.gossip.refresh_push_active_set(
|
||||
&cluster_info.keypair(),
|
||||
|
@ -3575,20 +3573,17 @@ RPC Enabled Nodes: 1"#;
|
|||
|
||||
#[test]
|
||||
fn test_cluster_info_new() {
|
||||
let d = ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), timestamp());
|
||||
let cluster_info = ClusterInfo::new(
|
||||
d.clone(),
|
||||
Arc::new(Keypair::new()),
|
||||
SocketAddrSpace::Unspecified,
|
||||
);
|
||||
let keypair = Arc::new(Keypair::new());
|
||||
let d = ContactInfo::new_localhost(&keypair.pubkey(), timestamp());
|
||||
let cluster_info = ClusterInfo::new(d.clone(), keypair, SocketAddrSpace::Unspecified);
|
||||
assert_eq!(d.id, cluster_info.id());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn insert_info_test() {
|
||||
let d = ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), timestamp());
|
||||
let cluster_info =
|
||||
ClusterInfo::new(d, Arc::new(Keypair::new()), SocketAddrSpace::Unspecified);
|
||||
let keypair = Arc::new(Keypair::new());
|
||||
let d = ContactInfo::new_localhost(&keypair.pubkey(), timestamp());
|
||||
let cluster_info = ClusterInfo::new(d, keypair, SocketAddrSpace::Unspecified);
|
||||
let d = ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), timestamp());
|
||||
let label = CrdsValueLabel::LegacyContactInfo(d.id);
|
||||
cluster_info.insert_info(d);
|
||||
|
@ -3727,13 +3722,9 @@ RPC Enabled Nodes: 1"#;
|
|||
|
||||
#[test]
|
||||
fn test_refresh_vote() {
|
||||
let keys = Keypair::new();
|
||||
let contact_info = ContactInfo::new_localhost(&keys.pubkey(), 0);
|
||||
let cluster_info = ClusterInfo::new(
|
||||
contact_info,
|
||||
Arc::new(Keypair::new()),
|
||||
SocketAddrSpace::Unspecified,
|
||||
);
|
||||
let keypair = Arc::new(Keypair::new());
|
||||
let contact_info = ContactInfo::new_localhost(&keypair.pubkey(), 0);
|
||||
let cluster_info = ClusterInfo::new(contact_info, keypair, SocketAddrSpace::Unspecified);
|
||||
|
||||
// Construct and push a vote for some other slot
|
||||
let unrefresh_slot = 5;
|
||||
|
@ -3820,13 +3811,10 @@ RPC Enabled Nodes: 1"#;
|
|||
#[test]
|
||||
fn test_push_vote() {
|
||||
let mut rng = rand::thread_rng();
|
||||
let keys = Keypair::new();
|
||||
let contact_info = ContactInfo::new_localhost(&keys.pubkey(), 0);
|
||||
let cluster_info = ClusterInfo::new(
|
||||
contact_info,
|
||||
Arc::new(Keypair::new()),
|
||||
SocketAddrSpace::Unspecified,
|
||||
);
|
||||
let keypair = Arc::new(Keypair::new());
|
||||
let contact_info = ContactInfo::new_localhost(&keypair.pubkey(), 0);
|
||||
let cluster_info =
|
||||
ClusterInfo::new(contact_info, keypair.clone(), SocketAddrSpace::Unspecified);
|
||||
|
||||
// make sure empty crds is handled correctly
|
||||
let mut cursor = Cursor::default();
|
||||
|
@ -3855,7 +3843,7 @@ RPC Enabled Nodes: 1"#;
|
|||
assert_eq!(labels.len(), 1);
|
||||
match labels[0] {
|
||||
CrdsValueLabel::Vote(_, pubkey) => {
|
||||
assert_eq!(pubkey, keys.pubkey());
|
||||
assert_eq!(pubkey, keypair.pubkey());
|
||||
}
|
||||
|
||||
_ => panic!("Bad match"),
|
||||
|
@ -3895,13 +3883,9 @@ RPC Enabled Nodes: 1"#;
|
|||
vote_slots.into_iter().collect()
|
||||
};
|
||||
let mut rng = rand::thread_rng();
|
||||
let keys = Keypair::new();
|
||||
let contact_info = ContactInfo::new_localhost(&keys.pubkey(), 0);
|
||||
let cluster_info = ClusterInfo::new(
|
||||
contact_info,
|
||||
Arc::new(Keypair::new()),
|
||||
SocketAddrSpace::Unspecified,
|
||||
);
|
||||
let keypair = Arc::new(Keypair::new());
|
||||
let contact_info = ContactInfo::new_localhost(&keypair.pubkey(), 0);
|
||||
let cluster_info = ClusterInfo::new(contact_info, keypair, SocketAddrSpace::Unspecified);
|
||||
let mut tower = Vec::new();
|
||||
for k in 0..MAX_LOCKOUT_HISTORY {
|
||||
let slot = k as Slot;
|
||||
|
@ -3948,13 +3932,9 @@ RPC Enabled Nodes: 1"#;
|
|||
|
||||
#[test]
|
||||
fn test_push_epoch_slots() {
|
||||
let keys = Keypair::new();
|
||||
let contact_info = ContactInfo::new_localhost(&keys.pubkey(), 0);
|
||||
let cluster_info = ClusterInfo::new(
|
||||
contact_info,
|
||||
Arc::new(Keypair::new()),
|
||||
SocketAddrSpace::Unspecified,
|
||||
);
|
||||
let keypair = Arc::new(Keypair::new());
|
||||
let contact_info = ContactInfo::new_localhost(&keypair.pubkey(), 0);
|
||||
let cluster_info = ClusterInfo::new(contact_info, keypair, SocketAddrSpace::Unspecified);
|
||||
let slots = cluster_info.get_epoch_slots(&mut Cursor::default());
|
||||
assert!(slots.is_empty());
|
||||
cluster_info.push_epoch_slots(&[0]);
|
||||
|
@ -4160,12 +4140,9 @@ RPC Enabled Nodes: 1"#;
|
|||
|
||||
#[test]
|
||||
fn test_tvu_peers_and_stakes() {
|
||||
let d = ContactInfo::new_localhost(&Pubkey::from([0; 32]), timestamp());
|
||||
let cluster_info = ClusterInfo::new(
|
||||
d.clone(),
|
||||
Arc::new(Keypair::new()),
|
||||
SocketAddrSpace::Unspecified,
|
||||
);
|
||||
let keypair = Arc::new(Keypair::new());
|
||||
let d = ContactInfo::new_localhost(&keypair.pubkey(), timestamp());
|
||||
let cluster_info = ClusterInfo::new(d.clone(), keypair, SocketAddrSpace::Unspecified);
|
||||
let mut stakes = HashMap::new();
|
||||
|
||||
// no stake
|
||||
|
@ -4684,8 +4661,8 @@ RPC Enabled Nodes: 1"#;
|
|||
|
||||
#[test]
|
||||
fn test_get_duplicate_shreds() {
|
||||
let node = Node::new_localhost();
|
||||
let host1_key = Arc::new(Keypair::new());
|
||||
let node = Node::new_localhost_with_pubkey(&host1_key.pubkey());
|
||||
let cluster_info = Arc::new(ClusterInfo::new(
|
||||
node.info,
|
||||
host1_key.clone(),
|
||||
|
|
|
@ -73,7 +73,7 @@ mod tests {
|
|||
duplicate_shred_listener::DuplicateShredHandlerTrait,
|
||||
},
|
||||
solana_ledger::shred::Shredder,
|
||||
solana_sdk::signature::Keypair,
|
||||
solana_sdk::signature::{Keypair, Signer},
|
||||
solana_streamer::socket::SocketAddrSpace,
|
||||
std::sync::{
|
||||
atomic::{AtomicU32, Ordering},
|
||||
|
@ -99,8 +99,8 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_listener_get_entries() {
|
||||
let node = Node::new_localhost();
|
||||
let host1_key = Arc::new(Keypair::new());
|
||||
let node = Node::new_localhost_with_pubkey(&host1_key.pubkey());
|
||||
let cluster_info = Arc::new(ClusterInfo::new(
|
||||
node.info,
|
||||
host1_key,
|
||||
|
|
|
@ -346,11 +346,14 @@ impl JsonRpcRequestProcessor {
|
|||
)));
|
||||
let blockstore = Arc::new(Blockstore::open(&get_tmp_ledger_path!()).unwrap());
|
||||
let exit = Arc::new(AtomicBool::new(false));
|
||||
let cluster_info = Arc::new(ClusterInfo::new(
|
||||
ContactInfo::default(),
|
||||
Arc::new(Keypair::new()),
|
||||
socket_addr_space,
|
||||
));
|
||||
let cluster_info = Arc::new({
|
||||
let keypair = Arc::new(Keypair::new());
|
||||
let contact_info = ContactInfo {
|
||||
id: keypair.pubkey(),
|
||||
..ContactInfo::default()
|
||||
};
|
||||
ClusterInfo::new(contact_info, keypair, socket_addr_space)
|
||||
});
|
||||
let tpu_address = cluster_info.my_contact_info().tpu;
|
||||
let (sender, receiver) = unbounded();
|
||||
SendTransactionService::new::<NullTpuInfo>(
|
||||
|
@ -4688,6 +4691,15 @@ pub mod tests {
|
|||
const TEST_SIGNATURE_FEE: u64 = 5_000;
|
||||
const TEST_SLOTS_PER_EPOCH: u64 = DELINQUENT_VALIDATOR_SLOT_DISTANCE + 1;
|
||||
|
||||
pub(crate) fn new_test_cluster_info() -> ClusterInfo {
|
||||
let keypair = Arc::new(Keypair::new());
|
||||
let contact_info = ContactInfo {
|
||||
id: keypair.pubkey(),
|
||||
..ContactInfo::default()
|
||||
};
|
||||
ClusterInfo::new(contact_info, keypair, SocketAddrSpace::Unspecified)
|
||||
}
|
||||
|
||||
fn create_test_request(method: &str, params: Option<serde_json::Value>) -> serde_json::Value {
|
||||
json!({
|
||||
"jsonrpc": "2.0",
|
||||
|
@ -4754,19 +4766,12 @@ pub mod tests {
|
|||
let blockstore = Arc::new(Blockstore::open(&ledger_path).unwrap());
|
||||
let bank = bank_forks.read().unwrap().working_bank();
|
||||
|
||||
let identity = Pubkey::new_unique();
|
||||
let leader_pubkey = *bank.collector_id();
|
||||
let block_commitment_cache = Arc::new(RwLock::new(BlockCommitmentCache::default()));
|
||||
let exit = Arc::new(AtomicBool::new(false));
|
||||
let validator_exit = create_validator_exit(&exit);
|
||||
let cluster_info = Arc::new(ClusterInfo::new(
|
||||
ContactInfo {
|
||||
id: identity,
|
||||
..ContactInfo::default()
|
||||
},
|
||||
Arc::new(Keypair::new()),
|
||||
SocketAddrSpace::Unspecified,
|
||||
));
|
||||
let cluster_info = Arc::new(new_test_cluster_info());
|
||||
let identity = cluster_info.id();
|
||||
cluster_info.insert_info(ContactInfo::new_with_pubkey_socketaddr(
|
||||
&leader_pubkey,
|
||||
&socketaddr!("127.0.0.1:1234"),
|
||||
|
@ -6384,11 +6389,15 @@ pub mod tests {
|
|||
|
||||
let mut io = MetaIoHandler::default();
|
||||
io.extend_with(rpc_full::FullImpl.to_delegate());
|
||||
let cluster_info = Arc::new(ClusterInfo::new(
|
||||
ContactInfo::new_with_socketaddr(&socketaddr!("127.0.0.1:1234")),
|
||||
Arc::new(Keypair::new()),
|
||||
SocketAddrSpace::Unspecified,
|
||||
));
|
||||
let cluster_info = Arc::new({
|
||||
let keypair = Arc::new(Keypair::new());
|
||||
let contact_info = ContactInfo::new_with_socketaddr(&socketaddr!("127.0.0.1:1234"));
|
||||
let contact_info = ContactInfo {
|
||||
id: keypair.pubkey(),
|
||||
..contact_info
|
||||
};
|
||||
ClusterInfo::new(contact_info, keypair, SocketAddrSpace::Unspecified)
|
||||
});
|
||||
let tpu_address = cluster_info.my_contact_info().tpu;
|
||||
let (meta, receiver) = JsonRpcRequestProcessor::new(
|
||||
JsonRpcConfig::default(),
|
||||
|
@ -6661,11 +6670,7 @@ pub mod tests {
|
|||
CommitmentSlots::new_from_slot(bank_forks.read().unwrap().highest_slot()),
|
||||
)));
|
||||
|
||||
let cluster_info = Arc::new(ClusterInfo::new(
|
||||
ContactInfo::default(),
|
||||
Arc::new(Keypair::new()),
|
||||
SocketAddrSpace::Unspecified,
|
||||
));
|
||||
let cluster_info = Arc::new(new_test_cluster_info());
|
||||
let tpu_address = cluster_info.my_contact_info().tpu;
|
||||
let (request_processor, receiver) = JsonRpcRequestProcessor::new(
|
||||
JsonRpcConfig::default(),
|
||||
|
@ -8259,11 +8264,7 @@ pub mod tests {
|
|||
let ledger_path = get_tmp_ledger_path!();
|
||||
let blockstore = Arc::new(Blockstore::open(&ledger_path).unwrap());
|
||||
let block_commitment_cache = Arc::new(RwLock::new(BlockCommitmentCache::default()));
|
||||
let cluster_info = Arc::new(ClusterInfo::new(
|
||||
ContactInfo::default(),
|
||||
Arc::new(Keypair::new()),
|
||||
SocketAddrSpace::Unspecified,
|
||||
));
|
||||
let cluster_info = Arc::new(new_test_cluster_info());
|
||||
let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(100);
|
||||
let bank = Bank::new_for_tests(&genesis_config);
|
||||
|
||||
|
|
|
@ -128,16 +128,9 @@ impl RpcHealth {
|
|||
|
||||
#[cfg(test)]
|
||||
pub(crate) fn stub() -> Arc<Self> {
|
||||
use {
|
||||
solana_gossip::legacy_contact_info::LegacyContactInfo as ContactInfo,
|
||||
solana_sdk::signer::keypair::Keypair, solana_streamer::socket::SocketAddrSpace,
|
||||
};
|
||||
use crate::rpc::tests::new_test_cluster_info;
|
||||
Arc::new(Self::new(
|
||||
Arc::new(ClusterInfo::new(
|
||||
ContactInfo::default(),
|
||||
Arc::new(Keypair::new()),
|
||||
SocketAddrSpace::Unspecified,
|
||||
)),
|
||||
Arc::new(new_test_cluster_info()),
|
||||
None,
|
||||
42,
|
||||
Arc::new(AtomicBool::new(false)),
|
||||
|
|
|
@ -573,11 +573,10 @@ impl JsonRpcService {
|
|||
mod tests {
|
||||
use {
|
||||
super::*,
|
||||
crate::rpc::create_validator_exit,
|
||||
crate::rpc::{create_validator_exit, tests::new_test_cluster_info},
|
||||
solana_gossip::{
|
||||
crds::GossipRoute,
|
||||
crds_value::{CrdsData, CrdsValue, SnapshotHashes},
|
||||
legacy_contact_info::LegacyContactInfo as ContactInfo,
|
||||
},
|
||||
solana_ledger::{
|
||||
genesis_utils::{create_genesis_config, GenesisConfigInfo},
|
||||
|
@ -588,9 +587,7 @@ mod tests {
|
|||
solana_sdk::{
|
||||
genesis_config::{ClusterType, DEFAULT_GENESIS_ARCHIVE},
|
||||
signature::Signer,
|
||||
signer::keypair::Keypair,
|
||||
},
|
||||
solana_streamer::socket::SocketAddrSpace,
|
||||
std::{
|
||||
io::Write,
|
||||
net::{IpAddr, Ipv4Addr},
|
||||
|
@ -608,11 +605,7 @@ mod tests {
|
|||
let exit = Arc::new(AtomicBool::new(false));
|
||||
let validator_exit = create_validator_exit(&exit);
|
||||
let bank = Bank::new_for_tests(&genesis_config);
|
||||
let cluster_info = Arc::new(ClusterInfo::new(
|
||||
ContactInfo::default(),
|
||||
Arc::new(Keypair::new()),
|
||||
SocketAddrSpace::Unspecified,
|
||||
));
|
||||
let cluster_info = Arc::new(new_test_cluster_info());
|
||||
let ip_addr = IpAddr::V4(Ipv4Addr::UNSPECIFIED);
|
||||
let rpc_addr = SocketAddr::new(
|
||||
ip_addr,
|
||||
|
@ -833,11 +826,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_health_check_with_known_validators() {
|
||||
let cluster_info = Arc::new(ClusterInfo::new(
|
||||
ContactInfo::default(),
|
||||
Arc::new(Keypair::new()),
|
||||
SocketAddrSpace::Unspecified,
|
||||
));
|
||||
let cluster_info = Arc::new(new_test_cluster_info());
|
||||
let health_check_slot_distance = 123;
|
||||
let override_health_check = Arc::new(AtomicBool::new(false));
|
||||
let startup_verification_complete = Arc::new(AtomicBool::new(true));
|
||||
|
|
|
@ -644,13 +644,13 @@ mod tests {
|
|||
}
|
||||
|
||||
fn start_with_config(config: TestConfig) -> Self {
|
||||
let identity = Pubkey::new_unique();
|
||||
let keypair = Arc::new(Keypair::new());
|
||||
let cluster_info = Arc::new(ClusterInfo::new(
|
||||
ContactInfo {
|
||||
id: identity,
|
||||
id: keypair.pubkey(),
|
||||
..ContactInfo::default()
|
||||
},
|
||||
Arc::new(Keypair::new()),
|
||||
keypair,
|
||||
SocketAddrSpace::Unspecified,
|
||||
));
|
||||
let exit = Arc::new(AtomicBool::new(false));
|
||||
|
|
Loading…
Reference in New Issue