diff --git a/codex/slots/proofs/backends/asynccircoms.nim b/codex/slots/proofs/backends/asynccircoms.nim index efd1141d..5b927a7f 100644 --- a/codex/slots/proofs/backends/asynccircoms.nim +++ b/codex/slots/proofs/backends/asynccircoms.nim @@ -1,4 +1,4 @@ -import std/sequtils +import std/options import pkg/taskpools import pkg/taskpools/flowvars @@ -26,14 +26,17 @@ type signal: ThreadSignalPtr params: CircomCompatParams -var circomBackend {.threadvar.}: CircomCompat +var circomBackend {.threadvar.}: Option[CircomCompat] proc proveTask[H]( args: ProveTaskArgs, data: ProofInputs[H] ): Result[CircomProof, string] = try: - let res = circomBackend.prove(data) + if circomBackend.isNone: + circomBackend = some CircomCompat.init(args.params) + + let res = circomBackend.get().prove(data) if res.isOk: return ok(res.get()) else: diff --git a/codex/slots/proofs/prover.nim b/codex/slots/proofs/prover.nim index 1c2d4ccf..d86dab5a 100644 --- a/codex/slots/proofs/prover.nim +++ b/codex/slots/proofs/prover.nim @@ -99,7 +99,6 @@ proc new*( backend: AnyBackend, nSamples: int ): Prover = - Prover( backend: backend, store: store,