Verify Rust Parity
verify_rust_parityCompile and run a sandboxed differential FFI harness that compares a C/C++ reference symbol against a candidate Rust function, shrinking failing inputs and reporting bit/ULP divergence.
Instructions
Compile and execute a sandboxed differential FFI property-testing harness comparing a C/C++ reference symbol (from a compiled shared library or inline C source code) against a candidate reconstructed Rust function across deterministic boundary cases and SplitMix64 randomized inputs. Automatically shrinks any failing counterexample via binary-search reduction and reports exact bit/ULP divergence and OS sandbox telemetry (bwrap/prlimit on Linux, sandbox-exec on macOS, Job Objects on Windows).
Example tool call
This call uses example arguments supplied in the tool’s input schema.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"seed": 1337420,
"arg_types": [
"u32",
"u32"
],
"iterations": 10000,
"timeout_ms": 20000,
"return_type": "u32",
"symbol_name": "add_u32",
"harness_mode": "native-rustc",
"c_source_code": "#include <stdint.h>\nuint32_t add_u32(uint32_t a, uint32_t b) { return a + b; }",
"rust_source_code": "pub fn add_u32(a: u32, b: u32) -> u32 { a.wrapping_add(b) }",
"float_ulp_tolerance": 0
},
"name": "verify_rust_parity"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| seed | No | Deterministic 64-bit PRNG seed for reproducible differential fuzzing. | |
| arg_types | Yes | Ordered list of C ABI parameter types accepted by both the C symbol and Rust function (1 to 16 arguments; 'bytes' passes (*const u8, usize) to C and &[u8] to Rust). | |
| iterations | No | Number of randomized FFI property-testing iterations to execute in addition to deterministic boundary cases (default 10000). | |
| timeout_ms | No | Hard wall-clock timeout in milliseconds for sandboxed execution (default 20000). | |
| return_type | Yes | Scalar C ABI return type produced by both the C symbol and Rust function. | |
| symbol_name | Yes | Exported C ABI symbol name to test (e.g., 'compute_packet_crc32c'). | |
| harness_mode | No | Execution harness mode: 'native-rustc' (default zero-network fast path using stdlib FFI dlopen + SplitMix64 + binary-search shrinker) or 'cargo-proptest' (Cargo workspace harness). | |
| rust_fn_name | No | Rust function identifier in rust_source_code to invoke (defaults to symbol_name). | |
| c_source_code | No | Optional C reference source code to compile into a shared library when verifying a decompiled or standalone C function. | |
| forbid_unsafe | No | Whether to enforce #![forbid(unsafe_code)] at compile time on the candidate Rust module (default true; set to false only when intentionally testing candidate code that uses unsafe). | |
| html_report_path | No | Optional file path to write an Antigravity generative_ui-compliant HTML parity report when status === 'verified_bit_exact'. | |
| rust_source_code | Yes | Candidate safe Rust source code defining pub fn <rust_fn_name>(...) or pub extern "C" fn <rust_fn_name>(...). | |
| target_binary_path | No | Optional absolute path to a compiled C/C++ shared library (.so, .dylib, .dll) or object/binary exporting symbol_name. | |
| float_ulp_tolerance | No | Maximum allowed IEEE-754 ULP (Units in the Last Place) distance for f32/f64 return values (default 0 for strict bit-exact equivalence). | |
| scaffold_output_dir | No | Optional directory path where a pure standalone verified #![forbid(unsafe_code)] Rust Cargo crate (Cargo.toml, src/lib.rs, tests/parity_regression.rs) will be scaffolded without HTML clutter when status === 'verified_bit_exact'. | |
| remediated_rust_source_code | No | Optional remediated Safe Rust source code (e.g., <fn>_remediated) to include alongside the bit-exact C-oracle reconstruction in the scaffolded Cargo crate. |