Function round_based::state_machine::wrap_protocol

source ·
pub fn wrap_protocol<'a, M, F>(
    protocol: impl FnOnce(MpcParty<M>) -> F
) -> impl StateMachine<Output = F::Output, Msg = M> + 'a
where F: Future + 'a, M: 'static,
Available on crate feature state-machine only.
Expand description

Wraps the protocol and provides sync API to execute it

Protocol is an async function that takes MpcParty as input. MpcParty contains channels (of incoming and outgoing messages) that protocol is expected to use, and a Runtime. Protocol is only allowed to .await on futures provided in MpcParty, such as polling next message from provided steam of incoming messages. If protocol polls an unknown future, executor won’t know what to do with that, the protocol will be aborted and error returned.