@@ -410,11 +410,13 @@ impl<ST: StateTransition> Circuit<Fr> for RecursionCircuit<ST> {
410
410
// Verify initial_state is same as the first application snark in the
411
411
// first round of recursion.
412
412
(
413
+ "initial state equal to app's initial (first round)" ,
413
414
main_gate. mul ( & mut ctx, Existing ( st) , Existing ( first_round) ) ,
414
415
main_gate. mul ( & mut ctx, Existing ( app_inst) , Existing ( first_round) ) ,
415
416
) ,
416
417
// Propagate initial_state for subsequent rounds of recursion.
417
418
(
419
+ "initial state equal to prev_recursion's initial (not first round)" ,
418
420
main_gate. mul ( & mut ctx, Existing ( st) , Existing ( not_first_round) ) ,
419
421
previous_st,
420
422
) ,
@@ -436,7 +438,7 @@ impl<ST: StateTransition> Circuit<Fr> for RecursionCircuit<ST> {
436
438
. map ( |i| & app_instances[ i] ) ,
437
439
) ,
438
440
)
439
- . map ( |( & st, & app_inst) | ( st, app_inst) )
441
+ . map ( |( & st, & app_inst) | ( "passing cur state to app" , st, app_inst) )
440
442
. collect :: < Vec < _ > > ( ) ;
441
443
442
444
// Verify that the "previous state" (additional state not included) is the same
@@ -451,6 +453,7 @@ impl<ST: StateTransition> Circuit<Fr> for RecursionCircuit<ST> {
451
453
)
452
454
. map ( |( & st, & app_inst) | {
453
455
(
456
+ "chain prev state with cur init state (not first round)" ,
454
457
main_gate. mul ( & mut ctx, Existing ( app_inst) , Existing ( not_first_round) ) ,
455
458
st,
456
459
)
@@ -459,9 +462,10 @@ impl<ST: StateTransition> Circuit<Fr> for RecursionCircuit<ST> {
459
462
460
463
// Finally apply the equality constraints between the (LHS, RHS) values constructed
461
464
// above.
462
- for ( lhs, rhs) in [
465
+ for ( comment , lhs, rhs) in [
463
466
// Propagate the preprocessed digest.
464
467
(
468
+ "chain preprocessed digest" ,
465
469
main_gate. mul (
466
470
& mut ctx,
467
471
Existing ( preprocessed_digest) ,
@@ -471,6 +475,7 @@ impl<ST: StateTransition> Circuit<Fr> for RecursionCircuit<ST> {
471
475
) ,
472
476
// Verify that "round" increments by 1 when not the first round of recursion.
473
477
(
478
+ "round increment" ,
474
479
round,
475
480
main_gate. add (
476
481
& mut ctx,
@@ -484,6 +489,13 @@ impl<ST: StateTransition> Circuit<Fr> for RecursionCircuit<ST> {
484
489
. chain ( verify_app_state)
485
490
. chain ( verify_app_init_state)
486
491
{
492
+ use halo2_proofs:: dev:: unwrap_value;
493
+ debug_assert_eq ! (
494
+ unwrap_value( lhs. value( ) ) ,
495
+ unwrap_value( rhs. value( ) ) ,
496
+ "equality constraint fail: {}" ,
497
+ comment
498
+ ) ;
487
499
ctx. region . constrain_equal ( lhs. cell ( ) , rhs. cell ( ) ) ?;
488
500
}
489
501
0 commit comments