bench-tps no longer uses an invalid ContactInfo for RPC
This commit is contained in:
parent
6de24ff0be
commit
cd88f81817
|
@ -3,7 +3,6 @@ mod cli;
|
|||
|
||||
use crate::bench::*;
|
||||
use solana::client::mk_client;
|
||||
use solana::contact_info::ContactInfo;
|
||||
use solana::gen_keys::GenKeys;
|
||||
use solana::gossip_service::discover;
|
||||
use solana_metrics;
|
||||
|
@ -39,8 +38,7 @@ fn main() {
|
|||
converge_only,
|
||||
} = cfg;
|
||||
|
||||
let cluster_entrypoint = ContactInfo::new_entry_point(&network);
|
||||
let nodes = discover(&cluster_entrypoint, num_nodes).unwrap_or_else(|err| {
|
||||
let nodes = discover(&network, num_nodes).unwrap_or_else(|err| {
|
||||
eprintln!("Failed to discover {} nodes: {:?}", num_nodes, err);
|
||||
exit(1);
|
||||
});
|
||||
|
@ -62,6 +60,7 @@ fn main() {
|
|||
if converge_only {
|
||||
return;
|
||||
}
|
||||
let cluster_entrypoint = nodes[0].clone(); // Pick the first node, why not?
|
||||
|
||||
let mut client = mk_client(&cluster_entrypoint);
|
||||
let mut barrier_client = mk_client(&cluster_entrypoint);
|
||||
|
|
|
@ -22,7 +22,7 @@ pub fn spend_and_verify_all_nodes(
|
|||
funding_keypair: &Keypair,
|
||||
nodes: usize,
|
||||
) {
|
||||
let cluster_nodes = discover(&entry_point_info, nodes).unwrap();
|
||||
let cluster_nodes = discover(&entry_point_info.gossip, nodes).unwrap();
|
||||
assert!(cluster_nodes.len() >= nodes);
|
||||
for ingress_node in &cluster_nodes {
|
||||
let random_keypair = Keypair::new();
|
||||
|
@ -49,7 +49,7 @@ pub fn spend_and_verify_all_nodes(
|
|||
}
|
||||
|
||||
pub fn fullnode_exit(entry_point_info: &ContactInfo, nodes: usize) {
|
||||
let cluster_nodes = discover(&entry_point_info, nodes).unwrap();
|
||||
let cluster_nodes = discover(&entry_point_info.gossip, nodes).unwrap();
|
||||
assert!(cluster_nodes.len() >= nodes);
|
||||
for node in &cluster_nodes {
|
||||
let mut client = mk_client(&node);
|
||||
|
@ -101,7 +101,7 @@ pub fn kill_entry_and_spend_and_verify_rest(
|
|||
nodes: usize,
|
||||
) {
|
||||
solana_logger::setup();
|
||||
let cluster_nodes = discover(&entry_point_info, nodes).unwrap();
|
||||
let cluster_nodes = discover(&entry_point_info.gossip, nodes).unwrap();
|
||||
assert!(cluster_nodes.len() >= nodes);
|
||||
let mut client = mk_client(&entry_point_info);
|
||||
info!("sleeping for an epoch");
|
||||
|
|
|
@ -3,9 +3,11 @@
|
|||
use crate::bank_forks::BankForks;
|
||||
use crate::blocktree::Blocktree;
|
||||
use crate::cluster_info::{ClusterInfo, NodeInfo};
|
||||
use crate::contact_info::ContactInfo;
|
||||
use crate::service::Service;
|
||||
use crate::streamer;
|
||||
use solana_sdk::signature::{Keypair, KeypairUtil};
|
||||
use std::net::SocketAddr;
|
||||
use std::net::UdpSocket;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::mpsc::channel;
|
||||
|
@ -49,9 +51,9 @@ impl GossipService {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn discover(entry_point_info: &NodeInfo, num_nodes: usize) -> std::io::Result<Vec<NodeInfo>> {
|
||||
pub fn discover(gossip_addr: &SocketAddr, num_nodes: usize) -> std::io::Result<Vec<NodeInfo>> {
|
||||
let exit = Arc::new(AtomicBool::new(false));
|
||||
let (gossip_service, spy_ref) = make_spy_node(entry_point_info, &exit);
|
||||
let (gossip_service, spy_ref) = make_spy_node(gossip_addr, &exit);
|
||||
let id = spy_ref.read().unwrap().keypair.pubkey();
|
||||
trace!(
|
||||
"discover: spy_node {} looking for at least {} nodes",
|
||||
|
@ -100,13 +102,13 @@ pub fn discover(entry_point_info: &NodeInfo, num_nodes: usize) -> std::io::Resul
|
|||
}
|
||||
|
||||
fn make_spy_node(
|
||||
entry_point: &NodeInfo,
|
||||
gossip_addr: &SocketAddr,
|
||||
exit: &Arc<AtomicBool>,
|
||||
) -> (GossipService, Arc<RwLock<ClusterInfo>>) {
|
||||
let keypair = Arc::new(Keypair::new());
|
||||
let (node, gossip_socket) = ClusterInfo::spy_node(&keypair.pubkey());
|
||||
let mut cluster_info = ClusterInfo::new(node, keypair);
|
||||
cluster_info.insert_info(entry_point.clone());
|
||||
cluster_info.insert_info(ContactInfo::new_entry_point(gossip_addr));
|
||||
|
||||
let cluster_info = Arc::new(RwLock::new(cluster_info));
|
||||
let gossip_service =
|
||||
|
|
|
@ -93,7 +93,7 @@ impl LocalCluster {
|
|||
);
|
||||
fullnodes.push(validator_server);
|
||||
}
|
||||
discover(&leader_node_info, node_stakes.len()).unwrap();
|
||||
discover(&leader_node_info.gossip, node_stakes.len()).unwrap();
|
||||
Self {
|
||||
funding_keypair: mint_keypair,
|
||||
entry_point_info: leader_node_info,
|
||||
|
|
|
@ -149,7 +149,7 @@ impl Replicator {
|
|||
);
|
||||
|
||||
info!("Looking for leader at {:?}", leader_info);
|
||||
crate::gossip_service::discover(&leader_info, 1)?;
|
||||
crate::gossip_service::discover(&leader_info.gossip, 1)?;
|
||||
|
||||
let (storage_blockhash, storage_entry_height) =
|
||||
Self::poll_for_blockhash_and_entry_height(&cluster_info)?;
|
||||
|
|
|
@ -455,7 +455,7 @@ mod tests {
|
|||
solana_logger::setup();
|
||||
let (server, leader_data, alice, ledger_path) = new_fullnode();
|
||||
let bob_pubkey = Keypair::new().pubkey();
|
||||
discover(&leader_data, 1).unwrap();
|
||||
discover(&leader_data.gossip, 1).unwrap();
|
||||
|
||||
let mut client = mk_client(&leader_data);
|
||||
|
||||
|
@ -486,7 +486,7 @@ mod tests {
|
|||
solana_logger::setup();
|
||||
let (server, leader_data, alice, ledger_path) = new_fullnode();
|
||||
let bob_pubkey = Keypair::new().pubkey();
|
||||
discover(&leader_data, 1).unwrap();
|
||||
discover(&leader_data.gossip, 1).unwrap();
|
||||
|
||||
let mut client = mk_client(&leader_data);
|
||||
|
||||
|
@ -517,7 +517,7 @@ mod tests {
|
|||
fn test_register_vote_account() {
|
||||
solana_logger::setup();
|
||||
let (server, leader_data, alice, ledger_path) = new_fullnode();
|
||||
discover(&leader_data, 1).unwrap();
|
||||
discover(&leader_data.gossip, 1).unwrap();
|
||||
|
||||
let mut client = mk_client(&leader_data);
|
||||
|
||||
|
@ -583,7 +583,7 @@ mod tests {
|
|||
solana_logger::setup();
|
||||
let (server, leader_data, alice, ledger_path) = new_fullnode();
|
||||
let bob_keypair = Keypair::new();
|
||||
discover(&leader_data, 1).unwrap();
|
||||
discover(&leader_data.gossip, 1).unwrap();
|
||||
|
||||
let mut client = mk_client(&leader_data);
|
||||
let blockhash = client.get_recent_blockhash();
|
||||
|
|
|
@ -62,7 +62,7 @@ fn test_replicator_startup_basic() {
|
|||
);
|
||||
|
||||
debug!("Looking for leader on gossip...");
|
||||
solana::gossip_service::discover(&leader_info, 1).unwrap();
|
||||
solana::gossip_service::discover(&leader_info.gossip, 1).unwrap();
|
||||
|
||||
let validator_keypair = Arc::new(Keypair::new());
|
||||
let voting_keypair = Keypair::new();
|
||||
|
|
Loading…
Reference in New Issue