add async proofs
This commit is contained in:
parent
c220136ea3
commit
325292325d
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue