Skip to main content

SumcheckData

Struct SumcheckData 

Source
pub struct SumcheckData<F, EF> {
    pub polynomial_evaluations: Vec<[EF; 2]>,
    pub pow_witnesses: Vec<F>,
}
Expand description

Sumcheck polynomial data

Stores the polynomial evaluations for sumcheck rounds in a compact format. Each round stores two evaluations: [h(0), h(inf)] in the evaluation basis (h(1) derived as claimed_sum - h(0)), or [s(1), s(inf)] in the projective basis (s(0) derived as claimed_sum - s(inf)).

Fields§

§polynomial_evaluations: Vec<[EF; 2]>

Polynomial evaluations for each sumcheck round.

Each entry is [h(0), h(inf)]:

  • h(0) is the constant term.
  • h(inf) is the leading coefficient (evaluation at infinity).

h(1) is derived as claimed_sum - h(0) by the verifier.

Length: folding_factor

§pow_witnesses: Vec<F>

PoW witnesses for each sumcheck round Length: folding_factor

Implementations§

Source§

impl<F, EF> SumcheckData<F, EF>

Source

pub fn polynomial_evaluations(&self) -> &[[EF; 2]]

Returns the polynomial evaluations [h(0), h(inf)] for each round.

Source

pub const fn num_rounds(&self) -> usize

Returns the number of rounds stored in this proof data.

Source

pub fn observe_and_sample<Challenger>( &mut self, transcript: &mut ProverTranscript<'_, Challenger, F, EF>, c_a: EF, c_inf: EF, ) -> EF
where F: TranscriptField, EF: ExtensionField<F>, Challenger: CanObserve<F> + CanSample<F> + GrindingChallenger<Witness = F>,

Records one round in this proof and plays the matching transcript step.

This is the only place a round reaches both the proof and the sponge. Recording and absorbing therefore cannot drift apart.

§Arguments
  • transcript - driver of the batch of rounds this one belongs to.
  • c_a - finite-point value: h(0) (evaluation) or s(1) (projective).
  • c_inf - leading coefficient h(inf) / s(inf).
§Returns

The sampled challenge r.

The two values are recorded and absorbed verbatim. Which basis defines them is fixed by the shape the driver was built from.

§Panics

When the batch has already played every round it was described with.

Source

pub fn verify_rounds<Challenger>( &self, challenger: &mut Challenger, claimed_sum: &mut EF, expected_rounds: usize, pow_bits: usize, basis: Basis, ) -> Result<Point<EF>, SumcheckError>
where F: TranscriptField, EF: ExtensionField<F>, Challenger: FieldChallenger<F> + GrindingChallenger<Witness = F>,

Verifies standard sumcheck rounds and extracts folding randomness from the transcript.

§Arguments
  • challenger - sponge of the surrounding protocol, borrowed for the batch.
  • claimed_sum - Running claim, folded in place to h(r) after each round.
  • expected_rounds - Protocol-fixed number of rounds this proof must carry.
  • pow_bits - PoW difficulty (0 to skip grinding).
  • basis - how the two transmitted values are read.
§Returns

The folding randomness, one challenge per round.

§Shape checks

Both counts this proof carries are attacker-controlled. Both are checked before any transcript work.

The round count decides how many steps the batch is described with. The witness count is what the round loop indexes into.

Taking either from the proof would let a wrong one desynchronise Fiat-Shamir. Both are therefore compared against the caller’s own configuration instead.

§Errors
  • The proof does not carry exactly expected_rounds rounds.
  • The witness count is not the one the difficulty implies.
  • A round carries a witness that misses the required difficulty.

Trait Implementations§

Source§

impl<F: Clone, EF: Clone> Clone for SumcheckData<F, EF>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<F: Debug, EF: Debug> Debug for SumcheckData<F, EF>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<F: Default, EF: Default> Default for SumcheckData<F, EF>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de, F, EF> Deserialize<'de> for SumcheckData<F, EF>
where F: Deserialize<'de>, EF: Deserialize<'de>,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<F, EF> Serialize for SumcheckData<F, EF>
where F: Serialize, EF: Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<F, EF> Freeze for SumcheckData<F, EF>
where Vec<[EF; 2]>: Freeze, Vec<F>: Freeze,

§

impl<F, EF> RefUnwindSafe for SumcheckData<F, EF>

§

impl<F, EF> Send for SumcheckData<F, EF>
where Vec<[EF; 2]>: Send, Vec<F>: Send,

§

impl<F, EF> Sync for SumcheckData<F, EF>
where Vec<[EF; 2]>: Sync, Vec<F>: Sync,

§

impl<F, EF> Unpin for SumcheckData<F, EF>
where Vec<[EF; 2]>: Unpin, Vec<F>: Unpin,

§

impl<F, EF> UnsafeUnpin for SumcheckData<F, EF>

§

impl<F, EF> UnwindSafe for SumcheckData<F, EF>

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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<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