@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.
@@ -10,17 +10,17 @@ export function initThreadPool(url: URL, num_threads: number): Promise<void>;
10
10
  */
11
11
  export function setWasmLogLevel(level: number): void;
12
12
  /**
13
- * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
13
+ * Verify a SNARK proof against a verifying key and public inputs.
14
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).
15
+ * This function verifies a proof produced by an Aleo program that may not be deployed on chain.
16
+ * It directly invokes the Varuna proof verification from snarkVM.
17
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
18
+ * @param {VerifyingKey} verifying_key The verifying key for the circuit
19
+ * @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
20
+ * @param {Proof} proof The proof to verify
21
+ * @returns {boolean} True if the proof is valid, false otherwise
22
22
  */
23
- export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>, proof: Proof): boolean;
23
+ export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, proof: Proof): boolean;
24
24
  /**
25
25
  * Verify an execution. Executions with multiple transitions must have the program source code and
26
26
  * verifying keys of imported functions supplied from outside to correctly verify. Also, this does
@@ -36,18 +36,17 @@ export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>,
36
36
  */
37
37
  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;
38
38
  /**
39
- * Verify a SNARK proof against a verifying key and public inputs.
39
+ * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
40
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.
41
+ * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
42
+ * Each verifying key is paired with one or more sets of public inputs (instances).
43
43
  *
44
- * @param {VerifyingKey} verifying_key The verifying key for the circuit
45
- * @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
46
- * @param {Proof} proof The proof to verify
47
- * @returns {boolean} True if the proof is valid, false otherwise
44
+ * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
45
+ * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
46
+ * @param {Proof} proof The batch proof to verify
47
+ * @returns {boolean} True if the batch proof is valid, false otherwise
48
48
  */
49
- export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, proof: Proof): boolean;
50
- export function stringToField(string: string): Field;
49
+ export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>, proof: Proof): boolean;
51
50
  /**
52
51
  * Set test consensus version heights for testing.
53
52
  *
@@ -60,6 +59,7 @@ export function stringToField(string: string): Field;
60
59
  * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14");
61
60
  */
62
61
  export function getOrInitConsensusVersionTestHeights(heights?: string | null): Array<any>;
62
+ export function stringToField(string: string): Field;
63
63
  /**
64
64
  * Public address of an Aleo account
65
65
  */
Binary file
@@ -321,25 +321,26 @@ function addBorrowedObject(obj) {
321
321
  return stack_pointer;
322
322
  }
323
323
  /**
324
- * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
324
+ * Verify a SNARK proof against a verifying key and public inputs.
325
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).
326
+ * This function verifies a proof produced by an Aleo program that may not be deployed on chain.
327
+ * It directly invokes the Varuna proof verification from snarkVM.
328
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
329
+ * @param {VerifyingKey} verifying_key The verifying key for the circuit
330
+ * @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
331
+ * @param {Proof} proof The proof to verify
332
+ * @returns {boolean} True if the proof is valid, false otherwise
333
+ * @param {VerifyingKey} verifying_key
334
334
  * @param {Array<any>} inputs
335
335
  * @param {Proof} proof
336
336
  * @returns {boolean}
337
337
  */
