TheAiCollectiveART commited on
Commit
2003560
·
verified ·
1 Parent(s): 167f3e6

Add new inference engine target: proof.js

Browse files
27_Zymatica_Inference_Engine/zymatica-inference-engine-inventory/zymatica-inference-engine-wasm/proof.js ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Watermark: ip zymatica.space | astronautshe.com
2
+ // Copyright (c) 2026 Zymatica. All rights reserved.
3
+
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+
7
+ function main() {
8
+ console.log("======================================================================");
9
+ console.log("ZYMATICA | zymatica-inference-engine-wasm (WebAssembly)");
10
+ console.log("======================================================================\n");
11
+
12
+ const wasmPath = path.join(__dirname, "proof_wasm.wasm");
13
+ if (!fs.existsSync(wasmPath)) {
14
+ console.error(`[-] Error: WebAssembly binary not found at ${wasmPath}`);
15
+ console.error("[-] Please run 'python build.py' first to compile.");
16
+ process.exit(1);
17
+ }
18
+
19
+ const wasmBuffer = fs.readFileSync(wasmPath);
20
+ WebAssembly.instantiate(new Uint8Array(wasmBuffer), {})
21
+ .then(wasmModule => {
22
+ const exports = wasmModule.instance.exports;
23
+
24
+ const start = performance.now();
25
+ const runs = 100000;
26
+ let result = 1;
27
+ for (let i = 0; i < runs; i++) {
28
+ result = exports.run_verification();
29
+ if (result !== 1) break;
30
+ }
31
+ const duration = (performance.now() - start).toFixed(4);
32
+
33
+ console.log(`[*] Executed WASM binary loop in ${duration} ms.`);
34
+ console.log(`[*] Verification return code: ${result}`);
35
+
36
+ if (result === 1) {
37
+ console.log(`[INTERNAL_MATH] ${duration} ms`);
38
+ console.log("\n[VERIFICATION] Multi-Language runtime FFI structures validated.");
39
+ } else {
40
+ console.error("\n[-] ERROR: Decoded sequence mismatch inside WASM context!");
41
+ process.exit(1);
42
+ }
43
+ })
44
+ .catch(err => {
45
+ console.error(`[-] Instantiation error: ${err}`);
46
+ process.exit(1);
47
+ });
48
+ }
49
+
50
+ main();