diff --git a/tests/codex/slots/testprover.nim b/tests/codex/slots/testprover.nim index 5618d400..37131561 100644 --- a/tests/codex/slots/testprover.nim +++ b/tests/codex/slots/testprover.nim @@ -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