@@ -167,6 +167,9 @@ impl<AB: InteractionBuilder> Air<AB> for NativeSumcheckAir {
167167 alpha,
168168 next. alpha ,
169169 ) ;
170+ builder
171+ . when ( next. prod_row + next. logup_row )
172+ . assert_eq ( max_round, next. max_round ) ;
170173 builder
171174 . when ( next. prod_row + next. logup_row )
172175 . assert_eq ( prod_nested_len, next. prod_nested_len ) ;
@@ -223,21 +226,21 @@ impl<AB: InteractionBuilder> Air<AB> for NativeSumcheckAir {
223226 . when ( next. prod_row + next. logup_row )
224227 . assert_eq (
225228 next. start_timestamp ,
226- start_timestamp + AB :: F :: from_canonical_usize ( 7 ) ,
229+ start_timestamp + AB :: F :: from_canonical_usize ( 8 ) ,
227230 ) ;
228231 builder
229232 . when ( prod_row)
230233 . when ( next. prod_row + next. logup_row )
231234 . assert_eq (
232235 next. start_timestamp ,
233- start_timestamp + AB :: F :: ONE + within_round_limit * AB :: F :: TWO ,
236+ start_timestamp + within_round_limit * AB :: F :: TWO ,
234237 ) ;
235238 builder
236239 . when ( logup_row)
237240 . when ( next. prod_row + next. logup_row )
238241 . assert_eq (
239242 next. start_timestamp ,
240- start_timestamp + AB :: F :: ONE + within_round_limit * AB :: F :: from_canonical_usize ( 3 ) ,
243+ start_timestamp + within_round_limit * AB :: F :: from_canonical_usize ( 3 ) ,
241244 ) ;
242245
243246 // Termination condition
@@ -330,6 +333,19 @@ impl<AB: InteractionBuilder> Air<AB> for NativeSumcheckAir {
330333 )
331334 . eval ( builder, header_row) ;
332335
336+ // Read max_round
337+ self . memory_bridge
338+ . read (
339+ MemoryAddress :: new (
340+ native_as,
341+ register_ptrs[ 0 ] + AB :: F :: from_canonical_usize ( CONTEXT_ARR_BASE_LEN ) ,
342+ ) ,
343+ [ max_round] ,
344+ first_timestamp + AB :: F :: from_canonical_usize ( 7 ) ,
345+ & header_row_specific. read_records [ 7 ] ,
346+ )
347+ . eval ( builder, header_row) ;
348+
333349 // Write final result
334350 self . memory_bridge
335351 . write (
@@ -348,20 +364,6 @@ impl<AB: InteractionBuilder> Air<AB> for NativeSumcheckAir {
348364 let next_prod_row_specific: & ProdSpecificCols < AB :: Var > =
349365 next. specific [ ..ProdSpecificCols :: < AB :: Var > :: width ( ) ] . borrow ( ) ;
350366
351- self . memory_bridge
352- . read (
353- MemoryAddress :: new (
354- native_as,
355- register_ptrs[ 0 ]
356- + AB :: F :: from_canonical_usize ( CONTEXT_ARR_BASE_LEN )
357- + ( curr_prod_n - AB :: F :: ONE ) ,
358- ) , // curr_prod_n starts at 1.
359- [ max_round] ,
360- start_timestamp,
361- & prod_row_specific. read_records [ 0 ] ,
362- )
363- . eval ( builder, prod_row) ;
364-
365367 // prod_row * within_round_limit =
366368 // prod_in_round_evaluation + prod_next_round_evaluation
367369 builder
@@ -385,8 +387,8 @@ impl<AB: InteractionBuilder> Air<AB> for NativeSumcheckAir {
385387 . read (
386388 MemoryAddress :: new ( native_as, register_ptrs[ 2 ] + prod_row_specific. data_ptr ) ,
387389 prod_row_specific. p ,
388- start_timestamp + AB :: F :: ONE ,
389- & prod_row_specific. read_records [ 1 ] ,
390+ start_timestamp,
391+ & prod_row_specific. read_records [ 0 ] ,
390392 )
391393 . eval ( builder, prod_row * within_round_limit) ;
392394
@@ -402,7 +404,7 @@ impl<AB: InteractionBuilder> Air<AB> for NativeSumcheckAir {
402404 register_ptrs[ 4 ] + curr_prod_n * AB :: F :: from_canonical_usize ( EXT_DEG ) ,
403405 ) ,
404406 prod_row_specific. p_evals ,
405- start_timestamp + AB :: F :: TWO ,
407+ start_timestamp + AB :: F :: ONE ,
406408 & prod_row_specific. write_record ,
407409 )
408410 . eval ( builder, prod_row * within_round_limit) ;
@@ -449,21 +451,6 @@ impl<AB: InteractionBuilder> Air<AB> for NativeSumcheckAir {
449451 let next_logup_row_specfic: & LogupSpecificCols < AB :: Var > =
450452 next. specific [ ..LogupSpecificCols :: < AB :: Var > :: width ( ) ] . borrow ( ) ;
451453
452- self . memory_bridge
453- . read (
454- MemoryAddress :: new (
455- native_as,
456- register_ptrs[ 0 ]
457- + AB :: F :: from_canonical_usize ( EXT_DEG * 2 )
458- + num_prod_spec
459- + ( curr_logup_n - AB :: F :: ONE ) ,
460- ) , // curr_logup_n starts at 1.
461- [ max_round] ,
462- start_timestamp,
463- & logup_row_specific. read_records [ 0 ] ,
464- )
465- . eval ( builder, logup_row) ;
466-
467454 // logup_row * within_round_limit =
468455 // logup_in_round_evaluation + logup_next_round_evaluation
469456 builder
@@ -488,8 +475,8 @@ impl<AB: InteractionBuilder> Air<AB> for NativeSumcheckAir {
488475 . read (
489476 MemoryAddress :: new ( native_as, register_ptrs[ 3 ] + logup_row_specific. data_ptr ) ,
490477 logup_row_specific. pq ,
491- start_timestamp + AB :: F :: ONE ,
492- & logup_row_specific. read_records [ 1 ] ,
478+ start_timestamp,
479+ & logup_row_specific. read_records [ 0 ] ,
493480 )
494481 . eval ( builder, logup_row * within_round_limit) ;
495482
@@ -513,7 +500,7 @@ impl<AB: InteractionBuilder> Air<AB> for NativeSumcheckAir {
513500 + ( num_prod_spec + curr_logup_n) * AB :: F :: from_canonical_usize ( EXT_DEG ) ,
514501 ) ,
515502 logup_row_specific. p_evals ,
516- start_timestamp + AB :: F :: TWO ,
503+ start_timestamp + AB :: F :: ONE ,
517504 & logup_row_specific. write_records [ 0 ] ,
518505 )
519506 . eval ( builder, logup_row * within_round_limit) ;
@@ -528,7 +515,7 @@ impl<AB: InteractionBuilder> Air<AB> for NativeSumcheckAir {
528515 * AB :: F :: from_canonical_usize ( EXT_DEG ) ,
529516 ) ,
530517 logup_row_specific. q_evals ,
531- start_timestamp + AB :: F :: from_canonical_usize ( 3 ) ,
518+ start_timestamp + AB :: F :: TWO ,
532519 & logup_row_specific. write_records [ 1 ] ,
533520 )
534521 . eval ( builder, logup_row * within_round_limit) ;
0 commit comments