Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
grooviegermanikus committed Mar 18, 2024
1 parent 233a9e2 commit 6496279
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 26 deletions.
7 changes: 3 additions & 4 deletions bench/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ use solana_rpc_client::nonblocking::rpc_client::RpcClient;
use solana_sdk::signature::Signature;
use solana_sdk::{
commitment_config::CommitmentConfig, hash::Hash, signature::Keypair, signer::Signer,
slot_history::Slot,
};
use std::sync::{
atomic::{AtomicU64, Ordering},
atomic::{AtomicU64},
Arc,
};
use tokio::{
sync::{mpsc::UnboundedSender, RwLock},
time::{Duration, Instant},
sync::RwLock,
time::{Duration},
};

#[tokio::main(flavor = "multi_thread", worker_threads = 16)]
Expand Down
15 changes: 6 additions & 9 deletions bench/src/oldbench.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
use crate::{
helpers::BenchHelper,
metrics::{AvgMetric, Metric, TxMetricData},
Args,
metrics::Metric,
metrics::TxMetricData,
};
use clap::Parser;
use dashmap::DashMap;
use futures::future::join_all;
use log::{error, info, warn};
use log::{warn};
use solana_rpc_client::nonblocking::rpc_client::RpcClient;
use solana_sdk::signature::Signature;
use solana_sdk::{
commitment_config::CommitmentConfig, hash::Hash, signature::Keypair, signer::Signer,
slot_history::Slot,
};
use solana_sdk::hash::Hash;
use solana_sdk::signature::Keypair;
use solana_sdk::slot_history::Slot;
use std::sync::{
atomic::{AtomicU64, Ordering},
Arc,
Expand Down
11 changes: 4 additions & 7 deletions bench/src/service_adapter.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
// adapter code for all from benchrunner-service

use crate::helpers::BenchHelper;
use crate::metrics::{AvgMetric, Metric, TxMetricData};
use crate::metrics::{Metric, TxMetricData};
use crate::oldbench;
use crate::oldbench::TransactionSize;
use crate::tx_size::TxSize;
use log::{debug, info};
use log::{debug};
use solana_rpc_client::nonblocking::rpc_client::RpcClient;
use solana_sdk::commitment_config::CommitmentConfig;
use solana_sdk::hash::Hash;
Expand Down Expand Up @@ -79,7 +78,7 @@ pub async fn bench_servicerunner(
// not used unless log_txs is set to true
let (tx_log_sx_null, _tx_log_rx) = tokio::sync::mpsc::unbounded_channel::<TxMetricData>();

let metric = oldbench::bench(
oldbench::bench(
rpc_client.clone(),
bench_config.tx_count,
funded_payer,
Expand All @@ -91,8 +90,6 @@ pub async fn bench_servicerunner(
transaction_size,
bench_config.cu_price_micro_lamports,
)
.await;

metric
.await
}
}
5 changes: 2 additions & 3 deletions benchrunner-service/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ pub struct TenantConfig {
pub fn get_funded_payer_from_env() -> Keypair {
let keypair58_string: String = std::env::var("FUNDED_PAYER_KEYPAIR58")
.expect("need funded payer keypair on env (variable FUNDED_PAYER_KEYPAIR58)");
let funded_payer = Keypair::from_base58_string(&keypair58_string);
funded_payer
Keypair::from_base58_string(&keypair58_string)
}

pub fn read_tenant_configs(env_vars: Vec<(String, String)>) -> Vec<TenantConfig> {
Expand All @@ -27,7 +26,7 @@ pub fn read_tenant_configs(env_vars: Vec<(String, String)>) -> Vec<TenantConfig>

let values = map
.iter()
.map(|(k, v)| TenantConfig {
.map(|(_k, v)| TenantConfig {
tenant_id: v
.iter()
.find(|(k, _)| k.ends_with("_ID"))
Expand Down
5 changes: 2 additions & 3 deletions benchrunner-service/src/postgres/metrics_dbstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use log::warn;
use postgres_types::ToSql;
use std::time::SystemTime;

#[allow(clippy::upper_case_acronyms)]
pub enum BenchRunStatus {
STARTED,
FINISHED,
Expand Down Expand Up @@ -44,7 +45,6 @@ pub async fn upsert_benchrun_status(

if let Err(err) = write_result {
warn!("Failed to upsert status (err {:?}) - continue", err);
return;
}
}

Expand All @@ -54,7 +54,7 @@ pub async fn save_metrics_to_postgres(
metric: &Metric,
benchrun_at: SystemTime,
) {
let metricjson = serde_json::to_value(&metric).unwrap();
let metricjson = serde_json::to_value(metric).unwrap();
let values: &[&(dyn ToSql + Sync)] = &[
&bench_config.tenant,
&benchrun_at,
Expand Down Expand Up @@ -86,6 +86,5 @@ pub async fn save_metrics_to_postgres(

if let Err(err) = write_result {
warn!("Failed to insert metrics (err {:?}) - continue", err);
return;
}
}
2 changes: 2 additions & 0 deletions util/src/secrets.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

pub fn obfuscate_rpcurl(rpc_addr: &str) -> String {
if rpc_addr.contains("rpcpool.com") {
return rpc_addr.replacen(char::is_numeric, "X", 99);
Expand Down

0 comments on commit 6496279

Please sign in to comment.