@noir-lang/acvm_js 0.49.0-e84f7d2.nightly → 0.50.0-abcae75.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,44 +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
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
10
- *
11
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
12
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
13
- * @returns {WitnessMap} A witness map containing the circuit's return values.
14
- * @param {Uint8Array} program
15
- * @param {WitnessMap} witness_map
16
- * @returns {WitnessMap}
17
- */
18
- export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
19
- /**
20
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
21
- *
22
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
23
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
24
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
25
- * @param {Uint8Array} program
26
- * @param {WitnessMap} solved_witness
27
- * @returns {WitnessMap}
28
- */
29
- export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
30
- /**
31
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
32
- *
33
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
34
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
35
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
36
- * @param {Uint8Array} program
37
- * @param {WitnessMap} solved_witness
38
- * @returns {WitnessMap}
39
- */
40
- export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
41
- /**
42
4
  * Performs a bitwise AND operation between `lhs` and `rhs`
43
5
  * @param {string} lhs
44
6
  * @param {string} rhs
@@ -124,6 +86,44 @@ export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessS
124
86
  */
125
87
  export function initLogLevel(filter: string): void;
126
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
+ /**
94
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
95
+ *
96
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
97
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
98
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
99
+ * @param {Uint8Array} program
100
+ * @param {WitnessMap} witness_map
101
+ * @returns {WitnessMap}
102
+ */
103
+ export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
104
+ /**
105
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
106
+ *
107
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
108
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
109
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
110
+ * @param {Uint8Array} program
111
+ * @param {WitnessMap} solved_witness
112
+ * @returns {WitnessMap}
113
+ */
114
+ export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
115
+ /**
116
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
117
+ *
118
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
119
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
120
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
121
+ * @param {Uint8Array} program
122
+ * @param {WitnessMap} solved_witness
123
+ * @returns {WitnessMap}
124
+ */
125
+ export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
126
+ /**
127
127
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
128
128
  *
129
129
  * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
@@ -152,6 +152,35 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
152
152
  */
153
153
  export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
154
154
 
155
+ export type ForeignCallInput = string[]
156
+ export type ForeignCallOutput = string | string[]
157
+
158
+ /**
159
+ * A callback which performs an foreign call and returns the response.
160
+ * @callback ForeignCallHandler
161
+ * @param {string} name - The identifier for the type of foreign call being performed.
162
+ * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
163
+ * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
164
+ */
165
+ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
166
+
167
+
168
+
169
+ // Map from witness index to hex string value of witness.
170
+ export type WitnessMap = Map<number, string>;
171
+
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
+ }
181
+
182
+
183
+
155
184
  /**
156
185
  * @typedef {Object} BuildInfo - Information about how the installed package was built
157
186
  * @property {string} gitHash - The hash of the git commit from which the package was built.
@@ -187,32 +216,3 @@ export type StackItem = {
187
216
  export type WitnessStack = Array<StackItem>;
188
217
 
189
218
 
190
-
191
- // Map from witness index to hex string value of witness.
192
- export type WitnessMap = Map<number, string>;
193
-
194
- /**
195
- * An execution result containing two witnesses.
196
- * 1. The full solved witness of the execution.
197
- * 2. The return witness which contains the given public return values within the full witness.
198
- */
199
- export type SolvedAndReturnWitness = {
200
- solvedWitness: WitnessMap;
201
- returnWitness: WitnessMap;
202
- }
203
-
204
-
205
-
206
- export type ForeignCallInput = string[]
207
- export type ForeignCallOutput = string | string[]
208
-
209
- /**
210
- * A callback which performs an foreign call and returns the response.
211
- * @callback ForeignCallHandler
212
- * @param {string} name - The identifier for the type of foreign call being performed.
213
- * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
214
- * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
215
- */
216
- export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
217
-
218
-
package/nodejs/acvm_js.js CHANGED
@@ -9,6 +9,28 @@ heap.push(undefined, null, true, false);
9
9
 
10
10
  function getObject(idx) { return heap[idx]; }
11
11
 
