@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.
@@ -1,7 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export function runRayonThread(receiver: number): void;
4
- export function initThreadPool(url: URL, num_threads: number): Promise<void>;
5
4
  /**
6
5
  * Set the WASM log level from JS. Called automatically by the SDK's
7
6
  * `setLogLevel(level)` to keep TS and WASM logging in sync.
@@ -9,18 +8,7 @@ export function initThreadPool(url: URL, num_threads: number): Promise<void>;
9
8
  * Values above 4 are clamped to debug.
10
9
  */
11
10
  export function setWasmLogLevel(level: number): void;
12
- /**
13
- * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
14
- *
15
- * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
16
- * Each verifying key is paired with one or more sets of public inputs (instances).
17
- *
18
- * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
19
- * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
20
- * @param {Proof} proof The batch proof to verify
21
- * @returns {boolean} True if the batch proof is valid, false otherwise
22
- */
23
- export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>, proof: Proof): boolean;
11
+ export function initThreadPool(url: URL, num_threads: number): Promise<void>;
24
12
  /**
25
13
  * Verify an execution. Executions with multiple transitions must have the program source code and
26
14
  * verifying keys of imported functions supplied from outside to correctly verify. Also, this does
@@ -39,7 +27,9 @@ export function verifyFunctionExecution(execution: Execution, verifying_key: Ver
39
27
  * Verify a SNARK proof against a verifying key and public inputs.
40
28
  *
41
29
  * 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.
30
+ * It directly invokes the Varuna proof verification from snarkVM, using the Varuna version required
31
+ * by the latest consensus version (Varuna V3 as of `ConsensusVersion::V21`). Proofs generated with
32
+ * an older Varuna version will fail verification.
43
33
  *
44
34
  * @param {VerifyingKey} verifying_key The verifying key for the circuit
45
35
  * @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
@@ -48,17 +38,18 @@ export function verifyFunctionExecution(execution: Execution, verifying_key: Ver
48
38
  */
49
39
  export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, proof: Proof): boolean;
50
40
  /**
51
- * Returns the maximum number of imports allowed in a program by the
52
- * snarkVM network implementation this SDK was built against.
53
- *
54
- * @returns {number} The maximum number of program imports.
41
+ * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
55
42
  *
56
- * @example
57
- * import { getMaxProgramImports } from '@provablehq/sdk';
43
+ * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
44
+ * Each verifying key is paired with one or more sets of public inputs (instances).
58
45
  *
59
- * const maxImports = getMaxProgramImports();
46
+ * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
47
+ * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
48
+ * @param {Proof} proof The batch proof to verify
49
+ * @returns {boolean} True if the batch proof is valid, false otherwise
60
50
  */
61
- export function getMaxProgramImports(): number;
51
+ export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>, proof: Proof): boolean;
52
+ export function stringToField(string: string): Field;
62
53
  /**
63
54
  * Set test consensus version heights for testing.
64
55
  *
@@ -68,10 +59,21 @@ export function getMaxProgramImports(): number;
68
59
  * import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
69
60
  *
70
61
  * Set the consensus version heights.
71
- * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20");
62
+ * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21");
72
63
  */
73
64
  export function getOrInitConsensusVersionTestHeights(heights?: string | null): Array<any>;
74
- export function stringToField(string: string): Field;
65
+ /**
66
+ * Returns the maximum number of imports allowed in a program by the
67
+ * snarkVM network implementation this SDK was built against.
68
+ *
69
+ * @returns {number} The maximum number of program imports.
70
+ *
71
+ * @example
72
+ * import { getMaxProgramImports } from '@provablehq/sdk';
73
+ *
74
+ * const maxImports = getMaxProgramImports();
75
+ */
76
+ export function getMaxProgramImports(): number;
75
77
  /**
76
78
  * Public address of an Aleo account
77
79
  */
Binary file
@@ -292,16 +292,6 @@ function runRayonThread(receiver) {
292
292
  wasm$1.runRayonThread(receiver);
293
293
  }
294
294
 
295
- /**
296
- * @param {URL} url
297
- * @param {number} num_threads
298
- * @returns {Promise<void>}
299
- */
300
- function initThreadPool(url, num_threads) {
301
- const ret = wasm$1.initThreadPool(addHeapObject(url), num_threads);
302
- return takeObject(ret);
303
- }
304
-
305
295
  /**
306
296
  * Set the WASM log level from JS. Called automatically by the SDK's
307
297
  * `setLogLevel(level)` to keep TS and WASM logging in sync.
@@ -313,6 +303,16 @@ function setWasmLogLevel(level) {
313
303
  wasm$1.setWasmLogLevel(level);
314
304
  }
315
305
 
306
+ /**
307
+ * @param {URL} url
308
+ * @param {number} num_threads
309
+ * @returns {Promise<void>}
310
+ */
311
+ function initThreadPool(url, num_threads) {
312
+ const ret = wasm$1.initThreadPool(addHeapObject(url), num_threads);
313
+ return takeObject(ret);
314
+ }
315
+
316
316
  let stack_pointer = 128;
317
317
 
318
318
  function addBorrowedObject(obj) {
@@ -320,38 +320,6 @@ function addBorrowedObject(obj) {
320
320
  heap[--stack_pointer] = obj;
321
321
  return stack_pointer;
322
322
  }
323
- /**
324
- * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
325
- *
326
- * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
327
- * Each verifying key is paired with one or more sets of public inputs (instances).
328
- *
329
- * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
330
- * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
331
- * @param {Proof} proof The batch proof to verify
332
- * @returns {boolean} True if the batch proof is valid, false otherwise
333
- * @param {Array<any>} verifying_keys
334
- * @param {Array<any>} inputs
335
- * @param {Proof} proof
336
- * @returns {boolean}
337
- */
338
- function snarkVerifyBatch(verifying_keys, inputs, proof) {
339
- try {
340
- const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
341
- _assertClass(proof, Proof);
342
- wasm$1.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
343
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
344
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
345
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
346
- if (r2) {
347
- throw takeObject(r1);
348
- }
349
- return r0 !== 0;
350
- } finally {
351
- wasm$1.__wbindgen_add_to_stack_pointer(16);
352
- }
353
- }
354
-
355
323
  /**
356
324
  * Verify an execution. Executions with multiple transitions must have the program source code and
357
325
  * verifying keys of imported functions supplied from outside to correctly verify. Also, this does
@@ -404,7 +372,9 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
404
372
  * Verify a SNARK proof against a verifying key and public inputs.
405
373
  *
406
374
  * 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.
375
+ * It directly invokes the Varuna proof verification from snarkVM, using the Varuna version required
376
+ * by the latest consensus version (Varuna V3 as of `ConsensusVersion::V21`). Proofs generated with
377
+ * an older Varuna version will fail verification.
408
378
  *
409
379
  * @param {VerifyingKey} verifying_key The verifying key for the circuit
410
380
  * @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
@@ -434,20 +404,57 @@ function snarkVerify(verifying_key, inputs, proof) {
434
404
  }
435
405
 
436
406
  /**
437
- * Returns the maximum number of imports allowed in a program by the
438
- * snarkVM network implementation this SDK was built against.
439
- *
440
- * @returns {number} The maximum number of program imports.
407
+ * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
441
408
  *
442
- * @example
443
- * import { getMaxProgramImports } from '@provablehq/sdk';
409
+ * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
410
+ * Each verifying key is paired with one or more sets of public inputs (instances).
444
411
  *
445
- * const maxImports = getMaxProgramImports();
446
- * @returns {number}
412
+ * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
413
+ * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
414
+ * @param {Proof} proof The batch proof to verify
415
+ * @returns {boolean} True if the batch proof is valid, false otherwise
416
+ * @param {Array<any>} verifying_keys
417
+ * @param {Array<any>} inputs
418
+ * @param {Proof} proof
419
+ * @returns {boolean}
447
420
  */
448
- function getMaxProgramImports() {
449
- const ret = wasm$1.getMaxProgramImports();
450
- return ret >>> 0;
421
+ function snarkVerifyBatch(verifying_keys, inputs, proof) {
422
+ try {
423
+ const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
424
+ _assertClass(proof, Proof);
425
+ wasm$1.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
426
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
427
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
428
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
429
+ if (r2) {
430
+ throw takeObject(r1);
431
+ }
432
+ return r0 !== 0;
433
+ } finally {
434
+ wasm$1.__wbindgen_add_to_stack_pointer(16);
435
+ }
436
+ }
437
+
438
+ /**
439
+ * @param {string} string
440
+ * @returns {Field}
441
+ */
442
+ function stringToField(string) {
443
+ try {
444
+ const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
445
+ const ptr0 = passStringToWasm0(string, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
446
+ const len0 = WASM_VECTOR_LEN;
447
+ wasm$1.stringToField(retptr, ptr0, len0);
448
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
449
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
450
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
451
+ if (r2) {
452
+ throw takeObject(r1);
453
+ }
454
+ return Field.__wrap(r0);
455
+ } finally {
456
+ wasm$1.__wbindgen_add_to_stack_pointer(16);
457
+ }
451
458
  }
452
459
 
453
460
  /**
@@ -459,7 +466,7 @@ function getMaxProgramImports() {
459
466
  * import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
460
467
  *
461
468
  * Set the consensus version heights.
462
- * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20");
469
+ * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21");
463
470
  * @param {string | null} [heights]
464
471
  * @returns {Array<any>}
465
472
  */
@@ -471,25 +478,20 @@ function getOrInitConsensusVersionTestHeights(heights) {
471
478
  }
472
479
 
473
480
  /**
474
- * @param {string} string
475
- * @returns {Field}
481
+ * Returns the maximum number of imports allowed in a program by the
482
+ * snarkVM network implementation this SDK was built against.
483
+ *
484
+ * @returns {number} The maximum number of program imports.
485
+ *
486
+ * @example
487
+ * import { getMaxProgramImports } from '@provablehq/sdk';
488
+ *
489
+ * const maxImports = getMaxProgramImports();
490
+ * @returns {number}
476
491
  */
477
- function stringToField(string) {
478
- try {
479
- const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
480
- const ptr0 = passStringToWasm0(string, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
481
- const len0 = WASM_VECTOR_LEN;
482
- wasm$1.stringToField(retptr, ptr0, len0);
483
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
484
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
485
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
486
- if (r2) {
487
- throw takeObject(r1);
488
- }
489
- return Field.__wrap(r0);
490
- } finally {
491
- wasm$1.__wbindgen_add_to_stack_pointer(16);
492
- }
492
+ function getMaxProgramImports() {
493
+ const ret = wasm$1.getMaxProgramImports();
494
+ return ret >>> 0;
493
495
  }
494
496
 
495
497
  function passArrayJsValueToWasm0(array, malloc) {
@@ -511,16 +513,16 @@ function getArrayJsValueFromWasm0(ptr, len) {
511
513
  }
512
514
  return result;
513
515
  }
514
- function __wasm_bindgen_func_elem_7556(arg0, arg1) {
515
- wasm$1.__wasm_bindgen_func_elem_7556(arg0, arg1);
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_8995(arg0, arg1, arg2) {
519
- wasm$1.__wasm_bindgen_func_elem_8995(arg0, arg1, addHeapObject(arg2));
520
+ function __wasm_bindgen_func_elem_7563(arg0, arg1) {
521
+ wasm$1.__wasm_bindgen_func_elem_7563(arg0, arg1);
520
522
  }
521
523
 
522
- function __wasm_bindgen_func_elem_7828(arg0, arg1, arg2, arg3) {
523
- wasm$1.__wasm_bindgen_func_elem_7828(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
524
+ function __wasm_bindgen_func_elem_7835(arg0, arg1, arg2, arg3) {
525
+ wasm$1.__wasm_bindgen_func_elem_7835(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_7828(a, state0.b, arg0, arg1);
19348
+ return __wasm_bindgen_func_elem_7835(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,11 +19599,6 @@ function __wbg_get_imports(memory) {
19597
19599
  const ret = Atomics.waitAsync(getObject(arg0), arg1 >>> 0, arg2);
19598
19600
  return addHeapObject(ret);
19599
19601
  };
19600
- imports.wbg.__wbindgen_cast_19cdf6e41653eb6c = function(arg0, arg1) {
19601
- // Cast intrinsic for `Closure(Closure { dtor_idx: 397, function: Function { arguments: [Externref], shim_idx: 398, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19602
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7555, __wasm_bindgen_func_elem_8995);
19603
- return addHeapObject(ret);
19604
- };
19605
19602
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
19606
19603
  // Cast intrinsic for `Ref(String) -> Externref`.
19607
19604
  const ret = getStringFromWasm0(arg0, arg1);
@@ -19617,6 +19614,16 @@ function __wbg_get_imports(memory) {
19617
19614
  const ret = BigInt.asUintN(64, arg0);
19618
19615
  return addHeapObject(ret);
19619
19616
  };
19617
+ imports.wbg.__wbindgen_cast_4a4bdde4030a89e7 = function(arg0, arg1) {
19618
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 398, function: Function { arguments: [], shim_idx: 533, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19619
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7562, __wasm_bindgen_func_elem_7563);
19620
+ return addHeapObject(ret);
19621
+ };
19622
+ imports.wbg.__wbindgen_cast_994af091adc907b6 = function(arg0, arg1) {
19623
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 398, function: Function { arguments: [Externref], shim_idx: 399, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19624
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7562, __wasm_bindgen_func_elem_9005);
19625
+ return addHeapObject(ret);
19626
+ };
19620
19627
  imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
19621
19628
  // Cast intrinsic for `I64 -> Externref`.
19622
19629
  const ret = arg0;
@@ -19627,19 +19634,14 @@ function __wbg_get_imports(memory) {
19627
19634
  const ret = arg0;
19628
19635
  return addHeapObject(ret);
19629
19636
  };
19630
- imports.wbg.__wbindgen_cast_dc45e30c78fa2793 = function(arg0, arg1) {
19631
- // Cast intrinsic for `Closure(Closure { dtor_idx: 397, function: Function { arguments: [], shim_idx: 533, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19632
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7555, __wasm_bindgen_func_elem_7556);
19633
- return addHeapObject(ret);
19634
- };
19635
19637
  imports.wbg.__wbindgen_cast_e7b45dd881f38ce3 = function(arg0, arg1) {
19636
19638
  // Cast intrinsic for `U128 -> Externref`.
19637
19639
  const ret = (BigInt.asUintN(64, arg0) | (BigInt.asUintN(64, arg1) << BigInt(64)));
19638
19640
  return addHeapObject(ret);
19639
19641
  };
19640
- imports.wbg.__wbindgen_cast_eb522c22a7f98ff2 = function(arg0, arg1) {
19641
- // Cast intrinsic for `Closure(Closure { dtor_idx: 397, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 398, 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_8995);
19642
+ imports.wbg.__wbindgen_cast_ffe78050edfd1435 = function(arg0, arg1) {
19643
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 398, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 399, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19644
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7562, __wasm_bindgen_func_elem_9005);
19643
19645
  return addHeapObject(ret);
19644
19646
  };
19645
19647
  imports.wbg.__wbindgen_link_b9f45ffe079ef2c1 = function(arg0) {