@@ -3,7 +3,7 @@ use std::borrow::Borrow;
33use openvm_circuit:: {
44 arch:: { ExecutionBridge , ExecutionState } ,
55 system:: memory:: {
6- offline_checker:: { MemoryBridge , MemoryReadAuxCols } ,
6+ offline_checker:: MemoryBridge ,
77 MemoryAddress ,
88 } ,
99} ;
@@ -26,9 +26,6 @@ use crate::{
2626 } ,
2727} ;
2828
29- pub const NUM_RWS_FOR_PRODUCT : usize = 2 ;
30- pub const NUM_RWS_FOR_LOGUP : usize = 3 ;
31-
3229#[ derive( Clone , Debug ) ]
3330pub struct NativeSumcheckAir {
3431 pub execution_bridge : ExecutionBridge ,
@@ -105,7 +102,7 @@ impl<AB: InteractionBuilder> Air<AB> for NativeSumcheckAir {
105102 within_round_limit,
106103 should_acc,
107104 eval_acc,
108- is_hint_src_id ,
105+ is_writeback ,
109106 specific,
110107 } = local;
111108
@@ -235,22 +232,6 @@ impl<AB: InteractionBuilder> Air<AB> for NativeSumcheckAir {
235232 next. start_timestamp ,
236233 start_timestamp + AB :: F :: from_canonical_usize ( 8 ) ,
237234 ) ;
238- builder
239- . when ( prod_row)
240- . when ( next. prod_row + next. logup_row )
241- . assert_eq (
242- next. start_timestamp ,
243- start_timestamp
244- + within_round_limit * AB :: F :: from_canonical_usize ( NUM_RWS_FOR_PRODUCT ) ,
245- ) ;
246- builder
247- . when ( logup_row)
248- . when ( next. prod_row + next. logup_row )
249- . assert_eq (
250- next. start_timestamp ,
251- start_timestamp
252- + within_round_limit * AB :: F :: from_canonical_usize ( NUM_RWS_FOR_LOGUP ) ,
253- ) ;
254235
255236 // Termination condition
256237 assert_array_eq (
@@ -349,7 +330,7 @@ impl<AB: InteractionBuilder> Air<AB> for NativeSumcheckAir {
349330 native_as,
350331 register_ptrs[ 0 ] + AB :: F :: from_canonical_usize ( CONTEXT_ARR_BASE_LEN ) ,
351332 ) ,
352- [ max_round, is_hint_src_id ] ,
333+ [ max_round, is_writeback ] ,
353334 first_timestamp + AB :: F :: from_canonical_usize ( 7 ) ,
354335 & header_row_specific. read_records [ 7 ] ,
355336 )
@@ -392,21 +373,6 @@ impl<AB: InteractionBuilder> Air<AB> for NativeSumcheckAir {
392373 ) ;
393374 builder. assert_eq ( prod_row * should_acc, prod_acc) ;
394375
395- // Read p1, p2 from witness arrays
396- self . memory_bridge
397- . read (
398- MemoryAddress :: new ( native_as, register_ptrs[ 2 ] + prod_row_specific. data_ptr ) ,
399- prod_row_specific. p ,
400- start_timestamp,
401- & MemoryReadAuxCols {
402- base : prod_row_specific. ps_record . base ,
403- } ,
404- )
405- . eval (
406- builder,
407- ( prod_in_round_evaluation + prod_next_round_evaluation) * not ( is_hint_src_id) ,
408- ) ;
409-
410376 // Obtain p1, p2 from hint space and write back to witness arrays
411377 self . memory_bridge
412378 . write (
@@ -417,7 +383,7 @@ impl<AB: InteractionBuilder> Air<AB> for NativeSumcheckAir {
417383 )
418384 . eval (
419385 builder,
420- ( prod_in_round_evaluation + prod_next_round_evaluation) * is_hint_src_id ,
386+ ( prod_in_round_evaluation + prod_next_round_evaluation) * is_writeback ,
421387 ) ;
422388
423389 let p1: [ AB :: Var ; EXT_DEG ] = prod_row_specific. p [ 0 ..EXT_DEG ] . try_into ( ) . unwrap ( ) ;
@@ -432,7 +398,7 @@ impl<AB: InteractionBuilder> Air<AB> for NativeSumcheckAir {
432398 register_ptrs[ 4 ] + curr_prod_n * AB :: F :: from_canonical_usize ( EXT_DEG ) ,
433399 ) ,
434400 prod_row_specific. p_evals ,
435- start_timestamp + AB :: F :: ONE ,
401+ start_timestamp + is_writeback * AB :: F :: ONE ,
436402 & prod_row_specific. write_record ,
437403 )
438404 . eval ( builder, prod_row * within_round_limit) ;
@@ -499,21 +465,6 @@ impl<AB: InteractionBuilder> Air<AB> for NativeSumcheckAir {
499465 ) ;
500466 builder. assert_eq ( logup_row * should_acc, logup_acc) ;
501467
502- // Read p1, p2, q1, q2 from witness arrays
503- self . memory_bridge
504- . read (
505- MemoryAddress :: new ( native_as, register_ptrs[ 3 ] + logup_row_specific. data_ptr ) ,
506- logup_row_specific. pq ,
507- start_timestamp,
508- & MemoryReadAuxCols {
509- base : logup_row_specific. pqs_record . base ,
510- } ,
511- )
512- . eval (
513- builder,
514- ( logup_in_round_evaluation + logup_next_round_evaluation) * not ( is_hint_src_id) ,
515- ) ;
516-
517468 // Obtain p1, p2, q1, q2 from hint space
518469 self . memory_bridge
519470 . write (
@@ -524,7 +475,7 @@ impl<AB: InteractionBuilder> Air<AB> for NativeSumcheckAir {
524475 )
525476 . eval (
526477 builder,
527- ( logup_in_round_evaluation + logup_next_round_evaluation) * is_hint_src_id ,
478+ ( logup_in_round_evaluation + logup_next_round_evaluation) * is_writeback ,
528479 ) ;
529480 let p1: [ _ ; EXT_DEG ] = logup_row_specific. pq [ 0 ..EXT_DEG ] . try_into ( ) . unwrap ( ) ;
530481 let p2: [ _ ; EXT_DEG ] = logup_row_specific. pq [ EXT_DEG ..( EXT_DEG * 2 ) ]
@@ -546,7 +497,7 @@ impl<AB: InteractionBuilder> Air<AB> for NativeSumcheckAir {
546497 + ( num_prod_spec + curr_logup_n) * AB :: F :: from_canonical_usize ( EXT_DEG ) ,
547498 ) ,
548499 logup_row_specific. p_evals ,
549- start_timestamp + AB :: F :: ONE ,
500+ start_timestamp + is_writeback * AB :: F :: ONE ,
550501 & logup_row_specific. write_records [ 0 ] ,
551502 )
552503 . eval ( builder, logup_row * within_round_limit) ;
@@ -561,7 +512,7 @@ impl<AB: InteractionBuilder> Air<AB> for NativeSumcheckAir {
561512 * AB :: F :: from_canonical_usize ( EXT_DEG ) ,
562513 ) ,
563514 logup_row_specific. q_evals ,
564- start_timestamp + AB :: F :: TWO ,
515+ start_timestamp + is_writeback * AB :: F :: ONE + AB :: F :: ONE ,
565516 & logup_row_specific. write_records [ 1 ] ,
566517 )
567518 . eval ( builder, logup_row * within_round_limit) ;
0 commit comments