2021-12-03 09:00:31 -08:00
|
|
|
use {
|
|
|
|
clap::{crate_description, crate_name, App, Arg, ArgMatches},
|
2022-04-12 08:43:29 -07:00
|
|
|
solana_clap_utils::input_validators::{is_url, is_url_or_moniker},
|
|
|
|
solana_cli_config::{ConfigInput, CONFIG_FILE},
|
2021-12-03 09:00:31 -08:00
|
|
|
solana_sdk::{
|
|
|
|
fee_calculator::FeeRateGovernor,
|
|
|
|
pubkey::Pubkey,
|
|
|
|
signature::{read_keypair_file, Keypair},
|
|
|
|
},
|
2022-08-24 09:47:02 -07:00
|
|
|
solana_tpu_client::connection_cache::{DEFAULT_TPU_CONNECTION_POOL_SIZE, DEFAULT_TPU_USE_QUIC},
|
2021-12-03 09:00:31 -08:00
|
|
|
std::{net::SocketAddr, process::exit, time::Duration},
|
2020-07-01 21:10:12 -07:00
|
|
|
};
|
2018-12-11 19:47:32 -08:00
|
|
|
|
2019-12-30 11:28:41 -08:00
|
|
|
const NUM_LAMPORTS_PER_ACCOUNT_DEFAULT: u64 = solana_sdk::native_token::LAMPORTS_PER_SOL;
|
2019-09-10 16:24:43 -07:00
|
|
|
|
2022-04-12 08:43:29 -07:00
|
|
|
pub enum ExternalClientType {
|
2022-04-13 12:11:34 -07:00
|
|
|
// Submits transactions to an Rpc node using an RpcClient
|
|
|
|
RpcClient,
|
2022-04-12 08:43:29 -07:00
|
|
|
// Submits transactions directly to leaders using a ThinClient, broadcasting to multiple
|
|
|
|
// leaders when num_nodes > 1
|
|
|
|
ThinClient,
|
|
|
|
// Submits transactions directly to leaders using a TpuClient, broadcasting to upcoming leaders
|
|
|
|
// via TpuClient default configuration
|
|
|
|
TpuClient,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Default for ExternalClientType {
|
|
|
|
fn default() -> Self {
|
|
|
|
Self::ThinClient
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-11 19:47:32 -08:00
|
|
|
/// Holds the configuration for a single run of the benchmark
|
|
|
|
pub struct Config {
|
2019-05-03 15:00:19 -07:00
|
|
|
pub entrypoint_addr: SocketAddr,
|
2022-04-12 08:43:29 -07:00
|
|
|
pub json_rpc_url: String,
|
|
|
|
pub websocket_url: String,
|
2018-12-11 19:47:32 -08:00
|
|
|
pub id: Keypair,
|
|
|
|
pub threads: usize,
|
|
|
|
pub num_nodes: usize,
|
|
|
|
pub duration: Duration,
|
|
|
|
pub tx_count: usize,
|
2019-12-18 20:50:17 -08:00
|
|
|
pub keypair_multiplier: usize,
|
2019-01-03 14:16:06 -08:00
|
|
|
pub thread_batch_sleep_ms: usize,
|
2018-12-11 19:47:32 -08:00
|
|
|
pub sustained: bool,
|
2019-06-11 18:47:35 -07:00
|
|
|
pub client_ids_and_stake_file: String,
|
|
|
|
pub write_to_client_file: bool,
|
|
|
|
pub read_from_client_file: bool,
|
2019-06-18 14:44:53 -07:00
|
|
|
pub target_lamports_per_signature: u64,
|
2019-10-30 14:43:30 -07:00
|
|
|
pub multi_client: bool,
|
2019-09-10 16:24:43 -07:00
|
|
|
pub num_lamports_per_account: u64,
|
2020-05-20 16:42:46 -07:00
|
|
|
pub target_slots_per_epoch: u64,
|
2020-07-01 21:10:12 -07:00
|
|
|
pub target_node: Option<Pubkey>,
|
2022-04-12 08:43:29 -07:00
|
|
|
pub external_client_type: ExternalClientType,
|
2022-04-13 11:17:10 -07:00
|
|
|
pub use_quic: bool,
|
2022-06-10 09:25:24 -07:00
|
|
|
pub tpu_connection_pool_size: usize,
|
2022-08-11 18:59:17 -07:00
|
|
|
pub use_randomized_compute_unit_price: bool,
|
2022-08-13 04:01:25 -07:00
|
|
|
pub use_durable_nonce: bool,
|
2018-12-11 19:47:32 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Default for Config {
|
|
|
|
fn default() -> Config {
|
|
|
|
Config {
|
2019-05-03 15:00:19 -07:00
|
|
|
entrypoint_addr: SocketAddr::from(([127, 0, 0, 1], 8001)),
|
2022-04-12 08:43:29 -07:00
|
|
|
json_rpc_url: ConfigInput::default().json_rpc_url,
|
|
|
|
websocket_url: ConfigInput::default().websocket_url,
|
2018-12-11 19:47:32 -08:00
|
|
|
id: Keypair::new(),
|
|
|
|
threads: 4,
|
|
|
|
num_nodes: 1,
|
|
|
|
duration: Duration::new(std::u64::MAX, 0),
|
2019-10-15 20:53:37 -07:00
|
|
|
tx_count: 50_000,
|
2019-12-18 20:50:17 -08:00
|
|
|
keypair_multiplier: 8,
|
2019-10-15 20:53:37 -07:00
|
|
|
thread_batch_sleep_ms: 1000,
|
2018-12-11 19:47:32 -08:00
|
|
|
sustained: false,
|
2019-06-11 18:47:35 -07:00
|
|
|
client_ids_and_stake_file: String::new(),
|
|
|
|
write_to_client_file: false,
|
|
|
|
read_from_client_file: false,
|
2020-02-28 12:27:01 -08:00
|
|
|
target_lamports_per_signature: FeeRateGovernor::default().target_lamports_per_signature,
|
2019-10-30 14:43:30 -07:00
|
|
|
multi_client: true,
|
2019-09-10 16:24:43 -07:00
|
|
|
num_lamports_per_account: NUM_LAMPORTS_PER_ACCOUNT_DEFAULT,
|
2020-05-20 16:42:46 -07:00
|
|
|
target_slots_per_epoch: 0,
|
2020-07-01 21:10:12 -07:00
|
|
|
target_node: None,
|
2022-04-12 08:43:29 -07:00
|
|
|
external_client_type: ExternalClientType::default(),
|
2022-06-08 04:57:12 -07:00
|
|
|
use_quic: DEFAULT_TPU_USE_QUIC,
|
2022-06-10 09:25:24 -07:00
|
|
|
tpu_connection_pool_size: DEFAULT_TPU_CONNECTION_POOL_SIZE,
|
2022-08-11 18:59:17 -07:00
|
|
|
use_randomized_compute_unit_price: false,
|
2022-08-13 04:01:25 -07:00
|
|
|
use_durable_nonce: false,
|
2018-12-11 19:47:32 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Defines and builds the CLI args for a run of the benchmark
|
2019-11-13 20:10:38 -08:00
|
|
|
pub fn build_args<'a, 'b>(version: &'b str) -> App<'a, 'b> {
|
2019-03-13 20:54:30 -07:00
|
|
|
App::new(crate_name!()).about(crate_description!())
|
2019-11-13 20:10:38 -08:00
|
|
|
.version(version)
|
2022-04-12 08:43:29 -07:00
|
|
|
.arg({
|
|
|
|
let arg = Arg::with_name("config_file")
|
|
|
|
.short("C")
|
|
|
|
.long("config")
|
|
|
|
.value_name("FILEPATH")
|
|
|
|
.takes_value(true)
|
|
|
|
.global(true)
|
|
|
|
.help("Configuration file to use");
|
|
|
|
if let Some(ref config_file) = *CONFIG_FILE {
|
|
|
|
arg.default_value(config_file)
|
|
|
|
} else {
|
|
|
|
arg
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.arg(
|
|
|
|
Arg::with_name("json_rpc_url")
|
|
|
|
.short("u")
|
|
|
|
.long("url")
|
|
|
|
.value_name("URL_OR_MONIKER")
|
|
|
|
.takes_value(true)
|
|
|
|
.global(true)
|
|
|
|
.validator(is_url_or_moniker)
|
|
|
|
.help(
|
|
|
|
"URL for Solana's JSON RPC or moniker (or their first letter): \
|
|
|
|
[mainnet-beta, testnet, devnet, localhost]",
|
|
|
|
),
|
|
|
|
)
|
|
|
|
.arg(
|
|
|
|
Arg::with_name("websocket_url")
|
|
|
|
.long("ws")
|
|
|
|
.value_name("URL")
|
|
|
|
.takes_value(true)
|
|
|
|
.global(true)
|
|
|
|
.validator(is_url)
|
|
|
|
.help("WebSocket URL for the solana cluster"),
|
|
|
|
)
|
2022-05-01 00:14:47 -07:00
|
|
|
.arg(
|
|
|
|
Arg::with_name("rpc_addr")
|
|
|
|
.long("rpc-addr")
|
|
|
|
.value_name("HOST:PORT")
|
|
|
|
.takes_value(true)
|
|
|
|
.conflicts_with("tpu_client")
|
|
|
|
.conflicts_with("rpc_client")
|
|
|
|
.requires("tpu_addr")
|
|
|
|
.help("Specify custom rpc_addr to create thin_client"),
|
|
|
|
)
|
|
|
|
.arg(
|
|
|
|
Arg::with_name("tpu_addr")
|
|
|
|
.long("tpu-addr")
|
|
|
|
.value_name("HOST:PORT")
|
|
|
|
.conflicts_with("tpu_client")
|
|
|
|
.conflicts_with("rpc_client")
|
|
|
|
.takes_value(true)
|
|
|
|
.requires("rpc_addr")
|
|
|
|
.help("Specify custom tpu_addr to create thin_client"),
|
|
|
|
)
|
2018-12-11 19:47:32 -08:00
|
|
|
.arg(
|
2019-05-03 15:00:19 -07:00
|
|
|
Arg::with_name("entrypoint")
|
2018-12-11 19:47:32 -08:00
|
|
|
.short("n")
|
2019-05-03 15:00:19 -07:00
|
|
|
.long("entrypoint")
|
2018-12-11 19:47:32 -08:00
|
|
|
.value_name("HOST:PORT")
|
|
|
|
.takes_value(true)
|
2019-05-03 15:00:19 -07:00
|
|
|
.help("Rendezvous with the cluster at this entry point; defaults to 127.0.0.1:8001"),
|
2018-12-11 19:47:32 -08:00
|
|
|
)
|
|
|
|
.arg(
|
2019-12-16 13:05:17 -08:00
|
|
|
Arg::with_name("faucet")
|
2018-12-11 19:47:32 -08:00
|
|
|
.short("d")
|
2019-12-16 13:05:17 -08:00
|
|
|
.long("faucet")
|
2018-12-11 19:47:32 -08:00
|
|
|
.value_name("HOST:PORT")
|
|
|
|
.takes_value(true)
|
2022-04-11 12:45:40 -07:00
|
|
|
.hidden(true)
|
|
|
|
.help("Deprecated. BenchTps no longer queries the faucet directly"),
|
2018-12-11 19:47:32 -08:00
|
|
|
)
|
|
|
|
.arg(
|
|
|
|
Arg::with_name("identity")
|
|
|
|
.short("i")
|
|
|
|
.long("identity")
|
|
|
|
.value_name("PATH")
|
|
|
|
.takes_value(true)
|
|
|
|
.help("File containing a client identity (keypair)"),
|
|
|
|
)
|
|
|
|
.arg(
|
|
|
|
Arg::with_name("num-nodes")
|
|
|
|
.short("N")
|
|
|
|
.long("num-nodes")
|
|
|
|
.value_name("NUM")
|
|
|
|
.takes_value(true)
|
|
|
|
.help("Wait for NUM nodes to converge"),
|
|
|
|
)
|
|
|
|
.arg(
|
|
|
|
Arg::with_name("threads")
|
|
|
|
.short("t")
|
|
|
|
.long("threads")
|
|
|
|
.value_name("NUM")
|
|
|
|
.takes_value(true)
|
|
|
|
.help("Number of threads"),
|
|
|
|
)
|
|
|
|
.arg(
|
|
|
|
Arg::with_name("duration")
|
|
|
|
.long("duration")
|
|
|
|
.value_name("SECS")
|
|
|
|
.takes_value(true)
|
|
|
|
.help("Seconds to run benchmark, then exit; default is forever"),
|
|
|
|
)
|
|
|
|
.arg(
|
|
|
|
Arg::with_name("sustained")
|
|
|
|
.long("sustained")
|
|
|
|
.help("Use sustained performance mode vs. peak mode. This overlaps the tx generation with transfers."),
|
|
|
|
)
|
2019-10-30 14:43:30 -07:00
|
|
|
.arg(
|
|
|
|
Arg::with_name("no-multi-client")
|
|
|
|
.long("no-multi-client")
|
|
|
|
.help("Disable multi-client support, only transact with the entrypoint."),
|
|
|
|
)
|
2020-07-01 21:10:12 -07:00
|
|
|
.arg(
|
|
|
|
Arg::with_name("target_node")
|
|
|
|
.long("target-node")
|
|
|
|
.requires("no-multi-client")
|
|
|
|
.takes_value(true)
|
|
|
|
.value_name("PUBKEY")
|
|
|
|
.help("Specify an exact node to send transactions to."),
|
|
|
|
)
|
2018-12-11 19:47:32 -08:00
|
|
|
.arg(
|
|
|
|
Arg::with_name("tx_count")
|
|
|
|
.long("tx_count")
|
|
|
|
.value_name("NUM")
|
|
|
|
.takes_value(true)
|
|
|
|
.help("Number of transactions to send per batch")
|
|
|
|
)
|
2019-12-18 20:50:17 -08:00
|
|
|
.arg(
|
|
|
|
Arg::with_name("keypair_multiplier")
|
|
|
|
.long("keypair-multiplier")
|
|
|
|
.value_name("NUM")
|
|
|
|
.takes_value(true)
|
|
|
|
.help("Multiply by transaction count to determine number of keypairs to create")
|
|
|
|
)
|
2019-01-03 14:16:06 -08:00
|
|
|
.arg(
|
|
|
|
Arg::with_name("thread-batch-sleep-ms")
|
|
|
|
.short("z")
|
|
|
|
.long("thread-batch-sleep-ms")
|
|
|
|
.value_name("NUM")
|
|
|
|
.takes_value(true)
|
|
|
|
.help("Per-thread-per-iteration sleep in ms"),
|
|
|
|
)
|
2019-06-11 18:47:35 -07:00
|
|
|
.arg(
|
|
|
|
Arg::with_name("write-client-keys")
|
|
|
|
.long("write-client-keys")
|
|
|
|
.value_name("FILENAME")
|
|
|
|
.takes_value(true)
|
|
|
|
.help("Generate client keys and stakes and write the list to YAML file"),
|
|
|
|
)
|
|
|
|
.arg(
|
|
|
|
Arg::with_name("read-client-keys")
|
|
|
|
.long("read-client-keys")
|
|
|
|
.value_name("FILENAME")
|
|
|
|
.takes_value(true)
|
|
|
|
.help("Read client keys and stakes from the YAML file"),
|
|
|
|
)
|
2019-06-18 14:44:53 -07:00
|
|
|
.arg(
|
|
|
|
Arg::with_name("target_lamports_per_signature")
|
|
|
|
.long("target-lamports-per-signature")
|
|
|
|
.value_name("LAMPORTS")
|
|
|
|
.takes_value(true)
|
|
|
|
.help(
|
|
|
|
"The cost in lamports that the cluster will charge for signature \
|
|
|
|
verification when the cluster is operating at target-signatures-per-slot",
|
|
|
|
),
|
|
|
|
)
|
2019-09-10 16:24:43 -07:00
|
|
|
.arg(
|
|
|
|
Arg::with_name("num_lamports_per_account")
|
|
|
|
.long("num-lamports-per-account")
|
|
|
|
.value_name("LAMPORTS")
|
|
|
|
.takes_value(true)
|
|
|
|
.help(
|
|
|
|
"Number of lamports per account.",
|
|
|
|
),
|
|
|
|
)
|
2020-05-20 16:42:46 -07:00
|
|
|
.arg(
|
|
|
|
Arg::with_name("target_slots_per_epoch")
|
|
|
|
.long("target-slots-per-epoch")
|
|
|
|
.value_name("SLOTS")
|
|
|
|
.takes_value(true)
|
|
|
|
.help(
|
|
|
|
"Wait until epochs are this many slots long.",
|
|
|
|
),
|
|
|
|
)
|
2022-04-13 12:11:34 -07:00
|
|
|
.arg(
|
|
|
|
Arg::with_name("rpc_client")
|
|
|
|
.long("use-rpc-client")
|
|
|
|
.conflicts_with("tpu_client")
|
|
|
|
.takes_value(false)
|
|
|
|
.help("Submit transactions with a RpcClient")
|
|
|
|
)
|
2022-04-12 08:43:29 -07:00
|
|
|
.arg(
|
|
|
|
Arg::with_name("tpu_client")
|
|
|
|
.long("use-tpu-client")
|
2022-04-13 12:11:34 -07:00
|
|
|
.conflicts_with("rpc_client")
|
2022-04-12 08:43:29 -07:00
|
|
|
.takes_value(false)
|
|
|
|
.help("Submit transactions with a TpuClient")
|
|
|
|
)
|
2022-04-13 11:17:10 -07:00
|
|
|
.arg(
|
2022-08-19 07:15:15 -07:00
|
|
|
Arg::with_name("tpu_disable_quic")
|
|
|
|
.long("tpu-disable-quic")
|
2022-04-13 11:17:10 -07:00
|
|
|
.takes_value(false)
|
2022-08-19 07:15:15 -07:00
|
|
|
.help("Do not submit transactions via QUIC; only affects ThinClient (default) \
|
2022-04-13 11:17:10 -07:00
|
|
|
or TpuClient sends"),
|
|
|
|
)
|
2022-06-10 09:25:24 -07:00
|
|
|
.arg(
|
|
|
|
Arg::with_name("tpu_connection_pool_size")
|
|
|
|
.long("tpu-connection-pool-size")
|
|
|
|
.takes_value(true)
|
|
|
|
.help("Controls the connection pool size per remote address; only affects ThinClient (default) \
|
|
|
|
or TpuClient sends"),
|
|
|
|
)
|
2022-08-11 18:59:17 -07:00
|
|
|
.arg(
|
|
|
|
Arg::with_name("use_randomized_compute_unit_price")
|
|
|
|
.long("use-randomized-compute-unit-price")
|
|
|
|
.takes_value(false)
|
|
|
|
.help("Sets random compute-unit-price in range [0..100] to transfer transactions"),
|
|
|
|
)
|
2018-12-11 19:47:32 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Parses a clap `ArgMatches` structure into a `Config`
|
|
|
|
/// # Arguments
|
|
|
|
/// * `matches` - command line arguments parsed by clap
|
|
|
|
/// # Panics
|
|
|
|
/// Panics if there is trouble parsing any of the arguments
|
2020-12-13 17:26:34 -08:00
|
|
|
pub fn extract_args(matches: &ArgMatches) -> Config {
|
2018-12-11 19:47:32 -08:00
|
|
|
let mut args = Config::default();
|
|
|
|
|
2022-04-12 08:43:29 -07:00
|
|
|
let config = if let Some(config_file) = matches.value_of("config_file") {
|
|
|
|
solana_cli_config::Config::load(config_file).unwrap_or_default()
|
|
|
|
} else {
|
|
|
|
solana_cli_config::Config::default()
|
|
|
|
};
|
|
|
|
let (_, json_rpc_url) = ConfigInput::compute_json_rpc_url_setting(
|
|
|
|
matches.value_of("json_rpc_url").unwrap_or(""),
|
|
|
|
&config.json_rpc_url,
|
|
|
|
);
|
|
|
|
args.json_rpc_url = json_rpc_url;
|
|
|
|
|
|
|
|
let (_, websocket_url) = ConfigInput::compute_websocket_url_setting(
|
|
|
|
matches.value_of("websocket_url").unwrap_or(""),
|
|
|
|
&config.websocket_url,
|
|
|
|
matches.value_of("json_rpc_url").unwrap_or(""),
|
|
|
|
&config.json_rpc_url,
|
|
|
|
);
|
|
|
|
args.websocket_url = websocket_url;
|
|
|
|
|
|
|
|
let (_, id_path) = ConfigInput::compute_keypair_path_setting(
|
|
|
|
matches.value_of("identity").unwrap_or(""),
|
|
|
|
&config.keypair_path,
|
|
|
|
);
|
2022-04-14 18:05:08 -07:00
|
|
|
if let Ok(id) = read_keypair_file(id_path) {
|
|
|
|
args.id = id;
|
|
|
|
} else if matches.is_present("identity") {
|
|
|
|
panic!("could not parse identity path");
|
|
|
|
}
|
2022-04-12 08:43:29 -07:00
|
|
|
|
|
|
|
if matches.is_present("tpu_client") {
|
|
|
|
args.external_client_type = ExternalClientType::TpuClient;
|
2022-04-13 12:11:34 -07:00
|
|
|
} else if matches.is_present("rpc_client") {
|
|
|
|
args.external_client_type = ExternalClientType::RpcClient;
|
2022-04-12 08:43:29 -07:00
|
|
|
}
|
|
|
|
|
2022-08-19 07:15:15 -07:00
|
|
|
if matches.is_present("tpu_disable_quic") {
|
|
|
|
args.use_quic = false;
|
2022-04-13 11:17:10 -07:00
|
|
|
}
|
|
|
|
|
2022-06-10 09:25:24 -07:00
|
|
|
if let Some(v) = matches.value_of("tpu_connection_pool_size") {
|
|
|
|
args.tpu_connection_pool_size = v
|
|
|
|
.to_string()
|
|
|
|
.parse()
|
|
|
|
.expect("can't parse tpu_connection_pool_size");
|
|
|
|
}
|
|
|
|
|
2019-05-03 15:00:19 -07:00
|
|
|
if let Some(addr) = matches.value_of("entrypoint") {
|
2019-11-12 12:37:13 -08:00
|
|
|
args.entrypoint_addr = solana_net_utils::parse_host_port(addr).unwrap_or_else(|e| {
|
2019-05-03 15:00:19 -07:00
|
|
|
eprintln!("failed to parse entrypoint address: {}", e);
|
2018-12-11 19:47:32 -08:00
|
|
|
exit(1)
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
if let Some(t) = matches.value_of("threads") {
|
|
|
|
args.threads = t.to_string().parse().expect("can't parse threads");
|
|
|
|
}
|
|
|
|
|
|
|
|
if let Some(n) = matches.value_of("num-nodes") {
|
|
|
|
args.num_nodes = n.to_string().parse().expect("can't parse num-nodes");
|
|
|
|
}
|
|
|
|
|
2018-12-14 21:18:41 -08:00
|
|
|
if let Some(duration) = matches.value_of("duration") {
|
|
|
|
args.duration = Duration::new(
|
|
|
|
duration.to_string().parse().expect("can't parse duration"),
|
|
|
|
0,
|
|
|
|
);
|
2018-12-11 19:47:32 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
if let Some(s) = matches.value_of("tx_count") {
|
2019-12-18 20:50:17 -08:00
|
|
|
args.tx_count = s.to_string().parse().expect("can't parse tx_count");
|
|
|
|
}
|
|
|
|
|
|
|
|
if let Some(s) = matches.value_of("keypair_multiplier") {
|
|
|
|
args.keypair_multiplier = s
|
|
|
|
.to_string()
|
|
|
|
.parse()
|
|
|
|
.expect("can't parse keypair-multiplier");
|
|
|
|
assert!(args.keypair_multiplier >= 2);
|
2018-12-11 19:47:32 -08:00
|
|
|
}
|
|
|
|
|
2019-01-03 14:16:06 -08:00
|
|
|
if let Some(t) = matches.value_of("thread-batch-sleep-ms") {
|
|
|
|
args.thread_batch_sleep_ms = t
|
|
|
|
.to_string()
|
|
|
|
.parse()
|
|
|
|
.expect("can't parse thread-batch-sleep-ms");
|
|
|
|
}
|
|
|
|
|
2018-12-11 19:47:32 -08:00
|
|
|
args.sustained = matches.is_present("sustained");
|
|
|
|
|
2019-06-11 18:47:35 -07:00
|
|
|
if let Some(s) = matches.value_of("write-client-keys") {
|
|
|
|
args.write_to_client_file = true;
|
|
|
|
args.client_ids_and_stake_file = s.to_string();
|
|
|
|
}
|
|
|
|
|
|
|
|
if let Some(s) = matches.value_of("read-client-keys") {
|
|
|
|
assert!(!args.write_to_client_file);
|
|
|
|
args.read_from_client_file = true;
|
|
|
|
args.client_ids_and_stake_file = s.to_string();
|
|
|
|
}
|
|
|
|
|
2019-06-18 14:44:53 -07:00
|
|
|
if let Some(v) = matches.value_of("target_lamports_per_signature") {
|
|
|
|
args.target_lamports_per_signature = v.to_string().parse().expect("can't parse lamports");
|
|
|
|
}
|
|
|
|
|
2019-10-30 14:43:30 -07:00
|
|
|
args.multi_client = !matches.is_present("no-multi-client");
|
2020-07-01 21:10:12 -07:00
|
|
|
args.target_node = matches
|
|
|
|
.value_of("target_node")
|
|
|
|
.map(|target_str| target_str.parse().unwrap());
|
2019-07-28 10:43:42 -07:00
|
|
|
|
2019-09-10 16:24:43 -07:00
|
|
|
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");
|
|
|
|
}
|
|
|
|
|
2020-05-20 16:42:46 -07:00
|
|
|
if let Some(t) = matches.value_of("target_slots_per_epoch") {
|
|
|
|
args.target_slots_per_epoch = t
|
|
|
|
.to_string()
|
|
|
|
.parse()
|
|
|
|
.expect("can't parse target slots per epoch");
|
|
|
|
}
|
|
|
|
|
2022-08-11 18:59:17 -07:00
|
|
|
if matches.is_present("use_randomized_compute_unit_price") {
|
|
|
|
args.use_randomized_compute_unit_price = true;
|
|
|
|
}
|
|
|
|
|
2018-12-11 19:47:32 -08:00
|
|
|
args
|
|
|
|
}
|