338
- function snarkVerifyBatch(verifying_keys, inputs, proof) {
338
+ function snarkVerify(verifying_key, inputs, proof) {
339
339
  try {
340
340
  const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
341
+ _assertClass(verifying_key, VerifyingKey);
341
342
  _assertClass(proof, Proof);
342
- wasm$1.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
343
+ wasm$1.snarkVerify(retptr, verifying_key.__wbg_ptr, addHeapObject(inputs), proof.__wbg_ptr);
343
344
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
344
345
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
345
346
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -401,26 +402,25 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
401
402
  }
402
403
 
403
404
  /**
404
- * Verify a SNARK proof against a verifying key and public inputs.
405
+ * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
405
406
  *
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.
407
+ * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
408
+ * Each verifying key is paired with one or more sets of public inputs (instances).
408
409
  *
409
- * @param {VerifyingKey} verifying_key The verifying key for the circuit
410
- * @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
411
- * @param {Proof} proof The proof to verify
412
- * @returns {boolean} True if the proof is valid, false otherwise
413
- * @param {VerifyingKey} verifying_key
410
+ * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
411
+ * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
412
+ * @param {Proof} proof The batch proof to verify
413
+ * @returns {boolean} True if the batch proof is valid, false otherwise
414
+ * @param {Array<any>} verifying_keys
414
415
  * @param {Array<any>} inputs
415
416
  * @param {Proof} proof
416
417
  * @returns {boolean}
417
418
  */
418
- function snarkVerify(verifying_key, inputs, proof) {
419
+ function snarkVerifyBatch(verifying_keys, inputs, proof) {
419
420
  try {
420
421
  const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
421
- _assertClass(verifying_key, VerifyingKey);
422
422
  _assertClass(proof, Proof);
423
- wasm$1.snarkVerify(retptr, verifying_key.__wbg_ptr, addHeapObject(inputs), proof.__wbg_ptr);
423
+ wasm$1.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
424
424
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
425
425
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
426
426
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -433,6 +433,26 @@ function snarkVerify(verifying_key, inputs, proof) {
433
433
  }
434
434
  }
435
435
 
436
+ /**
437
+ * Set test consensus version heights for testing.
438
+ *
439
+ * @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.
440
+ *
441
+ * @example
442
+ * import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
443
+ *
444
+ * Set the consensus version heights.
445
+ * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14");
446
+ * @param {string | null} [heights]
447
+ * @returns {Array<any>}
448
+ */
449
+ function getOrInitConsensusVersionTestHeights(heights) {
450
+ var ptr0 = isLikeNone(heights) ? 0 : passStringToWasm0(heights, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
451
+ var len0 = WASM_VECTOR_LEN;
452
+ const ret = wasm$1.getOrInitConsensusVersionTestHeights(ptr0, len0);
453
+ return takeObject(ret);
454
+ }
455
+
436
456
  /**
437
457
  * @param {string} string
438
458
  * @returns {Field}
@@ -455,26 +475,6 @@ function stringToField(string) {
455
475
  }
456
476
  }
457
477
 
458
- /**
459
- * Set test consensus version heights for testing.
460
- *
461
- * @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.
462
- *
463
- * @example
464
- * import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
465
- *
466
- * Set the consensus version heights.
467
- * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14");
468
- * @param {string | null} [heights]
469
- * @returns {Array<any>}
470
- */
471
- function getOrInitConsensusVersionTestHeights(heights) {
472
- var ptr0 = isLikeNone(heights) ? 0 : passStringToWasm0(heights, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
473
- var len0 = WASM_VECTOR_LEN;
474
- const ret = wasm$1.getOrInitConsensusVersionTestHeights(ptr0, len0);
475
- return takeObject(ret);
476
- }
477
-
478
478
  function passArrayJsValueToWasm0(array, malloc) {
479
479
  const ptr = malloc(array.length * 4, 4) >>> 0;
480
480
  const mem = getDataViewMemory0();
@@ -494,16 +494,16 @@ function getArrayJsValueFromWasm0(ptr, len) {
494
494
  }
495
495
  return result;
496
496
  }
497
- function __wasm_bindgen_func_elem_8742(arg0, arg1, arg2) {
498
- wasm$1.__wasm_bindgen_func_elem_8742(arg0, arg1, addHeapObject(arg2));
497
+ function __wasm_bindgen_func_elem_7387(arg0, arg1) {
498
+ wasm$1.__wasm_bindgen_func_elem_7387(arg0, arg1);
499
499
  }
500
500
 
501
- function __wasm_bindgen_func_elem_7376(arg0, arg1) {
502
- wasm$1.__wasm_bindgen_func_elem_7376(arg0, arg1);
501
+ function __wasm_bindgen_func_elem_8758(arg0, arg1, arg2) {
502
+ wasm$1.__wasm_bindgen_func_elem_8758(arg0, arg1, addHeapObject(arg2));
503
503
  }
504
504
 
505
- function __wasm_bindgen_func_elem_7648(arg0, arg1, arg2, arg3) {
506
- wasm$1.__wasm_bindgen_func_elem_7648(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
505
+ function __wasm_bindgen_func_elem_7660(arg0, arg1, arg2, arg3) {
506
+ wasm$1.__wasm_bindgen_func_elem_7660(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
507
507
  }
508
508
 
509
509
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
@@ -19238,7 +19238,7 @@ function __wbg_get_imports(memory) {
19238
19238
  const ret = getObject(arg0).length;
19239
19239
  return ret;
19240
19240
  };
19241
- imports.wbg.__wbg_log_a61781f88cdec01a = function(arg0, arg1) {
19241
+ imports.wbg.__wbg_log_0eaae399732a802e = function(arg0, arg1) {
19242
19242
  console.log(getStringFromWasm0(arg0, arg1));
19243
19243
  };
19244
19244
  imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
@@ -19256,7 +19256,7 @@ function __wbg_get_imports(memory) {
19256
19256
  const a = state0.a;
19257
19257
  state0.a = 0;
19258
19258
  try {
19259
- return __wasm_bindgen_func_elem_7648(a, state0.b, arg0, arg1);
19259
+ return __wasm_bindgen_func_elem_7660(a, state0.b, arg0, arg1);
19260
19260
  } finally {
19261
19261
  state0.a = a;
19262
19262
  }
@@ -19428,7 +19428,7 @@ function __wbg_get_imports(memory) {
19428
19428
  const ret = Signature.__wrap(arg0);
19429
19429
  return addHeapObject(ret);
19430
19430
  };
19431
- imports.wbg.__wbg_spawnWorker_7994cee197aef72d = function(arg0, arg1, arg2, arg3) {
19431
+ imports.wbg.__wbg_spawnWorker_3f95ae6c0630b765 = function(arg0, arg1, arg2, arg3) {
19432
19432
  const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
19433
19433
  return addHeapObject(ret);
19434
19434
  };
@@ -19527,12 +19527,12 @@ function __wbg_get_imports(memory) {
19527
19527
  };
19528
19528
  imports.wbg.__wbindgen_cast_4a64cbb5b17898c9 = function(arg0, arg1) {
19529
19529
  // Cast intrinsic for `Closure(Closure { dtor_idx: 358, function: Function { arguments: [Externref], shim_idx: 359, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19530
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7375, __wasm_bindgen_func_elem_8742);
19530
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7386, __wasm_bindgen_func_elem_8758);
19531
19531
  return addHeapObject(ret);
19532
19532
  };
19533
19533
  imports.wbg.__wbindgen_cast_65bbaf572cb463ed = function(arg0, arg1) {
19534
19534
  // 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`.
19535
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7375, __wasm_bindgen_func_elem_8742);
19535
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7386, __wasm_bindgen_func_elem_8758);
19536
19536
  return addHeapObject(ret);
19537
19537
  };
19538
19538
  imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
@@ -19542,7 +19542,7 @@ function __wbg_get_imports(memory) {
19542
19542
  };
19543
19543
  imports.wbg.__wbindgen_cast_aca65e91b5ef2a91 = function(arg0, arg1) {
19544
19544
  // Cast intrinsic for `Closure(Closure { dtor_idx: 358, function: Function { arguments: [], shim_idx: 467, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19545
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7375, __wasm_bindgen_func_elem_7376);
19545
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7386, __wasm_bindgen_func_elem_7387);
19546
19546
  return addHeapObject(ret);
19547
19547
  };
19548
19548
  imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {