@@ -25,13 +25,15 @@ use multilinear_extensions::{
2525} ;
2626use std:: iter;
2727use ceno_zkvm:: virtual_polys:: VirtualPolynomials ;
28- use sumcheck:: structs:: { IOPProverStateV2 , IOPVerifierState } ;
28+ use sumcheck:: structs:: { IOPProof , IOPProverStateV2 , IOPVerifierState } ;
2929use ff:: Field ;
3030use halo2curves:: serde:: SerdeObject ;
3131use transcript:: BasicTranscript ;
3232
33- #[ derive( Serialize , Deserialize , Debug ) ]
33+ #[ derive( Serialize , Debug ) ]
3434pub struct R1CSProof < S : SpartanExtensionField > {
35+ sc_proof_phase1_proof : IOPProof < GoldilocksExt2 > ,
36+ sc_proof_phase1_state : IOPProverStateV2 < GoldilocksExt2 > ,
3537 sc_proof_phase1 : SumcheckInstanceProof < S > ,
3638 sc_proof_phase2 : SumcheckInstanceProof < S > ,
3739 claims_phase2 : ( S , S , S ) ,
@@ -305,14 +307,23 @@ impl<S: SpartanExtensionField + Send + Sync> R1CSProof<S> {
305307 let mut ceno_transcript = BasicTranscript :: new ( b"test" ) ;
306308
307309 let timer_tmp = Timer :: new ( "=> prove_sum_check with ceno: IOPProverStateV2::prove_batch_polys" ) ;
308- let ( sumcheck_proofs , _ ) = IOPProverStateV2 :: prove_batch_polys (
310+ let ( sc_proof_phase1_proof , sc_proof_phase1_state ) = IOPProverStateV2 :: prove_batch_polys (
309311 num_threads,
310312 virtual_polys. get_batched_polys ( ) ,
311313 & mut ceno_transcript,
312314 ) ;
313315 timer_tmp. stop ( ) ;
316+ let ( tau_claim, Az_claim , Bz_claim , Cz_claim ) = (
317+ & sc_proof_phase1_proof. point [ 0 ] ,
318+ & sc_proof_phase1_proof. point [ 1 ] ,
319+ & sc_proof_phase1_proof. point [ 2 ] ,
320+ & sc_proof_phase1_proof. point [ 3 ] ,
321+ ) ;
322+ let rx = sc_proof_phase1_state. challenges ;
323+ timer_sc_proof_phase1. stop ( ) ;
314324 // == test: ceno_verifier_bench ==
315325
326+ /*
316327 // Sumcheck 1: (Az * Bz - Cz) * eq(x, q, p) = 0
317328 let timer_tmp = Timer::new("prove_sum_check");
318329 let (sc_proof_phase1, rx, _claims_phase1) = R1CSProof::prove_phase_one(
@@ -338,7 +349,6 @@ impl<S: SpartanExtensionField + Send + Sync> R1CSProof<S> {
338349 assert_eq!(poly_Bz.len(), 1);
339350 assert_eq!(poly_Cz.len(), 1);
340351 timer_tmp.stop();
341- timer_sc_proof_phase1. stop ( ) ;
342352
343353 let (tau_claim, Az_claim, Bz_claim, Cz_claim) = (
344354 &(poly_tau_p[0] * poly_tau_q[0] * poly_tau_x[0]),
@@ -358,6 +368,19 @@ impl<S: SpartanExtensionField + Send + Sync> R1CSProof<S> {
358368 let rq_rev = rq_rev.to_vec();
359369 let rq: Vec<S> = rq_rev.iter().copied().rev().collect();
360370 let rp = rp.to_vec();
371+ */
372+
373+ S :: append_field_to_transcript ( b"Az_claim" , transcript, * Az_claim ) ;
374+ S :: append_field_to_transcript ( b"Bz_claim" , transcript, * Bz_claim ) ;
375+ S :: append_field_to_transcript ( b"Cz_claim" , transcript, * Cz_claim ) ;
376+
377+ // Separate the result rx into rp, rq, and rx
378+ let ( rx, rq) = rx. split_at ( num_rounds_x) ;
379+ let ( rq, rp) = rq. split_at ( num_rounds_q) ;
380+ let rx_rev: Vec < S > = rx. iter ( ) . copied ( ) . rev ( ) . collect ( ) ;
381+ let rq = rq. to_vec ( ) ;
382+ let rq_rev: Vec < S > = rq. iter ( ) . copied ( ) . rev ( ) . collect ( ) ;
383+ let rp = rp. to_vec ( ) ;
361384
362385 // --
363386 // PHASE 2
0 commit comments