zksecurity / noname

Noname: a programming language to write zkapps
https://zksecurity.github.io/noname/
161 stars 35 forks source link

improve debugging of simple arithmetic.no example #114

Open mimoo opened 1 month ago

mimoo commented 1 month ago

take a look:

$ cargo run -- test --path examples/arithmetic.no --private-inputs '{"private_input": "2"}' --public-inputs '{"public_input": "2"}' --debug
@ noname.0.7.0

╭────────────────────────────────────────────────────────────────────────────────
│ 0 │ v_3 == (v_2) * (v_1)
╭────────────────────────────────────────────────────────────────────────────────
│ FILE: examples/arithmetic.no
│────────────────────────────────────────────────────────────────────────────────
│ 3:     let yy = private_input * public_input;
│                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
╰────────────────────────────────────────────────────────────────────────────────
╭────────────────────────────────────────────────────────────────────────────────
│ 1 │ v_3 == (v_1 + v_2) * (1)
╭────────────────────────────────────────────────────────────────────────────────
│ FILE: examples/arithmetic.no
│────────────────────────────────────────────────────────────────────────────────
│ 4:     assert_eq(xx, yy);
│        ^^^^^^^^^^^^^^^^^
╰────────────────────────────────────────────────────────────────────────────────

how can we improve this? I think eventually we should produce a json artifact that gives us information (that a web UI would allow us to explore freely) like:

so perhaps this is what we should be doing:

the last two steps would be a nice feedback loop :)