mirror of
https://github.com/status-im/nim-dagger.git
synced 2025-01-20 19:50:03 +00:00
updates
This commit is contained in:
parent
4146690899
commit
682d03b989
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user