12
+ function isLikeNone(x) {
13
+ return x === undefined || x === null;
14
+ }
15
+
16
+ let cachedFloat64Memory0 = null;
17
+
18
+ function getFloat64Memory0() {
19
+ if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
20
+ cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
21
+ }
22
+ return cachedFloat64Memory0;
23
+ }
24
+
25
+ let cachedInt32Memory0 = null;
26
+
27
+ function getInt32Memory0() {
28
+ if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
29
+ cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
30
+ }
31
+ return cachedInt32Memory0;
32
+ }
33
+
12
34
  let heap_next = heap.length;
13
35
 
14
36
  function dropObject(idx) {
@@ -23,6 +45,15 @@ function takeObject(idx) {
23
45
  return ret;
24
46
  }
25
47
 
48
+ function addHeapObject(obj) {
49
+ if (heap_next === heap.length) heap.push(heap.length + 1);
50
+ const idx = heap_next;
51
+ heap_next = heap[idx];
52
+
53
+ heap[idx] = obj;
54
+ return idx;
55
+ }
56
+
26
57
  let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
27
58
 
28
59
  cachedTextDecoder.decode();
@@ -41,37 +72,6 @@ function getStringFromWasm0(ptr, len) {
41
72
  return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
42
73
  }
43
74
 
44
- function addHeapObject(obj) {
45
- if (heap_next === heap.length) heap.push(heap.length + 1);
46
- const idx = heap_next;
47
- heap_next = heap[idx];
48
-
49
- heap[idx] = obj;
50
- return idx;
51
- }
52
-
53
- function isLikeNone(x) {
54
- return x === undefined || x === null;
55
- }
56
-
57
- let cachedFloat64Memory0 = null;
58
-
59
- function getFloat64Memory0() {
60
- if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
61
- cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
62
- }
63
- return cachedFloat64Memory0;
64
- }
65
-
66
- let cachedInt32Memory0 = null;
67
-
68
- function getInt32Memory0() {
69
- if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
70
- cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
71
- }
72
- return cachedInt32Memory0;
73
- }
74
-
75
75
  let WASM_VECTOR_LEN = 0;
76
76
 
77
77
  let cachedTextEncoder = new TextEncoder('utf-8');
