pub trait MessagesStore: Sized + 'static {
type Msg;
type Output;
type Error: Error;
// Required methods
fn add_message(
&mut self,
msg: Incoming<Self::Msg>,
) -> Result<(), Self::Error>;
fn wants_more(&self) -> bool;
fn output(self) -> Result<Self::Output, Self>;
}Expand description
Stores messages received at particular round
In MPC protocol, party at every round usually needs to receive up to n messages. MessagesStore
is a container that stores messages, it knows how many messages are expected to be received,
and should implement extra measures against malicious parties (e.g. prohibit message overwrite).
§Procedure
MessagesStore stores received messages. Once enough messages are received, it outputs MessagesStore::Output.
In order to save received messages, .add_message(msg) is called. Then, .wants_more() tells whether more
messages are needed to be received. If it returned false, then output can be retrieved by calling .output().
§Example
RoundInput is an simple messages store. Refer to its docs to see usage examples.
Required Associated Types§
Required Methods§
Sourcefn add_message(&mut self, msg: Incoming<Self::Msg>) -> Result<(), Self::Error>
fn add_message(&mut self, msg: Incoming<Self::Msg>) -> Result<(), Self::Error>
Adds received message to the store
Returns error if message cannot be processed. Usually it means that sender behaves maliciously.
Sourcefn wants_more(&self) -> bool
fn wants_more(&self) -> bool
Indicates if store expects more messages to receive
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.