diff --git a/CHANGELOG.md b/CHANGELOG.md index 88d80fb6..41d7aaf1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,9 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - `session::tokio::run_session()` and `par_run_session()` take an additional `cancellation` argument to support external loop cancellation. ([#100]) +- rename `BoxedRound::new_dynamic` to `BoxedRound::new` ([#112]) [#100]: https://github.com/entropyxyz/manul/pull/100 +[#112]: https://github.com/entropyxyz/manul/pull/112 ## [0.2.1] - 2025-05-05 diff --git a/examples/src/simple.rs b/examples/src/simple.rs index 8517f7bc..08e98f38 100644 --- a/examples/src/simple.rs +++ b/examples/src/simple.rs @@ -182,7 +182,7 @@ impl EntryPoint for SimpleProtocolEntryPoint { let mut ids = self.all_ids; ids.remove(id); - Ok(BoxedRound::new_dynamic(Round1 { + Ok(BoxedRound::new(Round1 { context: Context { id: id.clone(), other_ids: ids, @@ -288,7 +288,7 @@ impl Round for Round1 { let sum = self.context.ids_to_positions[&self.context.id] + typed_payloads.iter().map(|payload| payload.x).sum::(); - let round2 = BoxedRound::new_dynamic(Round2 { + let round2 = BoxedRound::new(Round2 { round1_sum: sum, context: self.context, }); diff --git a/manul/benches/async_session.rs b/manul/benches/async_session.rs index 18aa1421..745bc78c 100644 --- a/manul/benches/async_session.rs +++ b/manul/benches/async_session.rs @@ -95,7 +95,7 @@ impl EntryPoint for Inputs { _shared_randomness: &[u8], _id: &Id, ) -> Result, LocalError> { - Ok(BoxedRound::new_dynamic(EmptyRound { + Ok(BoxedRound::new(EmptyRound { round_counter: 1, inputs: self, })) @@ -174,7 +174,7 @@ impl Round for EmptyRound { if self.round_counter == self.inputs.rounds_num { Ok(FinalizeOutcome::Result(())) } else { - let round = BoxedRound::new_dynamic(EmptyRound { + let round = BoxedRound::new(EmptyRound { round_counter: self.round_counter + 1, inputs: self.inputs, }); diff --git a/manul/benches/empty_rounds.rs b/manul/benches/empty_rounds.rs index 4607fc7b..edcdddc7 100644 --- a/manul/benches/empty_rounds.rs +++ b/manul/benches/empty_rounds.rs @@ -84,7 +84,7 @@ impl EntryPoint for Inputs { _shared_randomness: &[u8], _id: &Id, ) -> Result, LocalError> { - Ok(BoxedRound::new_dynamic(EmptyRound { + Ok(BoxedRound::new(EmptyRound { round_counter: 1, inputs: self, })) @@ -161,7 +161,7 @@ impl Round for EmptyRound { if self.round_counter == self.inputs.rounds_num { Ok(FinalizeOutcome::Result(())) } else { - let round = BoxedRound::new_dynamic(EmptyRound { + let round = BoxedRound::new(EmptyRound { round_counter: self.round_counter + 1, inputs: self.inputs, }); diff --git a/manul/src/combinators/chain.rs b/manul/src/combinators/chain.rs index 3a40ed2f..dff7b912 100644 --- a/manul/src/combinators/chain.rs +++ b/manul/src/combinators/chain.rs @@ -312,7 +312,7 @@ where round, }, }; - Ok(BoxedRound::new_dynamic(chained_round)) + Ok(BoxedRound::new(chained_round)) } } @@ -439,7 +439,7 @@ where let chained_round = ChainedRound:: { state: ChainState::Protocol2(round), }; - Ok(FinalizeOutcome::AnotherRound(BoxedRound::new_dynamic(chained_round))) + Ok(FinalizeOutcome::AnotherRound(BoxedRound::new(chained_round))) } FinalizeOutcome::AnotherRound(round) => { let chained_round = ChainedRound:: { @@ -450,7 +450,7 @@ where transition, }, }; - Ok(FinalizeOutcome::AnotherRound(BoxedRound::new_dynamic(chained_round))) + Ok(FinalizeOutcome::AnotherRound(BoxedRound::new(chained_round))) } }, ChainState::Protocol2(round) => match round.into_boxed().finalize(rng, payloads, artifacts)? { @@ -459,7 +459,7 @@ where let chained_round = ChainedRound:: { state: ChainState::Protocol2(round), }; - Ok(FinalizeOutcome::AnotherRound(BoxedRound::new_dynamic(chained_round))) + Ok(FinalizeOutcome::AnotherRound(BoxedRound::new(chained_round))) } }, } diff --git a/manul/src/combinators/misbehave.rs b/manul/src/combinators/misbehave.rs index a578d21c..7c6a9c13 100644 --- a/manul/src/combinators/misbehave.rs +++ b/manul/src/combinators/misbehave.rs @@ -181,7 +181,7 @@ where id: &Id, ) -> Result, LocalError> { let round = self.entry_point.make_round(rng, shared_randomness, id)?; - Ok(BoxedRound::new_dynamic(MisbehavingRound:: { + Ok(BoxedRound::new(MisbehavingRound:: { round, behavior: self.behavior, })) @@ -213,7 +213,7 @@ where match outcome { FinalizeOutcome::Result(result) => FinalizeOutcome::Result(result), FinalizeOutcome::AnotherRound(round) => { - FinalizeOutcome::AnotherRound(BoxedRound::new_dynamic(Self { round, behavior })) + FinalizeOutcome::AnotherRound(BoxedRound::new(Self { round, behavior })) } } } diff --git a/manul/src/protocol/boxed_round.rs b/manul/src/protocol/boxed_round.rs index 989064f2..b98dd9fb 100644 --- a/manul/src/protocol/boxed_round.rs +++ b/manul/src/protocol/boxed_round.rs @@ -13,7 +13,7 @@ pub struct BoxedRound>(Box> BoxedRound { /// Wraps an object implementing the dynamic round trait ([`Round`](`crate::protocol::Round`)). - pub fn new_dynamic>(round: R) -> Self { + pub fn new>(round: R) -> Self { Self(Box::new(round)) } diff --git a/manul/src/session/session.rs b/manul/src/session/session.rs index 1f0ec2cb..5bd3b79b 100644 --- a/manul/src/session/session.rs +++ b/manul/src/session/session.rs @@ -476,7 +476,7 @@ where )?; if let Some(echo_round_info) = self.echo_round_info { - let round = BoxedRound::new_dynamic(EchoRound::::new( + let round = BoxedRound::new(EchoRound::::new( verifier, transcript.echo_broadcasts(&round_id)?, echo_round_info, diff --git a/manul/src/tests/partial_echo.rs b/manul/src/tests/partial_echo.rs index 82e1bb58..9eb45bc6 100644 --- a/manul/src/tests/partial_echo.rs +++ b/manul/src/tests/partial_echo.rs @@ -82,7 +82,7 @@ impl Deserialize<'de>> EntryPoint for Inp _shared_randomness: &[u8], _id: &Id, ) -> Result, LocalError> { - Ok(BoxedRound::new_dynamic(Round1 { inputs: self })) + Ok(BoxedRound::new(Round1 { inputs: self })) } }