Conversation
|
/claude-review |
Code ReviewSummaryThis PR rewrites ReviewCorrectness & Soundness
Code Quality
Testing
Suggestions (non-blocking)
Verdict🔄 Request changes Items 1 (memory leak), 2 (proof format footgun), 4 (missing SAFETY comments), and 5 (non-workspace dep) need to be addressed before merge. Items 3, 6, and 7 are strongly encouraged. Testing gaps should be filled. |
…e cdylib for Android
| ram_limit_bytes: usize, | ||
| use_file_backed: bool, | ||
| swap_file_path: *const c_char, | ||
| pub unsafe extern "C" fn pk_prove_json( |
There was a problem hiding this comment.
tmp_dir.join("provekit_ffi_inputs.toml") is shared across all threads. Two concurrent pk_prove_json calls will overwrite each other's inputs, silently producing a proof for the wrong witness. Use tempfile::NamedTempFile or append a unique suffix (e.g. thread ID + atomic counter).
There was a problem hiding this comment.
No temp file is used. pk_prove_json parses the JSON string entirely in-memory, and pk_prove_toml reads from a caller-provided path. There is no shared tmp_dir or intermediate file that could be overwritten by concurrent calls.
Summery :
The v1 FFI required callers to manage file paths for schemes, inputs, and proofs. This made SDK integration (Swift, Kotlin ) awkward and limited as SDKs had to write temp files and coordinate paths. The v2 handle-based API lets SDKs hold compiled schemes in memory, pass inputs as strings, and receive proofs as byte buffers, which seems a natural interface for mobiles.
Changes made :