Skip to content

Commit a76c30c

Browse files
committed
fixed the consistency check issue and also added a new error check
1 parent fc1d1a3 commit a76c30c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

crates/jagged/src/jagged_eval/sumcheck_eval.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,13 @@ pub struct JaggedSumcheckEvalProof<F> {
2020
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
2121
pub struct JaggedEvalSumcheckConfig<F>(PhantomData<F>);
2222

23+
//added a new error variant to JaggedEvalSumcheckError to handle the case where the claimedSum doesn't match
2324
#[derive(Debug, Error)]
2425
pub enum JaggedEvalSumcheckError<F: Field> {
2526
#[error("sumcheck error: {0}")]
2627
SumcheckError(SumcheckError),
28+
#[error("claimed sum mismatch, expected: {0}, got: {1}")]
29+
ClaimedSumMismatch(F, F),
2730
#[error("jagged evaluation proof verification failed, expected: {0}, got: {1}")]
2831
JaggedEvaluationFailed(F, F),
2932
}
@@ -59,6 +62,14 @@ where
5962
*partial_lagrange * *branching_program_eval
6063
})
6164
.sum::<EF>();
65+
// added this missing piece to ensure that the jagged eval matches the claimed sum. as a malicious prover could
66+
// claim a sum that is different from the actual sum, this check ensures that the sum is correct.
67+
if jagged_eval != partial_sumcheck_proof.claimed_sum {
68+
return Err(JaggedEvalSumcheckError::ClaimedSumMismatch(
69+
jagged_eval,
70+
partial_sumcheck_proof.claimed_sum,
71+
));
72+
}
6273

6374
// Verify the jagged eval proof.
6475
let result = partially_verify_sumcheck_proof(partial_sumcheck_proof, challenger);

0 commit comments

Comments
 (0)