@provablehq/wasm 0.11.11 → 0.12.0

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.
@@ -362,39 +362,6 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
362
362
  }
363
363
  }
364
364
 
365
- /**
366
- * Verify a SNARK proof against a verifying key and public inputs.
367
- *
368
- * This function verifies a proof produced by an Aleo program that may not be deployed on chain.
369
- * It directly invokes the Varuna proof verification from snarkVM.
370
- *
371
- * @param {VerifyingKey} verifying_key The verifying key for the circuit
372
- * @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
373
- * @param {Proof} proof The proof to verify
374
- * @returns {boolean} True if the proof is valid, false otherwise
375
- * @param {VerifyingKey} verifying_key
376
- * @param {Array<any>} inputs
377
- * @param {Proof} proof
378
- * @returns {boolean}
379
- */
380
- function snarkVerify(verifying_key, inputs, proof) {
381
- try {
382
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
383
- _assertClass(verifying_key, VerifyingKey);
384
- _assertClass(proof, Proof);
385
- wasm.snarkVerify(retptr, verifying_key.__wbg_ptr, addHeapObject(inputs), proof.__wbg_ptr);
386
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
387
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
388
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
389
- if (r2) {
390
- throw takeObject(r1);
391
- }
392
- return r0 !== 0;
393
- } finally {
394
- wasm.__wbindgen_add_to_stack_pointer(16);
395
- }
396
- }
397
-
398
365
  /**
399
366
  * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
400
367
  *
@@ -428,22 +395,35 @@ function snarkVerifyBatch(verifying_keys, inputs, proof) {
428
395
  }
429
396
 
430
397
  /**
431
- * @param {string} string
432
- * @returns {Field}
398
+ * Verify a SNARK proof against a verifying key and public inputs.
399
+ *
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, using the Varuna version required
402
+ * by the latest consensus version (Varuna V3 as of `ConsensusVersion::V21`). Proofs generated with
403
+ * an older Varuna version will fail verification.
404
+ *
405
+ * @param {VerifyingKey} verifying_key The verifying key for the circuit
406
+ * @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
407
+ * @param {Proof} proof The proof to verify
408
+ * @returns {boolean} True if the proof is valid, false otherwise
409
+ * @param {VerifyingKey} verifying_key
410
+ * @param {Array<any>} inputs
411
+ * @param {Proof} proof
412
+ * @returns {boolean}
433
413
  */
