ProvableHQ / leo

🦁 The Leo Programming Language. A Programming Language for Formally Verified, Zero-Knowledge Applications
https://leo-lang.org/
GNU General Public License v3.0
4.77k stars 655 forks source link

[Feature] Improve console function error messages #580

Closed collinc97 closed 3 years ago

collinc97 commented 3 years ago

🚀 Feature

Console functions like console.assert will fail inside a leo main() function.

They produce the following error.

Setup Starting...
     Setup     --> "/home/batman/simple-console-1/src/main.leo": 4:5
     |
   4 |      console.assert(c == b + a);
     |      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = console.assert() failed to evaluate. This error is caused by empty input file values
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: SynthesisError(Unsatisfiable)'

This error message should be improved to highlight that console functions do not create constraints in the circuit and should only be used in a testing context.

damirka commented 3 years ago

It is odd, but calling setup over this case does not guarantee error (~40% chance of success). Still digging, will post updates once I figure out what exactly happens.

UPD