zksnarks_example icon indicating copy to clipboard operation
zksnarks_example copied to clipboard

Added private field to parameters

Open AntoineRondelet opened this issue 7 years ago • 1 comments

It looks like the compilation fails when I try to compile the program:

def main(x):
     s1 + s2 + x == 15
     return 1

I got:

Compiling sumsToFifteen.code
thread 'main' panicked at 'Compilation failed: Semantic error: s1 is undefined', src/main.rs:208:29
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Based on what I have seen here: https://github.com/JacobEberhardt/ZoKrates/blob/master/examples/factorization.code We can now add private parameters as arguments. Doing so in the sumsToFifteen.code solved my problem and compiled the code to out.code as expected.

AntoineRondelet avatar May 05 '18 13:05 AntoineRondelet

This problem as been raised by @ariary in the issue #3, my bad; I didn't look at it before I opened the PR.

I also had a problem when I tried to compute the witness. The flag --interactive was missing in the command. So we might need to modify it to:

-    $ ./target/release/zokrates compute-witness -a 5
+    $ ./target/release/zokrates compute-witness -a 5 --interactive

AntoineRondelet avatar May 05 '18 14:05 AntoineRondelet