@noir-lang/acvm_js 0.46.0-7936262.nightly → 0.46.0-e4eb5f5.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
@@ -6,6 +6,20 @@ heap.push(undefined, null, true, false);
6
6
 
7
7
  function getObject(idx) { return heap[idx]; }
8
8
 
9
+ let heap_next = heap.length;
10
+
11
+ function dropObject(idx) {
12
+ if (idx < 132) return;
13
+ heap[idx] = heap_next;
14
+ heap_next = idx;
15
+ }
16
+
17
+ function takeObject(idx) {
18
+ const ret = getObject(idx);
19
+ dropObject(idx);
20
+ return ret;
21
+ }
22
+
9
23
  function isLikeNone(x) {
10
24
  return x === undefined || x === null;
11
25
  }
@@ -28,29 +42,6 @@ function getInt32Memory0() {
28
42
  return cachedInt32Memory0;
29
43
  }
30
44
 
31
- let heap_next = heap.length;
32
-
33
- function dropObject(idx) {
34
- if (idx < 132) return;
35
- heap[idx] = heap_next;
36
- heap_next = idx;
37
- }
38
-
39
- function takeObject(idx) {
40
- const ret = getObject(idx);
41
- dropObject(idx);
42
- return ret;
43
- }
44
-
45
- function addHeapObject(obj) {
46
- if (heap_next === heap.length) heap.push(heap.length + 1);
47
- const idx = heap_next;
48
- heap_next = heap[idx];
49
-
50
- heap[idx] = obj;
51
- return idx;
52
- }
53
-
54
45
  const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
55
46
 
56
47
  if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
@@ -69,6 +60,15 @@ function getStringFromWasm0(ptr, len) {
69
60
  return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
70
61
  }
71
62
 
63
+ function addHeapObject(obj) {
64
+ if (heap_next === heap.length) heap.push(heap.length + 1);
65
+ const idx = heap_next;
66
+ heap_next = heap[idx];
67
+
68
+ heap[idx] = obj;
69
+ return idx;
70
+ }
71
+
72
72
  let WASM_VECTOR_LEN = 0;
73
73
 
74
74
  const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
