add async proofs

This commit is contained in:
Jaremy Creechley 2024-05-21 16:00:41 +03:00
parent c220136ea3
commit 325292325d
No known key found for this signature in database
GPG Key ID: 4E66FB67B21D3300
1 changed files with 25 additions and 0 deletions

View File

@ -70,3 +70,28 @@ suite "Test Prover":
check:
(await prover.verify(proof, inputs)).tryGet == true
test "Should sample and prove many slot":
let
r1cs = "tests/circuits/fixtures/proof_main.r1cs"
wasm = "tests/circuits/fixtures/proof_main.wasm"
taskpool = Taskpool.new(num_threads = 2)
params = CircomCompatParams.init(r1cs, wasm)
circomBackend = AsyncCircomCompat.init(params, taskpool)
prover = Prover.new(store, circomBackend, samples)
var proofs = newSeq[Future[?!(AnyProofInputs, AnyProof)]]()
for i in 1..10:
echo "PROVE: ", i
let
challenge = (1234567+i).toF.toBytes.toArray32
proofs.add(prover.prove(1, verifiable, challenge))
await allFutures(proofs)
for pf in proofs:
let (inputs, proof) = (await pf).tryGet
check:
(await prover.verify(proof, inputs)).tryGet == true