@provablehq/wasm 0.11.1 → 0.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -286,6 +286,16 @@ function runRayonThread(receiver) {
286
286
  wasm.runRayonThread(receiver);
287
287
  }
288
288
 
289
+ /**
290
+ * @param {URL} url
291
+ * @param {number} num_threads
292
+ * @returns {Promise<void>}
293
+ */
294
+ function initThreadPool(url, num_threads) {
295
+ const ret = wasm.initThreadPool(addHeapObject(url), num_threads);
296
+ return takeObject(ret);
297
+ }
298
+
289
299
  /**
290
300
  * Set the WASM log level from JS. Called automatically by the SDK's
291
301
  * `setLogLevel(level)` to keep TS and WASM logging in sync.
@@ -297,16 +307,6 @@ function setWasmLogLevel(level) {
297
307
  wasm.setWasmLogLevel(level);
298
308
  }
299
309
 
300
- /**
301
- * @param {URL} url
302
- * @param {number} num_threads
303
- * @returns {Promise<void>}
304
- */
305
- function initThreadPool(url, num_threads) {
306
- const ret = wasm.initThreadPool(addHeapObject(url), num_threads);
307
- return takeObject(ret);
308
- }
309
-
310
310
  let stack_pointer = 128;
311
311
 
312
312
  function addBorrowedObject(obj) {
@@ -314,6 +314,38 @@ function addBorrowedObject(obj) {
314
314
  heap[--stack_pointer] = obj;
315
315
  return stack_pointer;
316
316
  }
317
+ /**
318
+ * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
319
+ *
320
+ * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
321
+ * Each verifying key is paired with one or more sets of public inputs (instances).
322
+ *
323
+ * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
324
+ * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
325
+ * @param {Proof} proof The batch proof to verify
326
+ * @returns {boolean} True if the batch proof is valid, false otherwise
327
+ * @param {Array<any>} verifying_keys
328
+ * @param {Array<any>} inputs
329
+ * @param {Proof} proof
330
+ * @returns {boolean}
331
+ */
332
+ function snarkVerifyBatch(verifying_keys, inputs, proof) {
333
+ try {
334
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
335
+ _assertClass(proof, Proof);
336
+ wasm.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
337
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
338
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
339
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
340
+ if (r2) {
341
+ throw takeObject(r1);
342
+ }
343
+ return r0 !== 0;
344
+ } finally {
345
+ wasm.__wbindgen_add_to_stack_pointer(16);
346
+ }
347
+ }
348
+
317
349
  /**
318
350
  * Verify an execution. Executions with multiple transitions must have the program source code and
319
351
  * verifying keys of imported functions supplied from outside to correctly verify. Also, this does
@@ -362,38 +394,6 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
362
394
  }
363
395
  }
364
396
 
365
- /**
366
- * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
367
- *
368
- * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
369
- * Each verifying key is paired with one or more sets of public inputs (instances).
370
- *
371
- * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
372
- * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
373
- * @param {Proof} proof The batch proof to verify
374
- * @returns {boolean} True if the batch proof is valid, false otherwise
375
- * @param {Array<any>} verifying_keys
376
- * @param {Array<any>} inputs
377
- * @param {Proof} proof
378
- * @returns {boolean}
379
- */
380
- function snarkVerifyBatch(verifying_keys, inputs, proof) {
381
- try {
382
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
383
- _assertClass(proof, Proof);
384
- wasm.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
385
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
386
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
387
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
388
- if (r2) {
389
- throw takeObject(r1);
390
- }
391
- return r0 !== 0;
392
- } finally {
393
- wasm.__wbindgen_add_to_stack_pointer(16);
394
- }
395
- }
396
-
397
397
  /**
398
398
  * Verify a SNARK proof against a verifying key and public inputs.
399
399
  *
@@ -488,16 +488,16 @@ function getArrayJsValueFromWasm0(ptr, len) {
488
488
  }
489
489
  return result;
490
490
  }
491
- function __wasm_bindgen_func_elem_8740(arg0, arg1, arg2) {
492
- wasm.__wasm_bindgen_func_elem_8740(arg0, arg1, addHeapObject(arg2));
491
+ function __wasm_bindgen_func_elem_8742(arg0, arg1, arg2) {
492
+ wasm.__wasm_bindgen_func_elem_8742(arg0, arg1, addHeapObject(arg2));
493
493
  }
494
494
 
495
- function __wasm_bindgen_func_elem_7369(arg0, arg1) {
496
- wasm.__wasm_bindgen_func_elem_7369(arg0, arg1);
495
+ function __wasm_bindgen_func_elem_7376(arg0, arg1) {
496
+ wasm.__wasm_bindgen_func_elem_7376(arg0, arg1);
497
497
  }
498
498
 
499
- function __wasm_bindgen_func_elem_7641(arg0, arg1, arg2, arg3) {
500
- wasm.__wasm_bindgen_func_elem_7641(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
499
+ function __wasm_bindgen_func_elem_7648(arg0, arg1, arg2, arg3) {
500
+ wasm.__wasm_bindgen_func_elem_7648(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
501
501
  }
502
502
 
503
503
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
@@ -19232,7 +19232,7 @@ function __wbg_get_imports(memory) {
19232
19232
  const ret = getObject(arg0).length;
19233
19233
  return ret;
19234
19234
  };
19235
- imports.wbg.__wbg_log_e77f2654b14580d9 = function(arg0, arg1) {
19235
+ imports.wbg.__wbg_log_a61781f88cdec01a = function(arg0, arg1) {
19236
19236
  console.log(getStringFromWasm0(arg0, arg1));
19237
19237
  };
19238
19238
  imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
@@ -19250,7 +19250,7 @@ function __wbg_get_imports(memory) {
19250
19250
  const a = state0.a;
19251
19251
  state0.a = 0;
19252
19252
  try {
19253
- return __wasm_bindgen_func_elem_7641(a, state0.b, arg0, arg1);
19253
+ return __wasm_bindgen_func_elem_7648(a, state0.b, arg0, arg1);
19254
19254
  } finally {
19255
19255
  state0.a = a;
19256
19256
  }
@@ -19422,7 +19422,7 @@ function __wbg_get_imports(memory) {
19422
19422
  const ret = Signature.__wrap(arg0);
19423
19423
  return addHeapObject(ret);
19424
19424
  };
19425
- imports.wbg.__wbg_spawnWorker_77887968658d2179 = function(arg0, arg1, arg2, arg3) {
19425
+ imports.wbg.__wbg_spawnWorker_7994cee197aef72d = function(arg0, arg1, arg2, arg3) {
19426
19426
  const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
19427
19427
  return addHeapObject(ret);
19428
19428
  };
@@ -19521,12 +19521,12 @@ function __wbg_get_imports(memory) {
19521
19521
  };
19522
19522
  imports.wbg.__wbindgen_cast_4a64cbb5b17898c9 = function(arg0, arg1) {
19523
19523
  // Cast intrinsic for `Closure(Closure { dtor_idx: 358, function: Function { arguments: [Externref], shim_idx: 359, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19524
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7368, __wasm_bindgen_func_elem_8740);
19524
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7375, __wasm_bindgen_func_elem_8742);
19525
19525
  return addHeapObject(ret);
19526
19526
  };
19527
19527
  imports.wbg.__wbindgen_cast_65bbaf572cb463ed = function(arg0, arg1) {
19528
19528
  // Cast intrinsic for `Closure(Closure { dtor_idx: 358, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 359, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19529
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7368, __wasm_bindgen_func_elem_8740);
19529
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7375, __wasm_bindgen_func_elem_8742);
19530
19530
  return addHeapObject(ret);
19531
19531
  };
19532
19532
  imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
@@ -19536,7 +19536,7 @@ function __wbg_get_imports(memory) {
19536
19536
  };
19537
19537
  imports.wbg.__wbindgen_cast_aca65e91b5ef2a91 = function(arg0, arg1) {
19538
19538
  // Cast intrinsic for `Closure(Closure { dtor_idx: 358, function: Function { arguments: [], shim_idx: 467, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19539
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7368, __wasm_bindgen_func_elem_7369);
19539
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7375, __wasm_bindgen_func_elem_7376);
19540
19540
  return addHeapObject(ret);
19541
19541
  };
19542
19542
  imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {