Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate ThinClient and remove ThinClient from bench-tps #35365

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 28 additions & 58 deletions bench-tps/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use {
},
solana_tpu_client::tpu_client::{DEFAULT_TPU_CONNECTION_POOL_SIZE, DEFAULT_TPU_USE_QUIC},
std::{
net::{IpAddr, Ipv4Addr, SocketAddr},
net::{IpAddr, Ipv4Addr},
time::Duration,
},
};
Expand All @@ -24,9 +24,6 @@ const NUM_LAMPORTS_PER_ACCOUNT_DEFAULT: u64 = solana_sdk::native_token::LAMPORTS
pub enum ExternalClientType {
// Submits transactions to an Rpc node using an RpcClient
RpcClient,
// 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,
Expand All @@ -53,12 +50,10 @@ pub enum ComputeUnitPrice {
/// Holds the configuration for a single run of the benchmark
#[derive(PartialEq, Debug)]
pub struct Config {
pub entrypoint_addr: SocketAddr,
pub json_rpc_url: String,
pub websocket_url: String,
pub id: Keypair,
pub threads: usize,
pub num_nodes: usize,
pub duration: Duration,
pub tx_count: usize,
pub keypair_multiplier: usize,
Expand All @@ -68,10 +63,8 @@ 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 num_lamports_per_account: u64,
pub target_slots_per_epoch: u64,
pub target_node: Option<Pubkey>,
pub external_client_type: ExternalClientType,
pub use_quic: bool,
pub tpu_connection_pool_size: usize,
Expand All @@ -89,12 +82,10 @@ impl Eq for Config {}
impl Default for Config {
fn default() -> Config {
Config {
entrypoint_addr: SocketAddr::from((Ipv4Addr::LOCALHOST, 8001)),
json_rpc_url: ConfigInput::default().json_rpc_url,
websocket_url: ConfigInput::default().websocket_url,
id: Keypair::new(),
threads: 4,
num_nodes: 1,
duration: Duration::new(std::u64::MAX, 0),
tx_count: 50_000,
keypair_multiplier: 8,
Expand All @@ -104,10 +95,8 @@ impl Default for Config {
write_to_client_file: false,
read_from_client_file: false,
target_lamports_per_signature: FeeRateGovernor::default().target_lamports_per_signature,
multi_client: true,
num_lamports_per_account: NUM_LAMPORTS_PER_ACCOUNT_DEFAULT,
target_slots_per_epoch: 0,
target_node: None,
external_client_type: ExternalClientType::default(),
use_quic: DEFAULT_TPU_USE_QUIC,
tpu_connection_pool_size: DEFAULT_TPU_CONNECTION_POOL_SIZE,
Expand Down Expand Up @@ -169,8 +158,10 @@ pub fn build_args<'a>(version: &'_ str) -> App<'a, '_> {
.takes_value(true)
.conflicts_with("rpc_client")
.requires("tpu_addr")
.requires("thin_client")
.help("Specify custom rpc_addr to create thin_client"),
.hidden(hidden_unless_forced())
.help("Specify custom rpc_addr to create thin_client. \
Note: ThinClient is deprecated. Argument will not be used. \
Use tpc_client or rpc_client instead"),
)
.arg(
Arg::with_name("tpu_addr")
Expand All @@ -179,16 +170,21 @@ pub fn build_args<'a>(version: &'_ str) -> App<'a, '_> {
.conflicts_with("rpc_client")
.takes_value(true)
.requires("rpc_addr")
.requires("thin_client")
.help("Specify custom tpu_addr to create thin_client"),
.hidden(hidden_unless_forced())
.help("Specify custom tpu_addr to create thin_client. \
Note: ThinClient is deprecated. Argument will not be used. \
Use tpc_client or rpc_client instead"),
)
.arg(
Arg::with_name("entrypoint")
.short("n")
.long("entrypoint")
.value_name("HOST:PORT")
.takes_value(true)
.help("Rendezvous with the cluster at this entry point; defaults to 127.0.0.1:8001"),
.hidden(hidden_unless_forced())
.help("Rendezvous with the cluster at this entry point; defaults to 127.0.0.1:8001. \
Note: ThinClient is deprecated. Argument will not be used. \
Use tpc_client or rpc_client instead"),
)
.arg(
Arg::with_name("faucet")
Expand All @@ -213,7 +209,10 @@ pub fn build_args<'a>(version: &'_ str) -> App<'a, '_> {
.long("num-nodes")
.value_name("NUM")
.takes_value(true)
.help("Wait for NUM nodes to converge"),
.hidden(hidden_unless_forced())
.help("Wait for NUM nodes to converge. \
Note: ThinClient is deprecated. Argument will not be used. \
Use tpc_client or rpc_client instead"),
)
.arg(
Arg::with_name("threads")
Expand All @@ -238,15 +237,21 @@ pub fn build_args<'a>(version: &'_ str) -> App<'a, '_> {
.arg(
Arg::with_name("no-multi-client")
.long("no-multi-client")
.help("Disable multi-client support, only transact with the entrypoint."),
.hidden(hidden_unless_forced())
.help("Disable multi-client support, only transact with the entrypoint. \
Note: ThinClient is deprecated. Flag will not be used. \
Use tpc_client or rpc_client instead"),
)
.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."),
.hidden(hidden_unless_forced())
.help("Specify an exact node to send transactions to. \
Note: ThinClient is deprecated. Argument will not be used. \
Use tpc_client or rpc_client instead"),
)
.arg(
Arg::with_name("tx_count")
Expand Down Expand Up @@ -316,7 +321,6 @@ pub fn build_args<'a>(version: &'_ str) -> App<'a, '_> {
.arg(
Arg::with_name("rpc_client")
.long("use-rpc-client")
.conflicts_with("thin_client")
.conflicts_with("tpu_client")
.takes_value(false)
.help("Submit transactions with a RpcClient")
Expand All @@ -325,33 +329,20 @@ pub fn build_args<'a>(version: &'_ str) -> App<'a, '_> {
Arg::with_name("tpu_client")
.long("use-tpu-client")
.conflicts_with("rpc_client")
.conflicts_with("thin_client")
.takes_value(false)
.help("Submit transactions with a TpuClient")
)
.arg(
Arg::with_name("thin_client")
.long("use-thin-client")
.conflicts_with("rpc_client")
.conflicts_with("tpu_client")
.takes_value(false)
.hidden(hidden_unless_forced())
.help("Submit transactions with a ThinClient. Note: usage is discouraged. \
ThinClient will be deprecated.")
)
.arg(
Arg::with_name("tpu_disable_quic")
.long("tpu-disable-quic")
.takes_value(false)
.help("Do not submit transactions via QUIC; only affects ThinClient \
or TpuClient (default) sends"),
.help("Do not submit transactions via QUIC; only affects TpuClient (default) sends"),
)
.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 \
or TpuClient (default) sends"),
.help("Controls the connection pool size per remote address; only affects TpuClient (default) sends"),
)
.arg(
Arg::with_name("compute_unit_price")
Expand Down Expand Up @@ -456,8 +447,6 @@ pub fn parse_args(matches: &ArgMatches) -> Result<Config, &'static str> {

if matches.is_present("rpc_client") {
args.external_client_type = ExternalClientType::RpcClient;
} else if matches.is_present("thin_client") {
args.external_client_type = ExternalClientType::ThinClient;
}

if matches.is_present("tpu_disable_quic") {
Expand All @@ -471,19 +460,10 @@ pub fn parse_args(matches: &ArgMatches) -> Result<Config, &'static str> {
.map_err(|_| "can't parse tpu-connection-pool-size")?;
}

if let Some(addr) = matches.value_of("entrypoint") {
args.entrypoint_addr = solana_net_utils::parse_host_port(addr)
.map_err(|_| "failed to parse entrypoint address")?;
}

if let Some(t) = matches.value_of("threads") {
args.threads = t.to_string().parse().map_err(|_| "can't parse threads")?;
}

if let Some(n) = matches.value_of("num-nodes") {
args.num_nodes = n.to_string().parse().map_err(|_| "can't parse num-nodes")?;
}

if let Some(duration) = matches.value_of("duration") {
let seconds = duration
.to_string()
Expand Down Expand Up @@ -533,13 +513,6 @@ pub fn parse_args(matches: &ArgMatches) -> Result<Config, &'static str> {
.map_err(|_| "can't parse target-lamports-per-signature")?;
}

args.multi_client = !matches.is_present("no-multi-client");
args.target_node = matches
.value_of("target_node")
.map(|target_str| target_str.parse::<Pubkey>())
.transpose()
.map_err(|_| "Failed to parse target-node")?;

if let Some(v) = matches.value_of("num_lamports_per_account") {
args.num_lamports_per_account = v
.to_string()
Expand Down Expand Up @@ -611,7 +584,7 @@ mod tests {
super::*,
solana_sdk::signature::{read_keypair_file, write_keypair_file, Keypair, Signer},
std::{
net::{IpAddr, Ipv4Addr, SocketAddr},
net::{IpAddr, Ipv4Addr},
time::Duration,
},
tempfile::{tempdir, TempDir},
Expand Down Expand Up @@ -671,8 +644,6 @@ mod tests {
"4",
"--read-client-keys",
"./client-accounts.yml",
"--entrypoint",
"192.1.2.3:8001",
]);
let actual = parse_args(&matches).unwrap();
assert_eq!(
Expand All @@ -686,7 +657,6 @@ mod tests {
threads: 4,
read_from_client_file: true,
client_ids_and_stake_file: "./client-accounts.yml".to_string(),
entrypoint_addr: SocketAddr::from((Ipv4Addr::new(192, 1, 2, 3), 8001)),
..Config::default()
}
);
Expand Down
Loading
Loading