Restores tests
This commit is contained in:
parent
4a94df3663
commit
e1137a574c
|
@ -9,6 +9,7 @@ import pkg/codex/slots/proofs/backendfactory
|
|||
import pkg/codex/slots/proofs/backendutils
|
||||
|
||||
import ../helpers
|
||||
import ../examples
|
||||
|
||||
type
|
||||
BackendUtilsMock = ref object of BackendUtils
|
||||
|
@ -26,7 +27,7 @@ method initializeCircomBackend*(
|
|||
self.argWasmFile = wasmFile
|
||||
self.argZKeyFile = zKeyFile
|
||||
# We return a backend with *something* that's not nil that we can check for.
|
||||
var
|
||||
var
|
||||
key = VerifyingKey(icLen: 123)
|
||||
vkpPtr: ptr VerifyingKey = key.addr
|
||||
return CircomCompat(vkp: vkpPtr)
|
||||
|
@ -50,11 +51,12 @@ suite "Test BackendFactory":
|
|||
discoveryIp: ValidIpAddress.init(IPv4_any()),
|
||||
metricsAddress: ValidIpAddress.init("127.0.0.1"),
|
||||
persistenceCmd: PersistenceCmd.prover,
|
||||
marketplaceAddress: EthAddress.example.some,
|
||||
circomR1cs: InputFile("tests/circuits/fixtures/proof_main.r1cs"),
|
||||
circomWasm: InputFile("tests/circuits/fixtures/proof_main.wasm"),
|
||||
circomZkey: InputFile("tests/circuits/fixtures/proof_main.zkey")
|
||||
)
|
||||
backend = (await initializeBackend(config, utilsMock)).tryGet
|
||||
backend = initializeBackend(config, utilsMock).tryGet
|
||||
|
||||
check:
|
||||
backend.vkp != nil
|
||||
|
@ -70,12 +72,13 @@ suite "Test BackendFactory":
|
|||
discoveryIp: ValidIpAddress.init(IPv4_any()),
|
||||
metricsAddress: ValidIpAddress.init("127.0.0.1"),
|
||||
persistenceCmd: PersistenceCmd.prover,
|
||||
marketplaceAddress: EthAddress.example.some,
|
||||
|
||||
# Set the circuitDir such that the tests/circuits/fixtures/ files
|
||||
# will be picked up as local files:
|
||||
circuitDir: OutDir("tests/circuits/fixtures")
|
||||
)
|
||||
backend = (await initializeBackend(config, utilsMock)).tryGet
|
||||
backend = initializeBackend(config, utilsMock).tryGet
|
||||
|
||||
check:
|
||||
backend.vkp != nil
|
||||
|
@ -91,10 +94,11 @@ suite "Test BackendFactory":
|
|||
discoveryIp: ValidIpAddress.init(IPv4_any()),
|
||||
metricsAddress: ValidIpAddress.init("127.0.0.1"),
|
||||
persistenceCmd: PersistenceCmd.prover,
|
||||
marketplaceAddress: EthAddress.example.some,
|
||||
circuitDir: OutDir(circuitDir)
|
||||
)
|
||||
|
||||
backendResult = (await initializeBackend(config, utilsMock))
|
||||
backendResult = initializeBackend(config, utilsMock)
|
||||
|
||||
check:
|
||||
backendResult.isErr
|
||||
|
|
|
@ -15,6 +15,8 @@ import pkg/codex/chunker
|
|||
import pkg/codex/blocktype as bt
|
||||
import pkg/codex/slots
|
||||
import pkg/codex/stores
|
||||
import pkg/codex/conf
|
||||
import pkg/confutils/defs
|
||||
import pkg/poseidon2/io
|
||||
import pkg/codex/utils/poseidon2digest
|
||||
|
||||
|
@ -29,9 +31,6 @@ suite "Test Prover":
|
|||
cellSize = DefaultCellSize
|
||||
repoTmp = TempLevelDb.new()
|
||||
metaTmp = TempLevelDb.new()
|
||||
r1cs = "tests/circuits/fixtures/proof_main.r1cs"
|
||||
wasm = "tests/circuits/fixtures/proof_main.wasm"
|
||||
circomBackend = CircomCompat.init(r1cs, wasm)
|
||||
challenge = 1234567.toF.toBytes.toArray32
|
||||
|
||||
var
|
||||
|
@ -42,9 +41,20 @@ suite "Test Prover":
|
|||
let
|
||||
repoDs = repoTmp.newDb()
|
||||
metaDs = metaTmp.newDb()
|
||||
config = CodexConf(
|
||||
cmd: StartUpCmd.persistence,
|
||||
nat: ValidIpAddress.init("127.0.0.1"),
|
||||
discoveryIp: ValidIpAddress.init(IPv4_any()),
|
||||
metricsAddress: ValidIpAddress.init("127.0.0.1"),
|
||||
persistenceCmd: PersistenceCmd.prover,
|
||||
circomR1cs: InputFile("tests/circuits/fixtures/proof_main.r1cs"),
|
||||
circomWasm: InputFile("tests/circuits/fixtures/proof_main.wasm"),
|
||||
circomZkey: InputFile("tests/circuits/fixtures/proof_main.zkey"),
|
||||
numProofSamples: samples
|
||||
)
|
||||
|
||||
store = RepoStore.new(repoDs, metaDs)
|
||||
prover = Prover.new(store, circomBackend, samples)
|
||||
prover = Prover.new(store, config).tryGet()
|
||||
|
||||
teardown:
|
||||
await repoTmp.destroyDb()
|
||||
|
|
Loading…
Reference in New Issue