Skip to content

Rename BoxedRound::new_dynamic to just new #112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions examples/src/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ impl<Id: PartyId> EntryPoint<Id> for SimpleProtocolEntryPoint<Id> {
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,
Expand Down Expand Up @@ -288,7 +288,7 @@ impl<Id: PartyId> Round<Id> for Round1<Id> {
let sum = self.context.ids_to_positions[&self.context.id]
+ typed_payloads.iter().map(|payload| payload.x).sum::<u8>();

let round2 = BoxedRound::new_dynamic(Round2 {
let round2 = BoxedRound::new(Round2 {
round1_sum: sum,
context: self.context,
});
Expand Down
4 changes: 2 additions & 2 deletions manul/benches/async_session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl<Id: PartyId> EntryPoint<Id> for Inputs<Id> {
_shared_randomness: &[u8],
_id: &Id,
) -> Result<BoxedRound<Id, Self::Protocol>, LocalError> {
Ok(BoxedRound::new_dynamic(EmptyRound {
Ok(BoxedRound::new(EmptyRound {
round_counter: 1,
inputs: self,
}))
Expand Down Expand Up @@ -174,7 +174,7 @@ impl<Id: PartyId> Round<Id> for EmptyRound<Id> {
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,
});
Expand Down
4 changes: 2 additions & 2 deletions manul/benches/empty_rounds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl<Id: PartyId> EntryPoint<Id> for Inputs<Id> {
_shared_randomness: &[u8],
_id: &Id,
) -> Result<BoxedRound<Id, Self::Protocol>, LocalError> {
Ok(BoxedRound::new_dynamic(EmptyRound {
Ok(BoxedRound::new(EmptyRound {
round_counter: 1,
inputs: self,
}))
Expand Down Expand Up @@ -161,7 +161,7 @@ impl<Id: PartyId> Round<Id> for EmptyRound<Id> {
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,
});
Expand Down
8 changes: 4 additions & 4 deletions manul/src/combinators/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ where
round,
},
};
Ok(BoxedRound::new_dynamic(chained_round))
Ok(BoxedRound::new(chained_round))
}
}

Expand Down Expand Up @@ -439,7 +439,7 @@ where
let chained_round = ChainedRound::<Id, T> {
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::<Id, T> {
Expand All @@ -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)? {
Expand All @@ -459,7 +459,7 @@ where
let chained_round = ChainedRound::<Id, T> {
state: ChainState::Protocol2(round),
};
Ok(FinalizeOutcome::AnotherRound(BoxedRound::new_dynamic(chained_round)))
Ok(FinalizeOutcome::AnotherRound(BoxedRound::new(chained_round)))
}
},
}
Expand Down
4 changes: 2 additions & 2 deletions manul/src/combinators/misbehave.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ where
id: &Id,
) -> Result<BoxedRound<Id, Self::Protocol>, LocalError> {
let round = self.entry_point.make_round(rng, shared_randomness, id)?;
Ok(BoxedRound::new_dynamic(MisbehavingRound::<Id, B, M> {
Ok(BoxedRound::new(MisbehavingRound::<Id, B, M> {
round,
behavior: self.behavior,
}))
Expand Down Expand Up @@ -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 }))
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion manul/src/protocol/boxed_round.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub struct BoxedRound<Id: PartyId, P: Protocol<Id>>(Box<dyn Round<Id, Protocol =

impl<Id: PartyId, P: Protocol<Id>> BoxedRound<Id, P> {
/// Wraps an object implementing the dynamic round trait ([`Round`](`crate::protocol::Round`)).
pub fn new_dynamic<R: Round<Id, Protocol = P>>(round: R) -> Self {
pub fn new<R: Round<Id, Protocol = P>>(round: R) -> Self {
Self(Box::new(round))
}

Expand Down
2 changes: 1 addition & 1 deletion manul/src/session/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ where
)?;

if let Some(echo_round_info) = self.echo_round_info {
let round = BoxedRound::new_dynamic(EchoRound::<P, SP>::new(
let round = BoxedRound::new(EchoRound::<P, SP>::new(
verifier,
transcript.echo_broadcasts(&round_id)?,
echo_round_info,
Expand Down
2 changes: 1 addition & 1 deletion manul/src/tests/partial_echo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl<Id: PartyId + Serialize + for<'de> Deserialize<'de>> EntryPoint<Id> for Inp
_shared_randomness: &[u8],
_id: &Id,
) -> Result<BoxedRound<Id, Self::Protocol>, LocalError> {
Ok(BoxedRound::new_dynamic(Round1 { inputs: self }))
Ok(BoxedRound::new(Round1 { inputs: self }))
}
}

Expand Down
Loading