Skip to content

Commit

Permalink
remove unnecessary methods
Browse files Browse the repository at this point in the history
  • Loading branch information
carllin committed Dec 18, 2024
1 parent 987adec commit e433c38
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 27 deletions.
2 changes: 1 addition & 1 deletion bench-tps/tests/bench_tps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:?}");
}),
Expand Down
4 changes: 2 additions & 2 deletions dos/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:?}");
}),
Expand Down Expand Up @@ -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:?}");
}),
Expand Down
5 changes: 0 additions & 5 deletions local-cluster/src/cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ pub trait Cluster {
pubkey: &Pubkey,
commitment_config: CommitmentConfig,
) -> Result<QuicTpuClient>;
fn build_entrypoint_tpu_quic_client(&self) -> Result<QuicTpuClient>;
fn build_entrypoint_tpu_quic_client_with_commitment(
&self,
commitment_config: CommitmentConfig,
) -> Result<QuicTpuClient>;
fn get_contact_info(&self, pubkey: &Pubkey) -> Option<&ContactInfo>;
fn exit_node(&mut self, pubkey: &Pubkey) -> ClusterValidatorInfo;
fn restart_node(
Expand Down
20 changes: 4 additions & 16 deletions local-cluster/src/local_cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,9 @@ impl LocalCluster {
mut voting_keypair: Option<Arc<Keypair>>,
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();
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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<QuicTpuClient> {
self.build_validator_tpu_quic_client(self.entry_point_info.pubkey())
}

fn build_entrypoint_tpu_quic_client_with_commitment(
&self,
commitment_config: CommitmentConfig,
) -> Result<QuicTpuClient> {
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();

Expand Down
12 changes: 9 additions & 3 deletions local-cluster/tests/local_cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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 [
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit e433c38

Please sign in to comment.