Closed m1cm1c closed 2 years ago
I reduced this to:
def main(field f1, field f2):
bool lt = f1 - f2 > f1
return
When you assign to the carry, you do a dynamic comparison (x < y where neither x nor y is constant), which sadly is not complete in ZoKrates now, see here. In particular, f1 - f2 ends up being a large number (because of an underflow) which is bigger than ~ p/2, which makes the comparison fail.
I had a look at the semantics of comparison operators in Circom, it may have a complete operator, in which case we could also use that.
I was not aware of that restriction to comparison operators. Shall I close this issue because I used a comparison operator incorrectly?
Description
I wrote a subtraction function. It works just fine if its inputs are compile-time constants. However, if they are supplied to the proof, the compiler crashes during witness computation.
Environment
develop
(commit60f91894
)Steps to Reproduce
The following code compiles without issues and a witness can be computed:
Now make the numbers inputs to the proof and the compiler crashes during witness computation: