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

switch to solana-tpu-client from solana_client::tpu_client for bench-tps, dos/, LocalCluster, gossip/ #310

Merged
merged 2 commits into from
Mar 21, 2024
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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions bench-tps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion bench-tps/src/bench_tps_client/tpu_client.rs
Original file line number Diff line number Diff line change
@@ -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,
},
Expand All @@ -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,
};

Expand Down
6 changes: 2 additions & 4 deletions bench-tps/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand All @@ -22,6 +19,7 @@ use {
system_program,
},
solana_streamer::streamer::StakedNodes,
solana_tpu_client::tpu_client::{TpuClient, TpuClientConfig},
std::{
collections::HashMap,
fs::File,
Expand Down
17 changes: 14 additions & 3 deletions bench-tps/tests/bench_tps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ 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::{
cluster::Cluster,
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::{
Expand All @@ -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},
};

Expand Down Expand Up @@ -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;

Expand Down
6 changes: 2 additions & 4 deletions client/src/tpu_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 6 additions & 2 deletions dos/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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,
Expand All @@ -827,16 +827,20 @@ 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;

// 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]
Expand Down
5 changes: 2 additions & 3 deletions gossip/src/gossip_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -19,6 +17,7 @@ use {
socket::SocketAddrSpace,
streamer::{self, StreamerReceiveStats},
},
solana_tpu_client::tpu_client::{TpuClient, TpuClientConfig},
std::{
collections::HashSet,
net::{SocketAddr, TcpListener, UdpSocket},
Expand Down
6 changes: 5 additions & 1 deletion local-cluster/src/cluster.rs
Original file line number Diff line number Diff line change
@@ -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>,
Expand Down
10 changes: 4 additions & 6 deletions local-cluster/src/local_cluster.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
use {
crate::{
cluster::{Cluster, ClusterValidatorInfo, ValidatorInfo},
cluster::{Cluster, ClusterValidatorInfo, QuicTpuClient, ValidatorInfo},
cluster_tests,
validator_configs::*,
},
itertools::izip,
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,
Expand Down Expand Up @@ -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,
Expand Down
Loading