Skip to content

Commit

Permalink
fix nits
Browse files Browse the repository at this point in the history
  • Loading branch information
sragss committed Mar 26, 2024
1 parent 145aedd commit e823be0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
1 change: 0 additions & 1 deletion jolt-core/src/jolt/vm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,6 @@ pub trait Jolt<F: PrimeField, G: CurveGroup<ScalarField = F>, const C: usize, co
memory_trace: Vec<MemoryOp>,
circuit_flags: Vec<F>,
jolt_polynomials: &JoltPolynomials<F, G>,
// jolt_commitments: &JoltCommitments<G>,
transcript: &mut Transcript,
) -> (R1CSProof<F, G>, R1CSUniqueCommitments<G>) {
let N_FLAGS = 17;
Expand Down
25 changes: 12 additions & 13 deletions jolt-core/src/r1cs/spartan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,20 @@ pub enum SpartanError {
InvalidSumcheckProof,

/// returned when the recusive sumcheck proof fails
#[error("InvalidOuterSumcheckRecursive")]
InvalidOuterSumcheckRecursive,
#[error("InvalidOuterSumcheckProof")]
InvalidOuterSumcheckProof,

/// returned when the final sumcheck opening proof fails
#[error("InvalidOuterSumcheckFinal")]
InvalidOuterSumcheckFinal,
#[error("InvalidOuterSumcheckClaim")]
InvalidOuterSumcheckClaim,

/// returned when the recusive sumcheck proof fails
#[error("InvalidInnerSumcheckRecursive")]
InvalidInnerSumcheckRecursive,
#[error("InvalidInnerSumcheckProof")]
InvalidInnerSumcheckProof,

/// returned when the final sumcheck opening proof fails
#[error("InvalidInnerSumcheckFinal")]
InvalidInnerSumcheckFinal,
#[error("InvalidInnerSumcheckClaim")]
InvalidInnerSumcheckClaim,

/// returned if the supplied witness is not of the right length
#[error("InvalidWitnessLength")]
Expand Down Expand Up @@ -145,7 +145,6 @@ impl<F: PrimeField> IndexablePoly<F> for SegmentedPaddedWitness<F> {
/// The proof is produced using Spartan's combination of the sum-check and
/// the commitment to a vector viewed as a polynomial commitment
pub struct UniformSpartanProof<F: PrimeField, G: CurveGroup<ScalarField = F>> {
// witness_segment_commitments: Vec<HyraxCommitment<NUM_R1CS_POLYS, G>>,
outer_sumcheck_proof: SumcheckInstanceProof<F>,
outer_sumcheck_claims: (F, F, F),
inner_sumcheck_proof: SumcheckInstanceProof<F>,
Expand Down Expand Up @@ -441,14 +440,14 @@ impl<F: PrimeField, G: CurveGroup<ScalarField = F>> UniformSpartanProof<F, G> {
let (claim_outer_final, r_x) = self
.outer_sumcheck_proof
.verify::<G, Transcript>(F::zero(), num_rounds_x, 3, transcript)
.map_err(|_| SpartanError::InvalidOuterSumcheckRecursive)?;
.map_err(|_| SpartanError::InvalidOuterSumcheckProof)?;

// verify claim_outer_final
let (claim_Az, claim_Bz, claim_Cz) = self.outer_sumcheck_claims;
let taus_bound_rx = EqPolynomial::new(tau).evaluate(&r_x);
let claim_outer_final_expected = taus_bound_rx * (claim_Az * claim_Bz - claim_Cz);
if claim_outer_final != claim_outer_final_expected {
return Err(SpartanError::InvalidOuterSumcheckFinal);
return Err(SpartanError::InvalidOuterSumcheckClaim);
}

<Transcript as ProofTranscript<G>>::append_scalars(
Expand All @@ -472,7 +471,7 @@ impl<F: PrimeField, G: CurveGroup<ScalarField = F>> UniformSpartanProof<F, G> {
let (claim_inner_final, inner_sumcheck_r) = self
.inner_sumcheck_proof
.verify::<G, Transcript>(claim_inner_joint, num_rounds_y, 2, transcript)
.map_err(|_| SpartanError::InvalidInnerSumcheckRecursive)?;
.map_err(|_| SpartanError::InvalidInnerSumcheckProof)?;

// verify claim_inner_final
// this should be log (num segments)
Expand Down Expand Up @@ -571,7 +570,7 @@ impl<F: PrimeField, G: CurveGroup<ScalarField = F>> UniformSpartanProof<F, G> {
let claim_inner_final_expected = left_expected * right_expected;
if claim_inner_final != claim_inner_final_expected {
// DEDUPE(arasuarun): add
return Err(SpartanError::InvalidInnerSumcheckFinal);
return Err(SpartanError::InvalidInnerSumcheckClaim);
}

let r_y_point = &inner_sumcheck_r[n_prefix..];
Expand Down

0 comments on commit e823be0

Please sign in to comment.