2024-05-16 21:12:38 +03:00
|
|
|
|
|
|
|
import std/sequtils
|
|
|
|
|
|
|
|
import pkg/taskpools
|
|
|
|
import pkg/taskpools/flowvars
|
|
|
|
import pkg/chronos
|
|
|
|
import pkg/chronos/threadsync
|
|
|
|
import pkg/questionable/results
|
|
|
|
|
2024-05-16 21:41:24 +03:00
|
|
|
import ./circomcompat
|
2024-05-16 21:12:38 +03:00
|
|
|
|
|
|
|
const
|
|
|
|
CompletitionTimeout = 1.seconds # Maximum await time for completition after receiving a signal
|
|
|
|
CompletitionRetryDelay = 10.millis
|
|
|
|
|
|
|
|
type
|
2024-05-16 21:35:24 +03:00
|
|
|
AsyncCircomCompat* = object
|
|
|
|
params*: CircomCompatParams
|
2024-05-16 21:12:38 +03:00
|
|
|
|
|
|
|
# Args objects are missing seq[seq[byte]] field, to avoid unnecessary data copy
|
2024-05-16 21:41:24 +03:00
|
|
|
ProveTaskArgs = object
|
2024-05-16 21:12:38 +03:00
|
|
|
signal: ThreadSignalPtr
|
2024-05-16 21:41:24 +03:00
|
|
|
params: CircomCompatParams
|
2024-05-16 21:35:24 +03:00
|
|
|
|
|
|
|
proc prove*[H](
|
2024-05-16 21:41:24 +03:00
|
|
|
self: AsyncCircomCompat,
|
|
|
|
input: ProofInputs[H]
|
|
|
|
): Future[?!CircomProof] {.async.} =
|
|
|
|
## Generates proof using circom-compat asynchronously
|
|
|
|
##
|
|
|
|
discard
|
|
|
|
|
|
|
|
proc verify*[H](
|
|
|
|
self: AsyncCircomCompat,
|
|
|
|
proof: CircomProof,
|
|
|
|
inputs: ProofInputs[H]
|
|
|
|
): Future[?!bool] {.async.} =
|
|
|
|
## Verify a proof using a ctx
|
|
|
|
##
|
|
|
|
discard
|