I'm new to ZoKrates and ZK stuff in general. I am confused about how the witness works. If I compute an invalid witness the verifier still verifies the proof as correct. For example (based on ZoKrates "get started").
Given this program:
def main(private field a, field b) -> bool:
return a * a == b
Then running the following:
zokrates compile -i root.zok
zokrates setup
zokrates compute-witness -a 337 113569
zokrates generate-proof
When I run
zokrates verify
It returns PASSED.
However if I provide a bad value to compute-witness
it still passes. For example:
zokrates compute-witness -a 1 113569
zokrates generate-proof
zokrates verify // PASSES
I'm clearly miss-understanding something here but after spending a few hours reading different bits online I'm still not sure what.