pub struct SsaPartBuilder<S: PixSpec> {
commitment: SsaPartCommitment<S>,
min_shares: usize,
shares: Vec<DefaultShare<IdentifierPrimeField<PixScalar<S>>, IdentifierPrimeField<PixScalar<S>>>>,
reconstructed: Option<PixScalar<S>>,
failed: bool,
}Expand description
Collects shares of a single polynomial and reconstructs its constant term.
§Where verification happens
Nothing is checked per share beyond what interpolation itself requires (a non-zero, distinct
x-coordinate and a decodable y). The one cryptographic check is against
SsaPartCommitment, run once, on the reconstructed constant term. See that type for why
this is sufficient here and what it costs — briefly: PIX has a single shareholder, so
“the recovered a₀ is the committed one” is the whole property, and it is exact.
Fields§
§commitment: SsaPartCommitment<S>Shares needed to interpolate, i.e. the negotiated polynomial threshold.
Comes from SsaCommitmentBuilder::poly_threshold, never from the commitment: there is
only one commitment per polynomial now, so its size says nothing about the degree.
reconstructed: Option<PixScalar<S>>§failed: boolSet when the part could not be reconstructed — either the interpolation itself failed, or
the value it produced failed to open Self::commitment.
The failure is reported exactly once; every later share for this polynomial is absorbed
silently. There is nothing to be gained from re-running the interpolation — the share set
cannot be repaired without knowing which share is bad, and the cycle is already lost
because SsaBuilder needs every polynomial. Both failure paths must therefore set this
and release the share buffer, or the “exactly once” only holds for one of them.
Implementations§
Source§impl<S: PixSpec> SsaPartBuilder<S>
impl<S: PixSpec> SsaPartBuilder<S>
pub fn new(commitment: SsaPartCommitment<S>, min_shares: usize) -> Self
Sourcepub(crate) fn spi(&self) -> SsaPolynomialId<S::Pseudonym>
pub(crate) fn spi(&self) -> SsaPolynomialId<S::Pseudonym>
SsaPolynomialId of the polynomial this builder reconstructs.
Remains valid after the collected shares have been released.
Shares needed to interpolate this polynomial — the negotiated threshold.
Sourcefn release_verification_state(&mut self)
fn release_verification_state(&mut self)
Frees the collected shares, which are only needed until the part is reconstructed.
After that point they cannot be read again — the early returns in
add_share short-circuit every later call before it touches them.
At production dimensions this buffer is threshold × size_of::<CompletedShare>() held for
every one of the polys polynomials until the cycle is retired. Since the Entry emits
shares polynomial-major, releasing here means only the polynomials still in flight hold any.
Assigns a fresh empty Vec rather than clear(), so the backing allocation is actually
returned instead of being retained at capacity.
Auto Trait Implementations§
impl<S> Freeze for SsaPartBuilder<S>
impl<S> RefUnwindSafe for SsaPartBuilder<S>where
<<S as PixSpec>::Curve as CurveArithmetic>::ProjectivePoint: RefUnwindSafe,
<<S as PixSpec>::Curve as CurveArithmetic>::Scalar: RefUnwindSafe,
<S as PixSpec>::Pseudonym: RefUnwindSafe,
impl<S> Send for SsaPartBuilder<S>
impl<S> Sync for SsaPartBuilder<S>
impl<S> Unpin for SsaPartBuilder<S>
impl<S> UnsafeUnpin for SsaPartBuilder<S>where
<<S as PixSpec>::Curve as CurveArithmetic>::ProjectivePoint: UnsafeUnpin,
<<S as PixSpec>::Curve as CurveArithmetic>::Scalar: UnsafeUnpin,
<S as PixSpec>::Pseudonym: UnsafeUnpin,
impl<S> UnwindSafe for SsaPartBuilder<S>where
<<S as PixSpec>::Curve as CurveArithmetic>::ProjectivePoint: UnwindSafe,
<<S as PixSpec>::Curve as CurveArithmetic>::Scalar: UnwindSafe,
<S as PixSpec>::Pseudonym: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more