@noir-lang/acvm_js 0.49.0 → 0.50.0-19eef30.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.
@@ -1,17 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * Returns the `BuildInfo` object containing information about how the installed package was built.
5
- * @returns {BuildInfo} - Information on how the installed package was built.
6
- */
7
- export function buildInfo(): BuildInfo;
8
- /**
9
- * Sets the package's logging level.
10
- *
11
- * @param {LogLevel} level - The maximum level of logging to be emitted.
12
- */
13
- export function initLogLevel(filter: string): void;
14
- /**
15
4
  * Performs a bitwise AND operation between `lhs` and `rhs`
16
5
  * @param {string} lhs
17
6
  * @param {string} rhs
@@ -62,34 +51,6 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
62
51
  */
63
52
  export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
64
53
  /**
65
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
66
- *
67
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
68
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
69
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
70
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
71
- */
72
- export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
73
- /**
74
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
75
- * This method also extracts the public return values from the solved witness into its own return witness.
76
- *
77
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
78
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
79
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
80
- * @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.
81
- */
82
- export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
83
- /**
84
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
85
- *
86
- * @param {Uint8Array} program - A serialized representation of an ACIR program
87
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
88
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
89
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
90
- */
91
- export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
92
- /**
93
54
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
94
55
  *
95
56
  * @param {WitnessMap} witness_map - A witness map.
@@ -119,6 +80,17 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
119
80
  */
120
81
  export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
121
82
  /**
83
+ * Sets the package's logging level.
84
+ *
85
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
86
+ */
87
+ export function initLogLevel(filter: string): void;
88
+ /**
89
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
90
+ * @returns {BuildInfo} - Information on how the installed package was built.
91
+ */
92
+ export function buildInfo(): BuildInfo;
93
+ /**
122
94
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
123
95
  *
124
96
  * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
@@ -151,6 +123,34 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
151
123
  * @returns {WitnessMap}
152
124
  */
153
125
  export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
126
+ /**
127
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
128
+ *
129
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
130
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
131
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
132
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
133
+ */
134
+ export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
135
+ /**
136
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
137
+ * This method also extracts the public return values from the solved witness into its own return witness.
138
+ *
139
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
140
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
141
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
142
+ * @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.
143
+ */
144
+ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
145
+ /**
146
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
147
+ *
148
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
149
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
150
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
151
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
152
+ */
153
+ export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
154
154
 
155
155
  export type ForeignCallInput = string[]
156
156
  export type ForeignCallOutput = string | string[]
@@ -166,12 +166,18 @@ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => P
166
166
 
167
167
 
168
168
 
169
- export type StackItem = {
170
- index: number;
171
- witness: WitnessMap;
172
- }
169
+ // Map from witness index to hex string value of witness.
170
+ export type WitnessMap = Map<number, string>;
173
171
 
174
- export type WitnessStack = Array<StackItem>;
172
+ /**
173
+ * An execution result containing two witnesses.
174
+ * 1. The full solved witness of the execution.
175
+ * 2. The return witness which contains the given public return values within the full witness.
176
+ */
177
+ export type SolvedAndReturnWitness = {
178
+ solvedWitness: WitnessMap;
179
+ returnWitness: WitnessMap;
180
+ }
175
181
 
176
182
 
177
183
 
@@ -193,24 +199,20 @@ export type RawAssertionPayload = {
193
199
  selector: string;
194
200
  data: string[];
195
201
  };
202
+
196
203
  export type ExecutionError = Error & {
197
204
  callStack?: string[];
198
205
  rawAssertionPayload?: RawAssertionPayload;
206
+ brilligFunctionId?: number;
199
207
  };
200
208
 
201
209
 
202
210
 
203
- // Map from witness index to hex string value of witness.
204
- export type WitnessMap = Map<number, string>;
205
-
206
- /**
207
- * An execution result containing two witnesses.
208
- * 1. The full solved witness of the execution.
209
- * 2. The return witness which contains the given public return values within the full witness.
210
- */
211
- export type SolvedAndReturnWitness = {
212
- solvedWitness: WitnessMap;
213
- returnWitness: WitnessMap;
211
+ export type StackItem = {
212
+ index: number;
213
+ witness: WitnessMap;
214
214
  }
215
215
 
216
+ export type WitnessStack = Array<StackItem>;
217
+
216
218
 
package/nodejs/acvm_js.js CHANGED
@@ -9,20 +9,6 @@ heap.push(undefined, null, true, false);
9
9
 
10
10
  function getObject(idx) { return heap[idx]; }
11
11
 
12
- let heap_next = heap.length;
13
-
14
- function dropObject(idx) {
15
- if (idx < 132) return;
16
- heap[idx] = heap_next;
17
- heap_next = idx;
18
- }
19
-
20
- function takeObject(idx) {
21
- const ret = getObject(idx);
22
- dropObject(idx);
23
- return ret;
24
- }
25
-
26
12
  function isLikeNone(x) {
27
13
  return x === undefined || x === null;
28
14
  }
@@ -45,6 +31,20 @@ function getInt32Memory0() {
45
31
  return cachedInt32Memory0;
46
32
  }
47
33
 
34
+ let heap_next = heap.length;
35
+
36
+ function dropObject(idx) {
37
+ if (idx < 132) return;
38
+ heap[idx] = heap_next;
39
+ heap_next = idx;
40
+ }
41
+
42
+ function takeObject(idx) {
43
+ const ret = getObject(idx);
44
+ dropObject(idx);
45
+ return ret;
46
+ }
47
+
48
48
  function addHeapObject(obj) {
49
49
  if (heap_next === heap.length) heap.push(heap.length + 1);
50
50
  const idx = heap_next;
@@ -217,39 +217,9 @@ function makeMutClosure(arg0, arg1, dtor, f) {
217
217
  return real;
218
218
  }
219
219
  function __wbg_adapter_22(arg0, arg1, arg2) {
220
- wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h36bac5ff3ea3c380(arg0, arg1, addHeapObject(arg2));
220
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h21c8ca3eb6ab9385(arg0, arg1, addHeapObject(arg2));
221
221
  }
222
222
 
223
- /**
224
- * Returns the `BuildInfo` object containing information about how the installed package was built.
225
- * @returns {BuildInfo} - Information on how the installed package was built.
226
- */
227
- module.exports.buildInfo = function() {
228
- const ret = wasm.buildInfo();
229
- return takeObject(ret);
230
- };
231
-
232
- /**
233
- * Sets the package's logging level.
234
- *
235
- * @param {LogLevel} level - The maximum level of logging to be emitted.
236
- */
237
- module.exports.initLogLevel = function(filter) {
238
- try {
239
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
240
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
241
- const len0 = WASM_VECTOR_LEN;
242
- wasm.initLogLevel(retptr, ptr0, len0);
243
- var r0 = getInt32Memory0()[retptr / 4 + 0];
244
- var r1 = getInt32Memory0()[retptr / 4 + 1];
245
- if (r1) {
246
- throw takeObject(r0);
247
- }
248
- } finally {
249
- wasm.__wbindgen_add_to_stack_pointer(16);
250
- }
251
- };
252
-
253
223
  /**
254
224
  * Performs a bitwise AND operation between `lhs` and `rhs`
255
225
  * @param {string} lhs
@@ -388,52 +358,6 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
388
358
  return ret !== 0;
389
359
  };
390
360
 
391
- /**
392
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
393
- *
394
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
395
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
396
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
397
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
398
- */
399
- module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
400
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
401
- const len0 = WASM_VECTOR_LEN;
402
- const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
403
- return takeObject(ret);
404
- };
405
-
406
- /**
407
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
408
- * This method also extracts the public return values from the solved witness into its own return witness.
409
- *
410
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
411
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
412
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
413
- * @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.
414
- */
415
- module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
416
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
417
- const len0 = WASM_VECTOR_LEN;
418
- const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
419
- return takeObject(ret);
420
- };
421
-
422
- /**
423
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
424
- *
425
- * @param {Uint8Array} program - A serialized representation of an ACIR program
426
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
427
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
428
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
429
- */
430
- module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
431
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
432
- const len0 = WASM_VECTOR_LEN;
433
- const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
434
- return takeObject(ret);
435
- };
436
-
437
361
  /**
438
362
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
439
363
  *
@@ -533,6 +457,36 @@ module.exports.decompressWitnessStack = function(compressed_witness) {
533
457
  }
534
458
  };
535
459
 
460
+ /**
461
+ * Sets the package's logging level.
462
+ *
463
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
464
+ */
465
+ module.exports.initLogLevel = function(filter) {
466
+ try {
467
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
468
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
469
+ const len0 = WASM_VECTOR_LEN;
470
+ wasm.initLogLevel(retptr, ptr0, len0);
471
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
472
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
473
+ if (r1) {
474
+ throw takeObject(r0);
475
+ }
476
+ } finally {
477
+ wasm.__wbindgen_add_to_stack_pointer(16);
478
+ }
479
+ };
480
+
481
+ /**
482
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
483
+ * @returns {BuildInfo} - Information on how the installed package was built.
484
+ */
485
+ module.exports.buildInfo = function() {
486
+ const ret = wasm.buildInfo();
487
+ return takeObject(ret);
488
+ };
489
+
536
490
  /**
537
491
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
538
492
  *
@@ -617,8 +571,54 @@ module.exports.getPublicWitness = function(program, solved_witness) {
617
571
  }
618
572
  };
619
573
 
574
+ /**
575
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
576
+ *
577
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
578
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
579
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
580
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
581
+ */
582
+ module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
583
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
584
+ const len0 = WASM_VECTOR_LEN;
585
+ const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
586
+ return takeObject(ret);
587
+ };
588
+
589
+ /**
590
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
591
+ * This method also extracts the public return values from the solved witness into its own return witness.
592
+ *
593
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
594
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
595
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
596
+ * @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.
597
+ */
598
+ module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
599
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
600
+ const len0 = WASM_VECTOR_LEN;
601
+ const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
602
+ return takeObject(ret);
603
+ };
604
+
605
+ /**
606
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
607
+ *
608
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
609
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
610
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
611
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
612
+ */
613
+ module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
614
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
615
+ const len0 = WASM_VECTOR_LEN;
616
+ const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
617
+ return takeObject(ret);
618
+ };
619
+
620
620
  function __wbg_adapter_76(arg0, arg1, arg2, arg3, arg4) {
621
- wasm.wasm_bindgen__convert__closures__invoke3_mut__h629417323d5efbaa(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
621
+ wasm.wasm_bindgen__convert__closures__invoke3_mut__h17fc532521b46256(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
622
622
  }
623
623
 
624
624
  function handleError(f, args) {
@@ -629,9 +629,20 @@ function handleError(f, args) {
629
629
  }
630
630
  }
631
631
  function __wbg_adapter_93(arg0, arg1, arg2, arg3) {
632
- wasm.wasm_bindgen__convert__closures__invoke2_mut__h4efdd1050cfb3ea7(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
632
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h0d187b0f08495587(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
633
633
  }
634
634
 
635
+ module.exports.__wbindgen_number_get = function(arg0, arg1) {
636
+ const obj = getObject(arg1);
637
+ const ret = typeof(obj) === 'number' ? obj : undefined;
638
+ getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
639
+ getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
640
+ };
641
+
642
+ module.exports.__wbindgen_object_drop_ref = function(arg0) {
643
+ takeObject(arg0);
644
+ };
645
+
635
646
  module.exports.__wbindgen_cb_drop = function(arg0) {
636
647
  const obj = takeObject(arg0).original;
637
648
  if (obj.cnt-- == 1) {
@@ -642,29 +653,8 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
642
653
  return ret;
643
654
  };
644
655
 
645
- module.exports.__wbindgen_object_drop_ref = function(arg0) {
646
- takeObject(arg0);
647
- };
648
-
649
- module.exports.__wbindgen_is_string = function(arg0) {
650
- const ret = typeof(getObject(arg0)) === 'string';
651
- return ret;
652
- };
653
-
654
- module.exports.__wbindgen_is_array = function(arg0) {
655
- const ret = Array.isArray(getObject(arg0));
656
- return ret;
657
- };
658
-
659
- module.exports.__wbindgen_number_get = function(arg0, arg1) {
660
- const obj = getObject(arg1);
661
- const ret = typeof(obj) === 'number' ? obj : undefined;
662
- getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
663
- getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
664
- };
665
-
666
- module.exports.__wbg_new_baa0339c0c5c310a = function() {
667
- const ret = new Array();
656
+ module.exports.__wbg_new_7c63fcfa4f1f863b = function() {
657
+ const ret = new Map();
668
658
  return addHeapObject(ret);
669
659
  };
670
660
 
@@ -678,16 +668,6 @@ module.exports.__wbindgen_string_new = function(arg0, arg1) {
678
668
  return addHeapObject(ret);
679
669
  };
680
670
 
681
- module.exports.__wbg_constructor_9e0f49809a0dd2f4 = function(arg0) {
682
- const ret = new Error(takeObject(arg0));
683
- return addHeapObject(ret);
684
- };
685
-
686
- module.exports.__wbg_new_cd95aa9a75b6fbe6 = function() {
687
- const ret = new Map();
688
- return addHeapObject(ret);
689
- };
690
-
691
671
  module.exports.__wbindgen_string_get = function(arg0, arg1) {
692
672
  const obj = getObject(arg1);
693
673
  const ret = typeof(obj) === 'string' ? obj : undefined;
@@ -697,6 +677,26 @@ module.exports.__wbindgen_string_get = function(arg0, arg1) {
697
677
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
698
678
  };
699
679
 
680
+ module.exports.__wbg_constructor_cd1bce44c75e1104 = function(arg0) {
681
+ const ret = new Error(takeObject(arg0));
682
+ return addHeapObject(ret);
683
+ };
684
+
685
+ module.exports.__wbg_new_76b464e4772843b0 = function() {
686
+ const ret = new Array();
687
+ return addHeapObject(ret);
688
+ };
689
+
690
+ module.exports.__wbindgen_is_array = function(arg0) {
691
+ const ret = Array.isArray(getObject(arg0));
692
+ return ret;
693
+ };
694
+
695
+ module.exports.__wbindgen_is_string = function(arg0) {
696
+ const ret = typeof(getObject(arg0)) === 'string';
697
+ return ret;
698
+ };
699
+
700
700
  module.exports.__wbg_new_abda76e883ba8a5f = function() {
701
701
  const ret = new Error();
702
702
  return addHeapObject(ret);
@@ -915,8 +915,8 @@ module.exports.__wbindgen_throw = function(arg0, arg1) {
915
915
  throw new Error(getStringFromWasm0(arg0, arg1));
916
916
  };
917
917
 
918
- module.exports.__wbindgen_closure_wrapper734 = function(arg0, arg1, arg2) {
919
- const ret = makeMutClosure(arg0, arg1, 256, __wbg_adapter_22);
918
+ module.exports.__wbindgen_closure_wrapper747 = function(arg0, arg1, arg2) {
919
+ const ret = makeMutClosure(arg0, arg1, 265, __wbg_adapter_22);
920
920
  return addHeapObject(ret);
921
921
  };
922
922
 
Binary file
@@ -1,8 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export function buildInfo(): number;
5
- export function initLogLevel(a: number, b: number, c: number): void;
6
4
  export function and(a: number, b: number): number;
7
5
  export function xor(a: number, b: number): number;
8
6
  export function sha256(a: number, b: number, c: number): void;
@@ -10,22 +8,24 @@ export function blake2s256(a: number, b: number, c: number): void;
10
8
  export function keccak256(a: number, b: number, c: number): void;
11
9
  export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
12
10
  export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
13
- export function executeCircuit(a: number, b: number, c: number, d: number): number;
14
- export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
15
- export function executeProgram(a: number, b: number, c: number, d: number): number;
16
11
  export function compressWitness(a: number, b: number): void;
17
12
  export function decompressWitness(a: number, b: number, c: number): void;
18
13
  export function compressWitnessStack(a: number, b: number): void;
19
14
  export function decompressWitnessStack(a: number, b: number, c: number): void;
15
+ export function initLogLevel(a: number, b: number, c: number): void;
16
+ export function buildInfo(): number;
20
17
  export function getReturnWitness(a: number, b: number, c: number, d: number): void;
21
18
  export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
22
19
  export function getPublicWitness(a: number, b: number, c: number, d: number): void;
20
+ export function executeCircuit(a: number, b: number, c: number, d: number): number;
21
+ export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
22
+ export function executeProgram(a: number, b: number, c: number, d: number): number;
23
23
  export function __wbindgen_malloc(a: number): number;
24
24
  export function __wbindgen_realloc(a: number, b: number, c: number): number;
25
25
  export const __wbindgen_export_2: WebAssembly.Table;
26
- export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h36bac5ff3ea3c380(a: number, b: number, c: number): void;
26
+ 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;
27
27
  export function __wbindgen_add_to_stack_pointer(a: number): number;
28
28
  export function __wbindgen_free(a: number, b: number): void;
29
- export function wasm_bindgen__convert__closures__invoke3_mut__h629417323d5efbaa(a: number, b: number, c: number, d: number, e: number): void;
29
+ export function wasm_bindgen__convert__closures__invoke3_mut__h17fc532521b46256(a: number, b: number, c: number, d: number, e: number): void;
30
30
  export function __wbindgen_exn_store(a: number): void;
31
- export function wasm_bindgen__convert__closures__invoke2_mut__h4efdd1050cfb3ea7(a: number, b: number, c: number, d: number): void;
31
+ export function wasm_bindgen__convert__closures__invoke2_mut__h0d187b0f08495587(a: number, b: number, c: number, d: number): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noir-lang/acvm_js",
3
- "version": "0.49.0",
3
+ "version": "0.50.0-19eef30.nightly",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/web/acvm_js.d.ts CHANGED
@@ -1,17 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * Returns the `BuildInfo` object containing information about how the installed package was built.
5
- * @returns {BuildInfo} - Information on how the installed package was built.
6
- */
7
- export function buildInfo(): BuildInfo;
8
- /**
9
- * Sets the package's logging level.
10
- *
11
- * @param {LogLevel} level - The maximum level of logging to be emitted.
12
- */
13
- export function initLogLevel(filter: string): void;
14
- /**
15
4
  * Performs a bitwise AND operation between `lhs` and `rhs`
16
5
  * @param {string} lhs
17
6
  * @param {string} rhs
@@ -62,34 +51,6 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
62
51
  */
63
52
  export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
64
53
  /**
65
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
66
- *
67
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
68
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
69
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
70
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
71
- */
72
- export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
73
- /**
74
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
75
- * This method also extracts the public return values from the solved witness into its own return witness.
76
- *
77
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
78
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
79
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
80
- * @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.
81
- */
82
- export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
83
- /**
84
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
85
- *
86
- * @param {Uint8Array} program - A serialized representation of an ACIR program
87
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
88
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
89
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
90
- */
91
- export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
92
- /**
93
54
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
94
55
  *
95
56
  * @param {WitnessMap} witness_map - A witness map.
@@ -119,6 +80,17 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
119
80
  */
120
81
  export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
121
82
  /**
83
+ * Sets the package's logging level.
84
+ *
85
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
86
+ */
87
+ export function initLogLevel(filter: string): void;
88
+ /**
89
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
90
+ * @returns {BuildInfo} - Information on how the installed package was built.
91
+ */
92
+ export function buildInfo(): BuildInfo;
93
+ /**
122
94
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
123
95
  *
124
96
  * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
@@ -151,6 +123,34 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
151
123
  * @returns {WitnessMap}
152
124
  */
153
125
  export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
126
+ /**
127
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
128
+ *
129
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
130
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
131
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
132
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
133
+ */
134
+ export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
135
+ /**
136
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
137
+ * This method also extracts the public return values from the solved witness into its own return witness.
138
+ *
139
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
140
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
141
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
142
+ * @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.
143
+ */
144
+ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
145
+ /**
146
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
147
+ *
148
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
149
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
150
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
151
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
152
+ */
153
+ export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
154
154
 
155
155
  export type ForeignCallInput = string[]
156
156
  export type ForeignCallOutput = string | string[]
@@ -166,12 +166,18 @@ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => P
166
166
 
167
167
 
168
168
 
169
- export type StackItem = {
170
- index: number;
171
- witness: WitnessMap;
172
- }
169
+ // Map from witness index to hex string value of witness.
170
+ export type WitnessMap = Map<number, string>;
173
171
 
174
- export type WitnessStack = Array<StackItem>;
172
+ /**
173
+ * An execution result containing two witnesses.
174
+ * 1. The full solved witness of the execution.
175
+ * 2. The return witness which contains the given public return values within the full witness.
176
+ */
177
+ export type SolvedAndReturnWitness = {
178
+ solvedWitness: WitnessMap;
179
+ returnWitness: WitnessMap;
180
+ }
175
181
 
176
182
 
177
183
 
@@ -193,34 +199,28 @@ export type RawAssertionPayload = {
193
199
  selector: string;
194
200
  data: string[];
195
201
  };
202
+
196
203
  export type ExecutionError = Error & {
197
204
  callStack?: string[];
198
205
  rawAssertionPayload?: RawAssertionPayload;
206
+ brilligFunctionId?: number;
199
207
  };
200
208
 
201
209
 
202
210
 
203
- // Map from witness index to hex string value of witness.
204
- export type WitnessMap = Map<number, string>;
205
-
206
- /**
207
- * An execution result containing two witnesses.
208
- * 1. The full solved witness of the execution.
209
- * 2. The return witness which contains the given public return values within the full witness.
210
- */
211
- export type SolvedAndReturnWitness = {
212
- solvedWitness: WitnessMap;
213
- returnWitness: WitnessMap;
211
+ export type StackItem = {
212
+ index: number;
213
+ witness: WitnessMap;
214
214
  }
215
215
 
216
+ export type WitnessStack = Array<StackItem>;
217
+
216
218
 
217
219
 
218
220
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
219
221
 
220
222
  export interface InitOutput {
221
223
  readonly memory: WebAssembly.Memory;
222
- readonly buildInfo: () => number;
223
- readonly initLogLevel: (a: number, b: number, c: number) => void;
224
224
  readonly and: (a: number, b: number) => number;
225
225
  readonly xor: (a: number, b: number) => number;
226
226
  readonly sha256: (a: number, b: number, c: number) => void;
@@ -228,25 +228,27 @@ export interface InitOutput {
228
228
  readonly keccak256: (a: number, b: number, c: number) => void;
229
229
  readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
230
230
  readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
231
- readonly executeCircuit: (a: number, b: number, c: number, d: number) => number;
232
- readonly executeCircuitWithReturnWitness: (a: number, b: number, c: number, d: number) => number;
233
- readonly executeProgram: (a: number, b: number, c: number, d: number) => number;
234
231
  readonly compressWitness: (a: number, b: number) => void;
235
232
  readonly decompressWitness: (a: number, b: number, c: number) => void;
236
233
  readonly compressWitnessStack: (a: number, b: number) => void;
237
234
  readonly decompressWitnessStack: (a: number, b: number, c: number) => void;
235
+ readonly initLogLevel: (a: number, b: number, c: number) => void;
236
+ readonly buildInfo: () => number;
238
237
  readonly getReturnWitness: (a: number, b: number, c: number, d: number) => void;
239
238
  readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void;
240
239
  readonly getPublicWitness: (a: number, b: number, c: number, d: number) => void;
240
+ readonly executeCircuit: (a: number, b: number, c: number, d: number) => number;
241
+ readonly executeCircuitWithReturnWitness: (a: number, b: number, c: number, d: number) => number;
242
+ readonly executeProgram: (a: number, b: number, c: number, d: number) => number;
241
243
  readonly __wbindgen_malloc: (a: number) => number;
242
244
  readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
243
245
  readonly __wbindgen_export_2: WebAssembly.Table;
244
- readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h36bac5ff3ea3c380: (a: number, b: number, c: number) => void;
246
+ readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h21c8ca3eb6ab9385: (a: number, b: number, c: number) => void;
245
247
  readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
246
248
  readonly __wbindgen_free: (a: number, b: number) => void;
247
- readonly wasm_bindgen__convert__closures__invoke3_mut__h629417323d5efbaa: (a: number, b: number, c: number, d: number, e: number) => void;
249
+ readonly wasm_bindgen__convert__closures__invoke3_mut__h17fc532521b46256: (a: number, b: number, c: number, d: number, e: number) => void;
248
250
  readonly __wbindgen_exn_store: (a: number) => void;
249
- readonly wasm_bindgen__convert__closures__invoke2_mut__h4efdd1050cfb3ea7: (a: number, b: number, c: number, d: number) => void;
251
+ readonly wasm_bindgen__convert__closures__invoke2_mut__h0d187b0f08495587: (a: number, b: number, c: number, d: number) => void;
250
252
  }
251
253
 
252
254
  export type SyncInitInput = BufferSource | WebAssembly.Module;
package/web/acvm_js.js CHANGED
@@ -6,20 +6,6 @@ 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
-
23
9
  function isLikeNone(x) {
24
10
  return x === undefined || x === null;
25
11
  }
@@ -42,6 +28,20 @@ function getInt32Memory0() {
42
28
  return cachedInt32Memory0;
43
29
  }
44
30
 
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
45
  function addHeapObject(obj) {
46
46
  if (heap_next === heap.length) heap.push(heap.length + 1);
47
47
  const idx = heap_next;
@@ -214,37 +214,7 @@ 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__h36bac5ff3ea3c380(arg0, arg1, addHeapObject(arg2));
218
- }
219
-
220
- /**
221
- * Returns the `BuildInfo` object containing information about how the installed package was built.
222
- * @returns {BuildInfo} - Information on how the installed package was built.
223
- */
224
- export function buildInfo() {
225
- const ret = wasm.buildInfo();
226
- return takeObject(ret);
227
- }
228
-
229
- /**
230
- * Sets the package's logging level.
231
- *
232
- * @param {LogLevel} level - The maximum level of logging to be emitted.
233
- */
234
- export function initLogLevel(filter) {
235
- try {
236
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
237
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
238
- const len0 = WASM_VECTOR_LEN;
239
- wasm.initLogLevel(retptr, ptr0, len0);
240
- var r0 = getInt32Memory0()[retptr / 4 + 0];
241
- var r1 = getInt32Memory0()[retptr / 4 + 1];
242
- if (r1) {
243
- throw takeObject(r0);
244
- }
245
- } finally {
246
- wasm.__wbindgen_add_to_stack_pointer(16);
247
- }
217
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h21c8ca3eb6ab9385(arg0, arg1, addHeapObject(arg2));
248
218
  }
249
219
 
250
220
  /**
@@ -385,52 +355,6 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
385
355
  return ret !== 0;
386
356
  }
387
357
 
388
- /**
389
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
390
- *
391
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
392
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
393
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
394
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
395
- */
396
- export function executeCircuit(program, initial_witness, foreign_call_handler) {
397
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
398
- const len0 = WASM_VECTOR_LEN;
399
- const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
400
- return takeObject(ret);
401
- }
402
-
403
- /**
404
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
405
- * This method also extracts the public return values from the solved witness into its own return witness.
406
- *
407
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
408
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
409
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
410
- * @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.
411
- */
412
- export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
413
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
414
- const len0 = WASM_VECTOR_LEN;
415
- const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
416
- return takeObject(ret);
417
- }
418
-
419
- /**
420
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
421
- *
422
- * @param {Uint8Array} program - A serialized representation of an ACIR program
423
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
424
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
425
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
426
- */
427
- export function executeProgram(program, initial_witness, foreign_call_handler) {
428
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
429
- const len0 = WASM_VECTOR_LEN;
430
- const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
431
- return takeObject(ret);
432
- }
433
-
434
358
  /**
435
359
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
436
360
  *
@@ -530,6 +454,36 @@ export function decompressWitnessStack(compressed_witness) {
530
454
  }
531
455
  }
532
456
 
457
+ /**
458
+ * Sets the package's logging level.
459
+ *
460
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
461
+ */
462
+ export function initLogLevel(filter) {
463
+ try {
464
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
465
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
466
+ const len0 = WASM_VECTOR_LEN;
467
+ wasm.initLogLevel(retptr, ptr0, len0);
468
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
469
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
470
+ if (r1) {
471
+ throw takeObject(r0);
472
+ }
473
+ } finally {
474
+ wasm.__wbindgen_add_to_stack_pointer(16);
475
+ }
476
+ }
477
+
478
+ /**
479
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
480
+ * @returns {BuildInfo} - Information on how the installed package was built.
481
+ */
482
+ export function buildInfo() {
483
+ const ret = wasm.buildInfo();
484
+ return takeObject(ret);
485
+ }
486
+
533
487
  /**
534
488
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
535
489
  *
@@ -614,8 +568,54 @@ export function getPublicWitness(program, solved_witness) {
614
568
  }
615
569
  }
616
570
 
571
+ /**
572
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
573
+ *
574
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
575
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
576
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
577
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
578
+ */
579
+ export function executeCircuit(program, initial_witness, foreign_call_handler) {
580
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
581
+ const len0 = WASM_VECTOR_LEN;
582
+ const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
583
+ return takeObject(ret);
584
+ }
585
+
586
+ /**
587
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
588
+ * This method also extracts the public return values from the solved witness into its own return witness.
589
+ *
590
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
591
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
592
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
593
+ * @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.
594
+ */
595
+ export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
596
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
597
+ const len0 = WASM_VECTOR_LEN;
598
+ const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
599
+ return takeObject(ret);
600
+ }
601
+
602
+ /**
603
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
604
+ *
605
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
606
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
607
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
608
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
609
+ */
610
+ export function executeProgram(program, initial_witness, foreign_call_handler) {
611
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
612
+ const len0 = WASM_VECTOR_LEN;
613
+ const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
614
+ return takeObject(ret);
615
+ }
616
+
617
617
  function __wbg_adapter_76(arg0, arg1, arg2, arg3, arg4) {
618
- wasm.wasm_bindgen__convert__closures__invoke3_mut__h629417323d5efbaa(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
618
+ wasm.wasm_bindgen__convert__closures__invoke3_mut__h17fc532521b46256(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
619
619
  }
620
620
 
621
621
  function handleError(f, args) {
@@ -626,7 +626,7 @@ function handleError(f, args) {
626
626
  }
627
627
  }
628
628
  function __wbg_adapter_93(arg0, arg1, arg2, arg3) {
629
- wasm.wasm_bindgen__convert__closures__invoke2_mut__h4efdd1050cfb3ea7(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
629
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h0d187b0f08495587(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
630
630
  }
631
631
 
632
632
  async function __wbg_load(module, imports) {
@@ -663,6 +663,15 @@ async function __wbg_load(module, imports) {
663
663
  function __wbg_get_imports() {
664
664
  const imports = {};
665
665
  imports.wbg = {};
666
+ imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
667
+ const obj = getObject(arg1);
668
+ const ret = typeof(obj) === 'number' ? obj : undefined;
669
+ getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
670
+ getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
671
+ };
672
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
673
+ takeObject(arg0);
674
+ };
666
675
  imports.wbg.__wbindgen_cb_drop = function(arg0) {
667
676
  const obj = takeObject(arg0).original;
668
677
  if (obj.cnt-- == 1) {
@@ -672,25 +681,8 @@ function __wbg_get_imports() {
672
681
  const ret = false;
673
682
  return ret;
674
683
  };
675
- imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
676
- takeObject(arg0);
677
- };
678
- imports.wbg.__wbindgen_is_string = function(arg0) {
679
- const ret = typeof(getObject(arg0)) === 'string';
680
- return ret;
681
- };
682
- imports.wbg.__wbindgen_is_array = function(arg0) {
683
- const ret = Array.isArray(getObject(arg0));
684
- return ret;
685
- };
686
- imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
687
- const obj = getObject(arg1);
688
- const ret = typeof(obj) === 'number' ? obj : undefined;
689
- getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
690
- getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
691
- };
692
- imports.wbg.__wbg_new_baa0339c0c5c310a = function() {
693
- const ret = new Array();
684
+ imports.wbg.__wbg_new_7c63fcfa4f1f863b = function() {
685
+ const ret = new Map();
694
686
  return addHeapObject(ret);
695
687
  };
696
688
  imports.wbg.__wbindgen_number_new = function(arg0) {
@@ -701,14 +693,6 @@ function __wbg_get_imports() {
701
693
  const ret = getStringFromWasm0(arg0, arg1);
702
694
  return addHeapObject(ret);
703
695
  };
704
- imports.wbg.__wbg_constructor_9e0f49809a0dd2f4 = function(arg0) {
705
- const ret = new Error(takeObject(arg0));
706
- return addHeapObject(ret);
707
- };
708
- imports.wbg.__wbg_new_cd95aa9a75b6fbe6 = function() {
709
- const ret = new Map();
710
- return addHeapObject(ret);
711
- };
712
696
  imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
713
697
  const obj = getObject(arg1);
714
698
  const ret = typeof(obj) === 'string' ? obj : undefined;
@@ -717,6 +701,22 @@ function __wbg_get_imports() {
717
701
  getInt32Memory0()[arg0 / 4 + 1] = len1;
718
702
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
719
703
  };
704
+ imports.wbg.__wbg_constructor_cd1bce44c75e1104 = function(arg0) {
705
+ const ret = new Error(takeObject(arg0));
706
+ return addHeapObject(ret);
707
+ };
708
+ imports.wbg.__wbg_new_76b464e4772843b0 = function() {
709
+ const ret = new Array();
710
+ return addHeapObject(ret);
711
+ };
712
+ imports.wbg.__wbindgen_is_array = function(arg0) {
713
+ const ret = Array.isArray(getObject(arg0));
714
+ return ret;
715
+ };
716
+ imports.wbg.__wbindgen_is_string = function(arg0) {
717
+ const ret = typeof(getObject(arg0)) === 'string';
718
+ return ret;
719
+ };
720
720
  imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
721
721
  const ret = new Error();
722
722
  return addHeapObject(ret);
@@ -900,8 +900,8 @@ function __wbg_get_imports() {
900
900
  imports.wbg.__wbindgen_throw = function(arg0, arg1) {
901
901
  throw new Error(getStringFromWasm0(arg0, arg1));
902
902
  };
903
- imports.wbg.__wbindgen_closure_wrapper734 = function(arg0, arg1, arg2) {
904
- const ret = makeMutClosure(arg0, arg1, 256, __wbg_adapter_22);
903
+ imports.wbg.__wbindgen_closure_wrapper747 = function(arg0, arg1, arg2) {
904
+ const ret = makeMutClosure(arg0, arg1, 265, __wbg_adapter_22);
905
905
  return addHeapObject(ret);
906
906
  };
907
907
 
Binary file
@@ -1,8 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export function buildInfo(): number;
5
- export function initLogLevel(a: number, b: number, c: number): void;
6
4
  export function and(a: number, b: number): number;
7
5
  export function xor(a: number, b: number): number;
8
6
  export function sha256(a: number, b: number, c: number): void;
@@ -10,22 +8,24 @@ export function blake2s256(a: number, b: number, c: number): void;
10
8
  export function keccak256(a: number, b: number, c: number): void;
11
9
  export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
12
10
  export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
13
- export function executeCircuit(a: number, b: number, c: number, d: number): number;
14
- export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
15
- export function executeProgram(a: number, b: number, c: number, d: number): number;
16
11
  export function compressWitness(a: number, b: number): void;
17
12
  export function decompressWitness(a: number, b: number, c: number): void;
18
13
  export function compressWitnessStack(a: number, b: number): void;
19
14
  export function decompressWitnessStack(a: number, b: number, c: number): void;
15
+ export function initLogLevel(a: number, b: number, c: number): void;
16
+ export function buildInfo(): number;
20
17
  export function getReturnWitness(a: number, b: number, c: number, d: number): void;
21
18
  export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
22
19
  export function getPublicWitness(a: number, b: number, c: number, d: number): void;
20
+ export function executeCircuit(a: number, b: number, c: number, d: number): number;
21
+ export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
22
+ export function executeProgram(a: number, b: number, c: number, d: number): number;
23
23
  export function __wbindgen_malloc(a: number): number;
24
24
  export function __wbindgen_realloc(a: number, b: number, c: number): number;
25
25
  export const __wbindgen_export_2: WebAssembly.Table;
26
- export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h36bac5ff3ea3c380(a: number, b: number, c: number): void;
26
+ 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;
27
27
  export function __wbindgen_add_to_stack_pointer(a: number): number;
28
28
  export function __wbindgen_free(a: number, b: number): void;
29
- export function wasm_bindgen__convert__closures__invoke3_mut__h629417323d5efbaa(a: number, b: number, c: number, d: number, e: number): void;
29
+ export function wasm_bindgen__convert__closures__invoke3_mut__h17fc532521b46256(a: number, b: number, c: number, d: number, e: number): void;
30
30
  export function __wbindgen_exn_store(a: number): void;
31
- export function wasm_bindgen__convert__closures__invoke2_mut__h4efdd1050cfb3ea7(a: number, b: number, c: number, d: number): void;
31
+ export function wasm_bindgen__convert__closures__invoke2_mut__h0d187b0f08495587(a: number, b: number, c: number, d: number): void;