diff --git a/Cargo.lock b/Cargo.lock index 06d28868c2bcff..198110172c905d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5581,6 +5581,7 @@ dependencies = [ "solana-measure", "solana-metrics", "solana-net-utils", + "solana-quic-client", "solana-rpc", "solana-rpc-client", "solana-rpc-client-api", diff --git a/bench-tps/Cargo.toml b/bench-tps/Cargo.toml index 2c7060175f0a8c..3693f70e4ed9b8 100644 --- a/bench-tps/Cargo.toml +++ b/bench-tps/Cargo.toml @@ -28,6 +28,7 @@ solana-logger = { workspace = true } solana-measure = { workspace = true } solana-metrics = { workspace = true } solana-net-utils = { workspace = true } +solana-quic-client = { workspace = true } solana-rpc = { workspace = true } solana-rpc-client = { workspace = true } solana-rpc-client-api = { workspace = true } diff --git a/bench-tps/src/bench_tps_client/tpu_client.rs b/bench-tps/src/bench_tps_client/tpu_client.rs index 6c053271ad3eec..fbdae6ce02e32b 100644 --- a/bench-tps/src/bench_tps_client/tpu_client.rs +++ b/bench-tps/src/bench_tps_client/tpu_client.rs @@ -1,6 +1,5 @@ use { crate::bench_tps_client::{BenchTpsClient, BenchTpsError, Result}, - solana_client::tpu_client::TpuClient, solana_connection_cache::connection_cache::{ ConnectionManager, ConnectionPool, NewConnectionConfig, }, @@ -10,6 +9,7 @@ use { message::Message, pubkey::Pubkey, signature::Signature, slot_history::Slot, transaction::Transaction, }, + solana_tpu_client::tpu_client::TpuClient, solana_transaction_status::UiConfirmedBlock, }; diff --git a/bench-tps/src/main.rs b/bench-tps/src/main.rs index d3def39ed4d383..a5da5a515703c5 100644 --- a/bench-tps/src/main.rs +++ b/bench-tps/src/main.rs @@ -8,10 +8,7 @@ use { keypairs::get_keypairs, send_batch::{generate_durable_nonce_accounts, generate_keypairs}, }, - solana_client::{ - connection_cache::ConnectionCache, - tpu_client::{TpuClient, TpuClientConfig}, - }, + solana_client::connection_cache::ConnectionCache, solana_genesis::Base64Account, solana_rpc_client::rpc_client::RpcClient, solana_sdk::{ @@ -22,6 +19,7 @@ use { system_program, }, solana_streamer::streamer::StakedNodes, + solana_tpu_client::tpu_client::{TpuClient, TpuClientConfig}, std::{ collections::HashMap, fs::File, diff --git a/bench-tps/tests/bench_tps.rs b/bench-tps/tests/bench_tps.rs index bfff1f7e1250c4..857ae4cd2f7e20 100644 --- a/bench-tps/tests/bench_tps.rs +++ b/bench-tps/tests/bench_tps.rs @@ -7,7 +7,7 @@ use { cli::{Config, InstructionPaddingConfig}, send_batch::generate_durable_nonce_accounts, }, - solana_client::tpu_client::{TpuClient, TpuClientConfig}, + solana_connection_cache::connection_cache::NewConnectionConfig, solana_core::validator::ValidatorConfig, solana_faucet::faucet::run_local_faucet, solana_local_cluster::{ @@ -15,6 +15,7 @@ use { local_cluster::{ClusterConfig, LocalCluster}, validator_configs::make_identical_validator_configs, }, + solana_quic_client::{QuicConfig, QuicConnectionManager}, solana_rpc::rpc::JsonRpcConfig, solana_rpc_client::rpc_client::RpcClient, solana_sdk::{ @@ -26,6 +27,7 @@ use { }, solana_streamer::socket::SocketAddrSpace, solana_test_validator::TestValidatorGenesis, + solana_tpu_client::tpu_client::{TpuClient, TpuClientConfig}, std::{sync::Arc, time::Duration}, }; @@ -124,8 +126,17 @@ fn test_bench_tps_test_validator(config: Config) { CommitmentConfig::processed(), )); let websocket_url = test_validator.rpc_pubsub_url(); - let client = - Arc::new(TpuClient::new(rpc_client, &websocket_url, TpuClientConfig::default()).unwrap()); + + let client = Arc::new( + TpuClient::new( + "tpu_client_quic_bench_tps", + rpc_client, + &websocket_url, + TpuClientConfig::default(), + QuicConnectionManager::new_with_connection_config(QuicConfig::new().unwrap()), + ) + .expect("Should build Quic Tpu Client."), + ); let lamports_per_account = 1000; diff --git a/client/src/tpu_client.rs b/client/src/tpu_client.rs index 555d3aad88bcb1..893761637ce64d 100644 --- a/client/src/tpu_client.rs +++ b/client/src/tpu_client.rs @@ -21,11 +21,9 @@ pub use { solana_tpu_client::tpu_client::{TpuClientConfig, DEFAULT_FANOUT_SLOTS, MAX_FANOUT_SLOTS}, }; -pub type QuicTpuClient = TpuClient; - pub enum TpuClientWrapper { - Quic(TpuClient), - Udp(TpuClient), + Quic(BackendTpuClient), + Udp(BackendTpuClient), } /// Client which sends transactions directly to the current leader's TPU port over UDP. diff --git a/dos/src/main.rs b/dos/src/main.rs index 15874a86973f9c..5b46b7b6496719 100644 --- a/dos/src/main.rs +++ b/dos/src/main.rs @@ -795,6 +795,7 @@ fn main() { DEFAULT_TPU_CONNECTION_POOL_SIZE, ), }; + let client = get_client(&validators, Arc::new(connection_cache)); (gossip_nodes, Some(client)) } else { @@ -818,7 +819,6 @@ fn main() { pub mod test { use { super::*, - solana_client::tpu_client::QuicTpuClient, solana_core::validator::ValidatorConfig, solana_faucet::faucet::run_local_faucet, solana_gossip::contact_info::LegacyContactInfo, @@ -827,8 +827,10 @@ pub mod test { local_cluster::{ClusterConfig, LocalCluster}, validator_configs::make_identical_validator_configs, }, + solana_quic_client::{QuicConfig, QuicConnectionManager, QuicPool}, solana_rpc::rpc::JsonRpcConfig, solana_sdk::timing::timestamp, + solana_tpu_client::tpu_client::TpuClient, }; const TEST_SEND_BATCH_SIZE: usize = 1; @@ -836,7 +838,9 @@ pub mod test { // thin wrapper for the run_dos function // to avoid specifying everywhere generic parameters fn run_dos_no_client(nodes: &[ContactInfo], iterations: usize, params: DosClientParameters) { - run_dos::(nodes, iterations, None, params); + run_dos::>( + nodes, iterations, None, params, + ); } #[test] diff --git a/gossip/src/gossip_service.rs b/gossip/src/gossip_service.rs index 0bc258306edb32..d1c726051e6558 100644 --- a/gossip/src/gossip_service.rs +++ b/gossip/src/gossip_service.rs @@ -5,9 +5,7 @@ use { crossbeam_channel::{unbounded, Sender}, rand::{thread_rng, Rng}, solana_client::{ - connection_cache::ConnectionCache, - rpc_client::RpcClient, - tpu_client::{TpuClient, TpuClientConfig, TpuClientWrapper}, + connection_cache::ConnectionCache, rpc_client::RpcClient, tpu_client::TpuClientWrapper, }, solana_perf::recycler::Recycler, solana_runtime::bank_forks::BankForks, @@ -19,6 +17,7 @@ use { socket::SocketAddrSpace, streamer::{self, StreamerReceiveStats}, }, + solana_tpu_client::tpu_client::{TpuClient, TpuClientConfig}, std::{ collections::HashSet, net::{SocketAddr, TcpListener, UdpSocket}, diff --git a/local-cluster/src/cluster.rs b/local-cluster/src/cluster.rs index 425f65c48e14c5..5fab8df55205df 100644 --- a/local-cluster/src/cluster.rs +++ b/local-cluster/src/cluster.rs @@ -1,13 +1,17 @@ use { - solana_client::{thin_client::ThinClient, tpu_client::QuicTpuClient}, + solana_client::thin_client::ThinClient, solana_core::validator::{Validator, ValidatorConfig}, solana_gossip::{cluster_info::Node, contact_info::ContactInfo}, solana_ledger::shred::Shred, + solana_quic_client::{QuicConfig, QuicConnectionManager, QuicPool}, solana_sdk::{commitment_config::CommitmentConfig, pubkey::Pubkey, signature::Keypair}, solana_streamer::socket::SocketAddrSpace, + solana_tpu_client::tpu_client::TpuClient, std::{io::Result, path::PathBuf, sync::Arc}, }; +pub type QuicTpuClient = TpuClient; + pub struct ValidatorInfo { pub keypair: Arc, pub voting_keypair: Arc, diff --git a/local-cluster/src/local_cluster.rs b/local-cluster/src/local_cluster.rs index 400f4f73f78c26..d06c001bcc7ed1 100644 --- a/local-cluster/src/local_cluster.rs +++ b/local-cluster/src/local_cluster.rs @@ -1,6 +1,6 @@ use { crate::{ - cluster::{Cluster, ClusterValidatorInfo, ValidatorInfo}, + cluster::{Cluster, ClusterValidatorInfo, QuicTpuClient, ValidatorInfo}, cluster_tests, validator_configs::*, }, @@ -8,10 +8,7 @@ use { log::*, solana_accounts_db::utils::create_accounts_run_and_snapshot_dirs, solana_client::{ - connection_cache::ConnectionCache, - rpc_client::RpcClient, - thin_client::ThinClient, - tpu_client::{QuicTpuClient, TpuClient, TpuClientConfig}, + connection_cache::ConnectionCache, rpc_client::RpcClient, thin_client::ThinClient, }, solana_core::{ consensus::tower_storage::FileTowerStorage, @@ -52,7 +49,8 @@ use { solana_stake_program::stake_state, solana_streamer::socket::SocketAddrSpace, solana_tpu_client::tpu_client::{ - DEFAULT_TPU_CONNECTION_POOL_SIZE, DEFAULT_TPU_ENABLE_UDP, DEFAULT_TPU_USE_QUIC, + TpuClient, TpuClientConfig, DEFAULT_TPU_CONNECTION_POOL_SIZE, DEFAULT_TPU_ENABLE_UDP, + DEFAULT_TPU_USE_QUIC, }, solana_vote_program::{ vote_instruction,