Skip to content

Commit

Permalink
switch to QuicTpuClient
Browse files Browse the repository at this point in the history
  • Loading branch information
gregcusack committed Mar 18, 2024
1 parent 76ec779 commit a5bd940
Show file tree
Hide file tree
Showing 7 changed files with 8,137 additions and 18 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

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

2 changes: 0 additions & 2 deletions client/src/tpu_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ pub use {
solana_tpu_client::tpu_client::{TpuClientConfig, DEFAULT_FANOUT_SLOTS, MAX_FANOUT_SLOTS},
};

pub type QuicTpuClient = TpuClient<QuicPool, QuicConnectionManager, QuicConfig>;

/// Client which sends transactions directly to the current leader's TPU port over UDP.
/// The client uses RPC to determine the current leader and fetch node contact info
/// This is just a thin wrapper over the "BackendTpuClient", use that directly for more efficiency.
Expand Down
7 changes: 2 additions & 5 deletions dos/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -824,20 +824,17 @@ 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,
solana_tpu_client::tpu_client::QuicTpuClient,
};

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::<TpuClient<QuicPool, QuicConnectionManager, QuicConfig>>(
nodes, iterations, None, params,
);
run_dos::<QuicTpuClient>(nodes, iterations, None, params);
}

#[test]
Expand Down
7 changes: 3 additions & 4 deletions local-cluster/src/cluster.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
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_sdk::{commitment_config::CommitmentConfig, pubkey::Pubkey, signature::Keypair},
solana_streamer::socket::SocketAddrSpace,
solana_tpu_client::tpu_client::QuicTpuClient2,
solana_tpu_client::tpu_client::QuicTpuClient,
std::{io::Result, path::PathBuf, sync::Arc},
};

Expand Down Expand Up @@ -40,11 +39,11 @@ impl ClusterValidatorInfo {
pub trait Cluster {
fn get_node_pubkeys(&self) -> Vec<Pubkey>;
fn get_validator_client(&self, pubkey: &Pubkey) -> Option<ThinClient>;
fn build_tpu_quic_client(&self) -> Result<QuicTpuClient2>;
fn build_tpu_quic_client(&self) -> Result<QuicTpuClient>;
fn build_tpu_quic_client_with_commitment(
&self,
commitment_config: CommitmentConfig,
) -> Result<QuicTpuClient2>;
) -> Result<QuicTpuClient>;
fn get_contact_info(&self, pubkey: &Pubkey) -> Option<&ContactInfo>;
fn exit_node(&mut self, pubkey: &Pubkey) -> ClusterValidatorInfo;
fn restart_node(
Expand Down
8 changes: 4 additions & 4 deletions local-cluster/src/local_cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ use {
solana_stake_program::stake_state,
solana_streamer::socket::SocketAddrSpace,
solana_tpu_client::tpu_client::{
QuicTpuClient2, TpuClient as TpuClientBlocking, TpuClientConfig,
QuicTpuClient, TpuClient as TpuClientBlocking, TpuClientConfig,
DEFAULT_TPU_CONNECTION_POOL_SIZE, DEFAULT_TPU_ENABLE_UDP, DEFAULT_TPU_USE_QUIC,
},
solana_vote_program::{
Expand Down Expand Up @@ -806,7 +806,7 @@ impl LocalCluster {
}
}

fn build_tpu_client<F>(&self, rpc_client_builder: F) -> Result<QuicTpuClient2>
fn build_tpu_client<F>(&self, rpc_client_builder: F) -> Result<QuicTpuClient>
where
F: FnOnce(String) -> Arc<RpcClient>,
{
Expand Down Expand Up @@ -851,14 +851,14 @@ impl Cluster for LocalCluster {
})
}

fn build_tpu_quic_client(&self) -> Result<QuicTpuClient2> {
fn build_tpu_quic_client(&self) -> Result<QuicTpuClient> {
self.build_tpu_client(|rpc_url| Arc::new(RpcClient::new(rpc_url)))
}

fn build_tpu_quic_client_with_commitment(
&self,
commitment_config: CommitmentConfig,
) -> Result<QuicTpuClient2> {
) -> Result<QuicTpuClient> {
self.build_tpu_client(|rpc_url| {
Arc::new(RpcClient::new_with_commitment(rpc_url, commitment_config))
})
Expand Down
Loading

0 comments on commit a5bd940

Please sign in to comment.