@@ -217,199 +217,6 @@ function __wbg_adapter_22(arg0, arg1, arg2) {
217
217
  wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h36bac5ff3ea3c380(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
- }
224
- /**
225
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
226
- *
227
- * @param {WitnessMap} witness_map - A witness map.
228
- * @returns {Uint8Array} A compressed witness map
229
- */
230
- export function compressWitness(witness_map) {
231
- try {
232
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
233
- wasm.compressWitness(retptr, addHeapObject(witness_map));
234
- var r0 = getInt32Memory0()[retptr / 4 + 0];
235
- var r1 = getInt32Memory0()[retptr / 4 + 1];
236
- var r2 = getInt32Memory0()[retptr / 4 + 2];
237
- var r3 = getInt32Memory0()[retptr / 4 + 3];
238
- if (r3) {
239
- throw takeObject(r2);
240
- }
241
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
242
- wasm.__wbindgen_free(r0, r1 * 1);
243
- return v1;
244
- } finally {
245
- wasm.__wbindgen_add_to_stack_pointer(16);
246
- }
247
- }
248
-
249
- function passArray8ToWasm0(arg, malloc) {
250
- const ptr = malloc(arg.length * 1) >>> 0;
251
- getUint8Memory0().set(arg, ptr / 1);
252
- WASM_VECTOR_LEN = arg.length;
253
- return ptr;
254
- }
255
- /**
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.
258
- *
259
- * @param {Uint8Array} compressed_witness - A compressed witness.
260
- * @returns {WitnessMap} The decompressed witness map.
261
- */
262
- export function decompressWitness(compressed_witness) {
263
- try {
264
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
265
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
266
- const len0 = WASM_VECTOR_LEN;
267
- wasm.decompressWitness(retptr, ptr0, len0);
268
- var r0 = getInt32Memory0()[retptr / 4 + 0];
269
- var r1 = getInt32Memory0()[retptr / 4 + 1];
270
- var r2 = getInt32Memory0()[retptr / 4 + 2];
271
- if (r2) {
272
- throw takeObject(r1);
273
- }
274
- return takeObject(r0);
275
- } finally {
276
- wasm.__wbindgen_add_to_stack_pointer(16);
277
- }
278
- }
279
-
280
- /**
281
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
282
- *
283
- * @param {WitnessStack} witness_stack - A witness stack.
284
- * @returns {Uint8Array} A compressed witness stack
285
- */
286
- export function compressWitnessStack(witness_stack) {
287
- try {
288
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
289
- wasm.compressWitnessStack(retptr, addHeapObject(witness_stack));
290
- var r0 = getInt32Memory0()[retptr / 4 + 0];
291
- var r1 = getInt32Memory0()[retptr / 4 + 1];
292
- var r2 = getInt32Memory0()[retptr / 4 + 2];
293
- var r3 = getInt32Memory0()[retptr / 4 + 3];
294
- if (r3) {
295
- throw takeObject(r2);
296
- }
297
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
298
- wasm.__wbindgen_free(r0, r1 * 1);
299
- return v1;
300
- } finally {
301
- wasm.__wbindgen_add_to_stack_pointer(16);
302
- }
303
- }
304
-
305
- /**
306
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
307
- *
308
- * @param {Uint8Array} compressed_witness - A compressed witness.
309
- * @returns {WitnessStack} The decompressed witness stack.
310
- */
311
- export function decompressWitnessStack(compressed_witness) {
312
- try {
313
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
314
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
315
- const len0 = WASM_VECTOR_LEN;
316
- wasm.decompressWitnessStack(retptr, ptr0, len0);
317
- var r0 = getInt32Memory0()[retptr / 4 + 0];
318
- var r1 = getInt32Memory0()[retptr / 4 + 1];
319
- var r2 = getInt32Memory0()[retptr / 4 + 2];
320
- if (r2) {
321
- throw takeObject(r1);
322
- }
323
- return takeObject(r0);
324
- } finally {
325
- wasm.__wbindgen_add_to_stack_pointer(16);
326
- }
327
- }
328
-
329
- /**
330
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
331
- *
332
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
333
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
334
- * @returns {WitnessMap} A witness map containing the circuit's return values.
335
- * @param {Uint8Array} program
336
- * @param {WitnessMap} witness_map
337
- * @returns {WitnessMap}
338
- */
339
- export function getReturnWitness(program, witness_map) {
340
- try {
341
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
342
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
343
- const len0 = WASM_VECTOR_LEN;
344
- wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
345
- var r0 = getInt32Memory0()[retptr / 4 + 0];
346
- var r1 = getInt32Memory0()[retptr / 4 + 1];
347
- var r2 = getInt32Memory0()[retptr / 4 + 2];
348
- if (r2) {
349
- throw takeObject(r1);
350
- }
351
- return takeObject(r0);
352
- } finally {
353
- wasm.__wbindgen_add_to_stack_pointer(16);
354
- }
355
- }
356
-
357
- /**
358
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
359
- *
360
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
361
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
362
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
363
- * @param {Uint8Array} program
364
- * @param {WitnessMap} solved_witness
365
- * @returns {WitnessMap}
366
- */
367
- export function getPublicParametersWitness(program, solved_witness) {
368
- try {
369
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
370
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
371
- const len0 = WASM_VECTOR_LEN;
372
- wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
373
- var r0 = getInt32Memory0()[retptr / 4 + 0];
374
- var r1 = getInt32Memory0()[retptr / 4 + 1];
375
- var r2 = getInt32Memory0()[retptr / 4 + 2];
376
- if (r2) {
377
- throw takeObject(r1);
378
- }
379
- return takeObject(r0);
380
- } finally {
381
- wasm.__wbindgen_add_to_stack_pointer(16);
382
- }
383
- }
384
-
385
- /**
386
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
387
- *
388
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
389
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
390
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
391
- * @param {Uint8Array} program
392
- * @param {WitnessMap} solved_witness
393
- * @returns {WitnessMap}
394
- */
395
- export function getPublicWitness(program, solved_witness) {
396
- try {
397
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
398
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
399
- const len0 = WASM_VECTOR_LEN;
400
- wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
401
- var r0 = getInt32Memory0()[retptr / 4 + 0];
402
- var r1 = getInt32Memory0()[retptr / 4 + 1];
403
- var r2 = getInt32Memory0()[retptr / 4 + 2];
404
- if (r2) {
405
- throw takeObject(r1);
406
- }
407
- return takeObject(r0);
408
- } finally {
409
- wasm.__wbindgen_add_to_stack_pointer(16);
410
- }
411
- }
412
-
413
220
  /**
414
221
  * Performs a bitwise AND operation between `lhs` and `rhs`
415
222
  * @param {string} lhs
@@ -432,6 +239,17 @@ export function xor(lhs, rhs) {
432
239
  return takeObject(ret);
433
240
  }
434
241
 
242
+ function passArray8ToWasm0(arg, malloc) {
243
+ const ptr = malloc(arg.length * 1) >>> 0;
244
+ getUint8Memory0().set(arg, ptr / 1);
245
+ WASM_VECTOR_LEN = arg.length;
246
+ return ptr;
247
+ }
248
+
249
+ function getArrayU8FromWasm0(ptr, len) {
250
+ ptr = ptr >>> 0;
251
+ return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
252
+ }
435
253
  /**
436
254
  * Calculates the SHA256 hash of the input bytes
437
255
  * @param {Uint8Array} inputs
@@ -576,11 +394,11 @@ function _assertClass(instance, klass) {
576
394
  * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
577
395
  * @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.
578
396
  */
579
- export function executeCircuitWithReturnWitness(solver, program, initial_witness, foreign_call_handler) {
580
- _assertClass(solver, WasmBlackBoxFunctionSolver);
397
+ export function executeCircuitWithReturnWitness(_solver, program, initial_witness, foreign_call_handler) {
398
+ _assertClass(_solver, WasmBlackBoxFunctionSolver);
581
399
  const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
582
400
  const len0 = WASM_VECTOR_LEN;
583
- const ret = wasm.executeCircuitWithReturnWitness(solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
401
+ const ret = wasm.executeCircuitWithReturnWitness(_solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
584
402
  return takeObject(ret);
585
403
  }
586
404
 
@@ -593,11 +411,11 @@ export function executeCircuitWithReturnWitness(solver, program, initial_witness
593
411
  * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
594
412
  * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
595
413
  */
596
- export function executeCircuitWithBlackBoxSolver(solver, program, initial_witness, foreign_call_handler) {
597
- _assertClass(solver, WasmBlackBoxFunctionSolver);
414
+ export function executeCircuitWithBlackBoxSolver(_solver, program, initial_witness, foreign_call_handler) {
415
+ _assertClass(_solver, WasmBlackBoxFunctionSolver);
598
416
  const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
599
417
  const len0 = WASM_VECTOR_LEN;
600
- const ret = wasm.executeCircuitWithBlackBoxSolver(solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
418
+ const ret = wasm.executeCircuitWithBlackBoxSolver(_solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
601
419
  return takeObject(ret);
602
420
  }
603
421
 
@@ -612,11 +430,11 @@ export function executeProgram(program, initial_witness, foreign_call_handler) {
612
430
 
613
431
  /**
614
432
  */
615
- export function executeProgramWithBlackBoxSolver(solver, program, initial_witness, foreign_call_executor) {
616
- _assertClass(solver, WasmBlackBoxFunctionSolver);
433
+ export function executeProgramWithBlackBoxSolver(_solver, program, initial_witness, foreign_call_executor) {
434
+ _assertClass(_solver, WasmBlackBoxFunctionSolver);
617
435
  const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
618
436
  const len0 = WASM_VECTOR_LEN;
619
- const ret = wasm.executeProgramWithBlackBoxSolver(solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_executor));
437
+ const ret = wasm.executeProgramWithBlackBoxSolver(_solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_executor));
620
438
  return takeObject(ret);
621
439
  }
622
440
 
@@ -650,6 +468,189 @@ export function buildInfo() {
650
468
  return takeObject(ret);
651
469
  }
652
470
 
471
+ /**
472
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
473
+ *
474
+ * @param {WitnessMap} witness_map - A witness map.
475
+ * @returns {Uint8Array} A compressed witness map
476
+ */
477
+ export function compressWitness(witness_map) {
478
+ try {
479
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
480
+ wasm.compressWitness(retptr, addHeapObject(witness_map));
481
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
482
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
483
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
484
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
485
+ if (r3) {
486
+ throw takeObject(r2);
487
+ }
488
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
489
+ wasm.__wbindgen_free(r0, r1 * 1);
490
+ return v1;
491
+ } finally {
492
+ wasm.__wbindgen_add_to_stack_pointer(16);
493
+ }
494
+ }
495
+
496
+ /**
497
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
498
+ * This should be used to only fetch the witness map for the main function.
499
+ *
500
+ * @param {Uint8Array} compressed_witness - A compressed witness.
501
+ * @returns {WitnessMap} The decompressed witness map.
502
+ */
503
+ export function decompressWitness(compressed_witness) {
504
+ try {
505
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
506
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
507
+ const len0 = WASM_VECTOR_LEN;
508
+ wasm.decompressWitness(retptr, ptr0, len0);
509
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
510
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
511
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
512
+ if (r2) {
513
+ throw takeObject(r1);
514
+ }
515
+ return takeObject(r0);
516
+ } finally {
517
+ wasm.__wbindgen_add_to_stack_pointer(16);
518
+ }
519
+ }
520
+
521
+ /**
522
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
523
+ *
524
+ * @param {WitnessStack} witness_stack - A witness stack.
525
+ * @returns {Uint8Array} A compressed witness stack
526
+ */
527
+ export function compressWitnessStack(witness_stack) {
528
+ try {
529
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
530
+ wasm.compressWitnessStack(retptr, addHeapObject(witness_stack));
531
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
532
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
533
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
534
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
535
+ if (r3) {
536
+ throw takeObject(r2);
537
+ }
538
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
539
+ wasm.__wbindgen_free(r0, r1 * 1);
540
+ return v1;
541
+ } finally {
542
+ wasm.__wbindgen_add_to_stack_pointer(16);
543
+ }
544
+ }
545
+
546
+ /**
547
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
548
+ *
549
+ * @param {Uint8Array} compressed_witness - A compressed witness.
550
+ * @returns {WitnessStack} The decompressed witness stack.
551
+ */
552
+ export function decompressWitnessStack(compressed_witness) {
553
+ try {
554
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
555
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
556
+ const len0 = WASM_VECTOR_LEN;
557
+ wasm.decompressWitnessStack(retptr, ptr0, len0);
558
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
559
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
560
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
561
+ if (r2) {
562
+ throw takeObject(r1);
563
+ }
564
+ return takeObject(r0);
565
+ } finally {
566
+ wasm.__wbindgen_add_to_stack_pointer(16);
567
+ }
568
+ }
569
+
570
+ /**
571
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
572
+ *
573
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
574
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
575
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
576
+ * @param {Uint8Array} program
577
+ * @param {WitnessMap} witness_map
578
+ * @returns {WitnessMap}
579
+ */
580
+ export function getReturnWitness(program, witness_map) {
581
+ try {
582
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
583
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
584
+ const len0 = WASM_VECTOR_LEN;
585
+ wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
586
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
587
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
588
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
589
+ if (r2) {
590
+ throw takeObject(r1);
591
+ }
592
+ return takeObject(r0);
593
+ } finally {
594
+ wasm.__wbindgen_add_to_stack_pointer(16);
595
+ }
596
+ }
597
+
598
+ /**
599
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
600
+ *
601
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
602
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
603
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
604
+ * @param {Uint8Array} program
605
+ * @param {WitnessMap} solved_witness
606
+ * @returns {WitnessMap}
607
+ */
608
+ export function getPublicParametersWitness(program, solved_witness) {
609
+ try {
610
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
611
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
612
+ const len0 = WASM_VECTOR_LEN;
613
+ wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
614
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
615
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
616
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
617
+ if (r2) {
618
+ throw takeObject(r1);
619
+ }
620
+ return takeObject(r0);
621
+ } finally {
622
+ wasm.__wbindgen_add_to_stack_pointer(16);
623
+ }
624
+ }
625
+
626
+ /**
627
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
628
+ *
629
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
630
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
631
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
632
+ * @param {Uint8Array} program
633
+ * @param {WitnessMap} solved_witness
634
+ * @returns {WitnessMap}
635
+ */
636
+ export function getPublicWitness(program, solved_witness) {
637
+ try {
638
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
639
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
640
+ const len0 = WASM_VECTOR_LEN;
641
+ wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
642
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
643
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
644
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
645
+ if (r2) {
646
+ throw takeObject(r1);
647
+ }
648
+ return takeObject(r0);
649
+ } finally {
650
+ wasm.__wbindgen_add_to_stack_pointer(16);
651
+ }
652
+ }
653
+
653
654
  function __wbg_adapter_81(arg0, arg1, arg2, arg3, arg4) {
654
655
  wasm.wasm_bindgen__convert__closures__invoke3_mut__h629417323d5efbaa(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
655
656
  }
@@ -724,34 +725,18 @@ async function __wbg_load(module, imports) {
724
725
  function __wbg_get_imports() {
725
726
  const imports = {};
726
727
  imports.wbg = {};
727
- imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
728
- const obj = getObject(arg1);
729
- const ret = typeof(obj) === 'number' ? obj : undefined;
730
- getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
731
- getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
732
- };
733
728
  imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
734
729
  takeObject(arg0);
735
730
  };
736
- imports.wbg.__wbg_new_6f6c75f9324b78e8 = function() {
737
- const ret = new Map();
738
- return addHeapObject(ret);
739
- };
740
- imports.wbg.__wbindgen_number_new = function(arg0) {
741
- const ret = arg0;
742
- return addHeapObject(ret);
743
- };
744
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
745
- const ret = getStringFromWasm0(arg0, arg1);
731
+ imports.wbg.__wbg_wasmblackboxfunctionsolver_new = function(arg0) {
732
+ const ret = WasmBlackBoxFunctionSolver.__wrap(arg0);
746
733
  return addHeapObject(ret);
747
734
  };
748
- imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
735
+ imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
749
736
  const obj = getObject(arg1);
750
- const ret = typeof(obj) === 'string' ? obj : undefined;
751
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
752
- var len1 = WASM_VECTOR_LEN;
753
- getInt32Memory0()[arg0 / 4 + 1] = len1;
754
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
737
+ const ret = typeof(obj) === 'number' ? obj : undefined;
738
+ getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
739
+ getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
755
740
  };
756
741
  imports.wbg.__wbindgen_cb_drop = function(arg0) {
757
742
  const obj = takeObject(arg0).original;
@@ -762,10 +747,6 @@ function __wbg_get_imports() {
762
747
  const ret = false;
763
748
  return ret;
764
749
  };
765
- imports.wbg.__wbg_wasmblackboxfunctionsolver_new = function(arg0) {
766
- const ret = WasmBlackBoxFunctionSolver.__wrap(arg0);
767
- return addHeapObject(ret);
768
- };
769
750
  imports.wbg.__wbindgen_is_array = function(arg0) {
770
751
  const ret = Array.isArray(getObject(arg0));
771
752
  return ret;
@@ -778,6 +759,26 @@ function __wbg_get_imports() {
778
759
  const ret = new Error(takeObject(arg0));
779
760
  return addHeapObject(ret);
780
761
  };
762
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
763
+ const ret = getStringFromWasm0(arg0, arg1);
764
+ return addHeapObject(ret);
765
+ };
766
+ imports.wbg.__wbg_new_6f6c75f9324b78e8 = function() {
767
+ const ret = new Map();
768
+ return addHeapObject(ret);
769
+ };
770
+ imports.wbg.__wbindgen_number_new = function(arg0) {
771
+ const ret = arg0;
772
+ return addHeapObject(ret);
773
+ };
774
+ imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
775
+ const obj = getObject(arg1);
776
+ const ret = typeof(obj) === 'string' ? obj : undefined;
777
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
778
+ var len1 = WASM_VECTOR_LEN;
779
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
780
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
781
+ };
781
782
  imports.wbg.__wbg_new_ee5ac63ff3b0fa4d = function() {
782
783
  const ret = new Array();
783
784
  return addHeapObject(ret);
@@ -965,7 +966,7 @@ function __wbg_get_imports() {
965
966
  imports.wbg.__wbindgen_throw = function(arg0, arg1) {
966
967
  throw new Error(getStringFromWasm0(arg0, arg1));
967
968
  };
968
- imports.wbg.__wbindgen_closure_wrapper491 = function(arg0, arg1, arg2) {
969
+ imports.wbg.__wbindgen_closure_wrapper493 = function(arg0, arg1, arg2) {
969
970
  const ret = makeMutClosure(arg0, arg1, 201, __wbg_adapter_22);
970
971
  return addHeapObject(ret);
971
972
  };
Binary file
@@ -1,13 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
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 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;
11
4
  export function and(a: number, b: number): number;
12
5
  export function xor(a: number, b: number): number;
13
6
  export function sha256(a: number, b: number, c: number): void;
@@ -24,6 +17,13 @@ export function executeProgram(a: number, b: number, c: number, d: number): numb
24
17
  export function executeProgramWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number;
25
18
  export function initLogLevel(a: number, b: number, c: number): void;
26
19
  export function buildInfo(): number;
20
+ export function compressWitness(a: number, b: number): void;
21
+ export function decompressWitness(a: number, b: number, c: number): void;
22
+ export function compressWitnessStack(a: number, b: number): void;
23
+ export function decompressWitnessStack(a: number, b: number, c: number): void;
24
+ export function getReturnWitness(a: number, b: number, c: number, d: number): void;
25
+ export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
26
+ export function getPublicWitness(a: number, b: number, c: number, d: number): void;
27
27
  export function __wbindgen_malloc(a: number): number;
28
28
  export function __wbindgen_realloc(a: number, b: number, c: number): number;
29
29
  export const __wbindgen_export_2: WebAssembly.Table;