@@ -220,105 +220,6 @@ function __wbg_adapter_22(arg0, arg1, arg2) {
220
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
- function passArray8ToWasm0(arg, malloc) {
233
- const ptr = malloc(arg.length * 1) >>> 0;
234
- getUint8Memory0().set(arg, ptr / 1);
235
- WASM_VECTOR_LEN = arg.length;
236
- return ptr;
237
- }
238
- /**
239
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
240
- *
241
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
242
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
243
- * @returns {WitnessMap} A witness map containing the circuit's return values.
244
- * @param {Uint8Array} program
245
- * @param {WitnessMap} witness_map
246
- * @returns {WitnessMap}
247
- */
248
- module.exports.getReturnWitness = function(program, witness_map) {
249
- try {
250
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
251
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
252
- const len0 = WASM_VECTOR_LEN;
253
- wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
254
- var r0 = getInt32Memory0()[retptr / 4 + 0];
255
- var r1 = getInt32Memory0()[retptr / 4 + 1];
256
- var r2 = getInt32Memory0()[retptr / 4 + 2];
257
- if (r2) {
258
- throw takeObject(r1);
259
- }
260
- return takeObject(r0);
261
- } finally {
262
- wasm.__wbindgen_add_to_stack_pointer(16);
263
- }
264
- };
265
-
266
- /**
267
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
268
- *
269
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
270
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
271
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
272
- * @param {Uint8Array} program
273
- * @param {WitnessMap} solved_witness
274
- * @returns {WitnessMap}
275
- */
276
- module.exports.getPublicParametersWitness = function(program, solved_witness) {
277
- try {
278
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
279
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
280
- const len0 = WASM_VECTOR_LEN;
281
- wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
282
- var r0 = getInt32Memory0()[retptr / 4 + 0];
283
- var r1 = getInt32Memory0()[retptr / 4 + 1];
284
- var r2 = getInt32Memory0()[retptr / 4 + 2];
285
- if (r2) {
286
- throw takeObject(r1);
287
- }
288
- return takeObject(r0);
289
- } finally {
290
- wasm.__wbindgen_add_to_stack_pointer(16);
291
- }
292
- };
293
-
294
- /**
295
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
296
- *
297
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
298
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
299
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
300
- * @param {Uint8Array} program
301
- * @param {WitnessMap} solved_witness
302
- * @returns {WitnessMap}
303
- */
304
- module.exports.getPublicWitness = function(program, solved_witness) {
305
- try {
306
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
307
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
308
- const len0 = WASM_VECTOR_LEN;
309
- wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
310
- var r0 = getInt32Memory0()[retptr / 4 + 0];
311
- var r1 = getInt32Memory0()[retptr / 4 + 1];
312
- var r2 = getInt32Memory0()[retptr / 4 + 2];
313
- if (r2) {
314
- throw takeObject(r1);
315
- }
316
- return takeObject(r0);
317
- } finally {
318
- wasm.__wbindgen_add_to_stack_pointer(16);
319
- }
320
- };
321
-
322
223
  /**
323
224
  * Performs a bitwise AND operation between `lhs` and `rhs`
324
225
  * @param {string} lhs
@@ -341,6 +242,13 @@ module.exports.xor = function(lhs, rhs) {
341
242
  return takeObject(ret);
342
243
  };
343
244
 
245
+ function passArray8ToWasm0(arg, malloc) {
246
+ const ptr = malloc(arg.length * 1) >>> 0;
247
+ getUint8Memory0().set(arg, ptr / 1);
248
+ WASM_VECTOR_LEN = arg.length;
249
+ return ptr;
250
+ }
251
+
344
252
  function getArrayU8FromWasm0(ptr, len) {
345
253
  ptr = ptr >>> 0;
346
254
  return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
@@ -570,6 +478,99 @@ module.exports.initLogLevel = function(filter) {
570
478
  }
571
479
  };
572
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
+
490
+ /**
491
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
492
+ *
493
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
494
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
495
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
496
+ * @param {Uint8Array} program
497
+ * @param {WitnessMap} witness_map
498
+ * @returns {WitnessMap}
499
+ */
500
+ module.exports.getReturnWitness = function(program, witness_map) {
501
+ try {
502
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
503
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
504
+ const len0 = WASM_VECTOR_LEN;
505
+ wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
506
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
507
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
508
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
509
+ if (r2) {
510
+ throw takeObject(r1);
511
+ }
512
+ return takeObject(r0);
513
+ } finally {
514
+ wasm.__wbindgen_add_to_stack_pointer(16);
515
+ }
516
+ };
517
+
518
+ /**
519
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
520
+ *
521
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
522
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
523
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
524
+ * @param {Uint8Array} program
525
+ * @param {WitnessMap} solved_witness
526
+ * @returns {WitnessMap}
527
+ */
528
+ module.exports.getPublicParametersWitness = function(program, solved_witness) {
529
+ try {
530
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
531
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
532
+ const len0 = WASM_VECTOR_LEN;
533
+ wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
534
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
535
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
536
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
537
+ if (r2) {
538
+ throw takeObject(r1);
539
+ }
540
+ return takeObject(r0);
541
+ } finally {
542
+ wasm.__wbindgen_add_to_stack_pointer(16);
543
+ }
544
+ };
545
+
546
+ /**
547
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
548
+ *
549
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
550
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
551
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
552
+ * @param {Uint8Array} program
553
+ * @param {WitnessMap} solved_witness
554
+ * @returns {WitnessMap}
555
+ */
556
+ module.exports.getPublicWitness = function(program, solved_witness) {
557
+ try {
558
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
559
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
560
+ const len0 = WASM_VECTOR_LEN;
561
+ wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
562
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
563
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
564
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
565
+ if (r2) {
566
+ throw takeObject(r1);
567
+ }
568
+ return takeObject(r0);
569
+ } finally {
570
+ wasm.__wbindgen_add_to_stack_pointer(16);
571
+ }
572
+ };
573
+
573
574
  /**
574
575
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
575
576
  *
@@ -631,6 +632,13 @@ function __wbg_adapter_93(arg0, arg1, arg2, arg3) {
631
632
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h0d187b0f08495587(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
632
633
  }
633
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
+
634
642
  module.exports.__wbindgen_object_drop_ref = function(arg0) {
635
643
  takeObject(arg0);
636
644
  };
@@ -645,18 +653,8 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
645
653
  return ret;
646
654
  };
647
655
 
648
- module.exports.__wbg_constructor_9e0f49809a0dd2f4 = function(arg0) {
649
- const ret = new Error(takeObject(arg0));
650
- return addHeapObject(ret);
651
- };
652
-
653
- module.exports.__wbindgen_string_new = function(arg0, arg1) {
654
- const ret = getStringFromWasm0(arg0, arg1);
655
- return addHeapObject(ret);
656
- };
657
-
658
- module.exports.__wbg_new_baa0339c0c5c310a = function() {
659
- const ret = new Array();
656
+ module.exports.__wbg_new_7c63fcfa4f1f863b = function() {
657
+ const ret = new Map();
660
658
  return addHeapObject(ret);
661
659
  };
662
660
 
@@ -665,15 +663,8 @@ module.exports.__wbindgen_number_new = function(arg0) {
665
663
  return addHeapObject(ret);
666
664
  };
667
665
 
668
- module.exports.__wbindgen_number_get = function(arg0, arg1) {
669
- const obj = getObject(arg1);
670
- const ret = typeof(obj) === 'number' ? obj : undefined;
671
- getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
672
- getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
673
- };
674
-
675
- module.exports.__wbg_new_cd95aa9a75b6fbe6 = function() {
676
- const ret = new Map();
666
+ module.exports.__wbindgen_string_new = function(arg0, arg1) {
667
+ const ret = getStringFromWasm0(arg0, arg1);
677
668
  return addHeapObject(ret);
678
669
  };
679
670
 
@@ -686,6 +677,16 @@ module.exports.__wbindgen_string_get = function(arg0, arg1) {
686
677
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
687
678
  };
688
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
+
689
690
  module.exports.__wbindgen_is_array = function(arg0) {
690
691
  const ret = Array.isArray(getObject(arg0));
691
692
  return ret;
@@ -914,8 +915,8 @@ module.exports.__wbindgen_throw = function(arg0, arg1) {
914
915
  throw new Error(getStringFromWasm0(arg0, arg1));
915
916
  };
916
917
 
917
- module.exports.__wbindgen_closure_wrapper740 = function(arg0, arg1, arg2) {
918
- const ret = makeMutClosure(arg0, arg1, 259, __wbg_adapter_22);
918
+ module.exports.__wbindgen_closure_wrapper747 = function(arg0, arg1, arg2) {
919
+ const ret = makeMutClosure(arg0, arg1, 265, __wbg_adapter_22);
919
920
  return addHeapObject(ret);
920
921
  };
921
922
 
Binary file
@@ -1,10 +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 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;
8
4
  export function and(a: number, b: number): number;
9
5
  export function xor(a: number, b: number): number;
10
6
  export function sha256(a: number, b: number, c: number): void;
@@ -17,6 +13,10 @@ export function decompressWitness(a: number, b: number, c: number): void;
17
13
  export function compressWitnessStack(a: number, b: number): void;
18
14
  export function decompressWitnessStack(a: number, b: number, c: number): void;
19
15
  export function initLogLevel(a: number, b: number, c: number): void;
16
+ export function buildInfo(): number;
17
+ export function getReturnWitness(a: number, b: number, c: number, d: number): void;
18
+ export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
19
+ export function getPublicWitness(a: number, b: number, c: number, d: number): void;
20
20
  export function executeCircuit(a: number, b: number, c: number, d: number): number;
21
21
  export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
22
22
  export function executeProgram(a: number, b: number, c: number, d: number): number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noir-lang/acvm_js",
3
- "version": "0.49.0-e84f7d2.nightly",
3
+ "version": "0.50.0-abcae75.nightly",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/web/acvm_js.d.ts CHANGED
@@ -1,44 +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
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
10
- *
11
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
12
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
13
- * @returns {WitnessMap} A witness map containing the circuit's return values.
14
- * @param {Uint8Array} program
15
- * @param {WitnessMap} witness_map
16
- * @returns {WitnessMap}
17
- */
18
- export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
19
- /**
20
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
21
- *
22
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
23
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
24
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
25
- * @param {Uint8Array} program
26
- * @param {WitnessMap} solved_witness
27
- * @returns {WitnessMap}
28
- */
29
- export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
30
- /**
31
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
32
- *
33
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
34
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
35
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
36
- * @param {Uint8Array} program
37
- * @param {WitnessMap} solved_witness
38
- * @returns {WitnessMap}
39
- */
40
- export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
41
- /**
42
4
  * Performs a bitwise AND operation between `lhs` and `rhs`
43
5
  * @param {string} lhs
44
6
  * @param {string} rhs
@@ -124,6 +86,44 @@ export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessS
124
86
  */
125
87
  export function initLogLevel(filter: string): void;
126
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
+ /**
94
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
95
+ *
96
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
97
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
98
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
99
+ * @param {Uint8Array} program
100
+ * @param {WitnessMap} witness_map
101
+ * @returns {WitnessMap}
102
+ */
103
+ export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
104
+ /**
105
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
106
+ *
107
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
108
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
109
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
110
+ * @param {Uint8Array} program
111
+ * @param {WitnessMap} solved_witness
112
+ * @returns {WitnessMap}
113
+ */
114
+ export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
115
+ /**
116
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
117
+ *
118
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
119
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
120
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
121
+ * @param {Uint8Array} program
122
+ * @param {WitnessMap} solved_witness
123
+ * @returns {WitnessMap}
124
+ */
125
+ export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
126
+ /**
127
127
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
128
128
  *
129
129
  * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
@@ -152,6 +152,35 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
152
152
  */
153
153
  export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
154
154
 
155
+ export type ForeignCallInput = string[]
156
+ export type ForeignCallOutput = string | string[]
157
+
158
+ /**
159
+ * A callback which performs an foreign call and returns the response.
160
+ * @callback ForeignCallHandler
161
+ * @param {string} name - The identifier for the type of foreign call being performed.
162
+ * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
163
+ * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
164
+ */
165
+ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
166
+
167
+
168
+
169
+ // Map from witness index to hex string value of witness.
170
+ export type WitnessMap = Map<number, string>;
171
+
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
+ }
181
+
182
+
183
+
155
184
  /**
156
185
  * @typedef {Object} BuildInfo - Information about how the installed package was built
157
186
  * @property {string} gitHash - The hash of the git commit from which the package was built.
@@ -188,43 +217,10 @@ export type WitnessStack = Array<StackItem>;
188
217
 
189
218
 
190
219
 
191
- // Map from witness index to hex string value of witness.
192
- export type WitnessMap = Map<number, string>;
193
-
194
- /**
195
- * An execution result containing two witnesses.
196
- * 1. The full solved witness of the execution.
197
- * 2. The return witness which contains the given public return values within the full witness.
198
- */
199
- export type SolvedAndReturnWitness = {
200
- solvedWitness: WitnessMap;
201
- returnWitness: WitnessMap;
202
- }
203
-
204
-
205
-
206
- export type ForeignCallInput = string[]
207
- export type ForeignCallOutput = string | string[]
208
-
209
- /**
210
- * A callback which performs an foreign call and returns the response.
211
- * @callback ForeignCallHandler
212
- * @param {string} name - The identifier for the type of foreign call being performed.
213
- * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
214
- * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
215
- */
216
- export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
217
-
218
-
219
-
220
220
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
221
221
 
