Module echo_broadcast

Module echo_broadcast 

Source
Available on crate feature echo-broadcast only.
Expand description

Reliable broadcast for any protocol via echo messages

Broadcast message is a message meant to be received by all participants of the protocol.

We say that message is reliably broadcasted if, upon reception, it is guaranteed that all honest participants of the protocol has received the same message.

One way to achieve the reliable broadcast is by adding an echo round: when we receive messages in a reliable broadcast round, we hash all messages, and we send the hash to all other participants. If party receives a the same hash from everyone else, we can be assured that messages in the round were reliably broadcasted.

This module provides a mechanism that automatically add an echo round per each round of the protocol that requires a reliable broadcast.

§Example

// protocol to be executed that **requires** reliable broadcast
async fn keygen<M>(mpc: M, i: u16, n: u16) -> Result<KeyShare>
where
    M: round_based::Mpc<Msg = KeygenMsg>
{
    // ...
}
// The full message type, which corresponds to keygen msg + echo broadcast msg
type Msg = round_based::echo_broadcast::Msg<sha2::Sha256, KeygenMsg>;
// establishes network connection(s) to other parties, but
// **does not** support reliable broadcast
async fn connect() ->
    impl futures::Stream<Item = Result<round_based::Incoming<Msg>>>
        + futures::Sink<round_based::Outgoing<Msg>, Error = Error>
        + Unpin
{
    // ...
}
let delivery = connect().await;

// constructs an MPC engine as usual
let mpc = round_based::mpc::connected(delivery);
// wraps an engine to add reliable broadcast support
let mpc = round_based::echo_broadcast::wrap(mpc, i, n);

// execute the protocol
let keyshare = keygen(mpc, i, n).await?;

Structs§

EchoError
An error in echo-broadcast sub-protocol
Round
Round registration witness returned by WithEchoBroadcast::add_round()
WithEchoBroadcast
Mpc engine with echo-broadcast capabilities

Enums§

CompleteRoundError
An error returned in round completion
Error
An error originated either from main protocol or echo-broadcast sub-protocol
Msg
Message of the protocol with echo broadcast round(s)

Functions§

wrap
Wraps an Mpc engine and provides echo broadcast capabilities