From 50bbe34b6680b1f0132762494f00b1d1c4c54fdf Mon Sep 17 00:00:00 2001 From: Rob Walker Date: Thu, 26 Sep 2019 13:29:05 -0700 Subject: [PATCH] rename locktower to tower (#6120) --- core/tests/fork-selection.rs | 17 +++++++---------- local_cluster/src/tests/local_cluster.rs | 6 +++--- programs/bpf/Cargo.lock | 21 +++++++++++---------- 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/core/tests/fork-selection.rs b/core/tests/fork-selection.rs index 5ec1e3125..aa099572c 100644 --- a/core/tests/fork-selection.rs +++ b/core/tests/fork-selection.rs @@ -129,7 +129,7 @@ impl Vote { } #[derive(Debug)] -pub struct LockTower { +pub struct Tower { votes: VecDeque, max_size: usize, fork_trunk: Fork, @@ -139,7 +139,7 @@ pub struct LockTower { parasite: bool, } -impl LockTower { +impl Tower { pub fn new(max_size: usize, converge_depth: usize, delay_count: usize) -> Self { Self { votes: VecDeque::new(), @@ -365,7 +365,7 @@ fn test_push_vote() { let tree = HashMap::new(); let bmap = HashMap::new(); let b0 = Fork { id: 0, base: 0 }; - let mut tower = LockTower::new(32, 7, 0); + let mut tower = Tower::new(32, 7, 0); let vote = Vote::new(b0.clone(), 0); assert!(tower.push_vote(vote, &tree, &bmap)); assert_eq!(tower.votes.len(), 1); @@ -415,10 +415,10 @@ fn test_push_vote() { assert_eq!(tower.votes[1].lockout, 16); } -fn create_towers(sz: usize, height: usize, delay_count: usize) -> Vec { +fn create_towers(sz: usize, height: usize, delay_count: usize) -> Vec { (0..sz) .into_iter() - .map(|_| LockTower::new(32, height, delay_count)) + .map(|_| Tower::new(32, height, delay_count)) .collect() } @@ -438,10 +438,7 @@ fn calc_fork_depth(fork_tree: &HashMap, id: usize) -> usize { /// map of `fork id` to `tower count` /// This map contains the number of nodes that have the fork as an ancestor. /// The fork with the highest count that is the newest is the cluster "trunk". -fn calc_fork_map( - towers: &Vec, - fork_tree: &HashMap, -) -> HashMap { +fn calc_fork_map(towers: &Vec, fork_tree: &HashMap) -> HashMap { let mut lca_map: HashMap = HashMap::new(); for tower in towers { let mut start = tower.last_fork(); @@ -463,7 +460,7 @@ fn calc_newest_trunk(bmap: &HashMap) -> (usize, usize) { data.last().map(|v| (*v.0, *v.1)).unwrap() } /// how common is the latest fork of all the nodes -fn calc_tip_converged(towers: &Vec, bmap: &HashMap) -> usize { +fn calc_tip_converged(towers: &Vec, bmap: &HashMap) -> usize { let sum: usize = towers .iter() .map(|n| *bmap.get(&n.last_fork().id).unwrap_or(&0)) diff --git a/local_cluster/src/tests/local_cluster.rs b/local_cluster/src/tests/local_cluster.rs index 42e21e736..bbd82f027 100644 --- a/local_cluster/src/tests/local_cluster.rs +++ b/local_cluster/src/tests/local_cluster.rs @@ -296,7 +296,7 @@ fn test_listener_startup() { #[allow(unused_attributes)] #[test] #[serial] -fn test_snapshot_restart_locktower() { +fn test_snapshot_restart_tower() { // First set up the cluster with 2 nodes let snapshot_interval_slots = 10; let num_account_paths = 4; @@ -342,11 +342,11 @@ fn test_snapshot_restart_locktower() { snapshot_utils::get_snapshot_tar_path(&validator_snapshot_test_config.snapshot_output_path); fs::hard_link(tar, &validator_tar_path).unwrap(); - // Restart validator from snapshot, the validator's locktower state in this snapshot + // Restart validator from snapshot, the validator's tower state in this snapshot // will contain slots < the root bank of the snapshot. Validator should not panic. cluster.restart_node(&validator_id, validator_info); - // Test cluster can still make progress and get confirmations in locktower + // Test cluster can still make progress and get confirmations in tower cluster_tests::spend_and_verify_all_nodes( &cluster.entry_point_info, &cluster.funding_keypair, diff --git a/programs/bpf/Cargo.lock b/programs/bpf/Cargo.lock index 9f38de017..9a2a39a04 100644 --- a/programs/bpf/Cargo.lock +++ b/programs/bpf/Cargo.lock @@ -102,7 +102,7 @@ dependencies = [ [[package]] name = "bincode" -version = "1.1.4" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1529,7 +1529,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "solana-bpf-loader-api" version = "0.20.0" dependencies = [ - "bincode 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "bincode 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1553,7 +1553,7 @@ dependencies = [ name = "solana-bpf-programs" version = "0.20.0" dependencies = [ - "bincode 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "bincode 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "elf 0.0.10 (registry+https://github.com/rust-lang/crates.io-index)", "solana-bpf-loader-api 0.20.0", @@ -1676,7 +1676,7 @@ dependencies = [ name = "solana-config-api" version = "0.20.0" dependencies = [ - "bincode 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "bincode 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1757,11 +1757,12 @@ dependencies = [ name = "solana-runtime" version = "0.20.0" dependencies = [ - "bincode 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "bincode 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "bv 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1793,7 +1794,7 @@ name = "solana-sdk" version = "0.20.0" dependencies = [ "assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "bincode 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "bincode 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "bs58 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1825,7 +1826,7 @@ version = "0.20.0" name = "solana-stake-api" version = "0.20.0" dependencies = [ - "bincode 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "bincode 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "num-derive 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1854,7 +1855,7 @@ name = "solana-storage-api" version = "0.20.0" dependencies = [ "assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "bincode 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "bincode 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "num-derive 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1869,7 +1870,7 @@ dependencies = [ name = "solana-vote-api" version = "0.20.0" dependencies = [ - "bincode 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "bincode 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "num-derive 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2504,7 +2505,7 @@ dependencies = [ "checksum backtrace 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)" = "5180c5a20655b14a819b652fd2378fa5f1697b6c9ddad3e695c2f9cedf6df4e2" "checksum backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "82a830b4ef2d1124a711c71d263c5abdc710ef8e907bd508c88be475cebc422b" "checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" -"checksum bincode 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9f04a5e50dc80b3d5d35320889053637d15011aed5e66b66b37ae798c65da6f7" +"checksum bincode 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8ab639324e3ee8774d296864fbc0dbbb256cf1a41c490b94cba90c082915f92" "checksum bit-vec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "02b4ff8b16e6076c3e14220b39fbc1fabb6737522281a388998046859400895f" "checksum bit-vec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f59bbe95d4e52a6398ec21238d31577f2b28a9d86807f06ca59d191d8440d0bb" "checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd"