switch to `solana-tpu-client` from `solana_client::tpu_client` for `bench-tps`, `dos/`, `LocalCluster`, `gossip/` (#310)
* switch over to solana-tpu-client for bench-tps, dos, gossip, local-cluster * put TpuClientWrapper back in solana_client
This commit is contained in:
parent
b2f4fb306e
commit
792d7454d9
|
@ -5581,6 +5581,7 @@ dependencies = [
|
|||
"solana-measure",
|
||||
"solana-metrics",
|
||||
"solana-net-utils",
|
||||
"solana-quic-client",
|
||||
"solana-rpc",
|
||||
"solana-rpc-client",
|
||||
"solana-rpc-client-api",
|
||||
|
|
|
@ -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 }
|
||||
|
|
|
@ -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,
|
||||
};
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -21,11 +21,9 @@ pub use {
|
|||
solana_tpu_client::tpu_client::{TpuClientConfig, DEFAULT_FANOUT_SLOTS, MAX_FANOUT_SLOTS},
|
||||
};
|
||||
|
||||
pub type QuicTpuClient = TpuClient<QuicPool, QuicConnectionManager, QuicConfig>;
|
||||
|
||||
pub enum TpuClientWrapper {
|
||||
Quic(TpuClient<QuicPool, QuicConnectionManager, QuicConfig>),
|
||||
Udp(TpuClient<UdpPool, UdpConnectionManager, UdpConfig>),
|
||||
Quic(BackendTpuClient<QuicPool, QuicConnectionManager, QuicConfig>),
|
||||
Udp(BackendTpuClient<UdpPool, UdpConnectionManager, UdpConfig>),
|
||||
}
|
||||
|
||||
/// Client which sends transactions directly to the current leader's TPU port over UDP.
|
||||
|
|
|
@ -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::<QuicTpuClient>(nodes, iterations, None, params);
|
||||
run_dos::<TpuClient<QuicPool, QuicConnectionManager, QuicConfig>>(
|
||||
nodes, iterations, None, params,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -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},
|
||||
|
|
|
@ -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<QuicPool, QuicConnectionManager, QuicConfig>;
|
||||
|
||||
pub struct ValidatorInfo {
|
||||
pub keypair: Arc<Keypair>,
|
||||
pub voting_keypair: Arc<Keypair>,
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue