@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.
@@ -23,18 +23,6 @@ export function initThreadPool(url: URL, num_threads: number): Promise<void>;
23
23
  * @returns {boolean} True if the execution is valid, false otherwise
24
24
  */
25
25
  export function verifyFunctionExecution(execution: Execution, verifying_key: VerifyingKey, program: Program, function_id: string, imports: object | null | undefined, imported_verifying_keys: object | null | undefined, block_height: number, program_imports?: ProgramImports | null): boolean;
26
- /**
27
- * Verify a SNARK proof against a verifying key and public inputs.
28
- *
29
- * This function verifies a proof produced by an Aleo program that may not be deployed on chain.
30
- * It directly invokes the Varuna proof verification from snarkVM.
31
- *
32
- * @param {VerifyingKey} verifying_key The verifying key for the circuit
33
- * @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
34
- * @param {Proof} proof The proof to verify
35
- * @returns {boolean} True if the proof is valid, false otherwise
36
- */
37
- export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, proof: Proof): boolean;
38
26
  /**
39
27
  * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
40
28
  *
@@ -47,7 +35,20 @@ export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, pro
47
35
  * @returns {boolean} True if the batch proof is valid, false otherwise
48
36
  */
49
37
  export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>, proof: Proof): boolean;
50
- export function stringToField(string: string): Field;
38
+ /**
39
+ * Verify a SNARK proof against a verifying key and public inputs.
40
+ *
41
+ * This function verifies a proof produced by an Aleo program that may not be deployed on chain.
42
+ * It directly invokes the Varuna proof verification from snarkVM, using the Varuna version required
43
+ * by the latest consensus version (Varuna V3 as of `ConsensusVersion::V21`). Proofs generated with
44
+ * an older Varuna version will fail verification.
45
+ *
46
+ * @param {VerifyingKey} verifying_key The verifying key for the circuit
47
+ * @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
48
+ * @param {Proof} proof The proof to verify
49
+ * @returns {boolean} True if the proof is valid, false otherwise
50
+ */
51
+ export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, proof: Proof): boolean;
51
52
  /**
52
53
  * Set test consensus version heights for testing.
53
54
  *
@@ -57,7 +58,7 @@ export function stringToField(string: string): Field;
57
58
  * import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
58
59
  *
59
60
  * Set the consensus version heights.
60
- * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20");
61
+ * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21");
61
62
  */
62
63
  export function getOrInitConsensusVersionTestHeights(heights?: string | null): Array<any>;
63
64
  /**
@@ -72,6 +73,7 @@ export function getOrInitConsensusVersionTestHeights(heights?: string | null): A
72
73
  * const maxImports = getMaxProgramImports();
73
74
  */
74
75
  export function getMaxProgramImports(): number;
76
+ export function stringToField(string: string): Field;
75
77
  /**
76
78
  * Public address of an Aleo account
77
79
  */
Binary file
@@ -368,39 +368,6 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
368
368
  }
369
369
  }
370
370
 
371
- /**
372
- * Verify a SNARK proof against a verifying key and public inputs.
373
- *
374
- * This function verifies a proof produced by an Aleo program that may not be deployed on chain.
375
- * It directly invokes the Varuna proof verification from snarkVM.
376
- *
377
- * @param {VerifyingKey} verifying_key The verifying key for the circuit
378
- * @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
379
- * @param {Proof} proof The proof to verify
380
- * @returns {boolean} True if the proof is valid, false otherwise
381
- * @param {VerifyingKey} verifying_key
382
- * @param {Array<any>} inputs
383
- * @param {Proof} proof
384
- * @returns {boolean}
385
- */
386
- function snarkVerify(verifying_key, inputs, proof) {
387
- try {
388
- const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
389
- _assertClass(verifying_key, VerifyingKey);
390
- _assertClass(proof, Proof);
391
- wasm$1.snarkVerify(retptr, verifying_key.__wbg_ptr, addHeapObject(inputs), proof.__wbg_ptr);
392
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
393
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
394
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
395
- if (r2) {
396
- throw takeObject(r1);
397
- }
398
- return r0 !== 0;
399
- } finally {
400
- wasm$1.__wbindgen_add_to_stack_pointer(16);
401
- }
402
- }
403
-
404
371
  /**
405
372
  * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
406
373
  *
@@ -434,22 +401,35 @@ function snarkVerifyBatch(verifying_keys, inputs, proof) {
434
401
  }
435
402
 
436
403
  /**
437
- * @param {string} string
438
- * @returns {Field}
404
+ * Verify a SNARK proof against a verifying key and public inputs.
405
+ *
406
+ * This function verifies a proof produced by an Aleo program that may not be deployed on chain.
407
+ * It directly invokes the Varuna proof verification from snarkVM, using the Varuna version required
408
+ * by the latest consensus version (Varuna V3 as of `ConsensusVersion::V21`). Proofs generated with
409
+ * an older Varuna version will fail verification.
410
+ *
411
+ * @param {VerifyingKey} verifying_key The verifying key for the circuit
412
+ * @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
413
+ * @param {Proof} proof The proof to verify
414
+ * @returns {boolean} True if the proof is valid, false otherwise
415
+ * @param {VerifyingKey} verifying_key
416
+ * @param {Array<any>} inputs
417
+ * @param {Proof} proof
418
+ * @returns {boolean}
439
419
  */
