pub struct SoftwareDkgSession { /* private fields */ }Expand description
One participant’s software DKG state machine. Same six-step public
interface keep-cli drives against the hardware signer, so the CLI
dispatches on the presence of --hardware without any protocol branching.
The state machine is linear and validates every transition, so an
out-of-order call (e.g. dkg_round2 before every peer’s round1 arrived)
returns a clear error rather than silently producing garbage.
Implementations§
Source§impl SoftwareDkgSession
impl SoftwareDkgSession
Sourcepub fn init(threshold: u16, participants: u16, our_index: u16) -> Result<Self>
pub fn init(threshold: u16, participants: u16, our_index: u16) -> Result<Self>
Set up state for a threshold-of-participants DKG run where this
process holds share our_index (1-indexed). Rejects thresholds
outside 2..=participants and indexes outside 1..=participants so
a caller cannot pass a validated config to part1 and get an
UnknownIdentifier late in the run.
Sourcepub fn round1(&mut self) -> Result<SoftwareRound1Wire>
pub fn round1(&mut self) -> Result<SoftwareRound1Wire>
Run frost-core’s part1 and return the round1 wire package this
participant broadcasts to every peer. Must be called before any
round1_peer step and exactly once per session.
Sourcepub fn round1_peer(&mut self, wire: &SoftwareRound1Wire) -> Result<bool>
pub fn round1_peer(&mut self, wire: &SoftwareRound1Wire) -> Result<bool>
Consume a peer’s round1 wire package. Rejects a duplicate sender, a
self-echo, and a version mismatch. Returns true if this call
completed the round1 set (peers = participants - 1).
Sourcepub fn round2(&mut self) -> Result<Vec<(u16, SoftwareRound2Wire)>>
pub fn round2(&mut self) -> Result<Vec<(u16, SoftwareRound2Wire)>>
Run frost-core’s part2 and return the per-recipient round2 wire
packages. Refuses to run until every peer’s round1 package has
landed.
Consume a peer’s round2 share targeted at us. Same version + range +
duplicate checks as round1_peer. Returns true if this call
completed the round2 set.
Sourcepub fn finalize(&mut self) -> Result<SoftwareDkgResult>
pub fn finalize(&mut self) -> Result<SoftwareDkgResult>
Finalize the DKG. Refuses to run until every peer’s round2 share has arrived. On success the session state is consumed; further method calls return an error.