@noir-lang/acvm_js 1.0.0-beta.2-49a095d.nightly → 1.0.0-beta.2-44c35dc.nightly

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.
package/web/acvm_js.js CHANGED
@@ -20,18 +20,7 @@ function takeObject(idx) {
20
20
  return ret;
21
21
  }
22
22
 
23
- function addHeapObject(obj) {
24
- if (heap_next === heap.length) heap.push(heap.length + 1);
25
- const idx = heap_next;
26
- heap_next = heap[idx];
27
-
28
- heap[idx] = obj;
29
- return idx;
30
- }
31
-
32
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
33
-
34
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
23
+ let WASM_VECTOR_LEN = 0;
35
24
 
36
25
  let cachedUint8Memory0 = null;
37
26
 
@@ -42,13 +31,6 @@ function getUint8Memory0() {
42
31
  return cachedUint8Memory0;
43
32
  }
44
33
 
45
- function getStringFromWasm0(ptr, len) {
46
- ptr = ptr >>> 0;
47
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
48
- }
49
-
50
- let WASM_VECTOR_LEN = 0;
51
-
52
34
  const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
53
35
 
54
36
  const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
@@ -115,6 +97,24 @@ function getInt32Memory0() {
115
97
  return cachedInt32Memory0;
116
98
  }
117
99
 
100
+ function addHeapObject(obj) {
101
+ if (heap_next === heap.length) heap.push(heap.length + 1);
102
+ const idx = heap_next;
103
+ heap_next = heap[idx];
104
+
105
+ heap[idx] = obj;
106
+ return idx;
107
+ }
108
+
109
+ const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
110
+
111
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
112
+
113
+ function getStringFromWasm0(ptr, len) {
114
+ ptr = ptr >>> 0;
115
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
116
+ }
117
+
118
118
  let cachedFloat64Memory0 = null;
119
119
 