434
- function stringToField(string) {
414
+ function snarkVerify(verifying_key, inputs, proof) {
435
415
  try {
436
416
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
437
- const ptr0 = passStringToWasm0(string, wasm.__wbindgen_export, wasm.__wbindgen_export2);
438
- const len0 = WASM_VECTOR_LEN;
439
- wasm.stringToField(retptr, ptr0, len0);
417
+ _assertClass(verifying_key, VerifyingKey);
418
+ _assertClass(proof, Proof);
419
+ wasm.snarkVerify(retptr, verifying_key.__wbg_ptr, addHeapObject(inputs), proof.__wbg_ptr);
440
420
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
441
421
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
442
422
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
443
423
  if (r2) {
444
424
  throw takeObject(r1);
445
425
  }
446
- return Field.__wrap(r0);
426
+ return r0 !== 0;
447
427
  } finally {
448
428
  wasm.__wbindgen_add_to_stack_pointer(16);
449
429
  }
@@ -458,7 +438,7 @@ function stringToField(string) {
458
438
  * import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
459
439
  *
460
440
  * Set the consensus version heights.
461
- * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20");
441
+ * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21");
462
442
  * @param {string | null} [heights]
463
443
  * @returns {Array<any>}
464
444
  */
@@ -486,6 +466,28 @@ function getMaxProgramImports() {
486
466
  return ret >>> 0;
487
467
  }
488
468
 
469
+ /**
470
+ * @param {string} string
471
+ * @returns {Field}
472
+ */
473
+ function stringToField(string) {
474
+ try {
475
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
476
+ const ptr0 = passStringToWasm0(string, wasm.__wbindgen_export, wasm.__wbindgen_export2);
477
+ const len0 = WASM_VECTOR_LEN;
478
+ wasm.stringToField(retptr, ptr0, len0);
479
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
480
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
481
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
482
+ if (r2) {
483
+ throw takeObject(r1);
484
+ }
485
+ return Field.__wrap(r0);
486
+ } finally {
487
+ wasm.__wbindgen_add_to_stack_pointer(16);
488
+ }
489
+ }
490
+
489
491
  function passArrayJsValueToWasm0(array, malloc) {
490
492
  const ptr = malloc(array.length * 4, 4) >>> 0;
491
493
  const mem = getDataViewMemory0();
@@ -505,16 +507,16 @@ function getArrayJsValueFromWasm0(ptr, len) {
505
507
  }
506
508
  return result;
507
509
  }
508
- function __wasm_bindgen_func_elem_8995(arg0, arg1, arg2) {
509
- wasm.__wasm_bindgen_func_elem_8995(arg0, arg1, addHeapObject(arg2));
510
+ function __wasm_bindgen_func_elem_9005(arg0, arg1, arg2) {
511
+ wasm.__wasm_bindgen_func_elem_9005(arg0, arg1, addHeapObject(arg2));
510
512
  }
511
513
 
512
- function __wasm_bindgen_func_elem_7556(arg0, arg1) {
513
- wasm.__wasm_bindgen_func_elem_7556(arg0, arg1);
514
+ function __wasm_bindgen_func_elem_7568(arg0, arg1) {
515
+ wasm.__wasm_bindgen_func_elem_7568(arg0, arg1);
514
516
  }
515
517
 
516
- function __wasm_bindgen_func_elem_7829(arg0, arg1, arg2, arg3) {
517
- wasm.__wasm_bindgen_func_elem_7829(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
518
+ function __wasm_bindgen_func_elem_7840(arg0, arg1, arg2, arg3) {
519
+ wasm.__wasm_bindgen_func_elem_7840(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
518
520
  }
519
521
 
520
522
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
@@ -19319,7 +19321,7 @@ function __wbg_get_imports(memory) {
19319
19321
  const ret = getObject(arg0).length;
19320
19322
  return ret;
19321
19323
  };
19322
- imports.wbg.__wbg_log_873fe7a781ebc826 = function(arg0, arg1) {
19324
+ imports.wbg.__wbg_log_c2eca570a6157825 = function(arg0, arg1) {
19323
19325
  console.log(getStringFromWasm0(arg0, arg1));
19324
19326
  };
19325
19327
  imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
@@ -19337,7 +19339,7 @@ function __wbg_get_imports(memory) {
19337
19339
  const a = state0.a;
19338
19340
  state0.a = 0;
19339
19341
  try {
19340
- return __wasm_bindgen_func_elem_7829(a, state0.b, arg0, arg1);
19342
+ return __wasm_bindgen_func_elem_7840(a, state0.b, arg0, arg1);
19341
19343
  } finally {
19342
19344
  state0.a = a;
19343
19345
  }
@@ -19509,7 +19511,7 @@ function __wbg_get_imports(memory) {
19509
19511
  const ret = Signature.__wrap(arg0);
19510
19512
  return addHeapObject(ret);
19511
19513
  };
19512
- imports.wbg.__wbg_spawnWorker_087de831e4bfd369 = function(arg0, arg1, arg2, arg3) {
19514
+ imports.wbg.__wbg_spawnWorker_0d7c58b5ba9ab046 = function(arg0, arg1, arg2, arg3) {
19513
19515
  const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
19514
19516
  return addHeapObject(ret);
19515
19517
  };
@@ -19591,6 +19593,11 @@ function __wbg_get_imports(memory) {
19591
19593
  const ret = Atomics.waitAsync(getObject(arg0), arg1 >>> 0, arg2);
19592
19594
  return addHeapObject(ret);
19593
19595
  };
19596
+ imports.wbg.__wbindgen_cast_201f5d8c51d6c49f = function(arg0, arg1) {
19597
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 396, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 397, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19598
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7567, __wasm_bindgen_func_elem_9005);
19599
+ return addHeapObject(ret);
19600
+ };
19594
19601
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
19595
19602
  // Cast intrinsic for `Ref(String) -> Externref`.
19596
19603
  const ret = getStringFromWasm0(arg0, arg1);
@@ -19606,9 +19613,9 @@ function __wbg_get_imports(memory) {
19606
19613
  const ret = BigInt.asUintN(64, arg0);
19607
19614
  return addHeapObject(ret);
19608
19615
  };
19609
- imports.wbg.__wbindgen_cast_805ada4c4be963fc = function(arg0, arg1) {
19610
- // Cast intrinsic for `Closure(Closure { dtor_idx: 395, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 396, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19611
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7555, __wasm_bindgen_func_elem_8995);
19616
+ imports.wbg.__wbindgen_cast_81f27860ba10fea8 = function(arg0, arg1) {
19617
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 396, function: Function { arguments: [Externref], shim_idx: 397, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19618
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7567, __wasm_bindgen_func_elem_9005);
19612
19619
  return addHeapObject(ret);
19613
19620
  };
19614
19621
  imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
@@ -19616,26 +19623,21 @@ function __wbg_get_imports(memory) {
19616
19623
  const ret = arg0;
19617
19624
  return addHeapObject(ret);
19618
19625
  };
19619
- imports.wbg.__wbindgen_cast_c048d24de4cf58bb = function(arg0, arg1) {
19620
- // Cast intrinsic for `Closure(Closure { dtor_idx: 395, function: Function { arguments: [Externref], shim_idx: 396, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19621
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7555, __wasm_bindgen_func_elem_8995);
19622
- return addHeapObject(ret);
19623
- };
19624
19626
  imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
19625
19627
  // Cast intrinsic for `F64 -> Externref`.
19626
19628
  const ret = arg0;
19627
19629
  return addHeapObject(ret);
19628
19630
  };
19631
+ imports.wbg.__wbindgen_cast_df4137fc329f9ddc = function(arg0, arg1) {
19632
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 396, function: Function { arguments: [], shim_idx: 533, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19633
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7567, __wasm_bindgen_func_elem_7568);
19634
+ return addHeapObject(ret);
19635
+ };
19629
19636
  imports.wbg.__wbindgen_cast_e7b45dd881f38ce3 = function(arg0, arg1) {
19630
19637
  // Cast intrinsic for `U128 -> Externref`.
19631
19638
  const ret = (BigInt.asUintN(64, arg0) | (BigInt.asUintN(64, arg1) << BigInt(64)));
19632
19639
  return addHeapObject(ret);
19633
19640
  };
19634
- imports.wbg.__wbindgen_cast_f10277ab8e6ee562 = function(arg0, arg1) {
19635
- // Cast intrinsic for `Closure(Closure { dtor_idx: 395, function: Function { arguments: [], shim_idx: 533, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19636
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7555, __wasm_bindgen_func_elem_7556);
19637
- return addHeapObject(ret);
19638
- };
19639
19641
  imports.wbg.__wbindgen_link_b9f45ffe079ef2c1 = function(arg0) {
19640
19642
  const val = `onmessage = function (ev) {
19641
19643
  let [ia, index, value] = ev.data;