From 803214131113c565cd7c643b2e32b6efe77a8ce6 Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Wed, 30 Oct 2019 14:43:30 -0700 Subject: [PATCH] Add --no-multi-client (#6624) --- bench-tps/src/cli.rs | 8 ++++++++ bench-tps/src/main.rs | 25 +++++++++++++++---------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/bench-tps/src/cli.rs b/bench-tps/src/cli.rs index 26954bed2..7dec83608 100644 --- a/bench-tps/src/cli.rs +++ b/bench-tps/src/cli.rs @@ -21,6 +21,7 @@ pub struct Config { pub write_to_client_file: bool, pub read_from_client_file: bool, pub target_lamports_per_signature: u64, + pub multi_client: bool, pub use_move: bool, pub num_lamports_per_account: u64, } @@ -41,6 +42,7 @@ impl Default for Config { write_to_client_file: false, read_from_client_file: false, target_lamports_per_signature: FeeCalculator::default().target_lamports_per_signature, + multi_client: true, use_move: false, num_lamports_per_account: NUM_LAMPORTS_PER_ACCOUNT_DEFAULT, } @@ -108,6 +110,11 @@ pub fn build_args<'a, 'b>() -> App<'a, 'b> { .long("use-move") .help("Use Move language transactions to perform transfers."), ) + .arg( + Arg::with_name("no-multi-client") + .long("no-multi-client") + .help("Disable multi-client support, only transact with the entrypoint."), + ) .arg( Arg::with_name("tx_count") .long("tx_count") @@ -229,6 +236,7 @@ pub fn extract_args<'a>(matches: &ArgMatches<'a>) -> Config { } args.use_move = matches.is_present("use-move"); + args.multi_client = !matches.is_present("no-multi-client"); if let Some(v) = matches.value_of("num_lamports_per_account") { args.num_lamports_per_account = v.to_string().parse().expect("can't parse lamports"); diff --git a/bench-tps/src/main.rs b/bench-tps/src/main.rs index 90cb87192..cee37f4c6 100644 --- a/bench-tps/src/main.rs +++ b/bench-tps/src/main.rs @@ -1,7 +1,7 @@ use log::*; use solana_bench_tps::bench::{do_bench_tps, generate_and_fund_keypairs, generate_keypairs}; use solana_bench_tps::cli; -use solana_core::gossip_service::{discover_cluster, get_multi_client}; +use solana_core::gossip_service::{discover_cluster, get_client, get_multi_client}; use solana_genesis::Base64Account; use solana_sdk::fee_calculator::FeeCalculator; use solana_sdk::signature::{Keypair, KeypairUtil}; @@ -29,6 +29,7 @@ fn main() { read_from_client_file, target_lamports_per_signature, use_move, + multi_client, num_lamports_per_account, .. } = &cli_config; @@ -70,15 +71,19 @@ fn main() { exit(1); }); - let (client, num_clients) = get_multi_client(&nodes); - - if nodes.len() < num_clients { - eprintln!( - "Error: Insufficient nodes discovered. Expecting {} or more", - num_nodes - ); - exit(1); - } + let client = if *multi_client { + let (client, num_clients) = get_multi_client(&nodes); + if nodes.len() < num_clients { + eprintln!( + "Error: Insufficient nodes discovered. Expecting {} or more", + num_nodes + ); + exit(1); + } + client + } else { + get_client(&nodes) + }; let (keypairs, move_keypairs, keypair_balance) = if *read_from_client_file && !use_move { let path = Path::new(&client_ids_and_stake_file);