diff --git a/halo2_frontend/src/dev.rs b/halo2_frontend/src/dev.rs index d8e95d7a4..4678319ff 100644 --- a/halo2_frontend/src/dev.rs +++ b/halo2_frontend/src/dev.rs @@ -1566,9 +1566,7 @@ mod tests { } #[test] - #[should_panic( - expected = "pair of selector/fixed queries(querying the tag columns) should be included, otherwise we have soundness error" - )] + #[should_panic(expected = "all table expressions need selector/fixed query for tagging")] fn bad_lookup_any_no_fixed_col_or_selector() { const K: u32 = 4; diff --git a/halo2_frontend/src/plonk/circuit/constraint_system.rs b/halo2_frontend/src/plonk/circuit/constraint_system.rs index 18d49d8ae..7dad50312 100644 --- a/halo2_frontend/src/plonk/circuit/constraint_system.rs +++ b/halo2_frontend/src/plonk/circuit/constraint_system.rs @@ -402,6 +402,8 @@ impl ConstraintSystem { let mut cells = VirtualCells::new(self); let mut is_all_table_expr_fixed_or_selector = true; + let mut is_all_input_expr_contains_fixed_or_selector = true; + let mut is_all_table_expr_contains_fixed_or_selector = true; let mut is_tagging_cols_pair_exists = false; let table_map = table_map(&mut cells) @@ -416,6 +418,12 @@ impl ConstraintSystem { is_all_table_expr_fixed_or_selector &= table.degree() == 1 && table.contains_fixed_col_or_selector(); + + is_all_input_expr_contains_fixed_or_selector &= + input.contains_fixed_col_or_selector(); + is_all_table_expr_contains_fixed_or_selector &= + table.contains_fixed_col_or_selector(); + is_tagging_cols_pair_exists |= (input.contains_fixed_col_or_selector() && input.degree() == 1) && (table.contains_fixed_col_or_selector() && table.degree() == 1); @@ -429,6 +437,12 @@ impl ConstraintSystem { if is_all_table_expr_fixed_or_selector { panic!("all table expressions contain only fixed query, should use `lookup` api instead of `lookup_any`"); } + if !is_all_input_expr_contains_fixed_or_selector { + panic!("all input expressions need selector/fixed query for tagging"); + } + if !is_all_table_expr_contains_fixed_or_selector { + panic!("all table expressions need selector/fixed query for tagging"); + } if !is_tagging_cols_pair_exists { panic!("pair of selector/fixed queries(querying the tag columns) should be included, otherwise we have soundness error"); }