222
222
  export interface InitOutput {
223
223
  readonly memory: WebAssembly.Memory;
224
- readonly buildInfo: () => number;
225
- readonly getReturnWitness: (a: number, b: number, c: number, d: number) => void;
226
- readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void;
227
- readonly getPublicWitness: (a: number, b: number, c: number, d: number) => void;
228
224
  readonly and: (a: number, b: number) => number;
229
225
  readonly xor: (a: number, b: number) => number;
230
226
  readonly sha256: (a: number, b: number, c: number) => void;
@@ -237,6 +233,10 @@ export interface InitOutput {
237
233
  readonly compressWitnessStack: (a: number, b: number) => void;
238
234
  readonly decompressWitnessStack: (a: number, b: number, c: number) => void;
239
235
  readonly initLogLevel: (a: number, b: number, c: number) => void;
236
+ readonly buildInfo: () => number;
237
+ readonly getReturnWitness: (a: number, b: number, c: number, d: number) => void;
238
+ readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void;
239
+ readonly getPublicWitness: (a: number, b: number, c: number, d: number) => void;
240
240
  readonly executeCircuit: (a: number, b: number, c: number, d: number) => number;
241
241
  readonly executeCircuitWithReturnWitness: (a: number, b: number, c: number, d: number) => number;
242
242
  readonly executeProgram: (a: number, b: number, c: number, d: number) => number;
package/web/acvm_js.js CHANGED
@@ -6,6 +6,28 @@ heap.push(undefined, null, true, false);
6
6
 
7
7
  function getObject(idx) { return heap[idx]; }
8
8
 
9
+ function isLikeNone(x) {
10
+ return x === undefined || x === null;
11
+ }
12
+
13
+ let cachedFloat64Memory0 = null;
14
+
15
+ function getFloat64Memory0() {
16
+ if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
17
+ cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
18
+ }
19
+ return cachedFloat64Memory0;
20
+ }
21
+
22
+ let cachedInt32Memory0 = null;
23
+
24
+ function getInt32Memory0() {
25
+ if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
26
+ cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
27
+ }
28
+ return cachedInt32Memory0;
29
+ }
30
+
9
31
  let heap_next = heap.length;
