From 2ba2c31072d1a71d25f61263f537f65131b75e6c Mon Sep 17 00:00:00 2001 From: Jaremy Creechley Date: Fri, 22 Dec 2023 19:40:03 -0700 Subject: [PATCH] update ffi --- .gitignore | 1 + codex_storage_proofs.nim | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index d3ad3a8..5958c14 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ test/circuits/artifacts out.log src/circuit_tests/artifacts/* !src/circuit_tests/artifacts/.keep +codex_storage_proofs diff --git a/codex_storage_proofs.nim b/codex_storage_proofs.nim index adbafba..fbfa78b 100644 --- a/codex_storage_proofs.nim +++ b/codex_storage_proofs.nim @@ -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 +