Add Tree Circom Verifier Proofs

Circom Verifier Proofs allow to verify through a zkSNARK proof the
inclusion/exclusion of a leaf in a tree. This commit adds the needed
code in go to generate the circuit inputs for a CircomVerifierProof.
This commit is contained in:
2021-06-16 08:54:00 +02:00
parent 465f0ed172
commit 43cad713b0
4 changed files with 165 additions and 16 deletions

View File

@@ -305,9 +305,11 @@ func TestGenProofAndVerify(t *testing.T) {
k := BigIntToBytes(bLen, big.NewInt(int64(7)))
v := BigIntToBytes(bLen, big.NewInt(int64(14)))
proofV, siblings, err := tree.GenProof(k)
kAux, proofV, siblings, existence, err := tree.GenProof(k)
c.Assert(err, qt.IsNil)
c.Assert(proofV, qt.DeepEquals, v)
c.Assert(k, qt.DeepEquals, kAux)
c.Assert(existence, qt.IsTrue)
verif, err := CheckProof(tree.hashFunction, k, v, tree.Root(), siblings)
c.Assert(err, qt.IsNil)