update ffi

This commit is contained in:
Jaremy Creechley 2023-12-22 19:40:03 -07:00
parent aa7750bc4b
commit 2ba2c31072
No known key found for this signature in database
GPG Key ID: 4E66FB67B21D3300
2 changed files with 18 additions and 3 deletions

1
.gitignore vendored
View File

@ -16,3 +16,4 @@ test/circuits/artifacts
out.log
src/circuit_tests/artifacts/*
!src/circuit_tests/artifacts/.keep
codex_storage_proofs

View File

@ -21,8 +21,22 @@ static:
{.passl: "-lcodex_storage_proofs" & " -L" & libDir.}
import codex_proofs_ffi
export codex_proofs_ffi
include codex_proofs_ffi
proc unsafeBufferPath*(path: var string): Buffer =
assert path.len() > 0
Buffer(data: cast[ptr uint8](path.cstring), len: path.len().uint)
when isMainModule:
init_proof_ctx()
var
r1cs_path = "src/circuit_tests/artifacts/storer-test.r1cs"
wasm_path = "src/circuit_tests/artifacts/storer-test_js/storer-test.wasm"
let
r1cs_buff = unsafeBufferPath(r1cs_path)
wasm_buff = unsafeBufferPath(wasm_path)
let storage_ctx = init_storage_proofs(r1cs_buff, wasm_buff, nil)
echo "storage_ctx: ", storage_ctx.repr
assert storage_ctx != nil