From 729115ce09746ef915120d5f24af318f498602a3 Mon Sep 17 00:00:00 2001 From: fluidvanadium Date: Thu, 21 Nov 2024 04:33:03 +0000 Subject: [PATCH 1/3] pub struct SyncBenchmark --- zingolib/src/testutils.rs | 1 + zingolib/src/testutils/benchmarks.rs | 30 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 zingolib/src/testutils/benchmarks.rs diff --git a/zingolib/src/testutils.rs b/zingolib/src/testutils.rs index f6ebfc99b..799d823bf 100644 --- a/zingolib/src/testutils.rs +++ b/zingolib/src/testutils.rs @@ -31,6 +31,7 @@ use regtest::RegtestManager; use tokio::time::sleep; pub mod assertions; +pub mod benchmarks; pub mod chain_generics; pub mod fee_tables; /// TODO: Add Doc Comment Here! diff --git a/zingolib/src/testutils/benchmarks.rs b/zingolib/src/testutils/benchmarks.rs new file mode 100644 index 000000000..4f7531f08 --- /dev/null +++ b/zingolib/src/testutils/benchmarks.rs @@ -0,0 +1,30 @@ +//! a benchmark is a measurement of how quickly zingo can sync. +//! benchmarks need to take into account many factors + +use zcash_primitives::consensus::BlockHeight; + +/// all relevant data for a sync. +/// this struct will convert to json to be saved +pub struct SyncBenchmark { + network_info: NetworkInfo, + system_info: (), + account_info: AccountInfo, + client_info: ClientInfo, + /// / + final_time: u64, + /// / + final_height: BlockHeight, + /// / + sync_time: u64, + /// TODO should this be an alias? + synced_blocks: u32, +} + +/// the connected server, indexer, and chain +pub struct NetworkInfo {} +/// the hardware and underlying system +pub struct SystemInfo {} +/// the account (wallet) being synced +pub struct AccountInfo {} +/// the software being used to sync +pub struct ClientInfo {} From 6deaa15e7d23aabf4948dfd7e9ed5cdc93f20b96 Mon Sep 17 00:00:00 2001 From: fluidvanadium Date: Thu, 21 Nov 2024 04:34:54 +0000 Subject: [PATCH 2/3] benchmarks feature gate and alphabetized --- zingolib/Cargo.toml | 9 +++++---- zingolib/src/testutils.rs | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/zingolib/Cargo.toml b/zingolib/Cargo.toml index 94bdff27c..c4d8bdd99 100644 --- a/zingolib/Cargo.toml +++ b/zingolib/Cargo.toml @@ -7,15 +7,16 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] +benchmarks = [] ci = [] +darkside_tests = [] +default = ["sync"] deprecations = ["lightclient-deprecated"] lightclient-deprecated = [] -darkside_tests = [] +sync = ['dep:zingo-sync'] +tempfile = ["dep:tempfile"] test-elevation = ["portpicker", "testvectors", "tempfile", "tempdir"] testvectors = [] -tempfile = ["dep:tempfile"] -default = ["sync"] -sync = ['dep:zingo-sync'] zaino-test = ['test-elevation'] [dependencies] diff --git a/zingolib/src/testutils.rs b/zingolib/src/testutils.rs index 799d823bf..acbd9c234 100644 --- a/zingolib/src/testutils.rs +++ b/zingolib/src/testutils.rs @@ -31,6 +31,7 @@ use regtest::RegtestManager; use tokio::time::sleep; pub mod assertions; +#[cfg(feature = "benchmarks")] pub mod benchmarks; pub mod chain_generics; pub mod fee_tables; From 945850b22fe7ec4b72ae3dc60029e5730c3fbd28 Mon Sep 17 00:00:00 2001 From: fluidvanadium Date: Thu, 21 Nov 2024 04:43:15 +0000 Subject: [PATCH 3/3] specify benchmark.json fields --- zingolib/src/testutils/benchmarks.rs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/zingolib/src/testutils/benchmarks.rs b/zingolib/src/testutils/benchmarks.rs index 4f7531f08..412c3b3b2 100644 --- a/zingolib/src/testutils/benchmarks.rs +++ b/zingolib/src/testutils/benchmarks.rs @@ -5,6 +5,7 @@ use zcash_primitives::consensus::BlockHeight; /// all relevant data for a sync. /// this struct will convert to json to be saved +/// todo: distinguish between raw json standard and zingo specific template, add Options pub struct SyncBenchmark { network_info: NetworkInfo, system_info: (), @@ -21,10 +22,22 @@ pub struct SyncBenchmark { } /// the connected server, indexer, and chain -pub struct NetworkInfo {} +/// also, how fast is the network +pub struct NetworkInfo { + url: Url, + chain_type: ChainType, + bandwidth: (), + latency: (), +} /// the hardware and underlying system pub struct SystemInfo {} /// the account (wallet) being synced -pub struct AccountInfo {} +pub struct AccountInfo { + wallet_id: NetworkSeedVersion, + hdwallet_accounts: Option, +} /// the software being used to sync -pub struct ClientInfo {} +pub struct ClientInfo { + client: String, + version: String, +}