Display Number of Public Inputs
Displaying the number of public inputs in Kimchi and R1CS (to do). Addresses this issue suggested by @mimoo.
As an example, when passing in {"public_input": ["1", "2"]} to array.no:
gate 0
gate 1
gate 2
gate 3
@ noname.0.7.0
@ public inputs: 2
Or when passing in {"public_input": "2"} to arithmetic.no:
gate 0
gate 1
gate 2
gate 3
@ noname.0.7.0
@ public inputs: 1
thanks so much! a simple change but I've been waiting for this for a long time haha. Do you think you could take a look at the r1cs backend as well?
in addition, you will have to update the compiled circuits in examples/ to pass CI. I'm not sure if there's a command to easily do that (cc @katat)
Of course! I was playing around with displaying R1CS in a format you had mentioned,
@ v_0=1
@ pub=v_1 to v_3
and I ran into an issue when collecting the public input range. I only spent a few minutes on it last night, but I'll tackle it again shortly. Alternatively, we can just list the number of public inputs similarly to Kimchi above?
This is going to be an useful feature to add! It can help debug with the asm.
I'm not sure if there's a command to easily do that (cc @katat)
atm, it has to manually update the asm files. yeah, it would be nice to automatically update the asm files in a batch.
For now, Public Inputs for R1CS are identical to Kimchi; for the array.no example from above:
@ noname.0.7.0
@ public inputs: 2
╭────────────────────────────────────────────────────────────────────────────────
│ 0 │ 1 == (v_1) * (1)
╭────────────────────────────────────────────────────────────────────────────────
│ FILE: examples/array.no
│────────────────────────────────────────────────────────────────────────────────
│ 4: assert_eq(public_input[0], xx[0]);
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
╰────────────────────────────────────────────────────────────────────────────────
╭────────────────────────────────────────────────────────────────────────────────
│ 1 │ 2 == (v_2) * (1)
╭────────────────────────────────────────────────────────────────────────────────
│ FILE: examples/array.no
│────────────────────────────────────────────────────────────────────────────────
│ 5: assert_eq(public_input[1], xx[1]);
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
╰────────────────────────────────────────────────────────────────────────────────
Updated newlines so public inputs is right below the version, and the additional newline is after the public inputs:
@ noname.0.7.0
@ public inputs: 2
╭────────────────────────────────────────────────────────────────────────────────
│ 0 │ 1 == (v_1) * (1)
...
@katat just manually updated the asm files, waiting on the build to complete to ensure output looks okay. how does look to you? any suggestions?
Thanks @mantej
btw, you can also run cargo test to do the check locally.
@katat all tests are passing locally
@katat I pushed the cargo fmt commit, but I don't have write access to merge.
Thanks!