120
120
  function getFloat64Memory0() {
@@ -217,75 +217,83 @@ function __wbg_adapter_22(arg0, arg1, arg2) {
217
217
  wasm.wasm_bindgen__convert__closures__invoke1_mut__hec5660d9489c77a2(arg0, arg1, addHeapObject(arg2));
218
218
  }
219
219
 
220
+ function passArray8ToWasm0(arg, malloc) {
221
+ const ptr = malloc(arg.length * 1) >>> 0;
222
+ getUint8Memory0().set(arg, ptr / 1);
223
+ WASM_VECTOR_LEN = arg.length;
224
+ return ptr;
225
+ }
220
226
  /**
221
- * Sets the package's logging level.
227
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
222
228
  *
223
- * @param {LogLevel} level - The maximum level of logging to be emitted.
229
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
230
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
231
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
232
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
224
233
  */
225
- export function initLogLevel(filter) {
226
- try {
227
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
228
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
229
- const len0 = WASM_VECTOR_LEN;
230
- wasm.initLogLevel(retptr, ptr0, len0);
231
- var r0 = getInt32Memory0()[retptr / 4 + 0];
232
- var r1 = getInt32Memory0()[retptr / 4 + 1];
233
- if (r1) {
234
- throw takeObject(r0);
235
- }
236
- } finally {
237
- wasm.__wbindgen_add_to_stack_pointer(16);
238
- }
234
+ export function executeCircuit(program, initial_witness, foreign_call_handler) {
235
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
236
+ const len0 = WASM_VECTOR_LEN;
237
+ const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
238
+ return takeObject(ret);
239
239
  }
240
240
 
241
- function getArrayU8FromWasm0(ptr, len) {
242
- ptr = ptr >>> 0;
243
- return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
241
+ /**
242
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
243
+ * This method also extracts the public return values from the solved witness into its own return witness.
244
+ *
245
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
246
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
247
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
248
+ * @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
249
+ */
250
+ export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
251
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
252
+ const len0 = WASM_VECTOR_LEN;
253
+ const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
254
+ return takeObject(ret);
244
255
  }
256
+
245
257
  /**
246
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
258
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
247
259
  *
248
- * @param {WitnessMap} witness_map - A witness map.
249
- * @returns {Uint8Array} A compressed witness map
260
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
261
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
262
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
263
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
250
264
  */
251
- export function compressWitness(witness_map) {
252
- try {
253
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
254
- wasm.compressWitness(retptr, addHeapObject(witness_map));
255
- var r0 = getInt32Memory0()[retptr / 4 + 0];
256
- var r1 = getInt32Memory0()[retptr / 4 + 1];
257
- var r2 = getInt32Memory0()[retptr / 4 + 2];
258
- var r3 = getInt32Memory0()[retptr / 4 + 3];
259
- if (r3) {
260
- throw takeObject(r2);
261
- }
262
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
263
- wasm.__wbindgen_free(r0, r1 * 1);
264
- return v1;
265
- } finally {
266
- wasm.__wbindgen_add_to_stack_pointer(16);
267
- }
265
+ export function executeProgram(program, initial_witness, foreign_call_handler) {
266
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
267
+ const len0 = WASM_VECTOR_LEN;
268
+ const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
269
+ return takeObject(ret);
268
270
  }
269
271
 
270
- function passArray8ToWasm0(arg, malloc) {
271
- const ptr = malloc(arg.length * 1) >>> 0;
272
- getUint8Memory0().set(arg, ptr / 1);
273
- WASM_VECTOR_LEN = arg.length;
274
- return ptr;
272
+ /**
273
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
274
+ * @returns {BuildInfo} - Information on how the installed package was built.
275
+ */
276
+ export function buildInfo() {
277
+ const ret = wasm.buildInfo();
278
+ return takeObject(ret);
275
279
  }
280
+
276
281
  /**
277
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
278
- * This should be used to only fetch the witness map for the main function.
282
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
279
283
  *
280
- * @param {Uint8Array} compressed_witness - A compressed witness.
281
- * @returns {WitnessMap} The decompressed witness map.
284
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
285
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
286
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
287
+ * @param {Uint8Array} program
288
+ * @param {WitnessMap} witness_map
289
+ * @returns {WitnessMap}
282
290
  */
283
- export function decompressWitness(compressed_witness) {
291
+ export function getReturnWitness(program, witness_map) {
284
292
  try {
285
293
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
286
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
294
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
287
295
  const len0 = WASM_VECTOR_LEN;
288
- wasm.decompressWitness(retptr, ptr0, len0);
296
+ wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
289
297
  var r0 = getInt32Memory0()[retptr / 4 + 0];
290
298
  var r1 = getInt32Memory0()[retptr / 4 + 1];
291
299
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -299,42 +307,49 @@ export function decompressWitness(compressed_witness) {
299
307
  }
300
308
 
301
309
  /**
302
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
310
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
303
311
  *
304
- * @param {WitnessStack} witness_stack - A witness stack.
305
- * @returns {Uint8Array} A compressed witness stack
312
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
313
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
314
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
315
+ * @param {Uint8Array} program
316
+ * @param {WitnessMap} solved_witness
317
+ * @returns {WitnessMap}
306
318
  */
307
- export function compressWitnessStack(witness_stack) {
319
+ export function getPublicParametersWitness(program, solved_witness) {
308
320
  try {
309
321
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
310
- wasm.compressWitnessStack(retptr, addHeapObject(witness_stack));
322
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
323
+ const len0 = WASM_VECTOR_LEN;
324
+ wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
311
325
  var r0 = getInt32Memory0()[retptr / 4 + 0];
312
326
  var r1 = getInt32Memory0()[retptr / 4 + 1];
313
327
  var r2 = getInt32Memory0()[retptr / 4 + 2];
314
- var r3 = getInt32Memory0()[retptr / 4 + 3];
315
- if (r3) {
316
- throw takeObject(r2);
328
+ if (r2) {
329
+ throw takeObject(r1);
317
330
  }
318
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
319
- wasm.__wbindgen_free(r0, r1 * 1);
320
- return v1;
331
+ return takeObject(r0);
321
332
  } finally {
322
333
  wasm.__wbindgen_add_to_stack_pointer(16);
323
334
  }
324
335
  }
325
336
 
326
337
  /**
327
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
338
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
328
339
  *
329
- * @param {Uint8Array} compressed_witness - A compressed witness.
330
- * @returns {WitnessStack} The decompressed witness stack.
340
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
341
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
342
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
343
+ * @param {Uint8Array} program
344
+ * @param {WitnessMap} solved_witness
345
+ * @returns {WitnessMap}
331
346
  */
332
- export function decompressWitnessStack(compressed_witness) {
347
+ export function getPublicWitness(program, solved_witness) {
333
348
  try {
334
349
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
335
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
350
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
336
351
  const len0 = WASM_VECTOR_LEN;
337
- wasm.decompressWitnessStack(retptr, ptr0, len0);
352
+ wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
338
353
  var r0 = getInt32Memory0()[retptr / 4 + 0];
339
354
  var r1 = getInt32Memory0()[retptr / 4 + 1];
340
355
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -347,52 +362,6 @@ export function decompressWitnessStack(compressed_witness) {
347
362
  }
348
363
  }
349
364
 
350
- /**
351
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
352
- *
353
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
354
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
355
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
356
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
357
- */
358
- export function executeCircuit(program, initial_witness, foreign_call_handler) {
359
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
360
- const len0 = WASM_VECTOR_LEN;
361
- const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
362
- return takeObject(ret);
363
- }
364
-
365
- /**
366
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
367
- * This method also extracts the public return values from the solved witness into its own return witness.
368
- *
369
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
370
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
371
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
372
- * @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
373
- */
374
- export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
375
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
376
- const len0 = WASM_VECTOR_LEN;
377
- const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
378
- return takeObject(ret);
379
- }
380
-
381
- /**
382
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
383
- *
384
- * @param {Uint8Array} program - A serialized representation of an ACIR program
385
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
386
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
387
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
388
- */
389
- export function executeProgram(program, initial_witness, foreign_call_handler) {
390
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
391
- const len0 = WASM_VECTOR_LEN;
392
- const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
393
- return takeObject(ret);
394
- }
395
-
396
365
  /**
397
366
  * Performs a bitwise AND operation between `lhs` and `rhs`
398
367
  * @param {string} lhs
@@ -459,6 +428,10 @@ export function sha256_compression(inputs, state) {
459
428
  }
460
429
  }
461
430
 
431
+ function getArrayU8FromWasm0(ptr, len) {
432
+ ptr = ptr >>> 0;
433
+ return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
434
+ }
462
435
  /**
463
436
  * Calculates the Blake2s256 hash of the input bytes
464
437
  * @param {Uint8Array} inputs
@@ -523,30 +496,43 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
523
496
  }
524
497
 
525
498
  /**
526
- * Returns the `BuildInfo` object containing information about how the installed package was built.
527
- * @returns {BuildInfo} - Information on how the installed package was built.
499
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
500
+ *
501
+ * @param {WitnessMap} witness_map - A witness map.
502
+ * @returns {Uint8Array} A compressed witness map
528
503
  */
529
- export function buildInfo() {
530
- const ret = wasm.buildInfo();
531
- return takeObject(ret);
504
+ export function compressWitness(witness_map) {
505
+ try {
506
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
507
+ wasm.compressWitness(retptr, addHeapObject(witness_map));
508
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
509
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
510
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
511
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
512
+ if (r3) {
513
+ throw takeObject(r2);
514
+ }
515
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
516
+ wasm.__wbindgen_free(r0, r1 * 1);
517
+ return v1;
518
+ } finally {
519
+ wasm.__wbindgen_add_to_stack_pointer(16);
520
+ }
532
521
  }
533
522
 
534
523
  /**
535
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
524
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
525
+ * This should be used to only fetch the witness map for the main function.
536
526
  *
537
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
538
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
539
- * @returns {WitnessMap} A witness map containing the circuit's return values.
540
- * @param {Uint8Array} program
541
- * @param {WitnessMap} witness_map
542
- * @returns {WitnessMap}
527
+ * @param {Uint8Array} compressed_witness - A compressed witness.
528
+ * @returns {WitnessMap} The decompressed witness map.
543
529
  */
544
- export function getReturnWitness(program, witness_map) {
530
+ export function decompressWitness(compressed_witness) {
545
531
  try {
546
532
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
547
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
533
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
548
534
  const len0 = WASM_VECTOR_LEN;
549
- wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
535
+ wasm.decompressWitness(retptr, ptr0, len0);
550
536
  var r0 = getInt32Memory0()[retptr / 4 + 0];
551
537
  var r1 = getInt32Memory0()[retptr / 4 + 1];
552
538
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -560,49 +546,42 @@ export function getReturnWitness(program, witness_map) {
560
546
  }
561
547
 
562
548
  /**
563
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
549
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
564
550
  *
565
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
566
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
567
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
568
- * @param {Uint8Array} program
569
- * @param {WitnessMap} solved_witness
570
- * @returns {WitnessMap}
551
+ * @param {WitnessStack} witness_stack - A witness stack.
552
+ * @returns {Uint8Array} A compressed witness stack
571
553
  */
572
- export function getPublicParametersWitness(program, solved_witness) {
554
+ export function compressWitnessStack(witness_stack) {
573
555
  try {
574
556
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
575
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
576
- const len0 = WASM_VECTOR_LEN;
577
- wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
557
+ wasm.compressWitnessStack(retptr, addHeapObject(witness_stack));
578
558
  var r0 = getInt32Memory0()[retptr / 4 + 0];
579
559
  var r1 = getInt32Memory0()[retptr / 4 + 1];
580
560
  var r2 = getInt32Memory0()[retptr / 4 + 2];
581
- if (r2) {
582
- throw takeObject(r1);
561
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
562
+ if (r3) {
563
+ throw takeObject(r2);
583
564
  }
584
- return takeObject(r0);
565
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
566
+ wasm.__wbindgen_free(r0, r1 * 1);
567
+ return v1;
585
568
  } finally {
586
569
  wasm.__wbindgen_add_to_stack_pointer(16);
587
570
  }
588
571
  }
589
572
 
590
573
  /**
591
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
574
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
592
575
  *
593
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
594
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
595
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
596
- * @param {Uint8Array} program
597
- * @param {WitnessMap} solved_witness
598
- * @returns {WitnessMap}
576
+ * @param {Uint8Array} compressed_witness - A compressed witness.
577
+ * @returns {WitnessStack} The decompressed witness stack.
599
578
  */
600
- export function getPublicWitness(program, solved_witness) {
579
+ export function decompressWitnessStack(compressed_witness) {
601
580
  try {
602
581
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
603
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
582
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
604
583
  const len0 = WASM_VECTOR_LEN;
605
- wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
584
+ wasm.decompressWitnessStack(retptr, ptr0, len0);
606
585
  var r0 = getInt32Memory0()[retptr / 4 + 0];
607
586
  var r1 = getInt32Memory0()[retptr / 4 + 1];
608
587
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -615,6 +594,27 @@ export function getPublicWitness(program, solved_witness) {
615
594
  }
616
595
  }
617
596
 
597
+ /**
598
+ * Sets the package's logging level.
599
+ *
600
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
601
+ */
602
+ export function initLogLevel(filter) {
603
+ try {
604
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
605
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
606
+ const len0 = WASM_VECTOR_LEN;
607
+ wasm.initLogLevel(retptr, ptr0, len0);
608
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
609
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
610
+ if (r1) {
611
+ throw takeObject(r0);
612
+ }
613
+ } finally {
614
+ wasm.__wbindgen_add_to_stack_pointer(16);
615
+ }
616
+ }
617
+
618
618
  function __wbg_adapter_75(arg0, arg1, arg2, arg3, arg4) {
619
619
  wasm.wasm_bindgen__convert__closures__invoke3_mut__h083a66e5b0ae3ce9(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
620
620
  }
@@ -664,20 +664,24 @@ async function __wbg_load(module, imports) {
664
664
  function __wbg_get_imports() {
665
665
  const imports = {};
666
666
  imports.wbg = {};
667
- imports.wbg.__wbg_constructor_7d42f5e2b3ae2f5e = function(arg0) {
668
- const ret = new Error(takeObject(arg0));
669
- return addHeapObject(ret);
670
- };
671
667
  imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
672
668
  takeObject(arg0);
673
669
  };
670
+ imports.wbg.__wbindgen_is_array = function(arg0) {
671
+ const ret = Array.isArray(getObject(arg0));
672
+ return ret;
673
+ };
674
674
  imports.wbg.__wbindgen_is_string = function(arg0) {
675
675
  const ret = typeof(getObject(arg0)) === 'string';
676
676
  return ret;
677
677
  };
678
- imports.wbg.__wbindgen_is_array = function(arg0) {
679
- const ret = Array.isArray(getObject(arg0));
680
- return ret;
678
+ imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
679
+ const obj = getObject(arg1);
680
+ const ret = typeof(obj) === 'string' ? obj : undefined;
681
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
682
+ var len1 = WASM_VECTOR_LEN;
683
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
684
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
681
685
  };
682
686
  imports.wbg.__wbg_new_35cd49f1520efef9 = function() {
683
687
  const ret = new Map();
@@ -691,14 +695,6 @@ function __wbg_get_imports() {
691
695
  const ret = getStringFromWasm0(arg0, arg1);
692
696
  return addHeapObject(ret);
693
697
  };
694
- imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
695
- const obj = getObject(arg1);
696
- const ret = typeof(obj) === 'string' ? obj : undefined;
697
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
698
- var len1 = WASM_VECTOR_LEN;
699
- getInt32Memory0()[arg0 / 4 + 1] = len1;
700
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
701
- };
702
698
  imports.wbg.__wbindgen_cb_drop = function(arg0) {
703
699
  const obj = takeObject(arg0).original;
704
700
  if (obj.cnt-- == 1) {
@@ -708,16 +704,20 @@ function __wbg_get_imports() {
708
704
  const ret = false;
709
705
  return ret;
710
706
  };
707
+ imports.wbg.__wbg_constructor_7d42f5e2b3ae2f5e = function(arg0) {
708
+ const ret = new Error(takeObject(arg0));
709
+ return addHeapObject(ret);
710
+ };
711
+ imports.wbg.__wbg_new_3904a031fd091cf2 = function() {
712
+ const ret = new Array();
713
+ return addHeapObject(ret);
714
+ };
711
715
  imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
712
716
  const obj = getObject(arg1);
713
717
  const ret = typeof(obj) === 'number' ? obj : undefined;
714
718
  getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
715
719
  getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
716
720
  };
717
- imports.wbg.__wbg_new_3904a031fd091cf2 = function() {
718
- const ret = new Array();
719
- return addHeapObject(ret);
720
- };
721
721
  imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
722
722
  const ret = new Error();
723
723
  return addHeapObject(ret);
@@ -901,8 +901,8 @@ function __wbg_get_imports() {
901
901
  imports.wbg.__wbindgen_throw = function(arg0, arg1) {
902
902
  throw new Error(getStringFromWasm0(arg0, arg1));
903
903
  };
904
- imports.wbg.__wbindgen_closure_wrapper777 = function(arg0, arg1, arg2) {
905
- const ret = makeMutClosure(arg0, arg1, 296, __wbg_adapter_22);
904
+ imports.wbg.__wbindgen_closure_wrapper782 = function(arg0, arg1, arg2) {
905
+ const ret = makeMutClosure(arg0, arg1, 298, __wbg_adapter_22);
906
906
  return addHeapObject(ret);
907
907
  };
908
908
 
Binary file
@@ -1,24 +1,24 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export function initLogLevel(a: number, b: number, c: number): void;
5
- export function compressWitness(a: number, b: number): void;
6
- export function decompressWitness(a: number, b: number, c: number): void;
7
- export function compressWitnessStack(a: number, b: number): void;
8
- export function decompressWitnessStack(a: number, b: number, c: number): void;
9
4
  export function executeCircuit(a: number, b: number, c: number, d: number): number;
10
5
  export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
11
6
  export function executeProgram(a: number, b: number, c: number, d: number): number;
7
+ export function buildInfo(): number;
8
+ export function getReturnWitness(a: number, b: number, c: number, d: number): void;
9
+ export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
10
+ export function getPublicWitness(a: number, b: number, c: number, d: number): void;
12
11
  export function and(a: number, b: number): number;
13
12
  export function xor(a: number, b: number): number;
14
13
  export function sha256_compression(a: number, b: number, c: number, d: number, e: number): void;
15
14
  export function blake2s256(a: number, b: number, c: number): void;
16
15
  export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
17
16
  export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
18
- export function buildInfo(): number;
19
- export function getReturnWitness(a: number, b: number, c: number, d: number): void;
20
- export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
21
- export function getPublicWitness(a: number, b: number, c: number, d: number): void;
17
+ export function compressWitness(a: number, b: number): void;
18
+ export function decompressWitness(a: number, b: number, c: number): void;
19
+ export function compressWitnessStack(a: number, b: number): void;
20
+ export function decompressWitnessStack(a: number, b: number, c: number): void;
21
+ export function initLogLevel(a: number, b: number, c: number): void;
22
22
  export function __wbindgen_malloc(a: number): number;
23
23
  export function __wbindgen_realloc(a: number, b: number, c: number): number;
24
24
  export const __wbindgen_export_2: WebAssembly.Table;