fix results stuff

This commit is contained in:
Jaremy Creechley 2024-05-17 01:31:53 +03:00
parent 96862372e5
commit ebc284ae6a
No known key found for this signature in database
GPG Key ID: 4E66FB67B21D3300
2 changed files with 22 additions and 9 deletions

View File

@ -56,8 +56,20 @@ proc prove*[H](
let args = ProveTaskArgs(signal: signal, params: self.params)
let flowvar = self.tp.spawn proveTask(args, input)
without res =? await awaitThreadResult(signal, flowvar), err:
return failure(err)
without taskRes =? await awaitThreadResult(signal, flowvar), err:
let res: ?!CircomProof = failure(err)
return res
without proof =? taskRes.mapFailure, err:
let res: ?!CircomProof = failure(err)
return res
let sigRes = signal.close()
if sigRes.isErr:
return failure(sigRes.error())
let pf: CircomProof = proof
success(pf)
proc verify*[H](
self: AsyncCircomCompat, proof: CircomProof, inputs: ProofInputs[H]

View File

@ -15,6 +15,7 @@ proc awaitThreadResult*[T](signal: ThreadSignalPtr, handle: Flowvar[T]): Future[
var
res: T
awaitTotal: Duration
while awaitTotal < CompletionTimeout:
if handle.tryComplete(res):
return success(res)