From f88ac48a0148e003d5ff5071138fc9280d0d047a Mon Sep 17 00:00:00 2001 From: mango-dee Date: Tue, 26 Nov 2024 13:03:41 +0800 Subject: [PATCH] Sets requested tilde and fixes some clippy errors --- Cargo.toml | 28 +++++++++---------- accounts/src/inmemory_account_store.rs | 2 +- .../src/address_lookup_table_store.rs | 8 +++--- .../src/postgres/confirmation_slot.rs | 27 ------------------ benchrunner-service/src/postgres/mod.rs | 1 - core/src/stores/block_information_store.rs | 6 ++-- services/Cargo.toml | 3 ++ services/src/tpu_utils/tpu_service.rs | 4 +-- util/src/histogram_nbuckets.rs | 4 +-- 9 files changed, 29 insertions(+), 54 deletions(-) delete mode 100644 benchrunner-service/src/postgres/confirmation_slot.rs diff --git a/Cargo.toml b/Cargo.toml index 88370dd3..d2eaa551 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,20 +28,20 @@ license = "AGPL" edition = "2021" [workspace.dependencies] -solana-sdk = "2.0.16" -solana-rpc-client = "2.0.16" -solana-rpc-client-api = "2.0.16" -solana-transaction-status = "2.0.16" -solana-version = "2.0.16" -solana-client = "2.0.16" -solana-net-utils = "2.0.16" -solana-pubsub-client = "2.0.16" -solana-streamer = "2.0.16" -solana-account-decoder = "2.0.16" -solana-ledger = "2.0.16" -solana-program = "2.0.16" -solana-accounts-db = "2.0.16" -solana-address-lookup-table-program = "2.0.16" +solana-sdk = "~2.0.16" +solana-rpc-client = "~2.0.16" +solana-rpc-client-api = "~2.0.16" +solana-transaction-status = "~2.0.16" +solana-version = "~2.0.16" +solana-client = "~2.0.16" +solana-net-utils = "~2.0.16" +solana-pubsub-client = "~2.0.16" +solana-streamer = "~2.0.16" +solana-account-decoder = "~2.0.16" +solana-ledger = "~2.0.16" +solana-program = "~2.0.16" +solana-accounts-db = "~2.0.16" +solana-address-lookup-table-program = "~2.0.16" itertools = "0.10.5" rangetools = "0.1.4" serde = { version = "1.0.160", features = ["derive"] } diff --git a/accounts/src/inmemory_account_store.rs b/accounts/src/inmemory_account_store.rs index 0e534ea1..065366b6 100644 --- a/accounts/src/inmemory_account_store.rs +++ b/accounts/src/inmemory_account_store.rs @@ -92,7 +92,7 @@ impl AccountDataByCommitment { .unwrap_or(true); let mut updated = false; - if self.processed_accounts.get(&data.updated_slot).is_none() { + if !self.processed_accounts.contains_key(&data.updated_slot) { // processed not present for the slot self.processed_accounts .insert(data.updated_slot, data.clone()); diff --git a/address-lookup-tables/src/address_lookup_table_store.rs b/address-lookup-tables/src/address_lookup_table_store.rs index 91714dd8..e0e28d33 100644 --- a/address-lookup-tables/src/address_lookup_table_store.rs +++ b/address-lookup-tables/src/address_lookup_table_store.rs @@ -3,11 +3,11 @@ use std::{sync::Arc, time::Duration}; use async_trait::async_trait; use dashmap::DashMap; use itertools::Itertools; -use prometheus::{IntGauge, opts, register_int_gauge}; +use prometheus::{opts, register_int_gauge, IntGauge}; use serde::{Deserialize, Serialize}; use solana_rpc_client::nonblocking::rpc_client::RpcClient; -use solana_sdk::{commitment_config::CommitmentConfig, pubkey::Pubkey}; use solana_sdk::address_lookup_table::state::AddressLookupTable; +use solana_sdk::{commitment_config::CommitmentConfig, pubkey::Pubkey}; use solana_lite_rpc_core::traits::address_lookup_table_interface::AddressLookupTableInterface; @@ -222,12 +222,12 @@ impl AddressLookupTableInterface for AddressLookupTableStore { &message_address_table_lookup.account_key, &message_address_table_lookup.writable_indexes, ) - .await, + .await, self.get_accounts( &message_address_table_lookup.account_key, &message_address_table_lookup.readonly_indexes, ) - .await, + .await, ) } diff --git a/benchrunner-service/src/postgres/confirmation_slot.rs b/benchrunner-service/src/postgres/confirmation_slot.rs deleted file mode 100644 index f1cf6897..00000000 --- a/benchrunner-service/src/postgres/confirmation_slot.rs +++ /dev/null @@ -1,27 +0,0 @@ -use std::time::SystemTime; - -#[derive(Debug)] -pub struct PostgresConfirmationSlot { - pub signature: String, - pub bench_datetime: SystemTime, - pub slot_sent: u64, - pub slot_confirmed: u64, - pub endpoint: String, - pub confirmed: bool, - pub confirmation_time_ms: f32, -} - -// impl PostgresConfirmationSlot { -// pub fn to_values() -> &[&(dyn ToSql + Sync)] { -// let values: &[&(dyn ToSql + Sync)] = &[ -// &self.signature, -// &self.bench_datetime, -// &(self.slot_sent as i64), -// &(self.slot_confirmed as i64), -// &self.endpoint, -// &self.confirmed, -// &self.confirmation_time_ms, -// ]; -// values -// } -// } diff --git a/benchrunner-service/src/postgres/mod.rs b/benchrunner-service/src/postgres/mod.rs index e0750dc5..3131825c 100644 --- a/benchrunner-service/src/postgres/mod.rs +++ b/benchrunner-service/src/postgres/mod.rs @@ -1,4 +1,3 @@ -pub mod confirmation_slot; pub mod metrics_dbstore; pub mod postgres_session; pub mod postgres_session_cache; diff --git a/core/src/stores/block_information_store.rs b/core/src/stores/block_information_store.rs index 5ab7c547..6a203397 100644 --- a/core/src/stores/block_information_store.rs +++ b/core/src/stores/block_information_store.rs @@ -48,9 +48,9 @@ impl BlockInformation { } /// - Block Information Store -/// This structure will store block information till where finalized block is still in range of last valid block hash. -/// So 300 blocks for last valid blockhash and 32 slots between confirmed and finalized. -/// So it should not store more than 400 blocks information. +/// This structure will store block information till where finalized block is still in range of last valid block hash. +/// So 300 blocks for last valid blockhash and 32 slots between confirmed and finalized. +/// So it should not store more than 400 blocks information. #[derive(Clone)] pub struct BlockInformationStore { // maps Block Hash -> Block information diff --git a/services/Cargo.toml b/services/Cargo.toml index 3b4d72b9..47b09909 100644 --- a/services/Cargo.toml +++ b/services/Cargo.toml @@ -46,3 +46,6 @@ tracing = { workspace = true } # note: version 0.5.6 has a known bug crossbeam-channel = "0.5.6" countmap = "0.2.0" + +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(loom)', 'cfg(tokio_unstable)'] } \ No newline at end of file diff --git a/services/src/tpu_utils/tpu_service.rs b/services/src/tpu_utils/tpu_service.rs index b100137d..4b4c31ea 100644 --- a/services/src/tpu_utils/tpu_service.rs +++ b/services/src/tpu_utils/tpu_service.rs @@ -14,9 +14,9 @@ use solana_lite_rpc_core::traits::leaders_fetcher_interface::LeaderFetcherInterf use solana_lite_rpc_core::types::SlotStream; use solana_lite_rpc_core::AnyhowJoinHandle; use solana_sdk::{quic::QUIC_PORT_OFFSET, signature::Keypair, slot_history::Slot}; -use std::collections::HashMap; -use std::{sync::Arc}; use solana_streamer::tls_certificates::new_dummy_x509_certificate; +use std::collections::HashMap; +use std::sync::Arc; lazy_static::lazy_static! { static ref NB_CLUSTER_NODES: GenericGauge = diff --git a/util/src/histogram_nbuckets.rs b/util/src/histogram_nbuckets.rs index 3334b74e..5910372b 100644 --- a/util/src/histogram_nbuckets.rs +++ b/util/src/histogram_nbuckets.rs @@ -2,8 +2,8 @@ pub fn histogram(values: &[f64], bins: usize) -> Vec<(f64, usize)> { assert!(bins >= 2); let mut bucket: Vec = vec![0; bins]; - let mut min = std::f64::MAX; - let mut max = std::f64::MIN; + let mut min = f64::MAX; + let mut max = f64::MIN; for val in values { min = min.min(*val); max = max.max(*val);