Skip to content

Commit

Permalink
remove todo in toml.cargo and fmt & lints.
Browse files Browse the repository at this point in the history
  • Loading branch information
D-Stacks committed Feb 22, 2024
1 parent ee729d0 commit 8ffb763
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ sha2 = "0.10.8"
sha3 = "0.10.8"
slugify-rs = "0.0.3"
smallvec = { version = "1.11.1", features = ["serde"] }
sorted-insert = "0.2.3"# TODO "0.16.0"
sorted-insert = "0.2.3"
subtle = { version = "2.5.0", default-features = false }
tempfile = "3.8.1"
textwrap = "0.16.0"
Expand Down
17 changes: 9 additions & 8 deletions components/addressmanager/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ mod address_store_with_cache {
use kaspa_core::task::tick::TickService;
use kaspa_database::create_temp_db;
use kaspa_database::prelude::ConnBuilder;
use kaspa_utils::{as_slice::AsSlice, networking::IpAddress};
use kaspa_utils::networking::IpAddress;
use kolmogorov_smirnov::test::test as two_way_ks_test;
use std::net::{IpAddr, Ipv6Addr};

Expand Down Expand Up @@ -593,7 +593,7 @@ mod address_store_with_cache {
let num_of_trials = 512;
let mut cul_p = 0.;
// The target uniform distribution
let target_u_dist = Vec::from_iter((0..num_of_buckets));
let target_u_dist = Vec::from_iter(0..num_of_buckets);
for _ in 0..num_of_trials {
// The weight sampled expected uniform distibution
let prioritized_address_distribution = am
Expand All @@ -602,16 +602,17 @@ mod address_store_with_cache {
.take(num_of_buckets)
.map(|addr| addr.prefix_bucket().as_u64() as usize)
.collect_vec();
cul_p += (two_way_ks_test(
prioritized_address_distribution.as_slice(),
cul_p += two_way_ks_test(
prioritized_address_distribution.as_slice(),
target_u_dist.as_slice(),
0.5 // confidence is unimportant here, as we are just culminating reject_probabilities for now.
).reject_probability
/ 2.0); // Divide by 2 as we want to test one way.
0.5, // confidence is unimportant here, as we are just culminating reject_probabilities for now.
)
.reject_probability
/ 2.0; // Divide by 2 as we want to test one way.
}

// Normalize and adjust p to test for uniformity, over average of all trials.
let adjusted_p = cul_p / num_of_trials as f64;
let adjusted_p = cul_p / num_of_trials as f64;
// Define the significance threshold.
let significance = 0.10;

Expand Down

0 comments on commit 8ffb763

Please sign in to comment.