ZoKrates
ZoKrates copied to clipboard
Illegal instruction when running `./zokrates setup`
Issue
./zokrates setup
fails and with the error Illegal instruction
. No proving.key
or verifying.key
files are generated but variables.inf is generated.
Environment
Mac OS Sierra Version 10.12.6 zokrates/zokrates Docker image f6ed6566b46e
Steps to reproduce
Following the "Getting Started" section of the documentation:
1 . docker run -ti zokrates/zokrates /bin/bash
2. create root.code
def main(private field a, field b) -> (field):
field result = if a * a == b then 1 else 0 fi
return result
-
./zokrates compile -i root.code
-
./zokrates setup
Console Output
zokrates@120dafed7f25:~$ ./zokrates setup
Performing setup...
def main(_0) -> (1):
(1 * ~one) * (5 * ~one + 1 * _0) == 1 * _1
(1 * ~one) * (4 * ~one + 2 * _0 + 1 * _1) == 1 * _2
(1 * ~one) * (2 * _0 + 1 * _1 + 1 * _2) == 1 * _3
(1 * ~one) * (1 * _1 + 1 * _2 + 1 * _3) == 1 * ~out_0
return (1 * ~one) * (1 * ~out_0)
Illegal instruction
Hi @cwhinfrey thanks for this! I'm struggling to reproduce the issue but I can't fetch the image you're referring to:
docker pull zokrates/zokrates@sha256:f6ed6566b46e
> invalid reference format
Mind sharing the full hash?
Also, I could not reproduce on the latest image, identified as sha256:fde48e75338d57494baf099eff4a5155933d5b2b7c78e75bc3b70b8509833bd8
docker pull zokrates/zokrates
docker run -ti zokrates /bin/bash
echo "def main(private field a, field b) -> (field):
field result = if a * a == b then 1 else 0 fi
return result" > root.code
./zokrates compile -i root.code
./zokrates setup
Does the above fix it for you, or is there anything else I should look at?
@Schaeff Thanks for getting back to me on this. I believe we are using the same image. I don't use docker much so I'm not sure what the difference is between the image ID and the RepoDigest is. Running: docker inspect zokrates/zokrates
outputs the following though:
[
{
"Id": "sha256:f6ed6566b46ecab4100557d6f7eeabac05a850724b9ec944ed1f2ccbdf80ccee",
"RepoTags": [
"zokrates/zokrates:latest"
],
"RepoDigests": [
"zokrates/zokrates@sha256:fde48e75338d57494baf099eff4a5155933d5b2b7c78e75bc3b70b8509833bd8"
],...
}
]
I deleted the container and the image and pulled it down fresh running the commands you listed (except I ran docker run -ti zokrates/zokrates /bin/bash
instead of the second command) and got a similar output as I did above.
zokrates@405d9cf3cf55:~$ ./zokrates setup
Performing setup...
def main(_0, _1) -> (1):
(1 * _0) * (1 * _0) == 1 * _2
# _3, _4 = Rust::ConditionEq((-1) * _1 + 1 * _2)
((-1) * _1 + 1 * _2) * (1 * _4) == 1 * _3
(1 * ~one + (-1) * _3) * ((-1) * _1 + 1 * _2) == 0
(1 * ~one) * (1 * ~one + (-1) * _3) == 1 * _5
(1 * _5) * (1 * ~one) == 1 * _6
(1 * ~one + (-1) * _5) * (0) == 1 * _7
(1 * ~one) * (1 * _6 + 1 * _7) == 1 * _8
(1 * ~one) * (1 * _8) == 1 * ~out_0
return (1 * ~one) * (1 * ~out_0)
Illegal instruction
Only variables.inf
was created again as well.
Any ideas on what's going on here? Really appreciate the help!
Ok it does seem like we're running the same image, I didn't know about the different ids either. I'm not an expert here, but could you try to run:
ulimit -c unlimited
./zokrates setup
Then check if a file starting with core
got created? If so, share it with us here.
@Schaeff Here's the core file. https://gist.github.com/cwhinfrey/65ef78501b630f1e6343e061da062a7a Let me know if there's any other info I can provide.