From f4a2fb50eb09d439ae54e67a168f9c555ed82b39 Mon Sep 17 00:00:00 2001 From: BowTiedRadone Date: Thu, 24 Apr 2025 14:13:43 -0400 Subject: [PATCH 01/17] Add madhouse-rs setup and icebreaker command --- signer/Cargo.toml | 2 ++ signer/tests/integration/commands/context.rs | 13 +++++++++ signer/tests/integration/commands/db.rs | 29 +++++++++++++++++++ signer/tests/integration/commands/mod.rs | 5 ++++ signer/tests/integration/main.rs | 1 + .../tests/integration/transaction_signer.rs | 11 +++++++ 6 files changed, 61 insertions(+) create mode 100644 signer/tests/integration/commands/context.rs create mode 100644 signer/tests/integration/commands/db.rs create mode 100644 signer/tests/integration/commands/mod.rs diff --git a/signer/Cargo.toml b/signer/Cargo.toml index 250aec39b..80f6c1e38 100644 --- a/signer/Cargo.toml +++ b/signer/Cargo.toml @@ -62,6 +62,8 @@ wsts.workspace = true # Only for testing fake = { workspace = true, optional = true } mockall = { workspace = true, optional = true } +madhouse = { git = "https://github.com/stacks-network/madhouse-rs.git", rev = "b14bb8dce7df68cfe7e6122861e1945d6f6ef618" } +proptest = { git = "https://github.com/proptest-rs/proptest.git", rev = "c9bdf18c232665b2b740c667c81866b598d06dc7" } [build-dependencies] tonic-build.workspace = true diff --git a/signer/tests/integration/commands/context.rs b/signer/tests/integration/commands/context.rs new file mode 100644 index 000000000..c10c4921d --- /dev/null +++ b/signer/tests/integration/commands/context.rs @@ -0,0 +1,13 @@ +use madhouse::{State, TestContext}; + +#[derive(Clone, Debug)] +pub struct Ctx; + +impl TestContext for Ctx {} + +#[derive(Debug, Default)] +pub struct TestState { + pub db: Option, +} + +impl State for TestState {} diff --git a/signer/tests/integration/commands/db.rs b/signer/tests/integration/commands/db.rs new file mode 100644 index 000000000..4d7ac9821 --- /dev/null +++ b/signer/tests/integration/commands/db.rs @@ -0,0 +1,29 @@ +use madhouse::{Command, CommandWrapper}; +use proptest::prelude::Strategy; + +use super::{Ctx, TestState}; + +pub struct NewTestDatabase; + +impl Command for NewTestDatabase { + fn check(&self, state: &TestState) -> bool { + state.db.is_none() + } + + fn apply(&self, state: &mut TestState) { + // Create a Tokio runtime just for this operation + let rt = tokio::runtime::Runtime::new().unwrap(); + + // Use the Tokio runtime to run the async function + let db = rt.block_on(signer::testing::storage::new_test_database()); + state.db = Some(db); + } + + fn label(&self) -> String { + "NEW_TEST_DATABASE".to_string() + } + + fn build(_ctx: std::sync::Arc) -> impl Strategy> { + proptest::prelude::Just(CommandWrapper::new(NewTestDatabase)) + } +} diff --git a/signer/tests/integration/commands/mod.rs b/signer/tests/integration/commands/mod.rs new file mode 100644 index 000000000..a1b435f72 --- /dev/null +++ b/signer/tests/integration/commands/mod.rs @@ -0,0 +1,5 @@ +mod context; +mod db; + +pub use context::{Ctx, TestState}; +pub use db::NewTestDatabase; diff --git a/signer/tests/integration/main.rs b/signer/tests/integration/main.rs index 155dc8c91..cfdaad519 100644 --- a/signer/tests/integration/main.rs +++ b/signer/tests/integration/main.rs @@ -4,6 +4,7 @@ mod bitcoin_client; mod bitcoin_rpc; mod bitcoin_validation; mod block_observer; +mod commands; mod communication; mod complete_deposit; mod contracts; diff --git a/signer/tests/integration/transaction_signer.rs b/signer/tests/integration/transaction_signer.rs index 0200c7683..9e8fccb2a 100644 --- a/signer/tests/integration/transaction_signer.rs +++ b/signer/tests/integration/transaction_signer.rs @@ -850,6 +850,17 @@ mod validate_dkg_verification_message { )) } + use crate::commands::{Ctx, NewTestDatabase}; + use madhouse::{Command, execute_commands, prop_allof, scenario}; + use proptest::prelude::*; + + #[test] + fn latest_key_in_failed_state_scenario() { + let test_context = std::sync::Arc::new(Ctx); + + scenario![test_context, NewTestDatabase,] + } + #[tokio::test] async fn verification_window_elapsed() { let db = testing::storage::new_test_database().await; From 5bbeec33f2780f41dc3d9138f0fb6b15d01ffb46 Mon Sep 17 00:00:00 2001 From: BowTiedRadone Date: Thu, 24 Apr 2025 16:36:24 -0400 Subject: [PATCH 02/17] Add `CreateDkgShares` command --- Cargo.lock | 67 ++++++++++++++++++- signer/tests/integration/commands/context.rs | 2 + signer/tests/integration/commands/dkg.rs | 50 ++++++++++++++ signer/tests/integration/commands/mod.rs | 2 + .../tests/integration/transaction_signer.rs | 4 +- 5 files changed, 122 insertions(+), 3 deletions(-) create mode 100644 signer/tests/integration/commands/dkg.rs diff --git a/Cargo.lock b/Cargo.lock index 8dd4b568d..0ab2be37f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -772,6 +772,21 @@ dependencies = [ "which", ] +[[package]] +name = "bit-set" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" + [[package]] name = "bitcoin" version = "0.32.5" @@ -3622,6 +3637,14 @@ dependencies = [ "hashbrown 0.15.2", ] +[[package]] +name = "madhouse" +version = "0.1.1" +source = "git+https://github.com/stacks-network/madhouse-rs.git?rev=b14bb8dce7df68cfe7e6122861e1945d6f6ef618#b14bb8dce7df68cfe7e6122861e1945d6f6ef618" +dependencies = [ + "proptest 1.6.0 (git+https://github.com/proptest-rs/proptest.git?rev=c9bdf18c232665b2b740c667c81866b598d06dc7)", +] + [[package]] name = "match_cfg" version = "0.1.0" @@ -4638,6 +4661,25 @@ dependencies = [ "unarray", ] +[[package]] +name = "proptest" +version = "1.6.0" +source = "git+https://github.com/proptest-rs/proptest.git?rev=c9bdf18c232665b2b740c667c81866b598d06dc7#c9bdf18c232665b2b740c667c81866b598d06dc7" +dependencies = [ + "bit-set", + "bit-vec", + "bitflags 2.5.0", + "lazy_static", + "num-traits", + "rand", + "rand_chacha", + "rand_xorshift", + "regex-syntax 0.8.3", + "rusty-fork", + "tempfile", + "unarray", +] + [[package]] name = "prost" version = "0.13.4" @@ -5371,6 +5413,18 @@ version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +[[package]] +name = "rusty-fork" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f" +dependencies = [ + "fnv", + "quick-error", + "tempfile", + "wait-timeout", +] + [[package]] name = "rw-stream-sink" version = "0.4.0" @@ -5408,7 +5462,7 @@ dependencies = [ "clarity", "hex", "more-asserts", - "proptest", + "proptest 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand", "secp256k1 0.29.0", "serde", @@ -5796,6 +5850,7 @@ dependencies = [ "include_dir", "libp2p", "lru", + "madhouse", "metrics", "metrics-exporter-prometheus", "mockall", @@ -5803,6 +5858,7 @@ dependencies = [ "more-asserts", "p256k1", "polynomial", + "proptest 1.6.0 (git+https://github.com/proptest-rs/proptest.git?rev=c9bdf18c232665b2b740c667c81866b598d06dc7)", "prost", "rand", "reqwest 0.11.27", @@ -7184,6 +7240,15 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c3082ca00d5a5ef149bb8b555a72ae84c9c59f7250f013ac822ac2e49b19c64" +[[package]] +name = "wait-timeout" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11" +dependencies = [ + "libc", +] + [[package]] name = "walkdir" version = "2.5.0" diff --git a/signer/tests/integration/commands/context.rs b/signer/tests/integration/commands/context.rs index c10c4921d..53edd45b6 100644 --- a/signer/tests/integration/commands/context.rs +++ b/signer/tests/integration/commands/context.rs @@ -1,4 +1,5 @@ use madhouse::{State, TestContext}; +use signer::storage::model::EncryptedDkgShares; #[derive(Clone, Debug)] pub struct Ctx; @@ -8,6 +9,7 @@ impl TestContext for Ctx {} #[derive(Debug, Default)] pub struct TestState { pub db: Option, + pub shares: Option, } impl State for TestState {} diff --git a/signer/tests/integration/commands/dkg.rs b/signer/tests/integration/commands/dkg.rs new file mode 100644 index 000000000..6bbbd7cca --- /dev/null +++ b/signer/tests/integration/commands/dkg.rs @@ -0,0 +1,50 @@ +use fake::Fake as _; +use fake::Faker; +use madhouse::{Command, CommandWrapper}; +use proptest::prelude::Strategy; +use proptest::prelude::any; +use rand::SeedableRng; +use secp256k1::{Keypair, rand::rngs::StdRng}; +use signer::{ + keys::PublicKey, + storage::model::{DkgSharesStatus, EncryptedDkgShares}, +}; + +use super::{Ctx, TestState}; + +pub struct CreateDkgShares { + seed: u64, +} + +impl CreateDkgShares { + fn with_seed(seed: u64) -> Self { + Self { seed } + } +} + +impl Command for CreateDkgShares { + fn check(&self, _state: &TestState) -> bool { + true + } + + fn apply(&self, state: &mut TestState) { + let mut rng = StdRng::seed_from_u64(self.seed); + let aggregate_key: PublicKey = Keypair::new_global(&mut rng).public_key().into(); + let shares = EncryptedDkgShares { + aggregate_key, + dkg_shares_status: DkgSharesStatus::Unverified, + started_at_bitcoin_block_height: 0u64.into(), + ..Faker.fake() + }; + + state.shares = Some(shares); + } + + fn label(&self) -> String { + "CREATE_DKG_SHARES".to_string() + } + + fn build(_ctx: std::sync::Arc) -> impl Strategy> { + any::().prop_map(|seed| CommandWrapper::new(CreateDkgShares::with_seed(seed))) + } +} diff --git a/signer/tests/integration/commands/mod.rs b/signer/tests/integration/commands/mod.rs index a1b435f72..a3d405460 100644 --- a/signer/tests/integration/commands/mod.rs +++ b/signer/tests/integration/commands/mod.rs @@ -1,5 +1,7 @@ mod context; mod db; +mod dkg; pub use context::{Ctx, TestState}; pub use db::NewTestDatabase; +pub use dkg::CreateDkgShares; diff --git a/signer/tests/integration/transaction_signer.rs b/signer/tests/integration/transaction_signer.rs index 9e8fccb2a..39f11e49b 100644 --- a/signer/tests/integration/transaction_signer.rs +++ b/signer/tests/integration/transaction_signer.rs @@ -850,7 +850,7 @@ mod validate_dkg_verification_message { )) } - use crate::commands::{Ctx, NewTestDatabase}; + use crate::commands::{CreateDkgShares, Ctx, NewTestDatabase}; use madhouse::{Command, execute_commands, prop_allof, scenario}; use proptest::prelude::*; @@ -858,7 +858,7 @@ mod validate_dkg_verification_message { fn latest_key_in_failed_state_scenario() { let test_context = std::sync::Arc::new(Ctx); - scenario![test_context, NewTestDatabase,] + scenario![test_context, NewTestDatabase, CreateDkgShares] } #[tokio::test] From 10d6feb22fd2238a15573e80bf196c211db9f589 Mon Sep 17 00:00:00 2001 From: BowTiedRadone Date: Thu, 24 Apr 2025 17:13:50 -0400 Subject: [PATCH 03/17] Add command to initialize a shared tokio runtime --- signer/tests/integration/commands/context.rs | 1 + signer/tests/integration/commands/db.rs | 8 +++---- signer/tests/integration/commands/mod.rs | 2 ++ signer/tests/integration/commands/runtime.rs | 24 +++++++++++++++++++ .../tests/integration/transaction_signer.rs | 9 +++++-- 5 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 signer/tests/integration/commands/runtime.rs diff --git a/signer/tests/integration/commands/context.rs b/signer/tests/integration/commands/context.rs index 53edd45b6..0bedf42fe 100644 --- a/signer/tests/integration/commands/context.rs +++ b/signer/tests/integration/commands/context.rs @@ -10,6 +10,7 @@ impl TestContext for Ctx {} pub struct TestState { pub db: Option, pub shares: Option, + pub runtime: Option, } impl State for TestState {} diff --git a/signer/tests/integration/commands/db.rs b/signer/tests/integration/commands/db.rs index 4d7ac9821..384ee157d 100644 --- a/signer/tests/integration/commands/db.rs +++ b/signer/tests/integration/commands/db.rs @@ -11,11 +11,11 @@ impl Command for NewTestDatabase { } fn apply(&self, state: &mut TestState) { - // Create a Tokio runtime just for this operation - let rt = tokio::runtime::Runtime::new().unwrap(); + let runtime = state.runtime.as_ref().unwrap(); + let db = runtime.block_on(async { + signer::testing::storage::new_test_database().await + }); - // Use the Tokio runtime to run the async function - let db = rt.block_on(signer::testing::storage::new_test_database()); state.db = Some(db); } diff --git a/signer/tests/integration/commands/mod.rs b/signer/tests/integration/commands/mod.rs index a3d405460..8c2cf3d53 100644 --- a/signer/tests/integration/commands/mod.rs +++ b/signer/tests/integration/commands/mod.rs @@ -1,7 +1,9 @@ mod context; mod db; mod dkg; +mod runtime; pub use context::{Ctx, TestState}; pub use db::NewTestDatabase; pub use dkg::CreateDkgShares; +pub use runtime::InitializeRuntime; diff --git a/signer/tests/integration/commands/runtime.rs b/signer/tests/integration/commands/runtime.rs new file mode 100644 index 000000000..f270a2a1e --- /dev/null +++ b/signer/tests/integration/commands/runtime.rs @@ -0,0 +1,24 @@ +use madhouse::{Command, CommandWrapper}; +use proptest::prelude::Strategy; + +use super::{Ctx, TestState}; + +pub struct InitializeRuntime; + +impl Command for InitializeRuntime { + fn check(&self, state: &TestState) -> bool { + state.runtime.is_none() + } + + fn apply(&self, state: &mut TestState) { + state.runtime = Some(tokio::runtime::Runtime::new().unwrap()); + } + + fn label(&self) -> String { + "INITIALIZE_RUNTIME".to_string() + } + + fn build(_ctx: std::sync::Arc) -> impl Strategy> { + proptest::prelude::Just(CommandWrapper::new(InitializeRuntime)) + } +} diff --git a/signer/tests/integration/transaction_signer.rs b/signer/tests/integration/transaction_signer.rs index 39f11e49b..eb6d03338 100644 --- a/signer/tests/integration/transaction_signer.rs +++ b/signer/tests/integration/transaction_signer.rs @@ -850,7 +850,7 @@ mod validate_dkg_verification_message { )) } - use crate::commands::{CreateDkgShares, Ctx, NewTestDatabase}; + use crate::commands::{CreateDkgShares, Ctx, InitializeRuntime, NewTestDatabase}; use madhouse::{Command, execute_commands, prop_allof, scenario}; use proptest::prelude::*; @@ -858,7 +858,12 @@ mod validate_dkg_verification_message { fn latest_key_in_failed_state_scenario() { let test_context = std::sync::Arc::new(Ctx); - scenario![test_context, NewTestDatabase, CreateDkgShares] + scenario![ + test_context, + InitializeRuntime, + NewTestDatabase, + CreateDkgShares, + ] } #[tokio::test] From 5200bbc4ea21d57fe2b0394dfe6a9998e3f84880 Mon Sep 17 00:00:00 2001 From: BowTiedRadone Date: Thu, 24 Apr 2025 17:31:12 -0400 Subject: [PATCH 04/17] Add `WriteDkgShares` command --- signer/tests/integration/commands/db.rs | 36 +++++++++++++++++-- signer/tests/integration/commands/mod.rs | 2 +- .../tests/integration/transaction_signer.rs | 5 ++- 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/signer/tests/integration/commands/db.rs b/signer/tests/integration/commands/db.rs index 384ee157d..1c618defc 100644 --- a/signer/tests/integration/commands/db.rs +++ b/signer/tests/integration/commands/db.rs @@ -1,5 +1,6 @@ use madhouse::{Command, CommandWrapper}; use proptest::prelude::Strategy; +use signer::storage::DbWrite; use super::{Ctx, TestState}; @@ -12,9 +13,7 @@ impl Command for NewTestDatabase { fn apply(&self, state: &mut TestState) { let runtime = state.runtime.as_ref().unwrap(); - let db = runtime.block_on(async { - signer::testing::storage::new_test_database().await - }); + let db = runtime.block_on(async { signer::testing::storage::new_test_database().await }); state.db = Some(db); } @@ -27,3 +26,34 @@ impl Command for NewTestDatabase { proptest::prelude::Just(CommandWrapper::new(NewTestDatabase)) } } + +pub struct WriteDkgShares; + +impl Command for WriteDkgShares { + fn check(&self, state: &TestState) -> bool { + state.db.is_some() && state.shares.is_some() + } + + fn apply(&self, state: &mut TestState) { + let runtime = state.runtime.as_ref().unwrap(); + let db = state.db.as_ref().unwrap(); + let shares = state.shares.as_ref().unwrap(); + + runtime.block_on(async { + match db.write_encrypted_dkg_shares(shares).await { + Ok(db_result) => db_result, + Err(e) => { + panic!("Failed to write DKG shares: {}", e); + } + }; + }); + } + + fn label(&self) -> String { + "WRITE_DKG_SHARES".to_string() + } + + fn build(_ctx: std::sync::Arc) -> impl Strategy> { + proptest::prelude::Just(CommandWrapper::new(WriteDkgShares)) + } +} diff --git a/signer/tests/integration/commands/mod.rs b/signer/tests/integration/commands/mod.rs index 8c2cf3d53..55a17dc33 100644 --- a/signer/tests/integration/commands/mod.rs +++ b/signer/tests/integration/commands/mod.rs @@ -4,6 +4,6 @@ mod dkg; mod runtime; pub use context::{Ctx, TestState}; -pub use db::NewTestDatabase; +pub use db::{NewTestDatabase, WriteDkgShares}; pub use dkg::CreateDkgShares; pub use runtime::InitializeRuntime; diff --git a/signer/tests/integration/transaction_signer.rs b/signer/tests/integration/transaction_signer.rs index eb6d03338..f8b3f9a4f 100644 --- a/signer/tests/integration/transaction_signer.rs +++ b/signer/tests/integration/transaction_signer.rs @@ -850,7 +850,9 @@ mod validate_dkg_verification_message { )) } - use crate::commands::{CreateDkgShares, Ctx, InitializeRuntime, NewTestDatabase}; + use crate::commands::{ + CreateDkgShares, Ctx, InitializeRuntime, NewTestDatabase, WriteDkgShares, + }; use madhouse::{Command, execute_commands, prop_allof, scenario}; use proptest::prelude::*; @@ -863,6 +865,7 @@ mod validate_dkg_verification_message { InitializeRuntime, NewTestDatabase, CreateDkgShares, + WriteDkgShares, ] } From 9675385251340226690b2ffb2086e4dcef640162 Mon Sep 17 00:00:00 2001 From: BowTiedRadone Date: Fri, 25 Apr 2025 08:03:41 -0400 Subject: [PATCH 05/17] Add `VerifyDkgVerificationFailed` command --- signer/tests/integration/commands/context.rs | 3 +- signer/tests/integration/commands/dkg.rs | 2 +- signer/tests/integration/commands/mod.rs | 2 + .../tests/integration/commands/test_cases.rs | 39 +++++++++++++++++++ .../tests/integration/transaction_signer.rs | 13 ++++--- 5 files changed, 51 insertions(+), 8 deletions(-) create mode 100644 signer/tests/integration/commands/test_cases.rs diff --git a/signer/tests/integration/commands/context.rs b/signer/tests/integration/commands/context.rs index 0bedf42fe..56546bbc6 100644 --- a/signer/tests/integration/commands/context.rs +++ b/signer/tests/integration/commands/context.rs @@ -1,5 +1,4 @@ use madhouse::{State, TestContext}; -use signer::storage::model::EncryptedDkgShares; #[derive(Clone, Debug)] pub struct Ctx; @@ -9,8 +8,8 @@ impl TestContext for Ctx {} #[derive(Debug, Default)] pub struct TestState { pub db: Option, - pub shares: Option, pub runtime: Option, + pub shares: Option, } impl State for TestState {} diff --git a/signer/tests/integration/commands/dkg.rs b/signer/tests/integration/commands/dkg.rs index 6bbbd7cca..d2042ce02 100644 --- a/signer/tests/integration/commands/dkg.rs +++ b/signer/tests/integration/commands/dkg.rs @@ -32,7 +32,7 @@ impl Command for CreateDkgShares { let aggregate_key: PublicKey = Keypair::new_global(&mut rng).public_key().into(); let shares = EncryptedDkgShares { aggregate_key, - dkg_shares_status: DkgSharesStatus::Unverified, + dkg_shares_status: DkgSharesStatus::Failed, started_at_bitcoin_block_height: 0u64.into(), ..Faker.fake() }; diff --git a/signer/tests/integration/commands/mod.rs b/signer/tests/integration/commands/mod.rs index 55a17dc33..1f9220c2d 100644 --- a/signer/tests/integration/commands/mod.rs +++ b/signer/tests/integration/commands/mod.rs @@ -2,8 +2,10 @@ mod context; mod db; mod dkg; mod runtime; +mod test_cases; pub use context::{Ctx, TestState}; pub use db::{NewTestDatabase, WriteDkgShares}; pub use dkg::CreateDkgShares; pub use runtime::InitializeRuntime; +pub use test_cases::VerifyDkgVerificationFailed; diff --git a/signer/tests/integration/commands/test_cases.rs b/signer/tests/integration/commands/test_cases.rs new file mode 100644 index 000000000..386db2658 --- /dev/null +++ b/signer/tests/integration/commands/test_cases.rs @@ -0,0 +1,39 @@ +use madhouse::{Command, CommandWrapper}; +use proptest::prelude::{Just, Strategy}; +use signer::{error::Error, keys::PublicKeyXOnly, storage::model::DkgSharesStatus}; + +use crate::transaction_signer::validate_dkg_verification_message::TestParams; + +use super::{Ctx, TestState}; + +pub struct VerifyDkgVerificationFailed; + +impl Command for VerifyDkgVerificationFailed { + fn check(&self, state: &TestState) -> bool { + state.shares.is_some() + && state.shares.as_ref().unwrap().dkg_shares_status == DkgSharesStatus::Failed + } + + fn apply(&self, state: &mut TestState) { + let runtime = state.runtime.as_ref().unwrap(); + let aggregate_key = state.shares.as_ref().unwrap().aggregate_key.clone(); + let aggregate_key_x_only: PublicKeyXOnly = aggregate_key.into(); + let params = TestParams::new(aggregate_key_x_only); + let db = state.db.as_ref().unwrap(); + + let result = runtime.block_on(async { params.execute(db).await.unwrap_err() }); + + assert!(matches!( + result, + Error::DkgVerificationFailed(key) if aggregate_key_x_only == key + )) + } + + fn label(&self) -> String { + "VERIFY_DKG_VERIFICATION_FAILED".to_string() + } + + fn build(_ctx: std::sync::Arc) -> impl Strategy> { + Just(CommandWrapper::new(VerifyDkgVerificationFailed)) + } +} diff --git a/signer/tests/integration/transaction_signer.rs b/signer/tests/integration/transaction_signer.rs index f8b3f9a4f..04befba4a 100644 --- a/signer/tests/integration/transaction_signer.rs +++ b/signer/tests/integration/transaction_signer.rs @@ -721,7 +721,7 @@ async fn max_one_state_machine_per_bitcoin_block_hash_for_dkg() { /// [`MockedTxSigner::validate_dkg_verification_message`] function. See /// [`MockedTxSigner`] for information on the validations that these tests /// are asserting. -mod validate_dkg_verification_message { +pub mod validate_dkg_verification_message { use secp256k1::Keypair; use signer::{ @@ -733,7 +733,8 @@ mod validate_dkg_verification_message { /// Helper struct for testing /// [`MockedTxSigner::validate_dkg_verification_message`]. - struct TestParams { + #[derive(Debug)] + pub struct TestParams { pub new_aggregate_key: PublicKeyXOnly, pub dkg_verification_window: u16, pub bitcoin_chain_tip: BitcoinBlockRef, @@ -756,7 +757,7 @@ mod validate_dkg_verification_message { } impl TestParams { - fn new(new_aggregate_key: PublicKeyXOnly) -> Self { + pub fn new(new_aggregate_key: PublicKeyXOnly) -> Self { Self { new_aggregate_key, ..Self::default() @@ -764,7 +765,7 @@ mod validate_dkg_verification_message { } /// Executes [`MockedTxSigner::validate_dkg_verification_message`] with /// the values in this [`TestParams`] instance. - async fn execute(&self, db: &PgStore) -> Result<(), Error> { + pub async fn execute(&self, db: &PgStore) -> Result<(), Error> { MockedTxSigner::validate_dkg_verification_message::( &db, &self.new_aggregate_key, @@ -851,7 +852,8 @@ mod validate_dkg_verification_message { } use crate::commands::{ - CreateDkgShares, Ctx, InitializeRuntime, NewTestDatabase, WriteDkgShares, + CreateDkgShares, Ctx, InitializeRuntime, NewTestDatabase, VerifyDkgVerificationFailed, + WriteDkgShares, }; use madhouse::{Command, execute_commands, prop_allof, scenario}; use proptest::prelude::*; @@ -866,6 +868,7 @@ mod validate_dkg_verification_message { NewTestDatabase, CreateDkgShares, WriteDkgShares, + VerifyDkgVerificationFailed, ] } From bb09c70de2de46c7858f4421c4dd7a5a7ac3ecdb Mon Sep 17 00:00:00 2001 From: BowTiedRadone Date: Fri, 25 Apr 2025 08:25:55 -0400 Subject: [PATCH 06/17] Move `runtime` to the test context --- signer/tests/integration/commands/context.rs | 16 +++++++- signer/tests/integration/commands/db.rs | 40 ++++++++++++++----- signer/tests/integration/commands/mod.rs | 2 - .../tests/integration/commands/test_cases.rs | 21 +++++++--- .../tests/integration/transaction_signer.rs | 6 +-- 5 files changed, 62 insertions(+), 23 deletions(-) diff --git a/signer/tests/integration/commands/context.rs b/signer/tests/integration/commands/context.rs index 56546bbc6..64b4e17a0 100644 --- a/signer/tests/integration/commands/context.rs +++ b/signer/tests/integration/commands/context.rs @@ -1,14 +1,26 @@ use madhouse::{State, TestContext}; #[derive(Clone, Debug)] -pub struct Ctx; +pub struct Ctx { + runtime: std::sync::Arc, +} + +impl Ctx { + pub fn new() -> Self { + let runtime = std::sync::Arc::new(tokio::runtime::Runtime::new().unwrap()); + Self { runtime } + } + + pub fn runtime_handle(&self) -> std::sync::Arc { + self.runtime.clone() + } +} impl TestContext for Ctx {} #[derive(Debug, Default)] pub struct TestState { pub db: Option, - pub runtime: Option, pub shares: Option, } diff --git a/signer/tests/integration/commands/db.rs b/signer/tests/integration/commands/db.rs index 1c618defc..66bb2d68b 100644 --- a/signer/tests/integration/commands/db.rs +++ b/signer/tests/integration/commands/db.rs @@ -4,7 +4,15 @@ use signer::storage::DbWrite; use super::{Ctx, TestState}; -pub struct NewTestDatabase; +pub struct NewTestDatabase { + runtime_handle: std::sync::Arc, +} + +impl NewTestDatabase { + pub fn new(runtime_handle: std::sync::Arc) -> Self { + Self { runtime_handle } + } +} impl Command for NewTestDatabase { fn check(&self, state: &TestState) -> bool { @@ -12,8 +20,9 @@ impl Command for NewTestDatabase { } fn apply(&self, state: &mut TestState) { - let runtime = state.runtime.as_ref().unwrap(); - let db = runtime.block_on(async { signer::testing::storage::new_test_database().await }); + let db = self + .runtime_handle + .block_on(async { signer::testing::storage::new_test_database().await }); state.db = Some(db); } @@ -22,12 +31,22 @@ impl Command for NewTestDatabase { "NEW_TEST_DATABASE".to_string() } - fn build(_ctx: std::sync::Arc) -> impl Strategy> { - proptest::prelude::Just(CommandWrapper::new(NewTestDatabase)) + fn build(ctx: std::sync::Arc) -> impl Strategy> { + proptest::prelude::Just(CommandWrapper::new(NewTestDatabase::new( + ctx.runtime_handle(), + ))) } } -pub struct WriteDkgShares; +pub struct WriteDkgShares { + runtime_handle: std::sync::Arc, +} + +impl WriteDkgShares { + pub fn new(runtime_handle: std::sync::Arc) -> Self { + Self { runtime_handle } + } +} impl Command for WriteDkgShares { fn check(&self, state: &TestState) -> bool { @@ -35,11 +54,10 @@ impl Command for WriteDkgShares { } fn apply(&self, state: &mut TestState) { - let runtime = state.runtime.as_ref().unwrap(); let db = state.db.as_ref().unwrap(); let shares = state.shares.as_ref().unwrap(); - runtime.block_on(async { + self.runtime_handle.block_on(async { match db.write_encrypted_dkg_shares(shares).await { Ok(db_result) => db_result, Err(e) => { @@ -53,7 +71,9 @@ impl Command for WriteDkgShares { "WRITE_DKG_SHARES".to_string() } - fn build(_ctx: std::sync::Arc) -> impl Strategy> { - proptest::prelude::Just(CommandWrapper::new(WriteDkgShares)) + fn build(ctx: std::sync::Arc) -> impl Strategy> { + proptest::prelude::Just(CommandWrapper::new(WriteDkgShares::new( + ctx.runtime_handle(), + ))) } } diff --git a/signer/tests/integration/commands/mod.rs b/signer/tests/integration/commands/mod.rs index 1f9220c2d..43955915b 100644 --- a/signer/tests/integration/commands/mod.rs +++ b/signer/tests/integration/commands/mod.rs @@ -1,11 +1,9 @@ mod context; mod db; mod dkg; -mod runtime; mod test_cases; pub use context::{Ctx, TestState}; pub use db::{NewTestDatabase, WriteDkgShares}; pub use dkg::CreateDkgShares; -pub use runtime::InitializeRuntime; pub use test_cases::VerifyDkgVerificationFailed; diff --git a/signer/tests/integration/commands/test_cases.rs b/signer/tests/integration/commands/test_cases.rs index 386db2658..f55243a08 100644 --- a/signer/tests/integration/commands/test_cases.rs +++ b/signer/tests/integration/commands/test_cases.rs @@ -6,7 +6,15 @@ use crate::transaction_signer::validate_dkg_verification_message::TestParams; use super::{Ctx, TestState}; -pub struct VerifyDkgVerificationFailed; +pub struct VerifyDkgVerificationFailed { + runtime_handle: std::sync::Arc, +} + +impl VerifyDkgVerificationFailed { + pub fn new(runtime_handle: std::sync::Arc) -> Self { + Self { runtime_handle } + } +} impl Command for VerifyDkgVerificationFailed { fn check(&self, state: &TestState) -> bool { @@ -15,13 +23,14 @@ impl Command for VerifyDkgVerificationFailed { } fn apply(&self, state: &mut TestState) { - let runtime = state.runtime.as_ref().unwrap(); let aggregate_key = state.shares.as_ref().unwrap().aggregate_key.clone(); let aggregate_key_x_only: PublicKeyXOnly = aggregate_key.into(); let params = TestParams::new(aggregate_key_x_only); let db = state.db.as_ref().unwrap(); - let result = runtime.block_on(async { params.execute(db).await.unwrap_err() }); + let result = self + .runtime_handle + .block_on(async { params.execute(db).await.unwrap_err() }); assert!(matches!( result, @@ -33,7 +42,9 @@ impl Command for VerifyDkgVerificationFailed { "VERIFY_DKG_VERIFICATION_FAILED".to_string() } - fn build(_ctx: std::sync::Arc) -> impl Strategy> { - Just(CommandWrapper::new(VerifyDkgVerificationFailed)) + fn build(ctx: std::sync::Arc) -> impl Strategy> { + Just(CommandWrapper::new(VerifyDkgVerificationFailed::new( + ctx.runtime_handle(), + ))) } } diff --git a/signer/tests/integration/transaction_signer.rs b/signer/tests/integration/transaction_signer.rs index 04befba4a..bbea98f93 100644 --- a/signer/tests/integration/transaction_signer.rs +++ b/signer/tests/integration/transaction_signer.rs @@ -852,19 +852,17 @@ pub mod validate_dkg_verification_message { } use crate::commands::{ - CreateDkgShares, Ctx, InitializeRuntime, NewTestDatabase, VerifyDkgVerificationFailed, - WriteDkgShares, + CreateDkgShares, Ctx, NewTestDatabase, VerifyDkgVerificationFailed, WriteDkgShares, }; use madhouse::{Command, execute_commands, prop_allof, scenario}; use proptest::prelude::*; #[test] fn latest_key_in_failed_state_scenario() { - let test_context = std::sync::Arc::new(Ctx); + let test_context = std::sync::Arc::new(Ctx::new()); scenario![ test_context, - InitializeRuntime, NewTestDatabase, CreateDkgShares, WriteDkgShares, From fa464588ed1aa2807043280725e235b39e5e077f Mon Sep 17 00:00:00 2001 From: BowTiedRadone Date: Fri, 25 Apr 2025 08:43:48 -0400 Subject: [PATCH 07/17] Move `db` to the test context --- signer/tests/integration/commands/context.rs | 10 +++- signer/tests/integration/commands/db.rs | 53 ++++--------------- signer/tests/integration/commands/mod.rs | 2 +- .../tests/integration/commands/test_cases.rs | 16 +++--- .../tests/integration/transaction_signer.rs | 5 +- 5 files changed, 28 insertions(+), 58 deletions(-) diff --git a/signer/tests/integration/commands/context.rs b/signer/tests/integration/commands/context.rs index 64b4e17a0..25e3ee6cc 100644 --- a/signer/tests/integration/commands/context.rs +++ b/signer/tests/integration/commands/context.rs @@ -2,13 +2,20 @@ use madhouse::{State, TestContext}; #[derive(Clone, Debug)] pub struct Ctx { + db: signer::storage::postgres::PgStore, runtime: std::sync::Arc, } impl Ctx { pub fn new() -> Self { let runtime = std::sync::Arc::new(tokio::runtime::Runtime::new().unwrap()); - Self { runtime } + let db = runtime.block_on(async { signer::testing::storage::new_test_database().await }); + + Self { db, runtime } + } + + pub fn db(&self) -> &signer::storage::postgres::PgStore { + &self.db } pub fn runtime_handle(&self) -> std::sync::Arc { @@ -20,7 +27,6 @@ impl TestContext for Ctx {} #[derive(Debug, Default)] pub struct TestState { - pub db: Option, pub shares: Option, } diff --git a/signer/tests/integration/commands/db.rs b/signer/tests/integration/commands/db.rs index 66bb2d68b..7cdc20b3e 100644 --- a/signer/tests/integration/commands/db.rs +++ b/signer/tests/integration/commands/db.rs @@ -1,64 +1,31 @@ +use std::sync::Arc; + use madhouse::{Command, CommandWrapper}; use proptest::prelude::Strategy; use signer::storage::DbWrite; use super::{Ctx, TestState}; -pub struct NewTestDatabase { - runtime_handle: std::sync::Arc, -} - -impl NewTestDatabase { - pub fn new(runtime_handle: std::sync::Arc) -> Self { - Self { runtime_handle } - } -} - -impl Command for NewTestDatabase { - fn check(&self, state: &TestState) -> bool { - state.db.is_none() - } - - fn apply(&self, state: &mut TestState) { - let db = self - .runtime_handle - .block_on(async { signer::testing::storage::new_test_database().await }); - - state.db = Some(db); - } - - fn label(&self) -> String { - "NEW_TEST_DATABASE".to_string() - } - - fn build(ctx: std::sync::Arc) -> impl Strategy> { - proptest::prelude::Just(CommandWrapper::new(NewTestDatabase::new( - ctx.runtime_handle(), - ))) - } -} - pub struct WriteDkgShares { - runtime_handle: std::sync::Arc, + ctx: Arc, } impl WriteDkgShares { - pub fn new(runtime_handle: std::sync::Arc) -> Self { - Self { runtime_handle } + pub fn new(ctx: Arc) -> Self { + Self { ctx } } } impl Command for WriteDkgShares { fn check(&self, state: &TestState) -> bool { - state.db.is_some() && state.shares.is_some() + state.shares.is_some() } fn apply(&self, state: &mut TestState) { - let db = state.db.as_ref().unwrap(); let shares = state.shares.as_ref().unwrap(); - self.runtime_handle.block_on(async { - match db.write_encrypted_dkg_shares(shares).await { + self.ctx.runtime_handle().block_on(async { + match self.ctx.db().write_encrypted_dkg_shares(shares).await { Ok(db_result) => db_result, Err(e) => { panic!("Failed to write DKG shares: {}", e); @@ -72,8 +39,6 @@ impl Command for WriteDkgShares { } fn build(ctx: std::sync::Arc) -> impl Strategy> { - proptest::prelude::Just(CommandWrapper::new(WriteDkgShares::new( - ctx.runtime_handle(), - ))) + proptest::prelude::Just(CommandWrapper::new(WriteDkgShares::new(ctx.clone()))) } } diff --git a/signer/tests/integration/commands/mod.rs b/signer/tests/integration/commands/mod.rs index 43955915b..1c0c1ed57 100644 --- a/signer/tests/integration/commands/mod.rs +++ b/signer/tests/integration/commands/mod.rs @@ -4,6 +4,6 @@ mod dkg; mod test_cases; pub use context::{Ctx, TestState}; -pub use db::{NewTestDatabase, WriteDkgShares}; +pub use db::WriteDkgShares; pub use dkg::CreateDkgShares; pub use test_cases::VerifyDkgVerificationFailed; diff --git a/signer/tests/integration/commands/test_cases.rs b/signer/tests/integration/commands/test_cases.rs index f55243a08..2bc236509 100644 --- a/signer/tests/integration/commands/test_cases.rs +++ b/signer/tests/integration/commands/test_cases.rs @@ -1,3 +1,5 @@ +use std::sync::Arc; + use madhouse::{Command, CommandWrapper}; use proptest::prelude::{Just, Strategy}; use signer::{error::Error, keys::PublicKeyXOnly, storage::model::DkgSharesStatus}; @@ -7,12 +9,12 @@ use crate::transaction_signer::validate_dkg_verification_message::TestParams; use super::{Ctx, TestState}; pub struct VerifyDkgVerificationFailed { - runtime_handle: std::sync::Arc, + ctx: Arc, } impl VerifyDkgVerificationFailed { - pub fn new(runtime_handle: std::sync::Arc) -> Self { - Self { runtime_handle } + pub fn new(ctx: Arc) -> Self { + Self { ctx } } } @@ -26,11 +28,11 @@ impl Command for VerifyDkgVerificationFailed { let aggregate_key = state.shares.as_ref().unwrap().aggregate_key.clone(); let aggregate_key_x_only: PublicKeyXOnly = aggregate_key.into(); let params = TestParams::new(aggregate_key_x_only); - let db = state.db.as_ref().unwrap(); let result = self - .runtime_handle - .block_on(async { params.execute(db).await.unwrap_err() }); + .ctx + .runtime_handle() + .block_on(async { params.execute(self.ctx.db()).await.unwrap_err() }); assert!(matches!( result, @@ -44,7 +46,7 @@ impl Command for VerifyDkgVerificationFailed { fn build(ctx: std::sync::Arc) -> impl Strategy> { Just(CommandWrapper::new(VerifyDkgVerificationFailed::new( - ctx.runtime_handle(), + ctx.clone(), ))) } } diff --git a/signer/tests/integration/transaction_signer.rs b/signer/tests/integration/transaction_signer.rs index bbea98f93..8a0289686 100644 --- a/signer/tests/integration/transaction_signer.rs +++ b/signer/tests/integration/transaction_signer.rs @@ -851,9 +851,7 @@ pub mod validate_dkg_verification_message { )) } - use crate::commands::{ - CreateDkgShares, Ctx, NewTestDatabase, VerifyDkgVerificationFailed, WriteDkgShares, - }; + use crate::commands::{CreateDkgShares, Ctx, VerifyDkgVerificationFailed, WriteDkgShares}; use madhouse::{Command, execute_commands, prop_allof, scenario}; use proptest::prelude::*; @@ -863,7 +861,6 @@ pub mod validate_dkg_verification_message { scenario![ test_context, - NewTestDatabase, CreateDkgShares, WriteDkgShares, VerifyDkgVerificationFailed, From 7d54fd59f1965881ef39dcd00816cd4d452a0d8f Mon Sep 17 00:00:00 2001 From: BowTiedRadone Date: Fri, 25 Apr 2025 08:46:01 -0400 Subject: [PATCH 08/17] Rename `CreateDkgShares` to `CreateFailedDkgShares` --- signer/tests/integration/commands/dkg.rs | 10 +++++----- signer/tests/integration/commands/mod.rs | 2 +- signer/tests/integration/transaction_signer.rs | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/signer/tests/integration/commands/dkg.rs b/signer/tests/integration/commands/dkg.rs index d2042ce02..c893a1be3 100644 --- a/signer/tests/integration/commands/dkg.rs +++ b/signer/tests/integration/commands/dkg.rs @@ -12,17 +12,17 @@ use signer::{ use super::{Ctx, TestState}; -pub struct CreateDkgShares { +pub struct CreateFailedDkgShares { seed: u64, } -impl CreateDkgShares { +impl CreateFailedDkgShares { fn with_seed(seed: u64) -> Self { Self { seed } } } -impl Command for CreateDkgShares { +impl Command for CreateFailedDkgShares { fn check(&self, _state: &TestState) -> bool { true } @@ -41,10 +41,10 @@ impl Command for CreateDkgShares { } fn label(&self) -> String { - "CREATE_DKG_SHARES".to_string() + "CREATE_FAILED_DKG_SHARES".to_string() } fn build(_ctx: std::sync::Arc) -> impl Strategy> { - any::().prop_map(|seed| CommandWrapper::new(CreateDkgShares::with_seed(seed))) + any::().prop_map(|seed| CommandWrapper::new(CreateFailedDkgShares::with_seed(seed))) } } diff --git a/signer/tests/integration/commands/mod.rs b/signer/tests/integration/commands/mod.rs index 1c0c1ed57..25cb06d3d 100644 --- a/signer/tests/integration/commands/mod.rs +++ b/signer/tests/integration/commands/mod.rs @@ -5,5 +5,5 @@ mod test_cases; pub use context::{Ctx, TestState}; pub use db::WriteDkgShares; -pub use dkg::CreateDkgShares; +pub use dkg::CreateFailedDkgShares; pub use test_cases::VerifyDkgVerificationFailed; diff --git a/signer/tests/integration/transaction_signer.rs b/signer/tests/integration/transaction_signer.rs index 8a0289686..df948dbce 100644 --- a/signer/tests/integration/transaction_signer.rs +++ b/signer/tests/integration/transaction_signer.rs @@ -851,7 +851,7 @@ pub mod validate_dkg_verification_message { )) } - use crate::commands::{CreateDkgShares, Ctx, VerifyDkgVerificationFailed, WriteDkgShares}; + use crate::commands::{CreateFailedDkgShares, Ctx, VerifyDkgVerificationFailed, WriteDkgShares}; use madhouse::{Command, execute_commands, prop_allof, scenario}; use proptest::prelude::*; @@ -861,7 +861,7 @@ pub mod validate_dkg_verification_message { scenario![ test_context, - CreateDkgShares, + CreateFailedDkgShares, WriteDkgShares, VerifyDkgVerificationFailed, ] From b7623fcda4e451e1ff50921bc2aebedc12326734 Mon Sep 17 00:00:00 2001 From: BowTiedRadone Date: Fri, 25 Apr 2025 08:58:46 -0400 Subject: [PATCH 09/17] Housekeep command-based testing harness --- signer/tests/integration/commands/context.rs | 21 ++++++--- signer/tests/integration/commands/db.rs | 44 ------------------- signer/tests/integration/commands/dkg.rs | 43 +++++++++++++++++- signer/tests/integration/commands/mod.rs | 4 +- signer/tests/integration/commands/runtime.rs | 24 ---------- .../tests/integration/commands/test_cases.rs | 2 +- .../tests/integration/transaction_signer.rs | 8 +++- 7 files changed, 64 insertions(+), 82 deletions(-) delete mode 100644 signer/tests/integration/commands/db.rs delete mode 100644 signer/tests/integration/commands/runtime.rs diff --git a/signer/tests/integration/commands/context.rs b/signer/tests/integration/commands/context.rs index 25e3ee6cc..6edbb8bf9 100644 --- a/signer/tests/integration/commands/context.rs +++ b/signer/tests/integration/commands/context.rs @@ -1,24 +1,31 @@ +use std::sync::Arc; + use madhouse::{State, TestContext}; +use signer::{ + storage::{model::EncryptedDkgShares, postgres::PgStore}, + testing::storage::new_test_database, +}; +use tokio::runtime::Runtime; #[derive(Clone, Debug)] pub struct Ctx { - db: signer::storage::postgres::PgStore, - runtime: std::sync::Arc, + db: PgStore, + runtime: Arc, } impl Ctx { pub fn new() -> Self { - let runtime = std::sync::Arc::new(tokio::runtime::Runtime::new().unwrap()); - let db = runtime.block_on(async { signer::testing::storage::new_test_database().await }); + let runtime = Arc::new(Runtime::new().unwrap()); + let db = runtime.block_on(async { new_test_database().await }); Self { db, runtime } } - pub fn db(&self) -> &signer::storage::postgres::PgStore { + pub fn db(&self) -> &PgStore { &self.db } - pub fn runtime_handle(&self) -> std::sync::Arc { + pub fn runtime_handle(&self) -> Arc { self.runtime.clone() } } @@ -27,7 +34,7 @@ impl TestContext for Ctx {} #[derive(Debug, Default)] pub struct TestState { - pub shares: Option, + pub shares: Option, } impl State for TestState {} diff --git a/signer/tests/integration/commands/db.rs b/signer/tests/integration/commands/db.rs deleted file mode 100644 index 7cdc20b3e..000000000 --- a/signer/tests/integration/commands/db.rs +++ /dev/null @@ -1,44 +0,0 @@ -use std::sync::Arc; - -use madhouse::{Command, CommandWrapper}; -use proptest::prelude::Strategy; -use signer::storage::DbWrite; - -use super::{Ctx, TestState}; - -pub struct WriteDkgShares { - ctx: Arc, -} - -impl WriteDkgShares { - pub fn new(ctx: Arc) -> Self { - Self { ctx } - } -} - -impl Command for WriteDkgShares { - fn check(&self, state: &TestState) -> bool { - state.shares.is_some() - } - - fn apply(&self, state: &mut TestState) { - let shares = state.shares.as_ref().unwrap(); - - self.ctx.runtime_handle().block_on(async { - match self.ctx.db().write_encrypted_dkg_shares(shares).await { - Ok(db_result) => db_result, - Err(e) => { - panic!("Failed to write DKG shares: {}", e); - } - }; - }); - } - - fn label(&self) -> String { - "WRITE_DKG_SHARES".to_string() - } - - fn build(ctx: std::sync::Arc) -> impl Strategy> { - proptest::prelude::Just(CommandWrapper::new(WriteDkgShares::new(ctx.clone()))) - } -} diff --git a/signer/tests/integration/commands/dkg.rs b/signer/tests/integration/commands/dkg.rs index c893a1be3..5961d947d 100644 --- a/signer/tests/integration/commands/dkg.rs +++ b/signer/tests/integration/commands/dkg.rs @@ -1,10 +1,14 @@ +use std::sync::Arc; + use fake::Fake as _; use fake::Faker; use madhouse::{Command, CommandWrapper}; +use proptest::prelude::Just; use proptest::prelude::Strategy; use proptest::prelude::any; use rand::SeedableRng; use secp256k1::{Keypair, rand::rngs::StdRng}; +use signer::storage::DbWrite as _; use signer::{ keys::PublicKey, storage::model::{DkgSharesStatus, EncryptedDkgShares}, @@ -44,7 +48,44 @@ impl Command for CreateFailedDkgShares { "CREATE_FAILED_DKG_SHARES".to_string() } - fn build(_ctx: std::sync::Arc) -> impl Strategy> { + fn build(_ctx: Arc) -> impl Strategy> { any::().prop_map(|seed| CommandWrapper::new(CreateFailedDkgShares::with_seed(seed))) } } + +pub struct WriteDkgShares { + ctx: Arc, +} + +impl WriteDkgShares { + pub fn new(ctx: Arc) -> Self { + Self { ctx } + } +} + +impl Command for WriteDkgShares { + fn check(&self, state: &TestState) -> bool { + state.shares.is_some() + } + + fn apply(&self, state: &mut TestState) { + let shares = state.shares.as_ref().unwrap(); + + self.ctx.runtime_handle().block_on(async { + match self.ctx.db().write_encrypted_dkg_shares(shares).await { + Ok(db_result) => db_result, + Err(e) => { + panic!("Failed to write DKG shares: {}", e); + } + }; + }); + } + + fn label(&self) -> String { + "WRITE_DKG_SHARES".to_string() + } + + fn build(ctx: Arc) -> impl Strategy> { + Just(CommandWrapper::new(WriteDkgShares::new(ctx.clone()))) + } +} diff --git a/signer/tests/integration/commands/mod.rs b/signer/tests/integration/commands/mod.rs index 25cb06d3d..f698857be 100644 --- a/signer/tests/integration/commands/mod.rs +++ b/signer/tests/integration/commands/mod.rs @@ -1,9 +1,7 @@ mod context; -mod db; mod dkg; mod test_cases; pub use context::{Ctx, TestState}; -pub use db::WriteDkgShares; -pub use dkg::CreateFailedDkgShares; +pub use dkg::{CreateFailedDkgShares, WriteDkgShares}; pub use test_cases::VerifyDkgVerificationFailed; diff --git a/signer/tests/integration/commands/runtime.rs b/signer/tests/integration/commands/runtime.rs deleted file mode 100644 index f270a2a1e..000000000 --- a/signer/tests/integration/commands/runtime.rs +++ /dev/null @@ -1,24 +0,0 @@ -use madhouse::{Command, CommandWrapper}; -use proptest::prelude::Strategy; - -use super::{Ctx, TestState}; - -pub struct InitializeRuntime; - -impl Command for InitializeRuntime { - fn check(&self, state: &TestState) -> bool { - state.runtime.is_none() - } - - fn apply(&self, state: &mut TestState) { - state.runtime = Some(tokio::runtime::Runtime::new().unwrap()); - } - - fn label(&self) -> String { - "INITIALIZE_RUNTIME".to_string() - } - - fn build(_ctx: std::sync::Arc) -> impl Strategy> { - proptest::prelude::Just(CommandWrapper::new(InitializeRuntime)) - } -} diff --git a/signer/tests/integration/commands/test_cases.rs b/signer/tests/integration/commands/test_cases.rs index 2bc236509..08f754c30 100644 --- a/signer/tests/integration/commands/test_cases.rs +++ b/signer/tests/integration/commands/test_cases.rs @@ -44,7 +44,7 @@ impl Command for VerifyDkgVerificationFailed { "VERIFY_DKG_VERIFICATION_FAILED".to_string() } - fn build(ctx: std::sync::Arc) -> impl Strategy> { + fn build(ctx: Arc) -> impl Strategy> { Just(CommandWrapper::new(VerifyDkgVerificationFailed::new( ctx.clone(), ))) diff --git a/signer/tests/integration/transaction_signer.rs b/signer/tests/integration/transaction_signer.rs index df948dbce..e0dc5fd4b 100644 --- a/signer/tests/integration/transaction_signer.rs +++ b/signer/tests/integration/transaction_signer.rs @@ -851,13 +851,17 @@ pub mod validate_dkg_verification_message { )) } - use crate::commands::{CreateFailedDkgShares, Ctx, VerifyDkgVerificationFailed, WriteDkgShares}; + use std::sync::Arc; + + use crate::commands::{ + CreateFailedDkgShares, Ctx, VerifyDkgVerificationFailed, WriteDkgShares, + }; use madhouse::{Command, execute_commands, prop_allof, scenario}; use proptest::prelude::*; #[test] fn latest_key_in_failed_state_scenario() { - let test_context = std::sync::Arc::new(Ctx::new()); + let test_context = Arc::new(Ctx::new()); scenario![ test_context, From d14f9adfd05ca9ce54bbaa292628a69f15693029 Mon Sep 17 00:00:00 2001 From: BowTiedRadone Date: Fri, 25 Apr 2025 11:37:34 -0400 Subject: [PATCH 10/17] Update to latest `madhouse-rs` --- Cargo.lock | 2 +- signer/Cargo.toml | 2 +- signer/tests/integration/transaction_signer.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0ab2be37f..deca710c8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3640,7 +3640,7 @@ dependencies = [ [[package]] name = "madhouse" version = "0.1.1" -source = "git+https://github.com/stacks-network/madhouse-rs.git?rev=b14bb8dce7df68cfe7e6122861e1945d6f6ef618#b14bb8dce7df68cfe7e6122861e1945d6f6ef618" +source = "git+https://github.com/stacks-network/madhouse-rs.git?rev=8623f2a4efc6a8b691f25bc95eb9801fec17b4c0#8623f2a4efc6a8b691f25bc95eb9801fec17b4c0" dependencies = [ "proptest 1.6.0 (git+https://github.com/proptest-rs/proptest.git?rev=c9bdf18c232665b2b740c667c81866b598d06dc7)", ] diff --git a/signer/Cargo.toml b/signer/Cargo.toml index 80f6c1e38..694c02fb8 100644 --- a/signer/Cargo.toml +++ b/signer/Cargo.toml @@ -62,7 +62,7 @@ wsts.workspace = true # Only for testing fake = { workspace = true, optional = true } mockall = { workspace = true, optional = true } -madhouse = { git = "https://github.com/stacks-network/madhouse-rs.git", rev = "b14bb8dce7df68cfe7e6122861e1945d6f6ef618" } +madhouse = { git = "https://github.com/stacks-network/madhouse-rs.git", rev = "8623f2a4efc6a8b691f25bc95eb9801fec17b4c0" } proptest = { git = "https://github.com/proptest-rs/proptest.git", rev = "c9bdf18c232665b2b740c667c81866b598d06dc7" } [build-dependencies] diff --git a/signer/tests/integration/transaction_signer.rs b/signer/tests/integration/transaction_signer.rs index e0dc5fd4b..99cbbbef2 100644 --- a/signer/tests/integration/transaction_signer.rs +++ b/signer/tests/integration/transaction_signer.rs @@ -856,7 +856,7 @@ pub mod validate_dkg_verification_message { use crate::commands::{ CreateFailedDkgShares, Ctx, VerifyDkgVerificationFailed, WriteDkgShares, }; - use madhouse::{Command, execute_commands, prop_allof, scenario}; + use madhouse::prelude::*; use proptest::prelude::*; #[test] From a1b519229b4c58bcde9d8fc82f2ebf9b4e0ed29b Mon Sep 17 00:00:00 2001 From: BowTiedRadone Date: Mon, 28 Apr 2025 17:22:43 -0400 Subject: [PATCH 11/17] Move `madhouse-rs` dependency to workspace `Cargo.toml` This commit addresses the following comments: - https://github.com/stacks-sbtc/sbtc/pull/1633#discussion_r2063117933 - https://github.com/stacks-sbtc/sbtc/pull/1633#discussion_r2063119488 --- Cargo.lock | 25 +++++-------------------- Cargo.toml | 1 + signer/Cargo.toml | 6 +++--- 3 files changed, 9 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index deca710c8..476ae3747 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3639,10 +3639,10 @@ dependencies = [ [[package]] name = "madhouse" -version = "0.1.1" -source = "git+https://github.com/stacks-network/madhouse-rs.git?rev=8623f2a4efc6a8b691f25bc95eb9801fec17b4c0#8623f2a4efc6a8b691f25bc95eb9801fec17b4c0" +version = "0.2.0" +source = "git+https://github.com/stacks-network/madhouse-rs.git?rev=a0983d0f7d43c4b2a765df7f46b7ee28f160924d#a0983d0f7d43c4b2a765df7f46b7ee28f160924d" dependencies = [ - "proptest 1.6.0 (git+https://github.com/proptest-rs/proptest.git?rev=c9bdf18c232665b2b740c667c81866b598d06dc7)", + "proptest", ] [[package]] @@ -4650,21 +4650,6 @@ name = "proptest" version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14cae93065090804185d3b75f0bf93b8eeda30c7a9b4a33d3bdb3988d6229e50" -dependencies = [ - "bitflags 2.5.0", - "lazy_static", - "num-traits", - "rand", - "rand_chacha", - "rand_xorshift", - "regex-syntax 0.8.3", - "unarray", -] - -[[package]] -name = "proptest" -version = "1.6.0" -source = "git+https://github.com/proptest-rs/proptest.git?rev=c9bdf18c232665b2b740c667c81866b598d06dc7#c9bdf18c232665b2b740c667c81866b598d06dc7" dependencies = [ "bit-set", "bit-vec", @@ -5462,7 +5447,7 @@ dependencies = [ "clarity", "hex", "more-asserts", - "proptest 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proptest", "rand", "secp256k1 0.29.0", "serde", @@ -5858,7 +5843,7 @@ dependencies = [ "more-asserts", "p256k1", "polynomial", - "proptest 1.6.0 (git+https://github.com/proptest-rs/proptest.git?rev=c9bdf18c232665b2b740c667c81866b598d06dc7)", + "proptest", "prost", "rand", "reqwest 0.11.27", diff --git a/Cargo.toml b/Cargo.toml index 6f6b8c574..7bbaa2c5e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -92,6 +92,7 @@ tracing-subscriber = { version = "0.3.19", default-features = false, features = # Crates used only for testing fake = { version = "3.1.0", default-features = false, features = ["derive", "time"] } +madhouse = { git = "https://github.com/stacks-network/madhouse-rs.git", rev = "a0983d0f7d43c4b2a765df7f46b7ee28f160924d", default-features = false } mockall = { version = "0.13.1", default-features = false } mockito = { version = "1.6.1", default-features = false } more-asserts = { version = "0.3.1", default-features = false } diff --git a/signer/Cargo.toml b/signer/Cargo.toml index 694c02fb8..ae3fc9741 100644 --- a/signer/Cargo.toml +++ b/signer/Cargo.toml @@ -8,7 +8,7 @@ ignored = ["tonic", "tonic-build", "stackslib"] [features] default = [] -testing = ["dep:fake", "dep:mockall", "sbtc/testing"] +testing = ["dep:fake", "dep:madhouse", "dep:mockall", "sbtc/testing"] [dependencies] aquamarine.workspace = true @@ -61,9 +61,8 @@ wsts.workspace = true # Only for testing fake = { workspace = true, optional = true } +madhouse = { workspace = true, optional = true } mockall = { workspace = true, optional = true } -madhouse = { git = "https://github.com/stacks-network/madhouse-rs.git", rev = "8623f2a4efc6a8b691f25bc95eb9801fec17b4c0" } -proptest = { git = "https://github.com/proptest-rs/proptest.git", rev = "c9bdf18c232665b2b740c667c81866b598d06dc7" } [build-dependencies] tonic-build.workspace = true @@ -72,6 +71,7 @@ tonic-build.workspace = true bitcoincore-rpc.workspace = true mockito.workspace = true more-asserts.workspace = true +proptest.workspace = true ripemd.workspace = true sbtc = { workspace = true, features = ["testing"] } # We need this so that we have access to "testing" feature code in our From cd2f4e2d2f228e5b6fdf32d8a3d2f8edbe54cd4f Mon Sep 17 00:00:00 2001 From: BowTiedRadone Date: Mon, 28 Apr 2025 17:30:08 -0400 Subject: [PATCH 12/17] Reference `madhouse-rs` dependency by tag --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 476ae3747..16cde3dd0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3640,7 +3640,7 @@ dependencies = [ [[package]] name = "madhouse" version = "0.2.0" -source = "git+https://github.com/stacks-network/madhouse-rs.git?rev=a0983d0f7d43c4b2a765df7f46b7ee28f160924d#a0983d0f7d43c4b2a765df7f46b7ee28f160924d" +source = "git+https://github.com/stacks-network/madhouse-rs.git?tag=0.2.0#a0983d0f7d43c4b2a765df7f46b7ee28f160924d" dependencies = [ "proptest", ] diff --git a/Cargo.toml b/Cargo.toml index 7bbaa2c5e..c86ea265c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -92,7 +92,7 @@ tracing-subscriber = { version = "0.3.19", default-features = false, features = # Crates used only for testing fake = { version = "3.1.0", default-features = false, features = ["derive", "time"] } -madhouse = { git = "https://github.com/stacks-network/madhouse-rs.git", rev = "a0983d0f7d43c4b2a765df7f46b7ee28f160924d", default-features = false } +madhouse = { git = "https://github.com/stacks-network/madhouse-rs.git", tag = "0.2.0", default-features = false } mockall = { version = "0.13.1", default-features = false } mockito = { version = "1.6.1", default-features = false } more-asserts = { version = "0.3.1", default-features = false } From a5df54da2a76fd8acdbdef4f1dadf9e4ec9373b8 Mon Sep 17 00:00:00 2001 From: BowTiedRadone Date: Tue, 29 Apr 2025 05:32:19 -0400 Subject: [PATCH 13/17] Make `CreateFailedDkgShares` `apply` deterministic --- signer/tests/integration/commands/dkg.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/signer/tests/integration/commands/dkg.rs b/signer/tests/integration/commands/dkg.rs index 5961d947d..37f82145b 100644 --- a/signer/tests/integration/commands/dkg.rs +++ b/signer/tests/integration/commands/dkg.rs @@ -38,7 +38,7 @@ impl Command for CreateFailedDkgShares { aggregate_key, dkg_shares_status: DkgSharesStatus::Failed, started_at_bitcoin_block_height: 0u64.into(), - ..Faker.fake() + ..Faker.fake_with_rng(&mut rng) }; state.shares = Some(shares); From f9e29ffbcdeb9665838a429ae284addd6cf7cb90 Mon Sep 17 00:00:00 2001 From: BowTiedRadone Date: Tue, 29 Apr 2025 07:25:54 -0400 Subject: [PATCH 14/17] Rename constructor in `WriteDkgShares` --- signer/tests/integration/commands/dkg.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/signer/tests/integration/commands/dkg.rs b/signer/tests/integration/commands/dkg.rs index 37f82145b..958910327 100644 --- a/signer/tests/integration/commands/dkg.rs +++ b/signer/tests/integration/commands/dkg.rs @@ -21,7 +21,7 @@ pub struct CreateFailedDkgShares { } impl CreateFailedDkgShares { - fn with_seed(seed: u64) -> Self { + fn new(seed: u64) -> Self { Self { seed } } } @@ -49,7 +49,7 @@ impl Command for CreateFailedDkgShares { } fn build(_ctx: Arc) -> impl Strategy> { - any::().prop_map(|seed| CommandWrapper::new(CreateFailedDkgShares::with_seed(seed))) + any::().prop_map(|seed| CommandWrapper::new(CreateFailedDkgShares::new(seed))) } } From e1034dc834fa10a6d919b3bb2d6cdc301bb82007 Mon Sep 17 00:00:00 2001 From: BowTiedRadone Date: Mon, 12 May 2025 00:20:49 +0300 Subject: [PATCH 15/17] Move `madhouse-rs` to dev-dependencies --- signer/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/signer/Cargo.toml b/signer/Cargo.toml index ae3fc9741..1611678a7 100644 --- a/signer/Cargo.toml +++ b/signer/Cargo.toml @@ -8,7 +8,7 @@ ignored = ["tonic", "tonic-build", "stackslib"] [features] default = [] -testing = ["dep:fake", "dep:madhouse", "dep:mockall", "sbtc/testing"] +testing = ["dep:fake", "dep:mockall", "sbtc/testing"] [dependencies] aquamarine.workspace = true @@ -61,7 +61,6 @@ wsts.workspace = true # Only for testing fake = { workspace = true, optional = true } -madhouse = { workspace = true, optional = true } mockall = { workspace = true, optional = true } [build-dependencies] @@ -69,6 +68,7 @@ tonic-build.workspace = true [dev-dependencies] bitcoincore-rpc.workspace = true +madhouse.workspace = true mockito.workspace = true more-asserts.workspace = true proptest.workspace = true From c1be6b481d641288b6e0b9e0055751eed9357ec7 Mon Sep 17 00:00:00 2001 From: BowTiedRadone Date: Mon, 12 May 2025 17:38:53 +0300 Subject: [PATCH 16/17] Use latest `madhouse-rs` tag --- Cargo.lock | 42 +----------------------------------------- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 42 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 16cde3dd0..c542fb743 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -772,21 +772,6 @@ dependencies = [ "which", ] -[[package]] -name = "bit-set" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" -dependencies = [ - "bit-vec", -] - -[[package]] -name = "bit-vec" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" - [[package]] name = "bitcoin" version = "0.32.5" @@ -3640,7 +3625,7 @@ dependencies = [ [[package]] name = "madhouse" version = "0.2.0" -source = "git+https://github.com/stacks-network/madhouse-rs.git?tag=0.2.0#a0983d0f7d43c4b2a765df7f46b7ee28f160924d" +source = "git+https://github.com/stacks-network/madhouse-rs.git?tag=0.2.1#5d4d51bedf2d56c8ef0643d891fb085df1615c91" dependencies = [ "proptest", ] @@ -4651,8 +4636,6 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14cae93065090804185d3b75f0bf93b8eeda30c7a9b4a33d3bdb3988d6229e50" dependencies = [ - "bit-set", - "bit-vec", "bitflags 2.5.0", "lazy_static", "num-traits", @@ -4660,8 +4643,6 @@ dependencies = [ "rand_chacha", "rand_xorshift", "regex-syntax 0.8.3", - "rusty-fork", - "tempfile", "unarray", ] @@ -5398,18 +5379,6 @@ version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" -[[package]] -name = "rusty-fork" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f" -dependencies = [ - "fnv", - "quick-error", - "tempfile", - "wait-timeout", -] - [[package]] name = "rw-stream-sink" version = "0.4.0" @@ -7225,15 +7194,6 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c3082ca00d5a5ef149bb8b555a72ae84c9c59f7250f013ac822ac2e49b19c64" -[[package]] -name = "wait-timeout" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11" -dependencies = [ - "libc", -] - [[package]] name = "walkdir" version = "2.5.0" diff --git a/Cargo.toml b/Cargo.toml index c86ea265c..dc0a4a456 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -92,7 +92,7 @@ tracing-subscriber = { version = "0.3.19", default-features = false, features = # Crates used only for testing fake = { version = "3.1.0", default-features = false, features = ["derive", "time"] } -madhouse = { git = "https://github.com/stacks-network/madhouse-rs.git", tag = "0.2.0", default-features = false } +madhouse = { git = "https://github.com/stacks-network/madhouse-rs.git", tag = "0.2.1", default-features = false } mockall = { version = "0.13.1", default-features = false } mockito = { version = "1.6.1", default-features = false } more-asserts = { version = "0.3.1", default-features = false } From b46f21e0e76358c10e39a57de780c97b58c8423d Mon Sep 17 00:00:00 2001 From: BowTiedRadone Date: Tue, 10 Jun 2025 13:29:10 +0300 Subject: [PATCH 17/17] Run `cargo vet prune` --- supply-chain/config.toml | 16 -------- supply-chain/imports.lock | 77 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 16 deletions(-) diff --git a/supply-chain/config.toml b/supply-chain/config.toml index d08ebcc69..753c7d728 100644 --- a/supply-chain/config.toml +++ b/supply-chain/config.toml @@ -49,10 +49,6 @@ criteria = "safe-to-deploy" version = "1.1.3" criteria = "safe-to-deploy" -[[exemptions.android-tzdata]] -version = "0.1.1" -criteria = "safe-to-deploy" - [[exemptions.anstyle]] version = "1.0.10" criteria = "safe-to-deploy" @@ -525,10 +521,6 @@ criteria = "safe-to-deploy" version = "0.1.9" criteria = "safe-to-deploy" -[[exemptions.fastrand]] -version = "2.3.0" -criteria = "safe-to-deploy" - [[exemptions.finl_unicode]] version = "1.2.0" criteria = "safe-to-deploy" @@ -1429,10 +1421,6 @@ criteria = "safe-to-deploy" version = "0.2.3" criteria = "safe-to-deploy" -[[exemptions.rustc_version]] -version = "0.4.0" -criteria = "safe-to-deploy" - [[exemptions.rustfmt-wrapper]] version = "0.2.1" criteria = "safe-to-deploy" @@ -1817,10 +1805,6 @@ criteria = "safe-to-deploy" version = "0.1.2" criteria = "safe-to-deploy" -[[exemptions.tinyvec_macros]] -version = "0.1.1" -criteria = "safe-to-deploy" - [[exemptions.tokio]] version = "1.43.0" criteria = "safe-to-deploy" diff --git a/supply-chain/imports.lock b/supply-chain/imports.lock index 1085c9e8b..503fa6fad 100644 --- a/supply-chain/imports.lock +++ b/supply-chain/imports.lock @@ -116,6 +116,21 @@ who = "Nick Fitzgerald " criteria = "safe-to-deploy" delta = "0.2.4 -> 0.2.5" +[[audits.bytecodealliance.audits.fastrand]] +who = "Alex Crichton " +criteria = "safe-to-deploy" +delta = "2.0.0 -> 2.0.1" +notes = """ +This update had a few doc updates but no otherwise-substantial source code +updates. +""" + +[[audits.bytecodealliance.audits.fastrand]] +who = "Alex Crichton " +criteria = "safe-to-deploy" +delta = "2.1.1 -> 2.3.0" +notes = "Minor refactoring, nothing new." + [[audits.bytecodealliance.audits.foldhash]] who = "Alex Crichton " criteria = "safe-to-deploy" @@ -363,6 +378,16 @@ without `unsafe`. Skimming the crate everything looks reasonable and what one would expect from idiomatic safe collections in Rust. """ +[[audits.bytecodealliance.audits.tinyvec_macros]] +who = "Alex Crichton " +criteria = "safe-to-deploy" +version = "0.1.0" +notes = """ +This is a trivial crate which only contains a singular macro definition which is +intended to multiplex across the internal representation of a tinyvec, +presumably. This trivially doesn't contain anything bad. +""" + [[audits.bytecodealliance.audits.tokio-native-tls]] who = "Pat Hickey " criteria = "safe-to-deploy" @@ -579,6 +604,16 @@ criteria = "safe-to-deploy" version = "1.0.1" aggregated-from = "https://chromium.googlesource.com/chromiumos/third_party/rust_crates/+/refs/heads/main/cargo-vet/audits.toml?format=TEXT" +[[audits.google.audits.fastrand]] +who = "George Burgess IV " +criteria = "safe-to-deploy" +version = "1.9.0" +notes = """ +`does-not-implement-crypto` is certified because this crate explicitly says +that the RNG here is not cryptographically secure. +""" +aggregated-from = "https://chromium.googlesource.com/chromiumos/third_party/rust_crates/+/refs/heads/main/cargo-vet/audits.toml?format=TEXT" + [[audits.google.audits.glob]] who = "George Burgess IV " criteria = "safe-to-deploy" @@ -1351,6 +1386,13 @@ criteria = "safe-to-deploy" version = "0.2.18" aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" +[[audits.mozilla.audits.android-tzdata]] +who = "Mark Hammond " +criteria = "safe-to-deploy" +version = "0.1.1" +notes = "Small crate parsing a file. No unsafe code" +aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" + [[audits.mozilla.audits.android_system_properties]] who = "Nicolas Silva " criteria = "safe-to-deploy" @@ -1436,6 +1478,25 @@ criteria = "safe-to-deploy" delta = "0.2.3 -> 0.2.4" aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" +[[audits.mozilla.audits.fastrand]] +who = "Mike Hommey " +criteria = "safe-to-deploy" +delta = "1.9.0 -> 2.0.0" +aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" + +[[audits.mozilla.audits.fastrand]] +who = "Mike Hommey " +criteria = "safe-to-deploy" +delta = "2.0.1 -> 2.1.0" +aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" + +[[audits.mozilla.audits.fastrand]] +who = "Chris Martin " +criteria = "safe-to-deploy" +delta = "2.1.0 -> 2.1.1" +notes = "Fairly trivial changes, no chance of security regression." +aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" + [[audits.mozilla.audits.fnv]] who = "Bobby Holley " criteria = "safe-to-deploy" @@ -1757,6 +1818,16 @@ version = "1.1.0" notes = "Straightforward crate with no unsafe code, does what it says on the tin." aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" +[[audits.mozilla.audits.rustc_version]] +who = "Nika Layzell " +criteria = "safe-to-deploy" +version = "0.4.0" +notes = """ +Use of powerful capabilities is limited to invoking `rustc -vV` to get version +information for parsing version information. +""" +aggregated-from = "https://raw.githubusercontent.com/mozilla/cargo-vet/main/supply-chain/audits.toml" + [[audits.mozilla.audits.sha2]] who = "Mike Hommey " criteria = "safe-to-deploy" @@ -1883,6 +1954,12 @@ criteria = "safe-to-deploy" delta = "0.7.4 -> 0.7.6" aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" +[[audits.mozilla.audits.tinyvec_macros]] +who = "Drew Willcoxon " +criteria = "safe-to-deploy" +delta = "0.1.0 -> 0.1.1" +aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" + [[audits.mozilla.audits.unicode-bidi]] who = "Makoto Kato " criteria = "safe-to-deploy"