10
32
 
11
33
  function dropObject(idx) {
@@ -20,6 +42,15 @@ function takeObject(idx) {
20
42
  return ret;
21
43
  }
22
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
+
23
54
  const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
24
55
 
25
56
  if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
@@ -38,37 +69,6 @@ function getStringFromWasm0(ptr, len) {
38
69
  return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
39
70
  }
40
71
 
41
- function addHeapObject(obj) {
42
- if (heap_next === heap.length) heap.push(heap.length + 1);
43
- const idx = heap_next;
44
- heap_next = heap[idx];
45
-
46
- heap[idx] = obj;
47
- return idx;
48
- }
49
-
50
- function isLikeNone(x) {
51
- return x === undefined || x === null;
52
- }
53
-
54
- let cachedFloat64Memory0 = null;
55
-
56
- function getFloat64Memory0() {
57
- if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
58
- cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
59
- }
60
- return cachedFloat64Memory0;
61
- }
62
-
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;
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,105 +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__h21c8ca3eb6ab9385(arg0, arg1, addHeapObject(arg2));
218
218
  }
219
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
- function passArray8ToWasm0(arg, malloc) {
230
- const ptr = malloc(arg.length * 1) >>> 0;
231
- getUint8Memory0().set(arg, ptr / 1);
232
- WASM_VECTOR_LEN = arg.length;
233
- return ptr;
234
- }
235
- /**
236
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
237
- *
238
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
239
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
240
- * @returns {WitnessMap} A witness map containing the circuit's return values.
241
- * @param {Uint8Array} program
242
- * @param {WitnessMap} witness_map
243
- * @returns {WitnessMap}
244
- */
245
- export function getReturnWitness(program, witness_map) {
246
- try {
247
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
248
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
249
- const len0 = WASM_VECTOR_LEN;
250
- wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
251
- var r0 = getInt32Memory0()[retptr / 4 + 0];
252
- var r1 = getInt32Memory0()[retptr / 4 + 1];
253
- var r2 = getInt32Memory0()[retptr / 4 + 2];
254
- if (r2) {
255
- throw takeObject(r1);
256
- }
257
- return takeObject(r0);
258
- } finally {
259
- wasm.__wbindgen_add_to_stack_pointer(16);
260
- }
261
- }
262
-
263
- /**
264
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
265
- *
266
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
267
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
268
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
269
- * @param {Uint8Array} program
270
- * @param {WitnessMap} solved_witness
271
- * @returns {WitnessMap}
272
- */
273
- export function getPublicParametersWitness(program, solved_witness) {
274
- try {
275
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
276
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
277
- const len0 = WASM_VECTOR_LEN;
278
- wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
279
- var r0 = getInt32Memory0()[retptr / 4 + 0];
280
- var r1 = getInt32Memory0()[retptr / 4 + 1];
281
- var r2 = getInt32Memory0()[retptr / 4 + 2];
282
- if (r2) {
283
- throw takeObject(r1);
284
- }
285
- return takeObject(r0);
286
- } finally {
287
- wasm.__wbindgen_add_to_stack_pointer(16);
288
- }
289
- }
290
-
291
- /**
292
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
293
- *
294
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
295
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
296
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
297
- * @param {Uint8Array} program
298
- * @param {WitnessMap} solved_witness
299
- * @returns {WitnessMap}
300
- */
301
- export function getPublicWitness(program, solved_witness) {
302
- try {
303
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
304
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
305
- const len0 = WASM_VECTOR_LEN;
306
- wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
307
- var r0 = getInt32Memory0()[retptr / 4 + 0];
308
- var r1 = getInt32Memory0()[retptr / 4 + 1];
309
- var r2 = getInt32Memory0()[retptr / 4 + 2];
310
- if (r2) {
311
- throw takeObject(r1);
312
- }
313
- return takeObject(r0);
314
- } finally {
315
- wasm.__wbindgen_add_to_stack_pointer(16);
316
- }
317
- }
318
-
319
220
  /**
320
221
  * Performs a bitwise AND operation between `lhs` and `rhs`
321
222
  * @param {string} lhs
@@ -338,6 +239,13 @@ export function xor(lhs, rhs) {
338
239
  return takeObject(ret);
339
240
  }
340
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
+
341
249
  function getArrayU8FromWasm0(ptr, len) {
342
250
  ptr = ptr >>> 0;
343
251
  return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
@@ -567,6 +475,99 @@ export function initLogLevel(filter) {
567
475
  }
568
476
  }
569
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
+
487
+ /**
488
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
489
+ *
490
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
491
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
492
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
493
+ * @param {Uint8Array} program
494
+ * @param {WitnessMap} witness_map
495
+ * @returns {WitnessMap}
496
+ */
497
+ export function getReturnWitness(program, witness_map) {
498
+ try {
499
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
500
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
501
+ const len0 = WASM_VECTOR_LEN;
502
+ wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
503
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
504
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
505
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
506
+ if (r2) {
507
+ throw takeObject(r1);
508
+ }
509
+ return takeObject(r0);
510
+ } finally {
511
+ wasm.__wbindgen_add_to_stack_pointer(16);
512
+ }
513
+ }
514
+
515
+ /**
516
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
517
+ *
518
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
519
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
520
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
521
+ * @param {Uint8Array} program
522
+ * @param {WitnessMap} solved_witness
523
+ * @returns {WitnessMap}
524
+ */
525
+ export function getPublicParametersWitness(program, solved_witness) {
526
+ try {
527
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
528
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
529
+ const len0 = WASM_VECTOR_LEN;
530
+ wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
531
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
532
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
533
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
534
+ if (r2) {
535
+ throw takeObject(r1);
536
+ }
537
+ return takeObject(r0);
538
+ } finally {
539
+ wasm.__wbindgen_add_to_stack_pointer(16);
540
+ }
541
+ }
542
+
543
+ /**
544
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
545
+ *
546
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
547
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
548
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
549
+ * @param {Uint8Array} program
550
+ * @param {WitnessMap} solved_witness
551
+ * @returns {WitnessMap}
552
+ */
553
+ export function getPublicWitness(program, solved_witness) {
554
+ try {
555
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
556
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
557
+ const len0 = WASM_VECTOR_LEN;
558
+ wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
559
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
560
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
561
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
562
+ if (r2) {
563
+ throw takeObject(r1);
564
+ }
565
+ return takeObject(r0);
566
+ } finally {
567
+ wasm.__wbindgen_add_to_stack_pointer(16);
568
+ }
569
+ }
570
+
570
571
  /**
571
572
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
572
573
  *
@@ -662,6 +663,12 @@ async function __wbg_load(module, imports) {
662
663
  function __wbg_get_imports() {
663
664
  const imports = {};
664
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
+ };
665
672
  imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
666
673
  takeObject(arg0);
667
674
  };
@@ -674,30 +681,16 @@ function __wbg_get_imports() {
674
681
  const ret = false;
675
682
  return ret;
676
683
  };
677
- imports.wbg.__wbg_constructor_9e0f49809a0dd2f4 = function(arg0) {
678
- const ret = new Error(takeObject(arg0));
679
- return addHeapObject(ret);
680
- };
681
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
682
- const ret = getStringFromWasm0(arg0, arg1);
683
- return addHeapObject(ret);
684
- };
685
- imports.wbg.__wbg_new_baa0339c0c5c310a = function() {
686
- const ret = new Array();
684
+ imports.wbg.__wbg_new_7c63fcfa4f1f863b = function() {
685
+ const ret = new Map();
687
686
  return addHeapObject(ret);
688
687
  };
689
688
  imports.wbg.__wbindgen_number_new = function(arg0) {
690
689
  const ret = arg0;
691
690
  return addHeapObject(ret);
692
691
  };
693
- imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
694
- const obj = getObject(arg1);
695
- const ret = typeof(obj) === 'number' ? obj : undefined;
696
- getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
697
- getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
698
- };
699
- imports.wbg.__wbg_new_cd95aa9a75b6fbe6 = function() {
700
- const ret = new Map();
692
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
693
+ const ret = getStringFromWasm0(arg0, arg1);
701
694
  return addHeapObject(ret);
702
695
  };
703
696
  imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
@@ -708,6 +701,14 @@ function __wbg_get_imports() {
708
701
  getInt32Memory0()[arg0 / 4 + 1] = len1;
709
702
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
710
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
+ };
711
712
  imports.wbg.__wbindgen_is_array = function(arg0) {
712
713
  const ret = Array.isArray(getObject(arg0));
713
714
  return ret;
@@ -899,8 +900,8 @@ function __wbg_get_imports() {
899
900
  imports.wbg.__wbindgen_throw = function(arg0, arg1) {
900
901
  throw new Error(getStringFromWasm0(arg0, arg1));
901
902
  };
902
- imports.wbg.__wbindgen_closure_wrapper740 = function(arg0, arg1, arg2) {
903
- const ret = makeMutClosure(arg0, arg1, 259, __wbg_adapter_22);
903
+ imports.wbg.__wbindgen_closure_wrapper747 = function(arg0, arg1, arg2) {
904
+ const ret = makeMutClosure(arg0, arg1, 265, __wbg_adapter_22);
904
905
  return addHeapObject(ret);
905
906
  };
906
907
 
Binary file
@@ -1,10 +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 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;
8
4
  export function and(a: number, b: number): number;
9
5
  export function xor(a: number, b: number): number;
10
6
  export function sha256(a: number, b: number, c: number): void;
@@ -17,6 +13,10 @@ export function decompressWitness(a: number, b: number, c: number): void;
17
13
  export function compressWitnessStack(a: number, b: number): void;
18
14
  export function decompressWitnessStack(a: number, b: number, c: number): void;
19
15
  export function initLogLevel(a: number, b: number, c: number): void;
16
+ export function buildInfo(): number;
17
+ export function getReturnWitness(a: number, b: number, c: number, d: number): void;
18
+ export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
19
+ export function getPublicWitness(a: number, b: number, c: number, d: number): void;
20
20
  export function executeCircuit(a: number, b: number, c: number, d: number): number;
21
21
  export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
22
22
  export function executeProgram(a: number, b: number, c: number, d: number): number;