zk-SQL icon indicating copy to clipboard operation
zk-SQL copied to clipboard

Potential Bug in `SELECT` circuit

Open Koukyosyumei opened this issue 6 months ago • 1 comments

In select.circom, line 79 uses an assert statement to check whether field[j] is binary. However, in Circom, assert does not generate a constraint—it only checks the condition during the witness generation, which is insufficient for enforcing validity within the circuit being proven.

https://github.com/nulltea/zk-SQL/blob/4c3626d383873fdd5e64e7fa874967d26cc61f96/circuits/select.circom#L79

To properly constrain the signal to be binary, this line should be replaced with:

(field[j] - 1) * field[j] === 0

Koukyosyumei avatar Jun 06 '25 00:06 Koukyosyumei