34 lines
1.0 KiB
Nim
Raw Permalink Normal View History

Feature/msgpack argument passing (#9) * adding rmpv crate * plumb in msgpack * setting up mpack basics * setting up mpack basics * setting up mpack basics * setting up mpack basics * updates * chunks * chunks * chunks * add mpack proof func * add mpack proof func - tests infra * add mpack proof func - tests infra remove * add mpack proof func - split mpack * rework funcs * rework funcs * rework funcs * rework funcs * rework funcs * rework funcs * refactor * refactor * refactor * refactor * refactor * refactor * refactor * refactor * refactor - read orig for testing * refactor - read orig for testing * setting up tests * setting up tests * setting up tests * setting up tests * setting rest of data * setting rest of data * setting rest of data * setting rest of data * re-add original prove for comparison * re-add original prove for comparison * re-add original prove for comparison * cleanup * refactor * refactor * pass tests * initial setup to build as a nim package * initial setup * update build setup * update build setup * update build setup * add nim ffi and genffi build task * add nim ffi and genffi build task * add nim ffi and genffi build task * update init to remove redundant pointers * update init to remove redundant pointers * update init to remove redundant pointers * update init to remove redundant pointers * save mpack * save mpack * update ffi * update ffi * add example ffi test * add example ffi test * updates * fix tests * adding git ignore * rename * run testament * fix stuffs * fix stuffs * fix stuffs * update build * update build
2024-01-17 22:04:47 +02:00
import std/os
import unittest2
import codex_storage_proofs
suite "storage proofs ffi":
test "basic ffi circuit":
var
r1csPath = "src/circuit_tests/artifacts/storer-test.r1cs".absolutePath()
wasmPath = "src/circuit_tests/artifacts/storer-test_js/storer-test.wasm".absolutePath()
if not r1csPath.fileExists():
raise newException(ValueError, "missing expected r1cs file: " & r1csPath)
if not wasmPath.fileExists():
raise newException(ValueError, "missing expected wasm file: " & wasmPath)
let
r1cs_buff = unsafeBufferPath(r1csPath)
wasm_buff = unsafeBufferPath(wasmPath)
let storage_ctx = init_storage_proofs(r1cs_buff, wasm_buff, nil)
echo "storage_ctx: ", storage_ctx.repr
check storage_ctx != nil
var
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)
echo "result: ", res.repr
check res != nil