Skip to main content

SoftwareDkgSession

Struct SoftwareDkgSession 

Source
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

Source

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.

Source

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.

Source

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).

Source

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.

Source

pub fn receive_share(&mut self, wire: &SoftwareRound2Wire) -> Result<bool>

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.

Source

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.

Source

pub fn our_index(&self) -> u16

This participant’s 1-indexed share number.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more