This commit is contained in:
Jaremy Creechley 2024-05-02 16:07:05 +03:00
parent d9ee7c01eb
commit be0527fd61
No known key found for this signature in database
GPG Key ID: 4E66FB67B21D3300
3 changed files with 16 additions and 8 deletions

View File

@ -28,9 +28,13 @@ proc findCodexProjectDir(): string =
func default*(tp: typedesc[CircuitEnv]): CircuitEnv = func default*(tp: typedesc[CircuitEnv]): CircuitEnv =
let codexDir = findCodexProjectDir() let codexDir = findCodexProjectDir()
result.nimCircuitCli = codexDir / "vendor" / "codex-storage-proofs-circuits" / "reference" / "nim" / "proof_input" / "cli" result.nimCircuitCli =
result.circuitDirIncludes = codexDir / "vendor" / "codex-storage-proofs-circuits" / "circuit" codexDir / "vendor" / "codex-storage-proofs-circuits" / "reference" / "nim" /
result.ptauPath = codexDir / "benchmarks" / "ceremony" / "powersOfTau28_hez_final_23.ptau" "proof_input" / "cli"
result.circuitDirIncludes =
codexDir / "vendor" / "codex-storage-proofs-circuits" / "circuit"
result.ptauPath =
codexDir / "benchmarks" / "ceremony" / "powersOfTau28_hez_final_23.ptau"
result.ptauUrl = "https://storage.googleapis.com/zkevm/ptau/" result.ptauUrl = "https://storage.googleapis.com/zkevm/ptau/"
result.codexProjDir = codexDir result.codexProjDir = codexDir
@ -87,7 +91,8 @@ proc downloadPtau*(ptauPath, ptauUrl: string) =
proc getCircuitBenchPath*(args: CircuitArgs, env: CircuitEnv): string = proc getCircuitBenchPath*(args: CircuitArgs, env: CircuitEnv): string =
## generate folder name for unique circuit args ## generate folder name for unique circuit args
var an = "" var an = ""
for f, v in fieldPairs(args): an &= "_" & f & $v for f, v in fieldPairs(args):
an &= "_" & f & $v
env.codexProjDir / "benchmarks/circuit_bench" & an env.codexProjDir / "benchmarks/circuit_bench" & an
proc generateCircomAndSamples*(args: CircuitArgs, env: CircuitEnv, name: string) = proc generateCircomAndSamples*(args: CircuitArgs, env: CircuitEnv, name: string) =
@ -110,8 +115,8 @@ proc createCircuit*(
): tuple[dir: string, name: string] = ): tuple[dir: string, name: string] =
## Generates all the files needed for to run a proof circuit. Downloads the PTAU file if needed. ## Generates all the files needed for to run a proof circuit. Downloads the PTAU file if needed.
## ##
## All needed circuit files will be generated in `circBenchDir` which ## All needed circuit files will be generated as needed.
## defaults to a folder like: ## They will be located in `circBenchDir` which defaults to a folder like:
## `nim-codex/benchmarks/circuit_bench_depth32_maxslots256_cellsize2048_blocksize65536_nsamples9_entropy1234567_seed12345_nslots11_ncells512_index3` ## `nim-codex/benchmarks/circuit_bench_depth32_maxslots256_cellsize2048_blocksize65536_nsamples9_entropy1234567_seed12345_nslots11_ncells512_index3`
## with all the given CircuitArgs. ## with all the given CircuitArgs.
## ##

View File

@ -1,4 +1,8 @@
import std/[sequtils, strutils, strformat, os, options, importutils, times, os, strutils, terminal] import
std/[
sequtils, strutils, strformat, os, options, importutils, times, os, strutils,
terminal
]
import pkg/questionable import pkg/questionable
import pkg/questionable/results import pkg/questionable/results

View File

@ -1,4 +1,3 @@
template withDir*(dir: string, blk: untyped) = template withDir*(dir: string, blk: untyped) =
## set working dir for duration of blk ## set working dir for duration of blk
let prev = getCurrentDir() let prev = getCurrentDir()