From dbc16413d6f9a79f454d8c1ab2528f938dbd5396 Mon Sep 17 00:00:00 2001 From: yihau Date: Mon, 24 Jun 2024 10:42:52 +0800 Subject: [PATCH 1/3] add dcou to apply_votes_to_tower --- Cargo.lock | 1 + local-cluster/Cargo.toml | 1 + local-cluster/src/cluster_tests.rs | 16 +++++++++++----- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8d76491cac02a3..3e877a9daf1a45 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6555,6 +6555,7 @@ dependencies = [ "solana-entry", "solana-gossip", "solana-ledger", + "solana-local-cluster", "solana-logger", "solana-pubsub-client", "solana-quic-client", diff --git a/local-cluster/Cargo.toml b/local-cluster/Cargo.toml index 0d72a867c60ac1..94d3d3e501e1cf 100644 --- a/local-cluster/Cargo.toml +++ b/local-cluster/Cargo.toml @@ -49,6 +49,7 @@ solana-core = { workspace = true, features = ["dev-context-only-utils"] } solana-download-utils = { workspace = true } solana-ledger = { workspace = true, features = ["dev-context-only-utils"] } solana-runtime = { workspace = true, features = ["dev-context-only-utils"] } +solana-local-cluster = { path = ".", features = ["dev-context-only-utils"] } [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] diff --git a/local-cluster/src/cluster_tests.rs b/local-cluster/src/cluster_tests.rs index e297457dcc3bd5..fe06c65aa9793f 100644 --- a/local-cluster/src/cluster_tests.rs +++ b/local-cluster/src/cluster_tests.rs @@ -8,10 +8,7 @@ use { rand::{thread_rng, Rng}, rayon::{prelude::*, ThreadPool}, solana_client::connection_cache::{ConnectionCache, Protocol}, - solana_core::consensus::{ - tower_storage::{FileTowerStorage, SavedTower, SavedTowerVersions, TowerStorage}, - VOTE_THRESHOLD_DEPTH, - }, + solana_core::consensus::VOTE_THRESHOLD_DEPTH, solana_entry::entry::{self, Entry, EntrySlice}, solana_gossip::{ cluster_info::{self, ClusterInfo}, @@ -44,7 +41,7 @@ use { std::{ collections::{HashMap, HashSet, VecDeque}, net::{IpAddr, Ipv4Addr, SocketAddr, TcpListener}, - path::{Path, PathBuf}, + path::Path, sync::{ atomic::{AtomicBool, Ordering}, Arc, RwLock, @@ -54,6 +51,14 @@ use { }, }; +#[cfg(feature = "dev-context-only-utils")] +use { + solana_core::consensus::tower_storage::{ + FileTowerStorage, SavedTower, SavedTowerVersions, TowerStorage, + }, + std::path::PathBuf, +}; + pub fn get_client_facing_addr( protocol: Protocol, contact_info: &ContactInfo, @@ -348,6 +353,7 @@ pub fn kill_entry_and_spend_and_verify_rest( } } +#[cfg(feature = "dev-context-only-utils")] pub fn apply_votes_to_tower(node_keypair: &Keypair, votes: Vec<(Slot, Hash)>, tower_path: PathBuf) { let tower_storage = FileTowerStorage::new(tower_path); let mut tower = tower_storage.load(&node_keypair.pubkey()).unwrap(); From 0753c43541df5baf550408a2339915e58cdb8ed9 Mon Sep 17 00:00:00 2001 From: yihau Date: Mon, 24 Jun 2024 14:00:00 +0800 Subject: [PATCH 2/3] cargo sort --- local-cluster/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/local-cluster/Cargo.toml b/local-cluster/Cargo.toml index 94d3d3e501e1cf..3e4cbc0e366531 100644 --- a/local-cluster/Cargo.toml +++ b/local-cluster/Cargo.toml @@ -48,8 +48,8 @@ serial_test = { workspace = true } solana-core = { workspace = true, features = ["dev-context-only-utils"] } solana-download-utils = { workspace = true } solana-ledger = { workspace = true, features = ["dev-context-only-utils"] } -solana-runtime = { workspace = true, features = ["dev-context-only-utils"] } solana-local-cluster = { path = ".", features = ["dev-context-only-utils"] } +solana-runtime = { workspace = true, features = ["dev-context-only-utils"] } [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] From 1b0e6353fd9a25bc0209305fadc1a734083bc75b Mon Sep 17 00:00:00 2001 From: yihau Date: Mon, 24 Jun 2024 18:35:57 +0800 Subject: [PATCH 3/3] fix fmt --- local-cluster/src/cluster_tests.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/local-cluster/src/cluster_tests.rs b/local-cluster/src/cluster_tests.rs index fe06c65aa9793f..9b80c15824f494 100644 --- a/local-cluster/src/cluster_tests.rs +++ b/local-cluster/src/cluster_tests.rs @@ -50,7 +50,6 @@ use { time::{Duration, Instant}, }, }; - #[cfg(feature = "dev-context-only-utils")] use { solana_core::consensus::tower_storage::{