From e433c38395e445de3a66349aad7d8ab0bdbe2b02 Mon Sep 17 00:00:00 2001 From: Carl Lin Date: Tue, 17 Dec 2024 20:27:57 -0500 Subject: [PATCH] remove unnecessary methods --- bench-tps/tests/bench_tps.rs | 2 +- dos/src/main.rs | 4 ++-- local-cluster/src/cluster.rs | 5 ----- local-cluster/src/local_cluster.rs | 20 ++++---------------- local-cluster/tests/local_cluster.rs | 12 +++++++++--- 5 files changed, 16 insertions(+), 27 deletions(-) diff --git a/bench-tps/tests/bench_tps.rs b/bench-tps/tests/bench_tps.rs index da710aed285ce7..eb2ab2540006e8 100644 --- a/bench-tps/tests/bench_tps.rs +++ b/bench-tps/tests/bench_tps.rs @@ -80,7 +80,7 @@ fn test_bench_tps_local_cluster(config: Config) { let client = Arc::new( cluster - .build_entrypoint_tpu_quic_client() + .build_validator_tpu_quic_client(cluster.entry_point_info.pubkey()) .unwrap_or_else(|err| { panic!("Could not create TpuClient with Quic Cache {err:?}"); }), diff --git a/dos/src/main.rs b/dos/src/main.rs index e809fb6d11c1d8..8651d3726c479f 100644 --- a/dos/src/main.rs +++ b/dos/src/main.rs @@ -972,7 +972,7 @@ pub mod test { let client = Arc::new( cluster - .build_entrypoint_tpu_quic_client() + .build_validator_tpu_quic_client(cluster.entry_point_info.pubkey()) .unwrap_or_else(|err| { panic!("Could not create TpuClient with Quic Cache {err:?}"); }), @@ -1106,7 +1106,7 @@ pub mod test { let client = Arc::new( cluster - .build_entrypoint_tpu_quic_client() + .build_validator_tpu_quic_client(cluster.entry_point_info.pubkey()) .unwrap_or_else(|err| { panic!("Could not create TpuClient with Quic Cache {err:?}"); }), diff --git a/local-cluster/src/cluster.rs b/local-cluster/src/cluster.rs index e8bda3d91513ec..6f443f91740576 100644 --- a/local-cluster/src/cluster.rs +++ b/local-cluster/src/cluster.rs @@ -46,11 +46,6 @@ pub trait Cluster { pubkey: &Pubkey, commitment_config: CommitmentConfig, ) -> Result; - fn build_entrypoint_tpu_quic_client(&self) -> Result; - fn build_entrypoint_tpu_quic_client_with_commitment( - &self, - commitment_config: CommitmentConfig, - ) -> Result; fn get_contact_info(&self, pubkey: &Pubkey) -> Option<&ContactInfo>; fn exit_node(&mut self, pubkey: &Pubkey) -> ClusterValidatorInfo; fn restart_node( diff --git a/local-cluster/src/local_cluster.rs b/local-cluster/src/local_cluster.rs index bafa89a326b245..ce3d82dcddfe84 100644 --- a/local-cluster/src/local_cluster.rs +++ b/local-cluster/src/local_cluster.rs @@ -493,7 +493,9 @@ impl LocalCluster { mut voting_keypair: Option>, socket_addr_space: SocketAddrSpace, ) -> Pubkey { - let client = self.build_entrypoint_tpu_quic_client().expect("tpu_client"); + let client = self + .build_validator_tpu_quic_client(self.entry_point_info.pubkey()) + .expect("tpu_client"); // Must have enough tokens to fund vote account and set delegate let should_create_vote_pubkey = voting_keypair.is_none(); @@ -593,7 +595,7 @@ impl LocalCluster { pub fn transfer(&self, source_keypair: &Keypair, dest_pubkey: &Pubkey, lamports: u64) -> u64 { let client = self - .build_entrypoint_tpu_quic_client() + .build_validator_tpu_quic_client(self.entry_point_info.pubkey()) .expect("new tpu quic client"); Self::transfer_with_client(&client, source_keypair, dest_pubkey, lamports) } @@ -995,20 +997,6 @@ impl Cluster for LocalCluster { self.build_tpu_client(rpc_client, contact_info.rpc_pubsub().unwrap()) } - fn build_entrypoint_tpu_quic_client(&self) -> Result { - self.build_validator_tpu_quic_client(self.entry_point_info.pubkey()) - } - - fn build_entrypoint_tpu_quic_client_with_commitment( - &self, - commitment_config: CommitmentConfig, - ) -> Result { - self.build_validator_tpu_quic_client_with_commitment( - self.entry_point_info.pubkey(), - commitment_config, - ) - } - fn exit_node(&mut self, pubkey: &Pubkey) -> ClusterValidatorInfo { let mut node = self.validators.remove(pubkey).unwrap(); diff --git a/local-cluster/tests/local_cluster.rs b/local-cluster/tests/local_cluster.rs index 4c3405489d7dcd..79c6fcd08908d5 100644 --- a/local-cluster/tests/local_cluster.rs +++ b/local-cluster/tests/local_cluster.rs @@ -222,7 +222,9 @@ fn test_local_cluster_signature_subscribe() { .unwrap(); let non_bootstrap_info = cluster.get_contact_info(&non_bootstrap_id).unwrap(); - let tx_client = cluster.build_entrypoint_tpu_quic_client().unwrap(); + let tx_client = cluster + .build_validator_tpu_quic_client(cluster.entry_point_info.pubkey()) + .unwrap(); let (blockhash, _) = tx_client .rpc_client() @@ -431,7 +433,9 @@ fn test_mainnet_beta_cluster_type() { .unwrap(); assert_eq!(cluster_nodes.len(), 1); - let client = cluster.build_entrypoint_tpu_quic_client().unwrap(); + let client = cluster + .build_validator_tpu_quic_client(cluster.entry_point_info.pubkey()) + .unwrap(); // Programs that are available at epoch 0 for program_id in [ @@ -2729,7 +2733,9 @@ fn test_oc_bad_signatures() { ); // 3) Start up a spy to listen for and push votes to leader TPU - let client = cluster.build_entrypoint_tpu_quic_client().unwrap(); + let client = cluster + .build_validator_tpu_quic_client(cluster.entry_point_info.pubkey()) + .unwrap(); let cluster_funding_keypair = cluster.funding_keypair.insecure_clone(); let voter_thread_sleep_ms: usize = 100; let num_votes_simulated = Arc::new(AtomicUsize::new(0));