When the operands of % are compile-time constants and the divisor is 0, circom aborts with an uncaught Rust panic instead of the graceful error[T3001]: Division by zero that \ and / emit for the same input.
MRE
pragma circom 2.1.0;
template Main() { signal output out; out <-- 17 % 0; }
component main = Main();
$ circom mod0.circom --wasm
thread 'main' panicked at num-bigint-dig-0.8.4/src/algorithms/div.rs:38:9:
explicit panic
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
$ echo $?
101
For comparison, \ and / on the same input report the error cleanly:
$ # out <-- 17 \ 0; (and out <-- 1 / 0;)
error[T3001]: Division by zero
$ echo $?
1
Environment
- circom: 2.2.3 (
a100fae)
- rustc:
1.97.0-nightly
When the operands of
%are compile-time constants and the divisor is0,circomaborts with an uncaught Rust panic instead of the gracefulerror[T3001]: Division by zerothat\and/emit for the same input.MRE
For comparison,
\and/on the same input report the error cleanly:Environment
a100fae)1.97.0-nightly