diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 04edd4c..ac35b31 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -21,4 +21,4 @@ tracing = "0.1" tokio = { version = "1", features = ["rt", "sync", "time", "macros"] } rand = "0.8" digest = "0.10" -manul = { path = "../manul", features = ["testing"] } +manul = { path = "../manul", features = ["dev"] } diff --git a/examples/src/simple.rs b/examples/src/simple.rs index 93ea482..69b0cc2 100644 --- a/examples/src/simple.rs +++ b/examples/src/simple.rs @@ -410,8 +410,8 @@ mod tests { use alloc::collections::BTreeSet; use manul::{ + dev::{run_sync_with_tracing, BinaryFormat, TestSessionParams, TestSigner}, session::signature::Keypair, - testing::{run_sync_with_tracing, BinaryFormat, TestSessionParams, TestSigner}, }; use rand_core::OsRng; diff --git a/examples/src/simple_chain.rs b/examples/src/simple_chain.rs index 236c40c..2851ee4 100644 --- a/examples/src/simple_chain.rs +++ b/examples/src/simple_chain.rs @@ -68,8 +68,8 @@ mod tests { use alloc::collections::BTreeSet; use manul::{ + dev::{run_sync_with_tracing, BinaryFormat, TestSessionParams, TestSigner}, session::signature::Keypair, - testing::{run_sync_with_tracing, BinaryFormat, TestSessionParams, TestSigner}, }; use rand_core::OsRng; diff --git a/examples/src/simple_malicious.rs b/examples/src/simple_malicious.rs index efc6761..750d704 100644 --- a/examples/src/simple_malicious.rs +++ b/examples/src/simple_malicious.rs @@ -3,12 +3,12 @@ use core::fmt::Debug; use manul::{ combinators::misbehave::{Misbehaving, MisbehavingEntryPoint}, + dev::{run_sync_with_tracing, BinaryFormat, TestSessionParams, TestSigner}, protocol::{ Artifact, BoxedRound, Deserializer, DirectMessage, EntryPoint, LocalError, PartyId, ProtocolMessagePart, RoundId, Serializer, }, session::signature::Keypair, - testing::{run_sync_with_tracing, BinaryFormat, TestSessionParams, TestSigner}, }; use rand_core::{CryptoRngCore, OsRng}; diff --git a/examples/tests/async_runner.rs b/examples/tests/async_runner.rs index 704e29a..4ec9012 100644 --- a/examples/tests/async_runner.rs +++ b/examples/tests/async_runner.rs @@ -3,12 +3,12 @@ extern crate alloc; use alloc::collections::{BTreeMap, BTreeSet}; use manul::{ + dev::{BinaryFormat, TestSessionParams, TestSigner}, protocol::Protocol, session::{ signature::Keypair, CanFinalize, LocalError, Message, RoundOutcome, Session, SessionId, SessionParameters, SessionReport, }, - testing::{BinaryFormat, TestSessionParams, TestSigner}, }; use manul_example::simple::{SimpleProtocol, SimpleProtocolEntryPoint}; use rand::Rng; diff --git a/manul/Cargo.toml b/manul/Cargo.toml index ca42de1..a2d6563 100644 --- a/manul/Cargo.toml +++ b/manul/Cargo.toml @@ -44,7 +44,7 @@ tracing-subscriber = { version = "0.3", features = ["std", "fmt", "env-filter"] tracing = { version = "0.1", default-features = false, features = ["std"] } [features] -testing = ["rand", "postcard", "serde_json", "tracing/std", "serde-persistent-deserializer", "tracing-subscriber"] +dev = ["rand", "postcard", "serde_json", "tracing/std", "serde-persistent-deserializer", "tracing-subscriber"] [package.metadata.docs.rs] all-features = true @@ -53,4 +53,4 @@ rustdoc-args = ["--cfg", "docsrs"] [[bench]] name = "empty_rounds" harness = false -required-features = ["testing"] +required-features = ["dev"] diff --git a/manul/benches/empty_rounds.rs b/manul/benches/empty_rounds.rs index 3e19da6..8666147 100644 --- a/manul/benches/empty_rounds.rs +++ b/manul/benches/empty_rounds.rs @@ -5,13 +5,13 @@ use core::fmt::Debug; use criterion::{criterion_group, criterion_main, Criterion}; use manul::{ + dev::{run_sync, BinaryFormat, TestSessionParams, TestSigner}, protocol::{ Artifact, BoxedRound, Deserializer, DirectMessage, EchoBroadcast, EntryPoint, FinalizeError, FinalizeOutcome, LocalError, NormalBroadcast, PartyId, Payload, Protocol, ProtocolMessagePart, ReceiveError, Round, RoundId, Serializer, }, session::signature::Keypair, - testing::{run_sync, BinaryFormat, TestSessionParams, TestSigner}, }; use rand_core::{CryptoRngCore, OsRng}; use serde::{Deserialize, Serialize}; diff --git a/manul/src/testing.rs b/manul/src/dev.rs similarity index 100% rename from manul/src/testing.rs rename to manul/src/dev.rs diff --git a/manul/src/testing/run_sync.rs b/manul/src/dev/run_sync.rs similarity index 100% rename from manul/src/testing/run_sync.rs rename to manul/src/dev/run_sync.rs diff --git a/manul/src/testing/session_parameters.rs b/manul/src/dev/session_parameters.rs similarity index 100% rename from manul/src/testing/session_parameters.rs rename to manul/src/dev/session_parameters.rs diff --git a/manul/src/testing/wire_format.rs b/manul/src/dev/wire_format.rs similarity index 100% rename from manul/src/testing/wire_format.rs rename to manul/src/dev/wire_format.rs diff --git a/manul/src/lib.rs b/manul/src/lib.rs index 438b56b..df54003 100644 --- a/manul/src/lib.rs +++ b/manul/src/lib.rs @@ -20,8 +20,8 @@ pub mod protocol; pub mod session; pub(crate) mod utils; -#[cfg(any(test, feature = "testing"))] -pub mod testing; +#[cfg(any(test, feature = "dev"))] +pub mod dev; #[cfg(test)] mod tests; diff --git a/manul/src/session/session.rs b/manul/src/session/session.rs index 655fabc..494d71a 100644 --- a/manul/src/session/session.rs +++ b/manul/src/session/session.rs @@ -63,7 +63,7 @@ impl SessionId { /// /// **Warning:** this should generally be used for testing; creating a random session ID in a centralized way /// usually defeats the purpose of having a distributed protocol. - #[cfg(any(test, feature = "testing"))] + #[cfg(any(test, feature = "dev"))] pub fn random(rng: &mut impl CryptoRngCore) -> Self { let mut buffer = digest::Output::::default(); rng.fill_bytes(&mut buffer); @@ -850,8 +850,8 @@ mod tests { use super::{Message, ProcessedArtifact, ProcessedMessage, Session, VerifiedMessage}; use crate::{ + dev::{BinaryFormat, TestSessionParams, TestVerifier}, protocol::Protocol, - testing::{BinaryFormat, TestSessionParams, TestVerifier}, }; #[test] diff --git a/manul/src/tests/partial_echo.rs b/manul/src/tests/partial_echo.rs index 9969a16..0a9755d 100644 --- a/manul/src/tests/partial_echo.rs +++ b/manul/src/tests/partial_echo.rs @@ -11,9 +11,9 @@ use rand_core::{CryptoRngCore, OsRng}; use serde::{Deserialize, Serialize}; use crate::{ + dev::{run_sync_with_tracing, BinaryFormat, TestSessionParams, TestSigner, TestVerifier}, protocol::*, session::signature::Keypair, - testing::{run_sync_with_tracing, BinaryFormat, TestSessionParams, TestSigner, TestVerifier}, }; #[derive(Debug)]