rename locktower to tower (#6120)

This commit is contained in:
Rob Walker 2019-09-26 13:29:05 -07:00 committed by GitHub
parent c10b2e6cc0
commit 50bbe34b66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 23 deletions

View File

@ -129,7 +129,7 @@ impl Vote {
}
#[derive(Debug)]
pub struct LockTower {
pub struct Tower {
votes: VecDeque<Vote>,
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<LockTower> {
fn create_towers(sz: usize, height: usize, delay_count: usize) -> Vec<Tower> {
(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<usize, Fork>, 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<LockTower>,
fork_tree: &HashMap<usize, Fork>,
) -> HashMap<usize, usize> {
fn calc_fork_map(towers: &Vec<Tower>, fork_tree: &HashMap<usize, Fork>) -> HashMap<usize, usize> {
let mut lca_map: HashMap<usize, usize> = HashMap::new();
for tower in towers {
let mut start = tower.last_fork();
@ -463,7 +460,7 @@ fn calc_newest_trunk(bmap: &HashMap<usize, usize>) -> (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<LockTower>, bmap: &HashMap<usize, usize>) -> usize {
fn calc_tip_converged(towers: &Vec<Tower>, bmap: &HashMap<usize, usize>) -> usize {
let sum: usize = towers
.iter()
.map(|n| *bmap.get(&n.last_fork().id).unwrap_or(&0))

View File

@ -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,

View File

@ -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"