@@ -244,10 +244,6 @@ impl<F: Field> SubCircuitConfig<F> for CopyCircuitConfig<F> {
244
244
) ( meta) ,
245
245
] ) ;
246
246
vec ! [
247
- // If a row is not enabled (fixed), it is not in an event.
248
- // TODO: not currently possible due to API limitations.
249
- // (1.expr() - enabled.expr()) * is_event.expr(),
250
-
251
247
// If a row is anything but padding (filler of the table), it is in an event.
252
248
enabled. expr( )
253
249
* ( ( 1 . expr( ) - is_event. expr( ) )
@@ -321,6 +317,9 @@ impl<F: Field> SubCircuitConfig<F> for CopyCircuitConfig<F> {
321
317
- meta. query_advice ( is_last, Rotation :: cur ( ) )
322
318
- meta. query_advice ( is_last, Rotation :: next ( ) ) ;
323
319
320
+ // Prevent an event from spilling into the disabled rows. This also ensures that eventually is_last=1.
321
+ cb. require_zero ( "the next row is enabled" , is_continue. expr ( ) * not:: expr ( meta. query_fixed ( q_enable, Rotation :: next ( ) ) ) ) ;
322
+
324
323
let is_word_end = is_word_end. is_equal_expression . expr ( ) ;
325
324
326
325
// Apply the same constraints for the RLCs of words before and after the write.
@@ -736,13 +735,6 @@ impl<F: Field> CopyCircuitConfig<F> {
736
735
{
737
736
let is_read = step_idx % 2 == 0 ;
738
737
739
- region. assign_fixed (
740
- || format ! ( "q_enable at row: {offset}" ) ,
741
- self . q_enable ,
742
- * offset,
743
- || Value :: known ( F :: one ( ) ) ,
744
- ) ?;
745
-
746
738
// Copy table assignments
747
739
for ( & column, & ( value, label) ) in
748
740
<CopyTable as LookupTable < F > >:: advice_columns ( & self . copy_table )
@@ -880,9 +872,7 @@ impl<F: Field> CopyCircuitConfig<F> {
880
872
. sum :: < usize > ( ) ;
881
873
882
874
// The `+ 2` is used to take into account the two extra empty copy rows needed
883
- // to satisfy the query at `Rotation(2)` performed inside of the
884
- // `rows[2].value == rows[0].value * r + rows[1].value` requirement in the RLC
885
- // Accumulation gate.
875
+ // to satisfy the queries at `Rotation(2)`.
886
876
assert ! (
887
877
copy_rows_needed + 2 <= max_copy_rows,
888
878
"copy rows not enough {copy_rows_needed} vs {max_copy_rows}"
@@ -976,14 +966,14 @@ impl<F: Field> CopyCircuitConfig<F> {
976
966
lt_chip : & LtChip < F , 8 > ,
977
967
lt_word_end_chip : & IsEqualChip < F > ,
978
968
) -> Result < ( ) , Error > {
969
+ // q_enable
970
+ region. assign_fixed (
971
+ || "q_enable" ,
972
+ self . q_enable ,
973
+ * offset,
974
+ || Value :: known ( F :: from ( !is_last_two) ) ,
975
+ ) ?;
979
976
if !is_last_two {
980
- // q_enable
981
- region. assign_fixed (
982
- || "q_enable" ,
983
- self . q_enable ,
984
- * offset,
985
- || Value :: known ( F :: one ( ) ) ,
986
- ) ?;
987
977
// q_step
988
978
if * offset % 2 == 0 {
989
979
self . q_step . enable ( region, * offset) ?;
0 commit comments