Skip to content

Commit

Permalink
Expose helper types for the Session machinery
Browse files Browse the repository at this point in the history
  • Loading branch information
fjarri committed Nov 18, 2023
1 parent dc5731f commit 5ffa177
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion synedrion/src/sessions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ pub use constructors::{
};
pub use error::{Error, LocalError, ProvableError, RemoteError, RemoteErrorEnum};
pub use signed_message::SignedMessage;
pub use states::{FinalizeOutcome, Session};
pub use states::{
Artefact, FinalizeOutcome, PreprocessedMessage, ProcessedMessage, RoundAccumulator, Session,
};
7 changes: 6 additions & 1 deletion synedrion/src/sessions/states.rs
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,7 @@ where
}
}

/// A mutable accumulator created for each round to assemble processed messages from other parties.
pub struct RoundAccumulator<Sig> {
received_direct_messages: Vec<(PartyIdx, VerifiedMessage<Sig>)>,
received_broadcasts: Vec<(PartyIdx, VerifiedMessage<Sig>)>,
Expand Down Expand Up @@ -618,7 +619,7 @@ impl<Sig> RoundAccumulator<Sig> {
})
}

/// Save a processed message produced by [`Session::verify_message`].
/// Save a processed message produced by [`Session::process_message`].
pub fn add_processed_message<Verifier>(
&mut self,
pm: ProcessedMessage<Sig, Verifier>,
Expand Down Expand Up @@ -698,17 +699,21 @@ impl<Sig> RoundAccumulator<Sig> {
}
}

/// Data produced when creating a direct message to another party
/// that has to be preserved for further processing.
pub struct Artefact<Verifier> {
destination: Verifier,
destination_idx: PartyIdx,
artefact: DynDmArtefact,
}

/// A message that passed initial validity checks.
pub struct PreprocessedMessage<Sig> {
from_idx: PartyIdx,
message: VerifiedMessage<Sig>,
}

/// A processed message from another party.
pub struct ProcessedMessage<Sig, Verifier> {
from: Verifier,
from_idx: PartyIdx,
Expand Down

0 comments on commit 5ffa177

Please sign in to comment.