@noir-lang/acvm_js 0.54.0 → 0.55.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.
package/web/acvm_js.js CHANGED
@@ -20,22 +20,26 @@ function takeObject(idx) {
20
20
  return ret;
21
21
  }
22
22
 
23
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
24
-
25
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
23
+ function isLikeNone(x) {
24
+ return x === undefined || x === null;
25
+ }
26
26
 
27
- let cachedUint8Memory0 = null;
27
+ let cachedFloat64Memory0 = null;
28
28
 
29
- function getUint8Memory0() {
30
- if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
31
- cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
29
+ function getFloat64Memory0() {
30
+ if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
31
+ cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
32
32
  }
33
- return cachedUint8Memory0;
33
+ return cachedFloat64Memory0;
34
34
  }
35
35
 
36
- function getStringFromWasm0(ptr, len) {
37
- ptr = ptr >>> 0;
38
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
36
+ let cachedInt32Memory0 = null;
37
+
38
+ function getInt32Memory0() {
39
+ if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
40
+ cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
41
+ }
42
+ return cachedInt32Memory0;
39
43
  }
40
44
 
41
45
  function addHeapObject(obj) {
@@ -47,26 +51,22 @@ function addHeapObject(obj) {
47
51
  return idx;
48
52
  }
49
53
 
50
- function isLikeNone(x) {
51
- return x === undefined || x === null;
52
- }
54
+ const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
53
55
 
54
- let cachedFloat64Memory0 = null;
56
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
55
57
 
56
- function getFloat64Memory0() {
57
- if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
58
- cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
58
+ let cachedUint8Memory0 = null;
59
+
60
+ function getUint8Memory0() {
61
+ if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
62
+ cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
59
63
  }
60
- return cachedFloat64Memory0;
64
+ return cachedUint8Memory0;
61
65
  }
62
66
 
63
- let cachedInt32Memory0 = null;
64
-
65
- function getInt32Memory0() {
66
- if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
67
- cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
68
- }
69
- return cachedInt32Memory0;
67
+ function getStringFromWasm0(ptr, len) {
68
+ ptr = ptr >>> 0;
69
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
70
70
  }
71
71
 
72
72
  let WASM_VECTOR_LEN = 0;
@@ -214,25 +214,33 @@ function makeMutClosure(arg0, arg1, dtor, f) {
214
214
  return real;
215
215
  }
216
216
  function __wbg_adapter_22(arg0, arg1, arg2) {
217
- wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h21c8ca3eb6ab9385(arg0, arg1, addHeapObject(arg2));
217
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h624a3dfbf78ca22a(arg0, arg1, addHeapObject(arg2));
218
218
  }
219
219
 
220
+ function getArrayU8FromWasm0(ptr, len) {
221
+ ptr = ptr >>> 0;
222
+ return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
223
+ }
220
224
  /**
221
- * Sets the package's logging level.
225
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
222
226
  *
223
- * @param {LogLevel} level - The maximum level of logging to be emitted.
227
+ * @param {WitnessMap} witness_map - A witness map.
228
+ * @returns {Uint8Array} A compressed witness map
224
229
  */
225
- export function initLogLevel(filter) {
230
+ export function compressWitness(witness_map) {
226
231
  try {
227
232
  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);
233
+ wasm.compressWitness(retptr, addHeapObject(witness_map));
231
234
  var r0 = getInt32Memory0()[retptr / 4 + 0];
232
235
  var r1 = getInt32Memory0()[retptr / 4 + 1];
233
- if (r1) {
234
- throw takeObject(r0);
236
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
237
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
238
+ if (r3) {
239
+ throw takeObject(r2);
235
240
  }
241
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
242
+ wasm.__wbindgen_free(r0, r1 * 1);
243
+ return v1;
236
244
  } finally {
237
245
  wasm.__wbindgen_add_to_stack_pointer(16);
238
246
  }
@@ -245,21 +253,18 @@ function passArray8ToWasm0(arg, malloc) {
245
253
  return ptr;
246
254
  }
247
255
  /**
248
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
256
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
257
+ * This should be used to only fetch the witness map for the main function.
249
258
  *
250
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
251
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
252
- * @returns {WitnessMap} A witness map containing the circuit's return values.
253
- * @param {Uint8Array} program
254
- * @param {WitnessMap} witness_map
255
- * @returns {WitnessMap}
259
+ * @param {Uint8Array} compressed_witness - A compressed witness.
260
+ * @returns {WitnessMap} The decompressed witness map.
256
261
  */
257
- export function getReturnWitness(program, witness_map) {
262
+ export function decompressWitness(compressed_witness) {
258
263
  try {
259
264
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
260
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
265
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
261
266
  const len0 = WASM_VECTOR_LEN;
262
- wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
267
+ wasm.decompressWitness(retptr, ptr0, len0);
263
268
  var r0 = getInt32Memory0()[retptr / 4 + 0];
264
269
  var r1 = getInt32Memory0()[retptr / 4 + 1];
265
270
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -273,49 +278,42 @@ export function getReturnWitness(program, witness_map) {
273
278
  }
274
279
 
275
280
  /**
276
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
281
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
277
282
  *
278
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
279
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
280
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
281
- * @param {Uint8Array} program
282
- * @param {WitnessMap} solved_witness
283
- * @returns {WitnessMap}
283
+ * @param {WitnessStack} witness_stack - A witness stack.
284
+ * @returns {Uint8Array} A compressed witness stack
284
285
  */
285
- export function getPublicParametersWitness(program, solved_witness) {
286
+ export function compressWitnessStack(witness_stack) {
286
287
  try {
287
288
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
288
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
289
- const len0 = WASM_VECTOR_LEN;
290
- wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
289
+ wasm.compressWitnessStack(retptr, addHeapObject(witness_stack));
291
290
  var r0 = getInt32Memory0()[retptr / 4 + 0];
292
291
  var r1 = getInt32Memory0()[retptr / 4 + 1];
293
292
  var r2 = getInt32Memory0()[retptr / 4 + 2];
294
- if (r2) {
295
- throw takeObject(r1);
293
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
294
+ if (r3) {
295
+ throw takeObject(r2);
296
296
  }
297
- return takeObject(r0);
297
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
298
+ wasm.__wbindgen_free(r0, r1 * 1);
299
+ return v1;
298
300
  } finally {
299
301
  wasm.__wbindgen_add_to_stack_pointer(16);
300
302
  }
301
303
  }
302
304
 
303
305
  /**
304
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
306
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
305
307
  *
306
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
307
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
308
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
309
- * @param {Uint8Array} program
310
- * @param {WitnessMap} solved_witness
311
- * @returns {WitnessMap}
308
+ * @param {Uint8Array} compressed_witness - A compressed witness.
309
+ * @returns {WitnessStack} The decompressed witness stack.
312
310
  */
313
- export function getPublicWitness(program, solved_witness) {
311
+ export function decompressWitnessStack(compressed_witness) {
314
312
  try {
315
313
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
316
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
314
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
317
315
  const len0 = WASM_VECTOR_LEN;
318
- wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
316
+ wasm.decompressWitnessStack(retptr, ptr0, len0);
319
317
  var r0 = getInt32Memory0()[retptr / 4 + 0];
320
318
  var r1 = getInt32Memory0()[retptr / 4 + 1];
321
319
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -328,6 +326,52 @@ export function getPublicWitness(program, solved_witness) {
328
326
  }
329
327
  }
330
328
 
329
+ /**
330
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
331
+ *
332
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
333
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
334
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
335
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
336
+ */
337
+ export function executeCircuit(program, initial_witness, foreign_call_handler) {
338
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
339
+ const len0 = WASM_VECTOR_LEN;
340
+ const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
341
+ return takeObject(ret);
342
+ }
343
+
344
+ /**
345
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
346
+ * This method also extracts the public return values from the solved witness into its own return witness.
347
+ *
348
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
349
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
350
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
351
+ * @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.
352
+ */
353
+ export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
354
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
355
+ const len0 = WASM_VECTOR_LEN;
356
+ const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
357
+ return takeObject(ret);
358
+ }
359
+
360
+ /**
361
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
362
+ *
363
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
364
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
365
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
366
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
367
+ */
368
+ export function executeProgram(program, initial_witness, foreign_call_handler) {
369
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
370
+ const len0 = WASM_VECTOR_LEN;
371
+ const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
372
+ return takeObject(ret);
373
+ }
374
+
331
375
  /**
332
376
  * Performs a bitwise AND operation between `lhs` and `rhs`
333
377
  * @param {string} lhs
@@ -394,10 +438,6 @@ export function sha256_compression(inputs, state) {
394
438
  }
395
439
  }
396
440
 
397
- function getArrayU8FromWasm0(ptr, len) {
398
- ptr = ptr >>> 0;
399
- return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
400
- }
401
441
  /**
402
442
  * Calculates the Blake2s256 hash of the input bytes
403
443
  * @param {Uint8Array} inputs
@@ -471,89 +511,42 @@ export function buildInfo() {
471
511
  }
472
512
 
473
513
  /**
474
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
475
- *
476
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
477
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
478
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
479
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
480
- */
481
- export function executeCircuit(program, initial_witness, foreign_call_handler) {
482
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
483
- const len0 = WASM_VECTOR_LEN;
484
- const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
485
- return takeObject(ret);
486
- }
487
-
488
- /**
489
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
490
- * This method also extracts the public return values from the solved witness into its own return witness.
491
- *
492
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
493
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
494
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
495
- * @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.
496
- */
497
- export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
498
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
499
- const len0 = WASM_VECTOR_LEN;
500
- const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
501
- return takeObject(ret);
502
- }
503
-
504
- /**
505
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
506
- *
507
- * @param {Uint8Array} program - A serialized representation of an ACIR program
508
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
509
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
510
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
511
- */
512
- export function executeProgram(program, initial_witness, foreign_call_handler) {
513
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
514
- const len0 = WASM_VECTOR_LEN;
515
- const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
516
- return takeObject(ret);
517
- }
518
-
519
- /**
520
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
514
+ * Sets the package's logging level.
521
515
  *
522
- * @param {WitnessMap} witness_map - A witness map.
523
- * @returns {Uint8Array} A compressed witness map
516
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
524
517
  */
525
- export function compressWitness(witness_map) {
518
+ export function initLogLevel(filter) {
526
519
  try {
527
520
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
528
- wasm.compressWitness(retptr, addHeapObject(witness_map));
521
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
522
+ const len0 = WASM_VECTOR_LEN;
523
+ wasm.initLogLevel(retptr, ptr0, len0);
529
524
  var r0 = getInt32Memory0()[retptr / 4 + 0];
530
525
  var r1 = getInt32Memory0()[retptr / 4 + 1];
531
- var r2 = getInt32Memory0()[retptr / 4 + 2];
532
- var r3 = getInt32Memory0()[retptr / 4 + 3];
533
- if (r3) {
534
- throw takeObject(r2);
526
+ if (r1) {
527
+ throw takeObject(r0);
535
528
  }
536
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
537
- wasm.__wbindgen_free(r0, r1 * 1);
538
- return v1;
539
529
  } finally {
540
530
  wasm.__wbindgen_add_to_stack_pointer(16);
541
531
  }
542
532
  }
543
533
 
544
534
  /**
545
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
546
- * This should be used to only fetch the witness map for the main function.
535
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
547
536
  *
548
- * @param {Uint8Array} compressed_witness - A compressed witness.
549
- * @returns {WitnessMap} The decompressed witness map.
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}
550
543
  */
551
- export function decompressWitness(compressed_witness) {
544
+ export function getReturnWitness(program, witness_map) {
552
545
  try {
553
546
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
554
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
547
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
555
548
  const len0 = WASM_VECTOR_LEN;
556
- wasm.decompressWitness(retptr, ptr0, len0);
549
+ wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
557
550
  var r0 = getInt32Memory0()[retptr / 4 + 0];
558
551
  var r1 = getInt32Memory0()[retptr / 4 + 1];
559
552
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -567,42 +560,49 @@ export function decompressWitness(compressed_witness) {
567
560
  }
568
561
 
569
562
  /**
570
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
563
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
571
564
  *
572
- * @param {WitnessStack} witness_stack - A witness stack.
573
- * @returns {Uint8Array} A compressed witness stack
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}
574
571
  */
575
- export function compressWitnessStack(witness_stack) {
572
+ export function getPublicParametersWitness(program, solved_witness) {
576
573
  try {
577
574
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
578
- wasm.compressWitnessStack(retptr, addHeapObject(witness_stack));
575
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
576
+ const len0 = WASM_VECTOR_LEN;
577
+ wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
579
578
  var r0 = getInt32Memory0()[retptr / 4 + 0];
580
579
  var r1 = getInt32Memory0()[retptr / 4 + 1];
581
580
  var r2 = getInt32Memory0()[retptr / 4 + 2];
582
- var r3 = getInt32Memory0()[retptr / 4 + 3];
583
- if (r3) {
584
- throw takeObject(r2);
581
+ if (r2) {
582
+ throw takeObject(r1);
585
583
  }
586
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
587
- wasm.__wbindgen_free(r0, r1 * 1);
588
- return v1;
584
+ return takeObject(r0);
589
585
  } finally {
590
586
  wasm.__wbindgen_add_to_stack_pointer(16);
591
587
  }
592
588
  }
593
589
 
594
590
  /**
595
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
591
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
596
592
  *
597
- * @param {Uint8Array} compressed_witness - A compressed witness.
598
- * @returns {WitnessStack} The decompressed witness stack.
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}
599
599
  */
600
- export function decompressWitnessStack(compressed_witness) {
600
+ export function getPublicWitness(program, solved_witness) {
601
601
  try {
602
602
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
603
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
603
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
604
604
  const len0 = WASM_VECTOR_LEN;
605
- wasm.decompressWitnessStack(retptr, ptr0, len0);
605
+ wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
606
606
  var r0 = getInt32Memory0()[retptr / 4 + 0];
607
607
  var r1 = getInt32Memory0()[retptr / 4 + 1];
608
608
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -616,7 +616,7 @@ export function decompressWitnessStack(compressed_witness) {
616
616
  }
617
617
 
618
618
  function __wbg_adapter_75(arg0, arg1, arg2, arg3, arg4) {
619
- wasm.wasm_bindgen__convert__closures__invoke3_mut__h17fc532521b46256(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
619
+ wasm.wasm_bindgen__convert__closures__invoke3_mut__h45040feada3ebb25(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
620
620
  }
621
621
 
622
622
  function handleError(f, args) {
@@ -627,7 +627,7 @@ function handleError(f, args) {
627
627
  }
628
628
  }
629
629
  function __wbg_adapter_92(arg0, arg1, arg2, arg3) {
630
- wasm.wasm_bindgen__convert__closures__invoke2_mut__h0d187b0f08495587(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
630
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h3f07259b3eb55784(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
631
631
  }
632
632
 
633
633
  async function __wbg_load(module, imports) {
@@ -676,15 +676,17 @@ function __wbg_get_imports() {
676
676
  const ret = false;
677
677
  return ret;
678
678
  };
679
- imports.wbg.__wbg_constructor_79bab16c42849d1b = function(arg0) {
680
- const ret = new Error(takeObject(arg0));
681
- return addHeapObject(ret);
679
+ imports.wbg.__wbindgen_is_array = function(arg0) {
680
+ const ret = Array.isArray(getObject(arg0));
681
+ return ret;
682
682
  };
683
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
684
- const ret = getStringFromWasm0(arg0, arg1);
685
- return addHeapObject(ret);
683
+ imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
684
+ const obj = getObject(arg1);
685
+ const ret = typeof(obj) === 'number' ? obj : undefined;
686
+ getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
687
+ getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
686
688
  };
687
- imports.wbg.__wbg_new_610492d70b2d4e55 = function() {
689
+ imports.wbg.__wbg_new_f4a2f4980eb0a66e = function() {
688
690
  const ret = new Array();
689
691
  return addHeapObject(ret);
690
692
  };
@@ -692,21 +694,19 @@ function __wbg_get_imports() {
692
694
  const ret = arg0;
693
695
  return addHeapObject(ret);
694
696
  };
695
- imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
696
- const obj = getObject(arg1);
697
- const ret = typeof(obj) === 'number' ? obj : undefined;
698
- getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
699
- getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
697
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
698
+ const ret = getStringFromWasm0(arg0, arg1);
699
+ return addHeapObject(ret);
700
+ };
701
+ imports.wbg.__wbg_constructor_bb18ee055059e54b = function(arg0) {
702
+ const ret = new Error(takeObject(arg0));
703
+ return addHeapObject(ret);
700
704
  };
701
705
  imports.wbg.__wbindgen_is_string = function(arg0) {
702
706
  const ret = typeof(getObject(arg0)) === 'string';
703
707
  return ret;
704
708
  };
705
- imports.wbg.__wbindgen_is_array = function(arg0) {
706
- const ret = Array.isArray(getObject(arg0));
707
- return ret;
708
- };
709
- imports.wbg.__wbg_new_7b5514a697f386eb = function() {
709
+ imports.wbg.__wbg_new_e0a89522928fc0a3 = function() {
710
710
  const ret = new Map();
711
711
  return addHeapObject(ret);
712
712
  };
@@ -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_wrapper734 = function(arg0, arg1, arg2) {
905
- const ret = makeMutClosure(arg0, arg1, 268, __wbg_adapter_22);
904
+ imports.wbg.__wbindgen_closure_wrapper726 = function(arg0, arg1, arg2) {
905
+ const ret = makeMutClosure(arg0, arg1, 265, __wbg_adapter_22);
906
906
  return addHeapObject(ret);
907
907
  };
908
908
 
Binary file
@@ -1,10 +1,13 @@
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 getReturnWitness(a: number, b: number, c: number, d: number): void;
6
- export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
7
- export function getPublicWitness(a: number, b: number, c: number, d: number): void;
4
+ export function compressWitness(a: number, b: number): void;
5
+ export function decompressWitness(a: number, b: number, c: number): void;
6
+ export function compressWitnessStack(a: number, b: number): void;
7
+ export function decompressWitnessStack(a: number, b: number, c: number): void;
8
+ export function executeCircuit(a: number, b: number, c: number, d: number): number;
9
+ export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
10
+ export function executeProgram(a: number, b: number, c: number, d: number): number;
8
11
  export function and(a: number, b: number): number;
9
12
  export function xor(a: number, b: number): number;
10
13
  export function sha256_compression(a: number, b: number, c: number, d: number, e: number): void;
@@ -12,19 +15,16 @@ export function blake2s256(a: number, b: number, c: number): void;
12
15
  export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
13
16
  export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
14
17
  export function buildInfo(): number;
15
- export function executeCircuit(a: number, b: number, c: number, d: number): number;
16
- export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
17
- export function executeProgram(a: number, b: number, c: number, d: number): number;
18
- export function compressWitness(a: number, b: number): void;
19
- export function decompressWitness(a: number, b: number, c: number): void;
20
- export function compressWitnessStack(a: number, b: number): void;
21
- export function decompressWitnessStack(a: number, b: number, c: number): void;
18
+ export function initLogLevel(a: number, b: number, c: number): void;
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;
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;
25
- export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h21c8ca3eb6ab9385(a: number, b: number, c: number): void;
25
+ export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h624a3dfbf78ca22a(a: number, b: number, c: number): void;
26
26
  export function __wbindgen_add_to_stack_pointer(a: number): number;
27
27
  export function __wbindgen_free(a: number, b: number): void;
28
- export function wasm_bindgen__convert__closures__invoke3_mut__h17fc532521b46256(a: number, b: number, c: number, d: number, e: number): void;
28
+ export function wasm_bindgen__convert__closures__invoke3_mut__h45040feada3ebb25(a: number, b: number, c: number, d: number, e: number): void;
29
29
  export function __wbindgen_exn_store(a: number): void;
30
- export function wasm_bindgen__convert__closures__invoke2_mut__h0d187b0f08495587(a: number, b: number, c: number, d: number): void;
30
+ export function wasm_bindgen__convert__closures__invoke2_mut__h3f07259b3eb55784(a: number, b: number, c: number, d: number): void;