diff --git a/CHANGELOG.md b/CHANGELOG.md index bd4e5b1..0b8c2f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Removed the RNG parameter from `Round::receive_message()` and `Session::process_message()`. ([#83]) - Renamed `Round::entry_round()` to `entry_round_id()` and made it mandatory to implement. ([#84]) - Rework `RequiredMessageParts` API. ([#85]) +- Removed `Send + Sync` bound on `WireFormat`. ([#92]) +- Removed `Send` bound on `ProtocolError`. ([#92]) ### Added @@ -58,6 +60,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [#88]: https://github.com/entropyxyz/manul/pull/88 [#90]: https://github.com/entropyxyz/manul/pull/90 [#91]: https://github.com/entropyxyz/manul/pull/91 +[#92]: https://github.com/entropyxyz/manul/pull/92 ## [0.1.0] - 2024-11-19 diff --git a/manul/src/protocol/object_safe.rs b/manul/src/protocol/object_safe.rs index 3d79e5c..5ac39e8 100644 --- a/manul/src/protocol/object_safe.rs +++ b/manul/src/protocol/object_safe.rs @@ -96,12 +96,11 @@ pub(crate) trait ObjectSafeRound: 'static + Debug + Send + Sync { } } -// The `fn(Id) -> Id` bit is so that `ObjectSafeRoundWrapper` didn't require a bound on `Id` to be -// `Send + Sync`. +// The `fn(Id)` bit is so that `ObjectSafeRoundWrapper` didn't require a bound on `Id` to be `Send + Sync`. #[derive(Debug)] pub(crate) struct ObjectSafeRoundWrapper { round: R, - phantom: PhantomData Id>, + phantom: PhantomData, } impl ObjectSafeRoundWrapper diff --git a/manul/src/protocol/round.rs b/manul/src/protocol/round.rs index d0df44e..96fac89 100644 --- a/manul/src/protocol/round.rs +++ b/manul/src/protocol/round.rs @@ -283,7 +283,7 @@ impl RequiredMessages { /// /// Provable here means that we can create an evidence object entirely of messages signed by some party, /// which, in combination, prove the party's malicious actions. -pub trait ProtocolError: Display + Debug + Clone + Send + Serialize + for<'de> Deserialize<'de> { +pub trait ProtocolError: Display + Debug + Clone + Serialize + for<'de> Deserialize<'de> { /// Additional data that cannot be derived from the node's messages alone /// and therefore has to be supplied externally during evidence verification. type AssociatedData: Debug; diff --git a/manul/src/protocol/serialization.rs b/manul/src/protocol/serialization.rs index cb0abb7..9dfd1fe 100644 --- a/manul/src/protocol/serialization.rs +++ b/manul/src/protocol/serialization.rs @@ -12,8 +12,9 @@ trait ObjectSafeSerializer: Debug { fn serialize(&self, value: Box) -> Result, LocalError>; } +// `fn(F)` makes the type `Send` + `Sync` even if `F` isn't. #[derive(Debug)] -struct SerializerWrapper(PhantomData); +struct SerializerWrapper(PhantomData); impl ObjectSafeSerializer for SerializerWrapper { fn serialize(&self, value: Box) -> Result, LocalError> { @@ -42,8 +43,9 @@ impl Serializer { // Deserialization +// `fn(F)` makes the type `Send` + `Sync` even if `F` isn't. #[derive(Debug)] -struct DeserializerFactoryWrapper(PhantomData); +struct DeserializerFactoryWrapper(PhantomData); trait ObjectSafeDeserializerFactory: Debug { fn make_erased_deserializer<'de>(&self, bytes: &'de [u8]) -> Box + 'de>; @@ -68,7 +70,7 @@ impl Deserializer { where F: WireFormat, { - Self(Box::new(DeserializerFactoryWrapper(PhantomData::))) + Self(Box::new(DeserializerFactoryWrapper::(PhantomData))) } /// Deserializes a `serde`-deserializable object. diff --git a/manul/src/session/wire_format.rs b/manul/src/session/wire_format.rs index d673d98..9675b2b 100644 --- a/manul/src/session/wire_format.rs +++ b/manul/src/session/wire_format.rs @@ -25,7 +25,7 @@ if we could instead type-erase the serializer, we wouldn't need that. */ /// A (de)serializer that will be used for the protocol messages. -pub trait WireFormat: 'static + Send + Sync + Debug { +pub trait WireFormat: 'static + Debug { /// Serializes the given object into a bytestring. fn serialize(value: T) -> Result, LocalError>;