Skip to content

Commit 64bce21

Browse files
committed
Update changelog and docs
1 parent 023ec68 commit 64bce21

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

round-based/CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
## v0.3.0
22
* Add no_std and wasm support [#6]
3+
* Add state machine wrapper that provides sync API to carry out the protocol defined as async function [#7]
34

45
[#6]: https://github.com/dfns/round-based/pull/6
6+
[#7]: https://github.com/dfns/round-based/pull/7
57

68
## v0.2.2
79

round-based/src/state_machine/mod.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
//! Wraps the protocol and provides sync API to execute it
1+
//! Wraps the protocol defined as async function and provides sync API to execute it
2+
//!
3+
//! In `round_based` framework, MPC protocols are defined as async function. However, sometimes it
4+
//! may not be possible/desirable to have async runtime which drives the futures until completion.
5+
//! For such use-cases, we provide [`wrap_protocol`] function that wraps an MPC protocol defined as
6+
//! async function and returns the [`StateMachine`] that exposes sync API to carry out the protocol.
27
38
mod delivery;
49
mod noop_waker;
@@ -176,6 +181,13 @@ pub type Delivery<M> = (Incomings<M>, Outgoings<M>);
176181
pub type MpcParty<M> = crate::MpcParty<M, Delivery<M>, Runtime<M>>;
177182

178183
/// Wraps the protocol and provides sync API to execute it
184+
///
185+
/// Protocol is an async function that takes [`MpcParty`] as input. `MpcParty` contains
186+
/// channels (of incoming and outgoing messages) that protocol is expected to use, and
187+
/// a [`Runtime`]. Protocol is only allowed to `.await` on futures provided in `MpcParty`,
188+
/// such as polling next message from provided steam of incoming messages. If protocol
189+
/// polls an unknown future, executor won't know what to do with that, the protocol will
190+
/// be aborted and error returned.
179191
pub fn wrap_protocol<'a, M, F>(
180192
protocol: impl FnOnce(MpcParty<M>) -> F,
181193
) -> impl StateMachine<Output = F::Output, Msg = M> + 'a

0 commit comments

Comments
 (0)