@provablehq/wasm 0.11.0 → 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.
@@ -315,26 +315,25 @@ function addBorrowedObject(obj) {
315
315
  return stack_pointer;
316
316
  }
317
317
  /**
318
- * Verify a SNARK proof against a verifying key and public inputs.
318
+ * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
319
319
  *
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.
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
322
  *
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
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
328
  * @param {Array<any>} inputs
329
329
  * @param {Proof} proof
330
330
  * @returns {boolean}
331
331
  */
332
- function snarkVerify(verifying_key, inputs, proof) {
332
+ function snarkVerifyBatch(verifying_keys, inputs, proof) {
333
333
  try {
334
334
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
335
- _assertClass(verifying_key, VerifyingKey);
336
335
  _assertClass(proof, Proof);
337
- wasm.snarkVerify(retptr, verifying_key.__wbg_ptr, addHeapObject(inputs), proof.__wbg_ptr);
336
+ wasm.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
338
337
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
339
338
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
340
339
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -348,25 +347,26 @@ function snarkVerify(verifying_key, inputs, proof) {
348
347
  }
349
348
 
350
349
  /**
351
- * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
350
+ * Verify a SNARK proof against a verifying key and public inputs.
352
351
  *
353
- * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
354
- * Each verifying key is paired with one or more sets of public inputs (instances).
352
+ * This function verifies a proof produced by an Aleo program that may not be deployed on chain.
353
+ * It directly invokes the Varuna proof verification from snarkVM.
355
354
  *
356
- * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
357
- * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
358
- * @param {Proof} proof The batch proof to verify
359
- * @returns {boolean} True if the batch proof is valid, false otherwise
360
- * @param {Array<any>} verifying_keys
355
+ * @param {VerifyingKey} verifying_key The verifying key for the circuit
356
+ * @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
357
+ * @param {Proof} proof The proof to verify
358
+ * @returns {boolean} True if the proof is valid, false otherwise
359
+ * @param {VerifyingKey} verifying_key
361
360
  * @param {Array<any>} inputs
362
361
  * @param {Proof} proof
363
362
  * @returns {boolean}
364
363
  */
365
- function snarkVerifyBatch(verifying_keys, inputs, proof) {
364
+ function snarkVerify(verifying_key, inputs, proof) {
366
365
  try {
367
366
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
367
+ _assertClass(verifying_key, VerifyingKey);
368
368
  _assertClass(proof, Proof);
369
- wasm.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
369
+ wasm.snarkVerify(retptr, verifying_key.__wbg_ptr, addHeapObject(inputs), proof.__wbg_ptr);
370
370
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
371
371
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
372
372
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -458,7 +458,7 @@ function stringToField(string) {
458
458
  * import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
459
459
  *
460
460
  * Set the consensus version heights.
461
- * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13");
461
+ * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14");
462
462
  * @param {string | null} [heights]
463
463
  * @returns {Array<any>}
464
464
  */
@@ -488,16 +488,16 @@ function getArrayJsValueFromWasm0(ptr, len) {
488
488
  }
489
489
  return result;
490
490
  }
491
- function __wasm_bindgen_func_elem_8655(arg0, arg1, arg2) {
492
- wasm.__wasm_bindgen_func_elem_8655(arg0, arg1, addHeapObject(arg2));
491
+ function __wasm_bindgen_func_elem_7389(arg0, arg1) {
492
+ wasm.__wasm_bindgen_func_elem_7389(arg0, arg1);
493
493
  }
494
494
 
495
- function __wasm_bindgen_func_elem_7286(arg0, arg1) {
496
- wasm.__wasm_bindgen_func_elem_7286(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_7558(arg0, arg1, arg2, arg3) {
500
- wasm.__wasm_bindgen_func_elem_7558(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"];
@@ -19017,10 +19017,6 @@ function __wbg_get_imports(memory) {
19017
19017
  const ret = typeof(val) === 'object' && val !== null;
19018
19018
  return ret;
19019
19019
  };
19020
- imports.wbg.__wbg___wbindgen_is_string_fbb76cb2940daafd = function(arg0) {
19021
- const ret = typeof(getObject(arg0)) === 'string';
19022
- return ret;
19023
- };
19024
19020
  imports.wbg.__wbg___wbindgen_is_undefined_2d472862bd29a478 = function(arg0) {
19025
19021
  const ret = getObject(arg0) === undefined;
19026
19022
  return ret;
@@ -19102,10 +19098,6 @@ function __wbg_get_imports(memory) {
19102
19098
  const ret = clearTimeout(takeObject(arg0));
19103
19099
  return addHeapObject(ret);
19104
19100
  };
19105
- imports.wbg.__wbg_crypto_574e78ad8b13b65f = function(arg0) {
19106
- const ret = getObject(arg0).crypto;
19107
- return addHeapObject(ret);
19108
- };
19109
19101
  imports.wbg.__wbg_data_ee4306d069f24f2d = function(arg0) {
19110
19102
  const ret = getObject(arg0).data;
19111
19103
  return addHeapObject(ret);
@@ -19149,8 +19141,8 @@ function __wbg_get_imports(memory) {
19149
19141
  const ret = Array.from(getObject(arg0));
19150
19142
  return addHeapObject(ret);
19151
19143
  };
19152
- imports.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e = function() { return handleError(function (arg0, arg1) {
19153
- getObject(arg0).getRandomValues(getObject(arg1));
19144
+ imports.wbg.__wbg_getRandomValues_90e56bff4f3b89fb = function() { return handleError(function (arg0) {
19145
+ globalThis.crypto.getRandomValues(getObject(arg0));
19154
19146
  }, arguments) };
19155
19147
  imports.wbg.__wbg_get_7bed016f185add81 = function(arg0, arg1) {
19156
19148
  const ret = getObject(arg0)[arg1 >>> 0];
@@ -19240,13 +19232,9 @@ function __wbg_get_imports(memory) {
19240
19232
  const ret = getObject(arg0).length;
19241
19233
  return ret;
19242
19234
  };
19243
- imports.wbg.__wbg_log_b88efcc0ed7757a6 = function(arg0, arg1) {
19235
+ imports.wbg.__wbg_log_e77f2654b14580d9 = function(arg0, arg1) {
19244
19236
  console.log(getStringFromWasm0(arg0, arg1));
19245
19237
  };
19246
- imports.wbg.__wbg_msCrypto_a61aeb35a24c1329 = function(arg0) {
19247
- const ret = getObject(arg0).msCrypto;
19248
- return addHeapObject(ret);
19249
- };
19250
19238
  imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
19251
19239
  const ret = new Object();
19252
19240
  return addHeapObject(ret);
@@ -19262,7 +19250,7 @@ function __wbg_get_imports(memory) {
19262
19250
  const a = state0.a;
19263
19251
  state0.a = 0;
19264
19252
  try {
19265
- return __wasm_bindgen_func_elem_7558(a, state0.b, arg0, arg1);
19253
+ return __wasm_bindgen_func_elem_7660(a, state0.b, arg0, arg1);
19266
19254
  } finally {
19267
19255
  state0.a = a;
19268
19256
  }
@@ -19329,10 +19317,6 @@ function __wbg_get_imports(memory) {
19329
19317
  const ret = getObject(arg0).next;
19330
19318
  return addHeapObject(ret);
19331
19319
  };
19332
- imports.wbg.__wbg_node_905d3e251edff8a2 = function(arg0) {
19333
- const ret = getObject(arg0).node;
19334
- return addHeapObject(ret);
19335
- };
19336
19320
  imports.wbg.__wbg_of_3192b3b018b8f660 = function(arg0, arg1, arg2) {
19337
19321
  const ret = Array.of(getObject(arg0), getObject(arg1), getObject(arg2));
19338
19322
  return addHeapObject(ret);
@@ -19350,10 +19334,6 @@ function __wbg_get_imports(memory) {
19350
19334
  imports.wbg.__wbg_postMessage_f34857ca078c8536 = function() { return handleError(function (arg0, arg1) {
19351
19335
  getObject(arg0).postMessage(getObject(arg1));
19352
19336
  }, arguments) };
19353
- imports.wbg.__wbg_process_dc0fbacc7c1c06f7 = function(arg0) {
19354
- const ret = getObject(arg0).process;
19355
- return addHeapObject(ret);
19356
- };
19357
19337
  imports.wbg.__wbg_prototypesetcall_2a6620b6922694b2 = function(arg0, arg1, arg2) {
19358
19338
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
19359
19339
  };
@@ -19372,9 +19352,6 @@ function __wbg_get_imports(memory) {
19372
19352
  imports.wbg.__wbg_queueMicrotask_9d76cacb20c84d58 = function(arg0) {
19373
19353
  queueMicrotask(getObject(arg0));
19374
19354
  };
19375
- imports.wbg.__wbg_randomFillSync_ac0988aba3254290 = function() { return handleError(function (arg0, arg1) {
19376
- getObject(arg0).randomFillSync(takeObject(arg1));
19377
- }, arguments) };
19378
19355
  imports.wbg.__wbg_recordciphertext_new = function(arg0) {
19379
19356
  const ret = RecordCiphertext.__wrap(arg0);
19380
19357
  return addHeapObject(ret);
@@ -19387,10 +19364,6 @@ function __wbg_get_imports(memory) {
19387
19364
  const ret = RecordPlaintext.__wrap(arg0);
19388
19365
  return addHeapObject(ret);
19389
19366
  };
19390
- imports.wbg.__wbg_require_60cc747a6bc5215a = function() { return handleError(function () {
19391
- const ret = module.require;
19392
- return addHeapObject(ret);
19393
- }, arguments) };
19394
19367
  imports.wbg.__wbg_resolve_caf97c30b83f7053 = function(arg0) {
19395
19368
  const ret = Promise.resolve(getObject(arg0));
19396
19369
  return addHeapObject(ret);
@@ -19449,7 +19422,7 @@ function __wbg_get_imports(memory) {
19449
19422
  const ret = Signature.__wrap(arg0);
19450
19423
  return addHeapObject(ret);
19451
19424
  };
19452
- imports.wbg.__wbg_spawnWorker_6ede797d507e374c = function(arg0, arg1, arg2, arg3) {
19425
+ imports.wbg.__wbg_spawnWorker_77887968658d2179 = function(arg0, arg1, arg2, arg3) {
19453
19426
  const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
19454
19427
  return addHeapObject(ret);
19455
19428
  };
@@ -19488,10 +19461,6 @@ function __wbg_get_imports(memory) {
19488
19461
  const ret = JSON.stringify(getObject(arg0));
19489
19462
  return addHeapObject(ret);
19490
19463
  }, arguments) };
19491
- imports.wbg.__wbg_subarray_480600f3d6a9f26c = function(arg0, arg1, arg2) {
19492
- const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
19493
- return addHeapObject(ret);
19494
- };
19495
19464
  imports.wbg.__wbg_then_4f46f6544e6b4a28 = function(arg0, arg1) {
19496
19465
  const ret = getObject(arg0).then(getObject(arg1));
19497
19466
  return addHeapObject(ret);
@@ -19527,10 +19496,6 @@ function __wbg_get_imports(memory) {
19527
19496
  const ret = VerifyingKey.__wrap(arg0);
19528
19497
  return addHeapObject(ret);
19529
19498
  };
19530
- imports.wbg.__wbg_versions_c01dfd4722a88165 = function(arg0) {
19531
- const ret = getObject(arg0).versions;
19532
- return addHeapObject(ret);
19533
- };
19534
19499
  imports.wbg.__wbg_waitAsync_2c4b633ebb554615 = function() {
19535
19500
  const ret = Atomics.waitAsync;
19536
19501
  return addHeapObject(ret);
@@ -19539,11 +19504,21 @@ function __wbg_get_imports(memory) {
19539
19504
  const ret = Atomics.waitAsync(getObject(arg0), arg1 >>> 0, arg2);
19540
19505
  return addHeapObject(ret);
19541
19506
  };
19507
+ imports.wbg.__wbindgen_cast_073ddd2b87fab8ab = function(arg0, arg1) {
19508
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 360, function: Function { arguments: [], shim_idx: 467, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19509
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7388, __wasm_bindgen_func_elem_7389);
19510
+ return addHeapObject(ret);
19511
+ };
19542
19512
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
19543
19513
  // Cast intrinsic for `Ref(String) -> Externref`.
19544
19514
  const ret = getStringFromWasm0(arg0, arg1);
19545
19515
  return addHeapObject(ret);
19546
19516
  };
19517
+ imports.wbg.__wbindgen_cast_263b62405be3c669 = function(arg0, arg1) {
19518
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 360, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 361, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19519
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7388, __wasm_bindgen_func_elem_8758);
19520
+ return addHeapObject(ret);
19521
+ };
19547
19522
  imports.wbg.__wbindgen_cast_2ddd8a25ff58642a = function(arg0, arg1) {
19548
19523
  // Cast intrinsic for `I128 -> Externref`.
19549
19524
  const ret = (BigInt.asUintN(64, arg0) | (arg1 << BigInt(64)));
@@ -19554,9 +19529,9 @@ function __wbg_get_imports(memory) {
19554
19529
  const ret = BigInt.asUintN(64, arg0);
19555
19530
  return addHeapObject(ret);
19556
19531
  };
19557
- imports.wbg.__wbindgen_cast_711d7deea8fc39ca = function(arg0, arg1) {
19558
- // Cast intrinsic for `Closure(Closure { dtor_idx: 356, function: Function { arguments: [Externref], shim_idx: 357, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19559
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7285, __wasm_bindgen_func_elem_8655);
19532
+ imports.wbg.__wbindgen_cast_5cd376b701f56c0e = function(arg0, arg1) {
19533
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 360, function: Function { arguments: [Externref], shim_idx: 361, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19534
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7388, __wasm_bindgen_func_elem_8758);
19560
19535
  return addHeapObject(ret);
19561
19536
  };
19562
19537
  imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
@@ -19564,21 +19539,6 @@ function __wbg_get_imports(memory) {
19564
19539
  const ret = arg0;
19565
19540
  return addHeapObject(ret);
19566
19541
  };
19567
- imports.wbg.__wbindgen_cast_cada7727142cd213 = function(arg0, arg1) {
19568
- // Cast intrinsic for `Closure(Closure { dtor_idx: 356, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 357, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19569
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7285, __wasm_bindgen_func_elem_8655);
19570
- return addHeapObject(ret);
19571
- };
19572
- imports.wbg.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
19573
- // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
19574
- const ret = getArrayU8FromWasm0(arg0, arg1);
19575
- return addHeapObject(ret);
19576
- };
19577
- imports.wbg.__wbindgen_cast_cdf07f87b2615f8c = function(arg0, arg1) {
19578
- // Cast intrinsic for `Closure(Closure { dtor_idx: 356, function: Function { arguments: [], shim_idx: 462, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19579
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7285, __wasm_bindgen_func_elem_7286);
19580
- return addHeapObject(ret);
19581
- };
19582
19542
  imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
19583
19543
  // Cast intrinsic for `F64 -> Externref`.
19584
19544
  const ret = arg0;