Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
Signed-off-by: Denis Varlakov <denis@dfns.co>
  • Loading branch information
survived committed Nov 29, 2024
1 parent 5213b10 commit cf466c7
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 3 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ the documentation of the protocol you're using), but usually they are:

## Features

* `dev` enables development tools such as protocol simulation
* `sim` enables protocol execution simulation, see `sim` module
* `sim-async` enables protocol execution simulation with tokio runtime, see `sim::async_env`
module
* `state-machine` provides ability to carry out the protocol, defined as async function, via Sync
API, see `state_machine` module
* `derive` is needed to use `ProtocolMessage` proc macro
* `runtime-tokio` enables tokio-specific implementation of async runtime

## Join us in Discord!
Expand Down
2 changes: 1 addition & 1 deletion round-based/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ rand_dev = "0.1"
default = ["std"]
state-machine = []
sim = ["std", "state-machine"]
sim-async = ["std", "tokio/sync", "tokio-stream", "futures-util/alloc"]
sim-async = ["sim", "tokio/sync", "tokio-stream", "futures-util/alloc"]
derive = ["round-based-derive"]
runtime-tokio = ["tokio"]
std = ["thiserror"]
Expand Down
7 changes: 6 additions & 1 deletion round-based/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@
//!
//! ## Features
//!
//! * `dev` enables development tools such as [protocol simulation](sim)
//! * `sim` enables protocol execution simulation, see [`sim`] module
//! * `sim-async` enables protocol execution simulation with tokio runtime, see [`sim::async_env`]
//! module
//! * `state-machine` provides ability to carry out the protocol, defined as async function, via Sync
//! API, see [`state_machine`] module
//! * `derive` is needed to use [`ProtocolMessage`](macro@ProtocolMessage) proc macro
//! * `runtime-tokio` enables [tokio]-specific implementation of [async runtime](runtime)
//!
//! ## Join us in Discord!
Expand Down
27 changes: 27 additions & 0 deletions round-based/src/state_machine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,33 @@
//! may not be possible/desirable to have async runtime which drives the futures until completion.
//! For such use-cases, we provide [`wrap_protocol`] function that wraps an MPC protocol defined as
//! async function and returns the [`StateMachine`] that exposes sync API to carry out the protocol.
//!
//! ## Example
//! ```rust,no_run
//! use round_based::{Mpc, PartyIndex};
//!
//! # type Result<T, E = ()> = std::result::Result<T, E>;
//! # type Randomness = [u8; 32];
//! # type Msg = ();
//! // Any MPC protocol
//! pub async fn protocol_of_random_generation<M>(
//! party: M,
//! i: PartyIndex,
//! n: u16
//! ) -> Result<Randomness>
//! where
//! M: Mpc<ProtocolMessage = Msg>
//! {
//! // ...
//! # todo!()
//! }
//!
//! let state_machine = round_based::state_machine::wrap_protocol(
//! |party| protocol_of_random_generation(party, 0, 3)
//! );
//! // `state_machine` implements `round_based::state_machine::StateMachine` trait.
//! // Its methods can be used to advance protocol until completion.
//! ```
mod delivery;
mod noop_waker;
Expand Down

0 comments on commit cf466c7

Please sign in to comment.