Trait round_based::party::Mpc
source · pub trait Mpc: Sealed {
type ProtocolMessage;
type Delivery: Delivery<Self::ProtocolMessage, SendError = Self::SendError, ReceiveError = Self::ReceiveError>;
type Runtime: AsyncRuntime;
type SendError: StdError + Send + Sync + 'static;
type ReceiveError: StdError + Send + Sync + 'static;
// Required method
fn into_party(
self
) -> MpcParty<Self::ProtocolMessage, Self::Delivery, Self::Runtime>;
}
Expand description
Party of MPC protocol (trait)
MpcParty
is the only struct that implement this trait. Motivation to have this trait is to fewer amount of
generic bounds that are needed to be specified.
Typical usage of this trait when implementing MPC protocol:
use round_based::{Mpc, MpcParty, PartyIndex};
async fn keygen<M>(party: M, i: PartyIndex, n: u16)
where
M: Mpc<ProtocolMessage = Msg>
{
let MpcParty{ delivery, .. } = party.into_party();
// ...
}
If we didn’t have this trait, generics would be less readable:
use round_based::{MpcParty, Delivery, runtime::AsyncRuntime, PartyIndex};
async fn keygen<D, R>(party: MpcParty<Msg, D, R>, i: PartyIndex, n: u16)
where
D: Delivery<Msg>,
R: AsyncRuntime
{
// ...
}
Required Associated Types§
sourcetype ProtocolMessage
type ProtocolMessage
MPC message
sourcetype Delivery: Delivery<Self::ProtocolMessage, SendError = Self::SendError, ReceiveError = Self::ReceiveError>
type Delivery: Delivery<Self::ProtocolMessage, SendError = Self::SendError, ReceiveError = Self::ReceiveError>
Transport layer implementation
sourcetype Runtime: AsyncRuntime
type Runtime: AsyncRuntime
Async runtime
sourcetype ReceiveError: StdError + Send + Sync + 'static
type ReceiveError: StdError + Send + Sync + 'static
Receiving message error
Required Methods§
sourcefn into_party(
self
) -> MpcParty<Self::ProtocolMessage, Self::Delivery, Self::Runtime>
fn into_party( self ) -> MpcParty<Self::ProtocolMessage, Self::Delivery, Self::Runtime>
Converts into MpcParty
Object Safety§
This trait is not object safe.