Restores testcircomcompat and testsampler.

This commit is contained in:
Ben 2024-10-29 11:11:48 +01:00
parent 33a37c6d4b
commit 00fe07a608
No known key found for this signature in database
GPG Key ID: 0F16E812E736C24B
5 changed files with 7 additions and 2 deletions

View File

@ -121,7 +121,6 @@ func reconstructRoot*[H, K](proof: MerkleProof[H, K], leaf: H): ?!H =
func verify*[H, K](proof: MerkleProof[H, K], leaf: H, root: H): ?!bool =
success bool(root == ? proof.reconstructRoot(leaf))
# TODO: replace with implementation in poseidon library plz
proc merkleTreeWorker*[H, K](
self: MerkleTree[H, K],
xs: seq[H],

View File

@ -66,6 +66,10 @@ proc prove*(
error "Unable to create slots builder", err = err.msg
return failure(err)
if err =? (await builder.init()).errorOption:
error "Failed to initialize builder", err = err.msg
return failure(err)
without sampler =? AnySampler.new(slotIdx, self.store, builder), err:
error "Unable to create data sampler", err = err.msg
return failure(err)

View File

@ -55,7 +55,7 @@ proc digestTree*(
return failure err
leaves.add(digest)
index += chunkSize
await sleepAsync(1.micros) # cooperative scheduling
await sleepAsync(1.nanos) # cooperative scheduling
return await Poseidon2Tree.init(leaves)
proc digest*(

View File

@ -99,6 +99,7 @@ suite "Test Circom Compat Backend":
cellSize)
builder = Poseidon2Builder.new(store, verifiable).tryGet
(await builder.init()).tryGet()
sampler = Poseidon2Sampler.new(slotId, store, builder).tryGet
circom = CircomCompat.init(r1cs, wasm, zkey)

View File

@ -111,6 +111,7 @@ suite "Test Sampler":
# create sampler
builder = Poseidon2Builder.new(store, verifiable).tryGet
(await builder.init()).tryGet()
teardown:
await store.close()