@provablehq/wasm 0.11.2 → 0.11.3

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.
@@ -315,25 +315,26 @@ function addBorrowedObject(obj) {
315
315
  return stack_pointer;
316
316
  }
317
317
  /**
318
- * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
318
+ * Verify a SNARK proof against a verifying key and public inputs.
319
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).
320
+ * This function verifies a proof produced by an Aleo program that may not be deployed on chain.
321
+ * It directly invokes the Varuna proof verification from snarkVM.
322
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
323
+ * @param {VerifyingKey} verifying_key The verifying key for the circuit
324
+ * @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
325
+ * @param {Proof} proof The proof to verify
326
+ * @returns {boolean} True if the proof is valid, false otherwise
327
+ * @param {VerifyingKey} verifying_key
328
328
  * @param {Array<any>} inputs
329
329
  * @param {Proof} proof
330
330
  * @returns {boolean}
331
331
  */
332
- function snarkVerifyBatch(verifying_keys, inputs, proof) {
332
+ function snarkVerify(verifying_key, inputs, proof) {
333
333
  try {
334
334
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
335
+ _assertClass(verifying_key, VerifyingKey);
335
336
  _assertClass(proof, Proof);
336
- wasm.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
337
+ wasm.snarkVerify(retptr, verifying_key.__wbg_ptr, addHeapObject(inputs), proof.__wbg_ptr);
337
338
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
338
339
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
339
340
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -395,26 +396,25 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
395
396
  }
396
397
 
397
398
  /**
398
- * Verify a SNARK proof against a verifying key and public inputs.
399
+ * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
399
400
  *
400
- * This function verifies a proof produced by an Aleo program that may not be deployed on chain.
401
- * It directly invokes the Varuna proof verification from snarkVM.
401
+ * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
402
+ * Each verifying key is paired with one or more sets of public inputs (instances).
402
403
  *
403
- * @param {VerifyingKey} verifying_key The verifying key for the circuit
404
- * @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
405
- * @param {Proof} proof The proof to verify
406
- * @returns {boolean} True if the proof is valid, false otherwise
407
- * @param {VerifyingKey} verifying_key
404
+ * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
405
+ * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
406
+ * @param {Proof} proof The batch proof to verify
407
+ * @returns {boolean} True if the batch proof is valid, false otherwise
408
+ * @param {Array<any>} verifying_keys
408
409
  * @param {Array<any>} inputs
409
410
  * @param {Proof} proof
410
411
  * @returns {boolean}
411
412
  */
412
- function snarkVerify(verifying_key, inputs, proof) {
413
+ function snarkVerifyBatch(verifying_keys, inputs, proof) {
413
414
  try {
414
415
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
415
- _assertClass(verifying_key, VerifyingKey);
416
416
  _assertClass(proof, Proof);
417
- wasm.snarkVerify(retptr, verifying_key.__wbg_ptr, addHeapObject(inputs), proof.__wbg_ptr);
417
+ wasm.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
418
418
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
419
419
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
420
420
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -427,6 +427,26 @@ function snarkVerify(verifying_key, inputs, proof) {
427
427
  }
428
428
  }
429
429
 
430
+ /**
431
+ * Set test consensus version heights for testing.
432
+ *
433
+ * @param {string | undefined} heights The block heights at which each consensus version applies. This input should be a simple csv list of block heights and there should be one number for each consensus version. If left undefined, the default test heights will be applied.
434
+ *
435
+ * @example
436
+ * import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
437
+ *
438
+ * Set the consensus version heights.
439
+ * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14");
440
+ * @param {string | null} [heights]
441
+ * @returns {Array<any>}
442
+ */
443
+ function getOrInitConsensusVersionTestHeights(heights) {
444
+ var ptr0 = isLikeNone(heights) ? 0 : passStringToWasm0(heights, wasm.__wbindgen_export, wasm.__wbindgen_export2);
445
+ var len0 = WASM_VECTOR_LEN;
446
+ const ret = wasm.getOrInitConsensusVersionTestHeights(ptr0, len0);
447
+ return takeObject(ret);
448
+ }
449
+
430
450
  /**
431
451
  * @param {string} string
432
452
  * @returns {Field}
@@ -449,26 +469,6 @@ function stringToField(string) {
449
469
  }
450
470
  }
451
471
 
452
- /**
453
- * Set test consensus version heights for testing.
454
- *
455
- * @param {string | undefined} heights The block heights at which each consensus version applies. This input should be a simple csv list of block heights and there should be one number for each consensus version. If left undefined, the default test heights will be applied.
456
- *
457
- * @example
458
- * import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
459
- *
460
- * Set the consensus version heights.
461
- * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14");
462
- * @param {string | null} [heights]
463
- * @returns {Array<any>}
464
- */
465
- function getOrInitConsensusVersionTestHeights(heights) {
466
- var ptr0 = isLikeNone(heights) ? 0 : passStringToWasm0(heights, wasm.__wbindgen_export, wasm.__wbindgen_export2);
467
- var len0 = WASM_VECTOR_LEN;
468
- const ret = wasm.getOrInitConsensusVersionTestHeights(ptr0, len0);
469
- return takeObject(ret);
470
- }
471
-
472
472
  function passArrayJsValueToWasm0(array, malloc) {
473
473
  const ptr = malloc(array.length * 4, 4) >>> 0;
474
474
  const mem = getDataViewMemory0();
@@ -488,16 +488,16 @@ function getArrayJsValueFromWasm0(ptr, len) {
488
488
  }
489
489
  return result;
490
490
  }
491
- function __wasm_bindgen_func_elem_8742(arg0, arg1, arg2) {
492
- wasm.__wasm_bindgen_func_elem_8742(arg0, arg1, addHeapObject(arg2));
491
+ function __wasm_bindgen_func_elem_7387(arg0, arg1) {
492
+ wasm.__wasm_bindgen_func_elem_7387(arg0, arg1);
493
493
  }
494
494
 
495
- function __wasm_bindgen_func_elem_7376(arg0, arg1) {
496
- wasm.__wasm_bindgen_func_elem_7376(arg0, arg1);
495
+ function __wasm_bindgen_func_elem_8758(arg0, arg1, arg2) {
496
+ wasm.__wasm_bindgen_func_elem_8758(arg0, arg1, addHeapObject(arg2));
497
497
  }
498
498
 
499
- function __wasm_bindgen_func_elem_7648(arg0, arg1, arg2, arg3) {
500
- wasm.__wasm_bindgen_func_elem_7648(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
499
+ function __wasm_bindgen_func_elem_7660(arg0, arg1, arg2, arg3) {
500
+ wasm.__wasm_bindgen_func_elem_7660(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_a61781f88cdec01a = function(arg0, arg1) {
19235
+ imports.wbg.__wbg_log_0eaae399732a802e = 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_7648(a, state0.b, arg0, arg1);
19253
+ return __wasm_bindgen_func_elem_7660(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_7994cee197aef72d = function(arg0, arg1, arg2, arg3) {
19425
+ imports.wbg.__wbg_spawnWorker_3f95ae6c0630b765 = 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_7375, __wasm_bindgen_func_elem_8742);
19524
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7386, __wasm_bindgen_func_elem_8758);
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_7375, __wasm_bindgen_func_elem_8742);
19529
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7386, __wasm_bindgen_func_elem_8758);
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_7375, __wasm_bindgen_func_elem_7376);
19539
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7386, __wasm_bindgen_func_elem_7387);
19540
19540
  return addHeapObject(ret);
19541
19541
  };
19542
19542
  imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {