Replies: 1 comment 1 reply
-
Resolved my issue by moving to MiMC and changing the way I build the hash to avoid bit operations in the circuit. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello All!
I would love some feedback on what I am doing wrong as I can't seem to wrap my head around what is happening.
A quick explanation:
Below is the code I am playing with.
First this code generates a bunch of 64 byte chunks of account data. Then it hashes each 64 byte account chunk using keccak256. Then it XORs those hashes together with an initial random 32 byte value. This results in a position independent hash of all the account chunks + the random value.
Second the code computes a partial total account set hash which is ((total accounts -1) + initial random value). Then is hashes the remaining single account. Then it XORs the single account hash with the partial account set hash. Then it checks if they are equal.
The above is done all outside of the circuit.
The code then uses partial account set hash as a private input, the single account hash as a private input, and the full account set hash as a public input into the circuit.
The circuit is supposed to take the partial account set hash and xor it with the owned account set hash, then check if it equals the full account set hash.
I have yet to find the right way to do this and keep running in to type errors.
Any feedback would be much appreciated, or even pointers to doing this in a more straight forward way as having to XOR the individual bits seems excessive.
Example output:
00:39:52 ERR parsing circuit error="[]frontend.Variable to big.Int not supported\nfrontend.parseCircuit.func2\n\tcompile.go:118\nutils.FromInterface\n\tconvert.go:86\nbn254.(*field).FromInterface\n\tcoeff.go:110\nr1cs.(*builder).toVariable\n\tbuilder.go:339\nr1cs.(*builder).AssertIsBoolean\n\tapi_assertions.go:56\nbits.fromBinary\n\tconversion_binary.go:36\nbits.FromBase\n\tconversion.go:42\nbits.FromBinary\n\tconversion_binary.go:16\nr1cs.(*builder).FromBinary\n\tapi.go:369\nmain.(*Circuit).Define\n\tbp2.go:170\n"
Beta Was this translation helpful? Give feedback.
All reactions