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>
impl<F, EF> SumcheckData<F, EF>
Sourcepub fn polynomial_evaluations(&self) -> &[[EF; 2]]
pub fn polynomial_evaluations(&self) -> &[[EF; 2]]
Returns the polynomial evaluations [h(0), h(inf)] for each round.
Sourcepub const fn num_rounds(&self) -> usize
pub const fn num_rounds(&self) -> usize
Returns the number of rounds stored in this proof data.
Sourcepub fn observe_and_sample<Challenger>(
&mut self,
transcript: &mut ProverTranscript<'_, Challenger, F, EF>,
c_a: EF,
c_inf: EF,
) -> EFwhere
F: TranscriptField,
EF: ExtensionField<F>,
Challenger: CanObserve<F> + CanSample<F> + GrindingChallenger<Witness = F>,
pub fn observe_and_sample<Challenger>(
&mut self,
transcript: &mut ProverTranscript<'_, Challenger, F, EF>,
c_a: EF,
c_inf: EF,
) -> EFwhere
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) ors(1)(projective).c_inf- leading coefficienth(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.
Sourcepub 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>,
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 toh(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_roundsrounds. - The witness count is not the one the difficulty implies.
- A round carries a witness that misses the required difficulty.
Trait Implementations§
Source§impl<'de, F, EF> Deserialize<'de> for SumcheckData<F, EF>where
F: Deserialize<'de>,
EF: Deserialize<'de>,
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>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl<F, EF> Freeze for SumcheckData<F, EF>
impl<F, EF> RefUnwindSafe for SumcheckData<F, EF>
impl<F, EF> Send for SumcheckData<F, EF>
impl<F, EF> Sync for SumcheckData<F, EF>
impl<F, EF> Unpin for SumcheckData<F, EF>
impl<F, EF> UnsafeUnpin for SumcheckData<F, EF>
impl<F, EF> UnwindSafe for SumcheckData<F, EF>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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