diff --git a/benchmarks/ark_prover_bench.nim b/benchmarks/ark_prover_bench.nim index d19601fe..65fe1f98 100644 --- a/benchmarks/ark_prover_bench.nim +++ b/benchmarks/ark_prover_bench.nim @@ -58,6 +58,27 @@ when isMainModule: ncells: 512, # number of cells in this slot ) - createCircuit(args) + let benchenv = createCircuit(args) ## TODO: copy over testcircomcompat proving + when false: + let + r1cs = "tests/circuits/fixtures/proof_main.r1cs" + wasm = "tests/circuits/fixtures/proof_main.wasm" + zkey = "tests/circuits/fixtures/proof_main.zkey" + + var + circom: CircomCompat + proofInputs: ProofInputs[Poseidon2Hash] + + let + inputData = readFile("tests/circuits/fixtures/input.json") + inputJson = !JsonNode.parse(inputData) + proofInputs = Poseidon2Hash.jsonToProofInput(inputJson) + circom = CircomCompat.init(r1cs, wasm, zkey) + + let proof = circom.prove(proofInputs).tryGet + + circom.verify(proof, proofInputs).tryGet + circom.release() # this comes from the rust FFI + diff --git a/benchmarks/create_circuits.nim b/benchmarks/create_circuits.nim index 00c29d61..af7428ae 100644 --- a/benchmarks/create_circuits.nim +++ b/benchmarks/create_circuits.nim @@ -109,7 +109,7 @@ proc createCircuit*( ptauPath = ptauDefPath, ptauUrl = ptauDefUrl, someEntropy = "some_entropy_75289v3b7rcawcsyiur", -) = +): tuple[dir: string, name: string] = ## Generates all the files needed for to run a proof circuit. Downloads the PTAU file if needed. ## let circdir = circBenchDir @@ -170,6 +170,8 @@ proc createCircuit*( moveFile(fmt"{name}_0001.zkey", fmt"{name}.zkey") removeFile(fmt"{name}_0000.zkey") + return (circdir, name) + when isMainModule: checkEnv() @@ -185,4 +187,5 @@ when isMainModule: index: 3, # which slot we prove (0..NSLOTS-1) ncells: 512, # number of cells in this slot ) - createCircuit(args) + let benchenv = createCircuit(args) + echo "\nBench dir:\n", benchenv