diff --git a/Cargo.lock b/Cargo.lock index a23ac57b11..f2766c1dff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -107,6 +107,12 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" +[[package]] +name = "autocfg" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" + [[package]] name = "backtrace" version = "0.3.40" @@ -255,12 +261,11 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.49" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e450b8da92aa6f274e7c6437692f9f2ce6d701fb73bacfcf87897b3f89a4c20e" +checksum = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd" dependencies = [ "jobserver", - "num_cpus", ] [[package]] @@ -409,7 +414,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5064ebdbf05ce3cb95e45c8b086f72263f4166b29b97f6baff7ef7fe047b55ac" dependencies = [ - "autocfg", + "autocfg 0.1.7", "cfg-if", "crossbeam-utils 0.7.0", "lazy_static", @@ -442,7 +447,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce446db02cdc3165b94ae73111e570793400d0794e46125cc4056c81cbb039f4" dependencies = [ - "autocfg", + "autocfg 0.1.7", "cfg-if", "lazy_static", ] @@ -541,6 +546,7 @@ dependencies = [ name = "dotenv" version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" [[package]] name = "dtoa" @@ -565,9 +571,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.7.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" +checksum = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3" dependencies = [ "atty", "humantime", @@ -578,14 +584,15 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.6.2" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" dependencies = [ - "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "atty", + "humantime", + "log", + "regex", + "termcolor", ] [[package]] @@ -817,7 +824,7 @@ dependencies = [ "libc", "libgit2-sys", "log", - "url 2.1.0", + "url 2.1.1", ] [[package]] @@ -911,14 +918,6 @@ dependencies = [ "quick-error", ] -[[package]] -name = "humantime" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "hyper" version = "0.12.35" @@ -990,7 +989,7 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712d7b3ea5827fcb9d4fda14bf4da5f136f0db2ae9c8f4bd4e2d1c6fde4e6db2" dependencies = [ - "autocfg", + "autocfg 0.1.7", ] [[package]] @@ -1015,8 +1014,9 @@ dependencies = [ name = "itertools" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" dependencies = [ - "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "either", ] [[package]] @@ -1238,7 +1238,7 @@ version = "0.1.0" dependencies = [ "log", "sphinx", - "tokio 0.2.8", + "tokio 0.2.9", ] [[package]] @@ -1290,21 +1290,21 @@ dependencies = [ [[package]] name = "num-integer" -version = "0.1.41" +version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09" +checksum = "3f6ea62e9d81a77cd3ee9a2a5b9b609447857f3d358704331e4ef39eb247fcba" dependencies = [ - "autocfg", + "autocfg 1.0.0", "num-traits", ] [[package]] name = "num-traits" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4c81ffc11c212fa327657cb19dd85eb7419e163b5b076bede2bdb5c974c07e4" +checksum = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096" dependencies = [ - "autocfg", + "autocfg 1.0.0", ] [[package]] @@ -1329,7 +1329,7 @@ dependencies = [ "curve25519-dalek", "directory-client", "dirs", - "env_logger", + "env_logger 0.7.1", "futures 0.3.1", "hex", "log", @@ -1343,7 +1343,7 @@ dependencies = [ "serde_json", "sfw-provider-requests", "sphinx", - "tokio 0.2.8", + "tokio 0.2.9", "tokio-tungstenite", "topology", "tungstenite", @@ -1361,7 +1361,7 @@ dependencies = [ "directory-client", "futures 0.3.1", "sphinx", - "tokio 0.2.8", + "tokio 0.2.9", ] [[package]] @@ -1383,26 +1383,26 @@ dependencies = [ "sfw-provider-requests", "sha2", "sphinx", - "tokio 0.2.8", + "tokio 0.2.9", ] [[package]] name = "nym-validator" version = "0.1.0" dependencies = [ - "built 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", - "directory-client 0.1.0", - "dotenv 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "pretty_env_logger 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", - "sphinx 0.1.0", - "tokio 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", - "topology 0.1.0", + "built", + "clap", + "directory-client", + "dotenv", + "futures 0.3.1", + "log", + "pretty_env_logger", + "serde", + "serde_derive", + "sphinx", + "tokio 0.2.9", + "toml", + "topology", ] [[package]] @@ -1437,7 +1437,7 @@ version = "0.9.53" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "465d16ae7fc0e313318f7de5cecf57b2fbe7511fd213978b457e1c96ff46736f" dependencies = [ - "autocfg", + "autocfg 0.1.7", "cc", "libc", "pkg-config", @@ -1541,10 +1541,11 @@ checksum = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b" name = "pretty_env_logger" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "717ee476b1690853d222af4634056d830b5197ffd747726a9a1eee6da9f49074" dependencies = [ - "chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono", + "env_logger 0.6.2", + "log", ] [[package]] @@ -1581,7 +1582,7 @@ dependencies = [ "log", "sfw-provider-requests", "sphinx", - "tokio 0.2.8", + "tokio 0.2.9", ] [[package]] @@ -1594,7 +1595,7 @@ dependencies = [ "idna 0.2.0", "lazy_static", "regex", - "url 2.1.0", + "url 2.1.1", ] [[package]] @@ -1618,7 +1619,7 @@ version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" dependencies = [ - "autocfg", + "autocfg 0.1.7", "libc", "rand_chacha 0.1.1", "rand_core 0.4.2", @@ -1650,7 +1651,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" dependencies = [ - "autocfg", + "autocfg 0.1.7", "rand_core 0.3.1", ] @@ -1755,7 +1756,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" dependencies = [ - "autocfg", + "autocfg 0.1.7", "rand_core 0.4.2", ] @@ -1797,9 +1798,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.3.1" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc220bd33bdce8f093101afe22a037b8eb0e5af33592e6a9caafff0d4cb81cbd" +checksum = "b5508c1941e4e7cb19965abef075d35a9a8b5cdf0846f30b4050e9b55dc55e87" dependencies = [ "aho-corasick", "memchr", @@ -1809,9 +1810,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.12" +version = "0.6.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11a7e20d1cce64ef2fed88b66d347f88bd9babb82845b2b858f3edbf59a4f716" +checksum = "e734e891f5b408a29efbf8309e656876276f49ab6a6ac208600b4419bd893d90" [[package]] name = "remove_dir_all" @@ -2160,14 +2161,6 @@ dependencies = [ "wincolor", ] -[[package]] -name = "termcolor" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "wincolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "textwrap" version = "0.11.0" @@ -2179,9 +2172,9 @@ dependencies = [ [[package]] name = "thread_local" -version = "0.3.6" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" +checksum = "88ddf1ad580c7e3d1efff877d972bcc93f995556b9087a5a259630985c88ceab" dependencies = [ "lazy_static", ] @@ -2218,9 +2211,9 @@ dependencies = [ [[package]] name = "tokio" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9d5acfe1b1130d50ac2286a2f1f8cf49309680366ceb7609ce369b75c9058d4" +checksum = "ffa2fdcfa937b20cb3c822a635ceecd5fc1a27a6a474527e5516aa24b8c8820a" dependencies = [ "bytes 0.5.3", "fnv", @@ -2372,7 +2365,7 @@ dependencies = [ "futures 0.3.1", "log", "pin-project", - "tokio 0.2.8", + "tokio 0.2.9", "tungstenite", ] @@ -2392,6 +2385,7 @@ dependencies = [ "addressing", "base64 0.11.0", "curve25519-dalek", + "itertools", "log", "rand 0.7.2", "serde", @@ -2429,7 +2423,7 @@ dependencies = [ "native-tls", "rand 0.7.2", "sha-1", - "url 2.1.0", + "url 2.1.1", "utf-8", ] @@ -2491,9 +2485,9 @@ dependencies = [ [[package]] name = "url" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75b414f6c464c879d7f9babf951f23bc3743fb7313c081b2e6ca719067ea9d61" +checksum = "829d4a8476c35c9bf0bbce5a3b23f4106f79728039b726d292bb93bc106787cb" dependencies = [ "idna 0.2.0", "matches", @@ -2597,14 +2591,6 @@ dependencies = [ "winapi 0.3.8", ] -[[package]] -name = "winapi-util" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -2621,15 +2607,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "wincolor" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "winreg" version = "0.6.2" diff --git a/validator/src/validator/health_check/mod.rs b/validator/src/validator/health_check/mod.rs index 7c1908c6f0..65007e0c3e 100644 --- a/validator/src/validator/health_check/mod.rs +++ b/validator/src/validator/health_check/mod.rs @@ -56,31 +56,29 @@ impl HealthCheckResult { HealthCheckResult(health) } - fn check_path(path: Vec) -> bool { + fn check_path(path: &Vec) -> bool { trace!("Checking path: {:?}", path); + // TODO: - false + true } pub fn calculate(topology: T) -> Self { - let all_paths = match current_topology.all_paths() { + let all_paths = match topology.all_paths() { Ok(paths) => paths, Err(_) => return Self::zero_score(topology), }; // create entries for all nodes let mut score_map = HashMap::new(); - current_topology - .get_mix_nodes() - .into_iter() - .for_each(|node| { - score_map.insert( - NodeAddressBytes::from_b64_string(node.pub_key.clone()).0, - NodeScore::from_mixnode(node), - ); - }); + topology.get_mix_nodes().into_iter().for_each(|node| { + score_map.insert( + NodeAddressBytes::from_b64_string(node.pub_key.clone()).0, + NodeScore::from_mixnode(node), + ); + }); - current_topology + topology .get_mix_provider_nodes() .into_iter() .for_each(|node| { @@ -91,7 +89,7 @@ impl HealthCheckResult { }); for path in all_paths { - let path_status = HealthCheckResult::check_path(path); + let path_status = HealthCheckResult::check_path(&path); for node in path { // if value doesn't exist, something extremely weird must have happened let current_score = score_map.get_mut(&node.pub_key.0); @@ -103,7 +101,7 @@ impl HealthCheckResult { } } - HealthCheckResult(score_map.values().collect()) + HealthCheckResult(score_map.drain().map(|(k, v)| v).collect()) } }