440
- function stringToField(string) {
420
+ function snarkVerify(verifying_key, inputs, proof) {
441
421
  try {
442
422
  const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
443
- const ptr0 = passStringToWasm0(string, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
444
- const len0 = WASM_VECTOR_LEN;
445
- wasm$1.stringToField(retptr, ptr0, len0);
423
+ _assertClass(verifying_key, VerifyingKey);
424
+ _assertClass(proof, Proof);
425
+ wasm$1.snarkVerify(retptr, verifying_key.__wbg_ptr, addHeapObject(inputs), proof.__wbg_ptr);
446
426
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
447
427
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
448
428
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
449
429
  if (r2) {
450
430
  throw takeObject(r1);
451
431
  }
452
- return Field.__wrap(r0);
432
+ return r0 !== 0;
453
433
  } finally {
454
434
  wasm$1.__wbindgen_add_to_stack_pointer(16);
455
435
  }
@@ -464,7 +444,7 @@ function stringToField(string) {
464
444
  * import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
465
445
  *
466
446
  * Set the consensus version heights.
467
- * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20");
447
+ * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21");
468
448
  * @param {string | null} [heights]
469
449
  * @returns {Array<any>}
470
450
  */
@@ -492,6 +472,28 @@ function getMaxProgramImports() {
492
472
  return ret >>> 0;
493
473
  }
494
474
 
475
+ /**
476
+ * @param {string} string
477
+ * @returns {Field}
478
+ */
479
+ function stringToField(string) {
480
+ try {
481
+ const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
482
+ const ptr0 = passStringToWasm0(string, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
483
+ const len0 = WASM_VECTOR_LEN;
484
+ wasm$1.stringToField(retptr, ptr0, len0);
485
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
486
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
487
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
488
+ if (r2) {
489
+ throw takeObject(r1);
490
+ }
491
+ return Field.__wrap(r0);
492
+ } finally {
493
+ wasm$1.__wbindgen_add_to_stack_pointer(16);
494
+ }
495
+ }
496
+
495
497
  function passArrayJsValueToWasm0(array, malloc) {
496
498
  const ptr = malloc(array.length * 4, 4) >>> 0;
497
499
  const mem = getDataViewMemory0();
@@ -511,16 +513,16 @@ function getArrayJsValueFromWasm0(ptr, len) {
511
513
  }
512
514
  return result;
513
515
  }
514
- function __wasm_bindgen_func_elem_8995(arg0, arg1, arg2) {
515
- wasm$1.__wasm_bindgen_func_elem_8995(arg0, arg1, addHeapObject(arg2));
516
+ function __wasm_bindgen_func_elem_9005(arg0, arg1, arg2) {
517
+ wasm$1.__wasm_bindgen_func_elem_9005(arg0, arg1, addHeapObject(arg2));
516
518
  }
517
519
 
518
- function __wasm_bindgen_func_elem_7556(arg0, arg1) {
519
- wasm$1.__wasm_bindgen_func_elem_7556(arg0, arg1);
520
+ function __wasm_bindgen_func_elem_7568(arg0, arg1) {
521
+ wasm$1.__wasm_bindgen_func_elem_7568(arg0, arg1);
520
522
  }
521
523
 
522
- function __wasm_bindgen_func_elem_7829(arg0, arg1, arg2, arg3) {
523
- wasm$1.__wasm_bindgen_func_elem_7829(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
524
+ function __wasm_bindgen_func_elem_7840(arg0, arg1, arg2, arg3) {
525
+ wasm$1.__wasm_bindgen_func_elem_7840(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
524
526
  }
525
527
 
526
528
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
@@ -19325,7 +19327,7 @@ function __wbg_get_imports(memory) {
19325
19327
  const ret = getObject(arg0).length;
19326
19328
  return ret;
19327
19329
  };
19328
- imports.wbg.__wbg_log_873fe7a781ebc826 = function(arg0, arg1) {
19330
+ imports.wbg.__wbg_log_c2eca570a6157825 = function(arg0, arg1) {
19329
19331
  console.log(getStringFromWasm0(arg0, arg1));
19330
19332
  };
19331
19333
  imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
@@ -19343,7 +19345,7 @@ function __wbg_get_imports(memory) {
19343
19345
  const a = state0.a;
19344
19346
  state0.a = 0;
19345
19347
  try {
19346
- return __wasm_bindgen_func_elem_7829(a, state0.b, arg0, arg1);
19348
+ return __wasm_bindgen_func_elem_7840(a, state0.b, arg0, arg1);
19347
19349
  } finally {
19348
19350
  state0.a = a;
19349
19351
  }
@@ -19515,7 +19517,7 @@ function __wbg_get_imports(memory) {
19515
19517
  const ret = Signature.__wrap(arg0);
19516
19518
  return addHeapObject(ret);
19517
19519
  };
19518
- imports.wbg.__wbg_spawnWorker_087de831e4bfd369 = function(arg0, arg1, arg2, arg3) {
19520
+ imports.wbg.__wbg_spawnWorker_0d7c58b5ba9ab046 = function(arg0, arg1, arg2, arg3) {
19519
19521
  const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
19520
19522
  return addHeapObject(ret);
19521
19523
  };
@@ -19597,6 +19599,11 @@ function __wbg_get_imports(memory) {
19597
19599
  const ret = Atomics.waitAsync(getObject(arg0), arg1 >>> 0, arg2);
19598
19600
  return addHeapObject(ret);
19599
19601
  };
19602
+ imports.wbg.__wbindgen_cast_201f5d8c51d6c49f = function(arg0, arg1) {
19603
+ // 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`.
19604
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7567, __wasm_bindgen_func_elem_9005);
19605
+ return addHeapObject(ret);
19606
+ };
19600
19607
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
19601
19608
  // Cast intrinsic for `Ref(String) -> Externref`.
19602
19609
  const ret = getStringFromWasm0(arg0, arg1);
@@ -19612,9 +19619,9 @@ function __wbg_get_imports(memory) {
19612
19619
  const ret = BigInt.asUintN(64, arg0);
19613
19620
  return addHeapObject(ret);
19614
19621
  };
19615
- imports.wbg.__wbindgen_cast_805ada4c4be963fc = function(arg0, arg1) {
19616
- // 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`.
19617
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7555, __wasm_bindgen_func_elem_8995);
19622
+ imports.wbg.__wbindgen_cast_81f27860ba10fea8 = function(arg0, arg1) {
19623
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 396, function: Function { arguments: [Externref], shim_idx: 397, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19624
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7567, __wasm_bindgen_func_elem_9005);
19618
19625
  return addHeapObject(ret);
19619
19626
  };
19620
19627
  imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
@@ -19622,26 +19629,21 @@ function __wbg_get_imports(memory) {
19622
19629
  const ret = arg0;
19623
19630
  return addHeapObject(ret);
19624
19631
  };
19625
- imports.wbg.__wbindgen_cast_c048d24de4cf58bb = function(arg0, arg1) {
19626
- // Cast intrinsic for `Closure(Closure { dtor_idx: 395, function: Function { arguments: [Externref], shim_idx: 396, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19627
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7555, __wasm_bindgen_func_elem_8995);
19628
- return addHeapObject(ret);
19629
- };
19630
19632
  imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
19631
19633
  // Cast intrinsic for `F64 -> Externref`.
19632
19634
  const ret = arg0;
19633
19635
  return addHeapObject(ret);
19634
19636
  };
19637
+ imports.wbg.__wbindgen_cast_df4137fc329f9ddc = function(arg0, arg1) {
19638
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 396, function: Function { arguments: [], shim_idx: 533, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19639
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7567, __wasm_bindgen_func_elem_7568);
19640
+ return addHeapObject(ret);
19641
+ };
19635
19642
  imports.wbg.__wbindgen_cast_e7b45dd881f38ce3 = function(arg0, arg1) {
19636
19643
  // Cast intrinsic for `U128 -> Externref`.
19637
19644
  const ret = (BigInt.asUintN(64, arg0) | (BigInt.asUintN(64, arg1) << BigInt(64)));
19638
19645
  return addHeapObject(ret);
19639
19646
  };
19640
- imports.wbg.__wbindgen_cast_f10277ab8e6ee562 = function(arg0, arg1) {
19641
- // Cast intrinsic for `Closure(Closure { dtor_idx: 395, function: Function { arguments: [], shim_idx: 533, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19642
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7555, __wasm_bindgen_func_elem_7556);
19643
- return addHeapObject(ret);
19644
- };
19645
19647
  imports.wbg.__wbindgen_link_b9f45ffe079ef2c1 = function(arg0) {
19646
19648
  const val = `onmessage = function (ev) {
19647
19649
  let [ia, index, value] = ev.data;