From 63371a45f645c8570167c1214cb938efbe335f21 Mon Sep 17 00:00:00 2001 From: rustaceanrob Date: Sun, 15 Feb 2026 18:44:28 +0000 Subject: [PATCH] Remove `analysis` crate Moved to https://github.com/rustaceanrob/swiftsync-research.git Add update step in CI --- .github/workflows/rust.yml | 4 +++- Cargo.toml | 2 +- analysis/Cargo.toml | 8 ------- analysis/src/main.rs | 43 -------------------------------------- 4 files changed, 4 insertions(+), 53 deletions(-) delete mode 100644 analysis/Cargo.toml delete mode 100644 analysis/src/main.rs diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index ec59477..9e12538 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -37,7 +37,9 @@ jobs: - uses: extractions/setup-just@v3 - uses: actions-rust-lang/setup-rust-toolchain@v1 - name: "Install Bitcoin dependencies" - run: sudo apt-get install build-essential cmake pkgconf python3 libevent-dev libboost-dev + run: | + sudo apt-get update + sudo apt-get install build-essential cmake pkgconf python3 libevent-dev libboost-dev capnproto libcapnp-dev - name: "Run test suite" run: just test diff --git a/Cargo.toml b/Cargo.toml index de214b6..5a68df1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace] -members = ["accumulator", "analysis", "hintfile", "node"] +members = ["accumulator", "hintfile", "node"] default-members = ["accumulator"] resolver = "2" diff --git a/analysis/Cargo.toml b/analysis/Cargo.toml deleted file mode 100644 index 604981f..0000000 --- a/analysis/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "analysis" -version = "0.1.0" -edition = "2021" - -[dependencies] -csv = "1.4.0" -hintfile = { path = "../hintfile/" } diff --git a/analysis/src/main.rs b/analysis/src/main.rs deleted file mode 100644 index 32e0f0f..0000000 --- a/analysis/src/main.rs +++ /dev/null @@ -1,43 +0,0 @@ -use std::fs::File; - -use hintfile::Hints; - -fn differentials(indexes: &[u64]) -> Vec { - indexes - .iter() - .zip(indexes.iter().skip(1)) - .map(|(a, b)| b - a) - .collect() -} - -fn average(diffs: &[u64]) -> f64 { - let sum = diffs.iter().sum::() as f64; - if !diffs.is_empty() { - return sum / diffs.len() as f64; - } - 0. -} - -fn main() { - let path = std::env::args() - .nth(1) - .expect("Usage: "); - let file = File::open(path).unwrap(); - let mut hints = Hints::from_file(file); - let csv = File::create("./results.csv").unwrap(); - let mut wtr = csv::Writer::from_writer(csv); - for height in 1..=hints.stop_height() { - let unspents = hints.get_indexes(height); - let max_unspent = unspents.iter().max().unwrap_or(&0); - let diffs = differentials(&unspents); - let average_diff = average(&diffs); - println!("Block height: {height}; average diff: {average_diff}; max index: {max_unspent}; diffs: {diffs:?}"); - wtr.write_record(vec![ - height.to_string(), - average_diff.to_string(), - max_unspent.to_string(), - ]) - .unwrap(); - // std::thread::sleep(Duration::from_millis(500)); - } -}