2024-09-23 14:37:17 +00:00
|
|
|
import std/os
|
|
|
|
import std/osproc
|
|
|
|
import std/options
|
|
|
|
import pkg/chronos
|
2024-10-30 10:40:17 +00:00
|
|
|
import pkg/codex/contracts
|
|
|
|
import ../../asynctest
|
|
|
|
import ../../contracts/deployment
|
2024-09-23 14:37:17 +00:00
|
|
|
|
2024-10-30 10:40:17 +00:00
|
|
|
suite "tools/cirdl":
|
2024-09-23 14:37:17 +00:00
|
|
|
const
|
|
|
|
cirdl = "build" / "cirdl"
|
|
|
|
workdir = "."
|
|
|
|
|
|
|
|
test "circuit download tool":
|
|
|
|
let
|
|
|
|
circuitPath = "testcircuitpath"
|
2024-11-25 11:23:04 +00:00
|
|
|
rpcEndpoint = "http://127.0.0.1:8545"
|
2024-10-30 10:40:17 +00:00
|
|
|
marketplaceAddress = Marketplace.address
|
2024-09-23 14:37:17 +00:00
|
|
|
|
|
|
|
discard existsOrCreateDir(circuitPath)
|
|
|
|
|
2024-10-30 10:40:17 +00:00
|
|
|
let args = [circuitPath, rpcEndpoint, $marketplaceAddress]
|
2024-09-23 14:37:17 +00:00
|
|
|
|
|
|
|
let process = osproc.startProcess(
|
|
|
|
cirdl,
|
|
|
|
workdir,
|
|
|
|
args,
|
|
|
|
options={poParentStreams}
|
|
|
|
)
|
|
|
|
|
|
|
|
let returnCode = process.waitForExit()
|
|
|
|
check returnCode == 0
|
|
|
|
|
|
|
|
check:
|
|
|
|
fileExists(circuitPath/"proof_main_verification_key.json")
|
|
|
|
fileExists(circuitPath/"proof_main.r1cs")
|
|
|
|
fileExists(circuitPath/"proof_main.wasm")
|
|
|
|
fileExists(circuitPath/"proof_main.zkey")
|
|
|
|
|
|
|
|
removeDir(circuitPath)
|