Fixes testprover.nim
This commit is contained in:
parent
983da3c24f
commit
8ff6b50c37
|
@ -69,10 +69,7 @@ proc downloadCeremony(
|
|||
# In the future, the zip file will be stored in the Codex network
|
||||
# instead of a url + ceremonyHash, we'll get a CID from the marketplace contract.
|
||||
|
||||
echo "OVERRIDE!"
|
||||
let hash = "1f512a1c6a089eff7eb22b810438c34fc59d4b0e7935dbc77ec77255d39ec094"
|
||||
|
||||
let url = "https://circuit.codex.storage/proving-key/" & hash # was ceremonyHash
|
||||
let url = "https://circuit.codex.storage/proving-key/" & ceremonyHash
|
||||
trace "Downloading ceremony file", url, filepath = config.zipFilePath
|
||||
try:
|
||||
# Nim's default webclient does not support SSL on all platforms.
|
||||
|
|
|
@ -99,9 +99,9 @@ proc verify*(
|
|||
proc start*(
|
||||
self: Prover,
|
||||
config: CodexConf,
|
||||
proofCeremonyUrl: ?string): Future[?!void] {.async.} =
|
||||
ceremonyHash: ?string): Future[?!void] {.async.} =
|
||||
|
||||
without backend =? (await initializeBackend(config, proofCeremonyUrl)), err:
|
||||
without backend =? (await initializeBackend(config, ceremonyHash)), err:
|
||||
error "Failed to initialize backend", msg = err.msg
|
||||
return failure(err)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
@ -57,13 +59,23 @@ suite "Test Prover":
|
|||
|
||||
test "Should sample and prove a slot":
|
||||
let
|
||||
r1cs = "tests/circuits/fixtures/proof_main.r1cs"
|
||||
wasm = "tests/circuits/fixtures/proof_main.wasm"
|
||||
|
||||
circomBackend = CircomCompat.init(r1cs, wasm)
|
||||
prover = Prover.new(store, circomBackend, samples)
|
||||
prover = Prover.new(store, samples)
|
||||
challenge = 1234567.toF.toBytes.toArray32
|
||||
(inputs, proof) = (await prover.prove(1, verifiable, challenge)).tryGet
|
||||
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")
|
||||
)
|
||||
ceremonyHash = string.none
|
||||
|
||||
(await prover.start(config, ceremonyHash)).tryGet()
|
||||
|
||||
let (inputs, proof) = (await prover.prove(1, verifiable, challenge)).tryGet
|
||||
|
||||
check:
|
||||
(await prover.verify(proof, inputs)).tryGet == true
|
||||
|
|
Loading…
Reference in New Issue