fix stuffs

This commit is contained in:
Jaremy Creechley 2024-01-10 16:30:18 +02:00
parent 40525d484f
commit c404233d8a
No known key found for this signature in database
GPG Key ID: 4E66FB67B21D3300
2 changed files with 9 additions and 6 deletions

View File

@ -4,4 +4,4 @@ task genffi, "update the nim ffi bindings":
exec "nbindgen --crate codex-storage-proofs --output codex_proofs_ffi.nim"
task tests, "run unit tests":
exec "testament pattern \"tests/t*.nim\" "
exec "nim c -r tests/tffi.nim"

View File

@ -1,16 +1,19 @@
import std/os
import unittest2
import codex_storage_proofs
suite "storage proofs ffi":
test "basic ffi circuit":
var
r1cs_path = "src/circuit_tests/artifacts/storer-test.r1cs"
wasm_path = "src/circuit_tests/artifacts/storer-test_js/storer-test.wasm"
r1csPath = "src/circuit_tests/artifacts/storer-test.r1cs".absolutePath()
wasmPath = "src/circuit_tests/artifacts/storer-test_js/storer-test.wasm".absolutePath()
assert r1csPath.fileExists()
assert wasmPath.fileExists()
let
r1cs_buff = unsafeBufferPath(r1cs_path)
wasm_buff = unsafeBufferPath(wasm_path)
r1cs_buff = unsafeBufferPath(r1csPath)
wasm_buff = unsafeBufferPath(wasmPath)
let storage_ctx = init_storage_proofs(r1cs_buff, wasm_buff, nil)
@ -18,7 +21,7 @@ suite "storage proofs ffi":
check storage_ctx != nil
var
mpack_arg_path = "test/proof_test.mpack"
mpack_arg_path = "tests/proof_test.mpack"
proofBuff = unsafeBufferFromFile(mpack_arg_path)
echo "proofArgs:size: ", proofBuff.len()
let res = prove_mpack_ext(storage_ctx, addr proofBuff)