circomkit icon indicating copy to clipboard operation
circomkit copied to clipboard

Human-readable constraint display

Open numtel opened this issue 1 year ago • 2 comments

I wrote this function to make it easier to understand my circuits. What do you think about this? It's a lot nicer than snarkjs rp mycircuit.r1cs. ~~I'll have to come up with something better than that giant string block in the test case before merging.~~

Sorry about just ignoring all the ts errors :rofl:

Also, the compute match fix is in here. I tried a few more tests but I couldn't get it to fail like I thought it might so there's no test change for it.


Since the full list of mutliplier(4) constraints is no longer in the test source, the output is like this:

-in[0] * in[1] + inner[0] = 0
-inner[0] * in[2] + inner[1] = 0
-inner[1] * in[3] + out = 0
isZero[0].in * isZero[0].inv - 1 = 0
isZero[1].in * isZero[1].inv - 1 = 0
isZero[2].in * isZero[2].inv - 1 = 0
isZero[3].in * isZero[3].inv - 1 = 0
-1 + in[0] - isZero[0].in = 0
-1 + in[1] - isZero[1].in = 0
-1 + in[2] - isZero[2].in = 0
-1 + in[3] - isZero[3].in = 0

numtel avatar Dec 04 '24 11:12 numtel

man this is the coolest thing ever <3

erhant avatar Dec 06 '24 18:12 erhant

Let me know any suggestions you have. It definitely is helping me think about constraints better so far as is

numtel avatar Dec 06 '24 18:12 numtel