@noir-lang/acvm_js 0.51.0 → 0.52.0-b820328.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,12 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * Sets the package's logging level.
5
- *
6
- * @param {LogLevel} level - The maximum level of logging to be emitted.
7
- */
8
- export function initLogLevel(filter: string): void;
9
- /**
10
4
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
11
5
  *
12
6
  * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
@@ -35,6 +29,44 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
35
29
  */
36
30
  export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
37
31
  /**
32
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
33
+ * @returns {BuildInfo} - Information on how the installed package was built.
34
+ */
35
+ export function buildInfo(): BuildInfo;
36
+ /**
37
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
38
+ *
39
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
40
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
41
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
42
+ * @param {Uint8Array} program
43
+ * @param {WitnessMap} witness_map
44
+ * @returns {WitnessMap}
45
+ */
46
+ export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
47
+ /**
48
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
49
+ *
50
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
51
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
52
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
53
+ * @param {Uint8Array} program
54
+ * @param {WitnessMap} solved_witness
55
+ * @returns {WitnessMap}
56
+ */
57
+ export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
58
+ /**
59
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
60
+ *
61
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
62
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
63
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
64
+ * @param {Uint8Array} program
65
+ * @param {WitnessMap} solved_witness
66
+ * @returns {WitnessMap}
67
+ */
68
+ export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
69
+ /**
38
70
  * Performs a bitwise AND operation between `lhs` and `rhs`
39
71
  * @param {string} lhs
40
72
  * @param {string} rhs
@@ -62,12 +94,6 @@ export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uin
62
94
  */
63
95
  export function blake2s256(inputs: Uint8Array): Uint8Array;
64
96
  /**
65
- * Calculates the Keccak256 hash of the input bytes
66
- * @param {Uint8Array} inputs
67
- * @returns {Uint8Array}
68
- */
69
- export function keccak256(inputs: Uint8Array): Uint8Array;
70
- /**
71
97
  * Verifies a ECDSA signature over the secp256k1 curve.
72
98
  * @param {Uint8Array} hashed_msg
73
99
  * @param {Uint8Array} public_key_x_bytes
@@ -115,58 +141,11 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
115
141
  */
116
142
  export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
117
143
  /**
118
- * Returns the `BuildInfo` object containing information about how the installed package was built.
119
- * @returns {BuildInfo} - Information on how the installed package was built.
120
- */
121
- export function buildInfo(): BuildInfo;
122
- /**
123
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
124
- *
125
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
126
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
127
- * @returns {WitnessMap} A witness map containing the circuit's return values.
128
- * @param {Uint8Array} program
129
- * @param {WitnessMap} witness_map
130
- * @returns {WitnessMap}
131
- */
132
- export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
133
- /**
134
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
135
- *
136
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
137
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
138
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
139
- * @param {Uint8Array} program
140
- * @param {WitnessMap} solved_witness
141
- * @returns {WitnessMap}
142
- */
143
- export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
144
- /**
145
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
144
+ * Sets the package's logging level.
146
145
  *
147
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
148
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
149
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
150
- * @param {Uint8Array} program
151
- * @param {WitnessMap} solved_witness
152
- * @returns {WitnessMap}
146
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
153
147
  */
154
- export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
155
-
156
- // Map from witness index to hex string value of witness.
157
- export type WitnessMap = Map<number, string>;
158
-
159
- /**
160
- * An execution result containing two witnesses.
161
- * 1. The full solved witness of the execution.
162
- * 2. The return witness which contains the given public return values within the full witness.
163
- */
164
- export type SolvedAndReturnWitness = {
165
- solvedWitness: WitnessMap;
166
- returnWitness: WitnessMap;
167
- }
168
-
169
-
148
+ export function initLogLevel(filter: string): void;
170
149
 
171
150
  export type ForeignCallInput = string[]
172
151
  export type ForeignCallOutput = string | string[]
@@ -217,3 +196,18 @@ export type StackItem = {
217
196
  export type WitnessStack = Array<StackItem>;
218
197
 
219
198
 
199
+
200
+ // Map from witness index to hex string value of witness.
201
+ export type WitnessMap = Map<number, string>;
202
+
203
+ /**
204
+ * An execution result containing two witnesses.
205
+ * 1. The full solved witness of the execution.
206
+ * 2. The return witness which contains the given public return values within the full witness.
207
+ */
208
+ export type SolvedAndReturnWitness = {
209
+ solvedWitness: WitnessMap;
210
+ returnWitness: WitnessMap;
211
+ }
212
+
213
+
package/nodejs/acvm_js.js CHANGED
@@ -45,15 +45,6 @@ function getInt32Memory0() {
45
45
  return cachedInt32Memory0;
46
46
  }
47
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
-
57
48
  let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
58
49
 
59
50
  cachedTextDecoder.decode();
@@ -72,6 +63,15 @@ function getStringFromWasm0(ptr, len) {
72
63
  return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
73
64
  }
74
65
 
66
+ function addHeapObject(obj) {
67
+ if (heap_next === heap.length) heap.push(heap.length + 1);
68
+ const idx = heap_next;
69
+ heap_next = heap[idx];
70
+
71
+ heap[idx] = obj;
72
+ return idx;
73
+ }
74
+
75
75
  let WASM_VECTOR_LEN = 0;
76
76
 
77
77
  let cachedTextEncoder = new TextEncoder('utf-8');
@@ -220,27 +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
- * Sets the package's logging level.
225
- *
226
- * @param {LogLevel} level - The maximum level of logging to be emitted.
227
- */
228
- module.exports.initLogLevel = function(filter) {
229
- try {
230
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
231
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
232
- const len0 = WASM_VECTOR_LEN;
233
- wasm.initLogLevel(retptr, ptr0, len0);
234
- var r0 = getInt32Memory0()[retptr / 4 + 0];
235
- var r1 = getInt32Memory0()[retptr / 4 + 1];
236
- if (r1) {
237
- throw takeObject(r0);
238
- }
239
- } finally {
240
- wasm.__wbindgen_add_to_stack_pointer(16);
241
- }
242
- };
243
-
244
223
  function passArray8ToWasm0(arg, malloc) {
245
224
  const ptr = malloc(arg.length * 1) >>> 0;
246
225
  getUint8Memory0().set(arg, ptr / 1);
@@ -293,6 +272,99 @@ module.exports.executeProgram = function(program, initial_witness, foreign_call_
293
272
  return takeObject(ret);
294
273
  };
295
274
 
275
+ /**
276
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
277
+ * @returns {BuildInfo} - Information on how the installed package was built.
278
+ */
279
+ module.exports.buildInfo = function() {
280
+ const ret = wasm.buildInfo();
281
+ return takeObject(ret);
282
+ };
283
+
284
+ /**
285
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
286
+ *
287
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
288
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
289
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
290
+ * @param {Uint8Array} program
291
+ * @param {WitnessMap} witness_map
292
+ * @returns {WitnessMap}
293
+ */
294
+ module.exports.getReturnWitness = function(program, witness_map) {
295
+ try {
296
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
297
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
298
+ const len0 = WASM_VECTOR_LEN;
299
+ wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
300
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
301
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
302
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
303
+ if (r2) {
304
+ throw takeObject(r1);
305
+ }
306
+ return takeObject(r0);
307
+ } finally {
308
+ wasm.__wbindgen_add_to_stack_pointer(16);
309
+ }
310
+ };
311
+
312
+ /**
313
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
314
+ *
315
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
316
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
317
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
318
+ * @param {Uint8Array} program
319
+ * @param {WitnessMap} solved_witness
320
+ * @returns {WitnessMap}
321
+ */
322
+ module.exports.getPublicParametersWitness = function(program, solved_witness) {
323
+ try {
324
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
325
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
326
+ const len0 = WASM_VECTOR_LEN;
327
+ wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
328
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
329
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
330
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
331
+ if (r2) {
332
+ throw takeObject(r1);
333
+ }
334
+ return takeObject(r0);
335
+ } finally {
336
+ wasm.__wbindgen_add_to_stack_pointer(16);
337
+ }
338
+ };
339
+
340
+ /**
341
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
342
+ *
343
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
344
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
345
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
346
+ * @param {Uint8Array} program
347
+ * @param {WitnessMap} solved_witness
348
+ * @returns {WitnessMap}
349
+ */
350
+ module.exports.getPublicWitness = function(program, solved_witness) {
351
+ try {
352
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
353
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
354
+ const len0 = WASM_VECTOR_LEN;
355
+ wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
356
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
357
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
358
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
359
+ if (r2) {
360
+ throw takeObject(r1);
361
+ }
362
+ return takeObject(r0);
363
+ } finally {
364
+ wasm.__wbindgen_add_to_stack_pointer(16);
365
+ }
366
+ };
367
+
296
368
  /**
297
369
  * Performs a bitwise AND operation between `lhs` and `rhs`
298
370
  * @param {string} lhs
@@ -384,27 +456,6 @@ module.exports.blake2s256 = function(inputs) {
384
456
  }
385
457
  };
386
458
 
387
- /**
388
- * Calculates the Keccak256 hash of the input bytes
389
- * @param {Uint8Array} inputs
390
- * @returns {Uint8Array}
391
- */
392
- module.exports.keccak256 = function(inputs) {
393
- try {
394
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
395
- const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
396
- const len0 = WASM_VECTOR_LEN;
397
- wasm.keccak256(retptr, ptr0, len0);
398
- var r0 = getInt32Memory0()[retptr / 4 + 0];
399
- var r1 = getInt32Memory0()[retptr / 4 + 1];
400
- var v2 = getArrayU8FromWasm0(r0, r1).slice();
401
- wasm.__wbindgen_free(r0, r1 * 1);
402
- return v2;
403
- } finally {
404
- wasm.__wbindgen_add_to_stack_pointer(16);
405
- }
406
- };
407
-
408
459
  /**
409
460
  * Verifies a ECDSA signature over the secp256k1 curve.
410
461
  * @param {Uint8Array} hashed_msg
@@ -547,99 +598,27 @@ module.exports.decompressWitnessStack = function(compressed_witness) {
547
598
  };
548
599
 
549
600
  /**
550
- * Returns the `BuildInfo` object containing information about how the installed package was built.
551
- * @returns {BuildInfo} - Information on how the installed package was built.
552
- */
553
- module.exports.buildInfo = function() {
554
- const ret = wasm.buildInfo();
555
- return takeObject(ret);
556
- };
557
-
558
- /**
559
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
560
- *
561
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
562
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
563
- * @returns {WitnessMap} A witness map containing the circuit's return values.
564
- * @param {Uint8Array} program
565
- * @param {WitnessMap} witness_map
566
- * @returns {WitnessMap}
567
- */
568
- module.exports.getReturnWitness = function(program, witness_map) {
569
- try {
570
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
571
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
572
- const len0 = WASM_VECTOR_LEN;
573
- wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
574
- var r0 = getInt32Memory0()[retptr / 4 + 0];
575
- var r1 = getInt32Memory0()[retptr / 4 + 1];
576
- var r2 = getInt32Memory0()[retptr / 4 + 2];
577
- if (r2) {
578
- throw takeObject(r1);
579
- }
580
- return takeObject(r0);
581
- } finally {
582
- wasm.__wbindgen_add_to_stack_pointer(16);
583
- }
584
- };
585
-
586
- /**
587
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
588
- *
589
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
590
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
591
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
592
- * @param {Uint8Array} program
593
- * @param {WitnessMap} solved_witness
594
- * @returns {WitnessMap}
595
- */
596
- module.exports.getPublicParametersWitness = function(program, solved_witness) {
597
- try {
598
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
599
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
600
- const len0 = WASM_VECTOR_LEN;
601
- wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
602
- var r0 = getInt32Memory0()[retptr / 4 + 0];
603
- var r1 = getInt32Memory0()[retptr / 4 + 1];
604
- var r2 = getInt32Memory0()[retptr / 4 + 2];
605
- if (r2) {
606
- throw takeObject(r1);
607
- }
608
- return takeObject(r0);
609
- } finally {
610
- wasm.__wbindgen_add_to_stack_pointer(16);
611
- }
612
- };
613
-
614
- /**
615
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
601
+ * Sets the package's logging level.
616
602
  *
617
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
618
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
619
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
620
- * @param {Uint8Array} program
621
- * @param {WitnessMap} solved_witness
622
- * @returns {WitnessMap}
603
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
623
604
  */
624
- module.exports.getPublicWitness = function(program, solved_witness) {
605
+ module.exports.initLogLevel = function(filter) {
625
606
  try {
626
607
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
627
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
608
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
628
609
  const len0 = WASM_VECTOR_LEN;
629
- wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
610
+ wasm.initLogLevel(retptr, ptr0, len0);
630
611
  var r0 = getInt32Memory0()[retptr / 4 + 0];
631
612
  var r1 = getInt32Memory0()[retptr / 4 + 1];
632
- var r2 = getInt32Memory0()[retptr / 4 + 2];
633
- if (r2) {
634
- throw takeObject(r1);
613
+ if (r1) {
614
+ throw takeObject(r0);
635
615
  }
636
- return takeObject(r0);
637
616
  } finally {
638
617
  wasm.__wbindgen_add_to_stack_pointer(16);
639
618
  }
640
619
  };
641
620
 
642
- function __wbg_adapter_76(arg0, arg1, arg2, arg3, arg4) {
621
+ function __wbg_adapter_75(arg0, arg1, arg2, arg3, arg4) {
643
622
  wasm.wasm_bindgen__convert__closures__invoke3_mut__h17fc532521b46256(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
644
623
  }
645
624
 
@@ -650,10 +629,31 @@ function handleError(f, args) {
650
629
  wasm.__wbindgen_exn_store(addHeapObject(e));
651
630
  }
652
631
  }
653
- function __wbg_adapter_93(arg0, arg1, arg2, arg3) {
632
+ function __wbg_adapter_92(arg0, arg1, arg2, arg3) {
654
633
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h0d187b0f08495587(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
655
634
  }
656
635
 
636
+ module.exports.__wbindgen_object_drop_ref = function(arg0) {
637
+ takeObject(arg0);
638
+ };
639
+
640
+ module.exports.__wbindgen_is_array = function(arg0) {
641
+ const ret = Array.isArray(getObject(arg0));
642
+ return ret;
643
+ };
644
+
645
+ module.exports.__wbindgen_is_string = function(arg0) {
646
+ const ret = typeof(getObject(arg0)) === 'string';
647
+ return ret;
648
+ };
649
+
650
+ module.exports.__wbindgen_number_get = function(arg0, arg1) {
651
+ const obj = getObject(arg1);
652
+ const ret = typeof(obj) === 'number' ? obj : undefined;
653
+ getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
654
+ getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
655
+ };
656
+
657
657
  module.exports.__wbindgen_cb_drop = function(arg0) {
658
658
  const obj = takeObject(arg0).original;
659
659
  if (obj.cnt-- == 1) {
@@ -664,19 +664,18 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
664
664
  return ret;
665
665
  };
666
666
 
667
- module.exports.__wbindgen_number_get = function(arg0, arg1) {
668
- const obj = getObject(arg1);
669
- const ret = typeof(obj) === 'number' ? obj : undefined;
670
- getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
671
- getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
667
+ module.exports.__wbg_constructor_720343c738f4344c = function(arg0) {
668
+ const ret = new Error(takeObject(arg0));
669
+ return addHeapObject(ret);
672
670
  };
673
671
 
674
- module.exports.__wbindgen_object_drop_ref = function(arg0) {
675
- takeObject(arg0);
672
+ module.exports.__wbindgen_string_new = function(arg0, arg1) {
673
+ const ret = getStringFromWasm0(arg0, arg1);
674
+ return addHeapObject(ret);
676
675
  };
677
676
 
678
- module.exports.__wbg_new_3b3e21164d5381ca = function() {
679
- const ret = new Map();
677
+ module.exports.__wbg_new_55c288bb849e1b31 = function() {
678
+ const ret = new Array();
680
679
  return addHeapObject(ret);
681
680
  };
682
681
 
@@ -685,8 +684,8 @@ module.exports.__wbindgen_number_new = function(arg0) {
685
684
  return addHeapObject(ret);
686
685
  };
687
686
 
688
- module.exports.__wbindgen_string_new = function(arg0, arg1) {
689
- const ret = getStringFromWasm0(arg0, arg1);
687
+ module.exports.__wbg_new_7379c57bfbea14d0 = function() {
688
+ const ret = new Map();
690
689
  return addHeapObject(ret);
691
690
  };
692
691
 
@@ -699,26 +698,6 @@ module.exports.__wbindgen_string_get = function(arg0, arg1) {
699
698
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
700
699
  };
701
700
 
702
- module.exports.__wbg_constructor_f4bcf4c70838c703 = function(arg0) {
703
- const ret = new Error(takeObject(arg0));
704
- return addHeapObject(ret);
705
- };
706
-
707
- module.exports.__wbindgen_is_array = function(arg0) {
708
- const ret = Array.isArray(getObject(arg0));
709
- return ret;
710
- };
711
-
712
- module.exports.__wbindgen_is_string = function(arg0) {
713
- const ret = typeof(getObject(arg0)) === 'string';
714
- return ret;
715
- };
716
-
717
- module.exports.__wbg_new_e14625531a95427d = function() {
718
- const ret = new Array();
719
- return addHeapObject(ret);
720
- };
721
-
722
701
  module.exports.__wbg_new_abda76e883ba8a5f = function() {
723
702
  const ret = new Error();
724
703
  return addHeapObject(ret);
@@ -808,7 +787,7 @@ module.exports.__wbg_forEach_5ae261259d7517c8 = function(arg0, arg1, arg2) {
808
787
  const a = state0.a;
809
788
  state0.a = 0;
810
789
  try {
811
- return __wbg_adapter_76(a, state0.b, arg0, arg1, arg2);
790
+ return __wbg_adapter_75(a, state0.b, arg0, arg1, arg2);
812
791
  } finally {
813
792
  state0.a = a;
814
793
  }
@@ -855,7 +834,7 @@ module.exports.__wbg_forEach_942772130a8d06a6 = function(arg0, arg1, arg2) {
855
834
  const a = state0.a;
856
835
  state0.a = 0;
857
836
  try {
858
- return __wbg_adapter_93(a, state0.b, arg0, arg1);
837
+ return __wbg_adapter_92(a, state0.b, arg0, arg1);
859
838
  } finally {
860
839
  state0.a = a;
861
840
  }
@@ -888,7 +867,7 @@ module.exports.__wbg_new_2b55e405e4af4986 = function(arg0, arg1) {
888
867
  const a = state0.a;
889
868
  state0.a = 0;
890
869
  try {
891
- return __wbg_adapter_93(a, state0.b, arg0, arg1);
870
+ return __wbg_adapter_92(a, state0.b, arg0, arg1);
892
871
  } finally {
893
872
  state0.a = a;
894
873
  }
@@ -937,8 +916,8 @@ module.exports.__wbindgen_throw = function(arg0, arg1) {
937
916
  throw new Error(getStringFromWasm0(arg0, arg1));
938
917
  };
939
918
 
940
- module.exports.__wbindgen_closure_wrapper747 = function(arg0, arg1, arg2) {
941
- const ret = makeMutClosure(arg0, arg1, 266, __wbg_adapter_22);
919
+ module.exports.__wbindgen_closure_wrapper727 = function(arg0, arg1, arg2) {
920
+ const ret = makeMutClosure(arg0, arg1, 267, __wbg_adapter_22);
942
921
  return addHeapObject(ret);
943
922
  };
944
923
 
Binary file
@@ -1,25 +1,24 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export function initLogLevel(a: number, b: number, c: number): void;
5
4
  export function executeCircuit(a: number, b: number, c: number, d: number): number;
6
5
  export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
7
6
  export function executeProgram(a: number, b: number, c: number, d: number): number;
7
+ export function buildInfo(): number;
8
+ export function getReturnWitness(a: number, b: number, c: number, d: number): void;
9
+ export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
10
+ export function getPublicWitness(a: number, b: number, c: number, d: number): void;
8
11
  export function and(a: number, b: number): number;
9
12
  export function xor(a: number, b: number): number;
10
13
  export function sha256_compression(a: number, b: number, c: number, d: number, e: number): void;
11
14
  export function blake2s256(a: number, b: number, c: number): void;
12
- export function keccak256(a: number, b: number, c: number): void;
13
15
  export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
14
16
  export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
15
17
  export function compressWitness(a: number, b: number): void;
16
18
  export function decompressWitness(a: number, b: number, c: number): void;
17
19
  export function compressWitnessStack(a: number, b: number): void;
18
20
  export function decompressWitnessStack(a: number, b: number, c: number): void;
19
- export function buildInfo(): number;
20
- export function getReturnWitness(a: number, b: number, c: number, d: number): void;
21
- export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
22
- export function getPublicWitness(a: number, b: number, c: number, d: number): void;
21
+ export function initLogLevel(a: number, b: number, c: number): void;
23
22
  export function __wbindgen_malloc(a: number): number;
24
23
  export function __wbindgen_realloc(a: number, b: number, c: number): number;
25
24
  export const __wbindgen_export_2: WebAssembly.Table;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noir-lang/acvm_js",
3
- "version": "0.51.0",
3
+ "version": "0.52.0-b820328.nightly",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/web/acvm_js.d.ts CHANGED
@@ -1,12 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * Sets the package's logging level.
5
- *
6
- * @param {LogLevel} level - The maximum level of logging to be emitted.
7
- */
8
- export function initLogLevel(filter: string): void;
9
- /**
10
4
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
11
5
  *
12
6
  * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
@@ -35,6 +29,44 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
35
29
  */
36
30
  export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
37
31
  /**
32
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
33
+ * @returns {BuildInfo} - Information on how the installed package was built.
34
+ */
35
+ export function buildInfo(): BuildInfo;
36
+ /**
37
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
38
+ *
39
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
40
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
41
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
42
+ * @param {Uint8Array} program
43
+ * @param {WitnessMap} witness_map
44
+ * @returns {WitnessMap}
45
+ */
46
+ export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
47
+ /**
48
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
49
+ *
50
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
51
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
52
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
53
+ * @param {Uint8Array} program
54
+ * @param {WitnessMap} solved_witness
55
+ * @returns {WitnessMap}
56
+ */
57
+ export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
58
+ /**
59
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
60
+ *
61
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
62
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
63
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
64
+ * @param {Uint8Array} program
65
+ * @param {WitnessMap} solved_witness
66
+ * @returns {WitnessMap}
67
+ */
68
+ export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
69
+ /**
38
70
  * Performs a bitwise AND operation between `lhs` and `rhs`
39
71
  * @param {string} lhs
40
72
  * @param {string} rhs
@@ -62,12 +94,6 @@ export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uin
62
94
  */
63
95
  export function blake2s256(inputs: Uint8Array): Uint8Array;
64
96
  /**
65
- * Calculates the Keccak256 hash of the input bytes
66
- * @param {Uint8Array} inputs
67
- * @returns {Uint8Array}
68
- */
69
- export function keccak256(inputs: Uint8Array): Uint8Array;
70
- /**
71
97
  * Verifies a ECDSA signature over the secp256k1 curve.
72
98
  * @param {Uint8Array} hashed_msg
73
99
  * @param {Uint8Array} public_key_x_bytes
@@ -115,58 +141,11 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
115
141
  */
116
142
  export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
117
143
  /**
118
- * Returns the `BuildInfo` object containing information about how the installed package was built.
119
- * @returns {BuildInfo} - Information on how the installed package was built.
120
- */
121
- export function buildInfo(): BuildInfo;
122
- /**
123
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
124
- *
125
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
126
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
127
- * @returns {WitnessMap} A witness map containing the circuit's return values.
128
- * @param {Uint8Array} program
129
- * @param {WitnessMap} witness_map
130
- * @returns {WitnessMap}
131
- */
132
- export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
133
- /**
134
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
135
- *
136
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
137
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
138
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
139
- * @param {Uint8Array} program
140
- * @param {WitnessMap} solved_witness
141
- * @returns {WitnessMap}
142
- */
143
- export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
144
- /**
145
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
144
+ * Sets the package's logging level.
146
145
  *
147
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
148
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
149
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
150
- * @param {Uint8Array} program
151
- * @param {WitnessMap} solved_witness
152
- * @returns {WitnessMap}
146
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
153
147
  */
154
- export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
155
-
156
- // Map from witness index to hex string value of witness.
157
- export type WitnessMap = Map<number, string>;
158
-
159
- /**
160
- * An execution result containing two witnesses.
161
- * 1. The full solved witness of the execution.
162
- * 2. The return witness which contains the given public return values within the full witness.
163
- */
164
- export type SolvedAndReturnWitness = {
165
- solvedWitness: WitnessMap;
166
- returnWitness: WitnessMap;
167
- }
168
-
169
-
148
+ export function initLogLevel(filter: string): void;
170
149
 
171
150
  export type ForeignCallInput = string[]
172
151
  export type ForeignCallOutput = string | string[]
@@ -218,29 +197,43 @@ export type WitnessStack = Array<StackItem>;
218
197
 
219
198
 
220
199
 
200
+ // Map from witness index to hex string value of witness.
201
+ export type WitnessMap = Map<number, string>;
202
+
203
+ /**
204
+ * An execution result containing two witnesses.
205
+ * 1. The full solved witness of the execution.
206
+ * 2. The return witness which contains the given public return values within the full witness.
207
+ */
208
+ export type SolvedAndReturnWitness = {
209
+ solvedWitness: WitnessMap;
210
+ returnWitness: WitnessMap;
211
+ }
212
+
213
+
214
+
221
215
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
222
216
 
223
217
  export interface InitOutput {
224
218
  readonly memory: WebAssembly.Memory;
225
- readonly initLogLevel: (a: number, b: number, c: number) => void;
226
219
  readonly executeCircuit: (a: number, b: number, c: number, d: number) => number;
227
220
  readonly executeCircuitWithReturnWitness: (a: number, b: number, c: number, d: number) => number;
228
221
  readonly executeProgram: (a: number, b: number, c: number, d: number) => number;
222
+ readonly buildInfo: () => number;
223
+ readonly getReturnWitness: (a: number, b: number, c: number, d: number) => void;
224
+ readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void;
225
+ readonly getPublicWitness: (a: number, b: number, c: number, d: number) => void;
229
226
  readonly and: (a: number, b: number) => number;
230
227
  readonly xor: (a: number, b: number) => number;
231
228
  readonly sha256_compression: (a: number, b: number, c: number, d: number, e: number) => void;
232
229
  readonly blake2s256: (a: number, b: number, c: number) => void;
233
- readonly keccak256: (a: number, b: number, c: number) => void;
234
230
  readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
235
231
  readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
236
232
  readonly compressWitness: (a: number, b: number) => void;
237
233
  readonly decompressWitness: (a: number, b: number, c: number) => void;
238
234
  readonly compressWitnessStack: (a: number, b: number) => void;
239
235
  readonly decompressWitnessStack: (a: number, b: number, c: number) => void;
240
- readonly buildInfo: () => number;
241
- readonly getReturnWitness: (a: number, b: number, c: number, d: number) => void;
242
- readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void;
243
- readonly getPublicWitness: (a: number, b: number, c: number, d: number) => void;
236
+ readonly initLogLevel: (a: number, b: number, c: number) => void;
244
237
  readonly __wbindgen_malloc: (a: number) => number;
245
238
  readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
246
239
  readonly __wbindgen_export_2: WebAssembly.Table;
package/web/acvm_js.js CHANGED
@@ -42,15 +42,6 @@ function getInt32Memory0() {
42
42
  return cachedInt32Memory0;
43
43
  }
44
44
 
45
- function addHeapObject(obj) {
46
- if (heap_next === heap.length) heap.push(heap.length + 1);
47
- const idx = heap_next;
48
- heap_next = heap[idx];
49
-
50
- heap[idx] = obj;
51
- return idx;
52
- }
53
-
54
45
  const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
55
46
 
56
47
  if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
@@ -69,6 +60,15 @@ function getStringFromWasm0(ptr, len) {
69
60
  return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
70
61
  }
71
62
 
63
+ function addHeapObject(obj) {
64
+ if (heap_next === heap.length) heap.push(heap.length + 1);
65
+ const idx = heap_next;
66
+ heap_next = heap[idx];
67
+
68
+ heap[idx] = obj;
69
+ return idx;
70
+ }
71
+
72
72
  let WASM_VECTOR_LEN = 0;
73
73
 
74
74
  const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
@@ -217,27 +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
- * Sets the package's logging level.
222
- *
223
- * @param {LogLevel} level - The maximum level of logging to be emitted.
224
- */
225
- export function initLogLevel(filter) {
226
- try {
227
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
228
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
229
- const len0 = WASM_VECTOR_LEN;
230
- wasm.initLogLevel(retptr, ptr0, len0);
231
- var r0 = getInt32Memory0()[retptr / 4 + 0];
232
- var r1 = getInt32Memory0()[retptr / 4 + 1];
233
- if (r1) {
234
- throw takeObject(r0);
235
- }
236
- } finally {
237
- wasm.__wbindgen_add_to_stack_pointer(16);
238
- }
239
- }
240
-
241
220
  function passArray8ToWasm0(arg, malloc) {
242
221
  const ptr = malloc(arg.length * 1) >>> 0;
243
222
  getUint8Memory0().set(arg, ptr / 1);
@@ -290,6 +269,99 @@ export function executeProgram(program, initial_witness, foreign_call_handler) {
290
269
  return takeObject(ret);
291
270
  }
292
271
 
272
+ /**
273
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
274
+ * @returns {BuildInfo} - Information on how the installed package was built.
275
+ */
276
+ export function buildInfo() {
277
+ const ret = wasm.buildInfo();
278
+ return takeObject(ret);
279
+ }
280
+
281
+ /**
282
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
283
+ *
284
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
285
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
286
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
287
+ * @param {Uint8Array} program
288
+ * @param {WitnessMap} witness_map
289
+ * @returns {WitnessMap}
290
+ */
291
+ export function getReturnWitness(program, witness_map) {
292
+ try {
293
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
294
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
295
+ const len0 = WASM_VECTOR_LEN;
296
+ wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
297
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
298
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
299
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
300
+ if (r2) {
301
+ throw takeObject(r1);
302
+ }
303
+ return takeObject(r0);
304
+ } finally {
305
+ wasm.__wbindgen_add_to_stack_pointer(16);
306
+ }
307
+ }
308
+
309
+ /**
310
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
311
+ *
312
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
313
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
314
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
315
+ * @param {Uint8Array} program
316
+ * @param {WitnessMap} solved_witness
317
+ * @returns {WitnessMap}
318
+ */
319
+ export function getPublicParametersWitness(program, solved_witness) {
320
+ try {
321
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
322
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
323
+ const len0 = WASM_VECTOR_LEN;
324
+ wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
325
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
326
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
327
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
328
+ if (r2) {
329
+ throw takeObject(r1);
330
+ }
331
+ return takeObject(r0);
332
+ } finally {
333
+ wasm.__wbindgen_add_to_stack_pointer(16);
334
+ }
335
+ }
336
+
337
+ /**
338
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
339
+ *
340
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
341
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
342
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
343
+ * @param {Uint8Array} program
344
+ * @param {WitnessMap} solved_witness
345
+ * @returns {WitnessMap}
346
+ */
347
+ export function getPublicWitness(program, solved_witness) {
348
+ try {
349
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
350
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
351
+ const len0 = WASM_VECTOR_LEN;
352
+ wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
353
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
354
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
355
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
356
+ if (r2) {
357
+ throw takeObject(r1);
358
+ }
359
+ return takeObject(r0);
360
+ } finally {
361
+ wasm.__wbindgen_add_to_stack_pointer(16);
362
+ }
363
+ }
364
+
293
365
  /**
294
366
  * Performs a bitwise AND operation between `lhs` and `rhs`
295
367
  * @param {string} lhs
@@ -381,27 +453,6 @@ export function blake2s256(inputs) {
381
453
  }
382
454
  }
383
455
 
384
- /**
385
- * Calculates the Keccak256 hash of the input bytes
386
- * @param {Uint8Array} inputs
387
- * @returns {Uint8Array}
388
- */
389
- export function keccak256(inputs) {
390
- try {
391
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
392
- const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
393
- const len0 = WASM_VECTOR_LEN;
394
- wasm.keccak256(retptr, ptr0, len0);
395
- var r0 = getInt32Memory0()[retptr / 4 + 0];
396
- var r1 = getInt32Memory0()[retptr / 4 + 1];
397
- var v2 = getArrayU8FromWasm0(r0, r1).slice();
398
- wasm.__wbindgen_free(r0, r1 * 1);
399
- return v2;
400
- } finally {
401
- wasm.__wbindgen_add_to_stack_pointer(16);
402
- }
403
- }
404
-
405
456
  /**
406
457
  * Verifies a ECDSA signature over the secp256k1 curve.
407
458
  * @param {Uint8Array} hashed_msg
@@ -544,99 +595,27 @@ export function decompressWitnessStack(compressed_witness) {
544
595
  }
545
596
 
546
597
  /**
547
- * Returns the `BuildInfo` object containing information about how the installed package was built.
548
- * @returns {BuildInfo} - Information on how the installed package was built.
549
- */
550
- export function buildInfo() {
551
- const ret = wasm.buildInfo();
552
- return takeObject(ret);
553
- }
554
-
555
- /**
556
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
557
- *
558
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
559
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
560
- * @returns {WitnessMap} A witness map containing the circuit's return values.
561
- * @param {Uint8Array} program
562
- * @param {WitnessMap} witness_map
563
- * @returns {WitnessMap}
564
- */
565
- export function getReturnWitness(program, witness_map) {
566
- try {
567
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
568
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
569
- const len0 = WASM_VECTOR_LEN;
570
- wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
571
- var r0 = getInt32Memory0()[retptr / 4 + 0];
572
- var r1 = getInt32Memory0()[retptr / 4 + 1];
573
- var r2 = getInt32Memory0()[retptr / 4 + 2];
574
- if (r2) {
575
- throw takeObject(r1);
576
- }
577
- return takeObject(r0);
578
- } finally {
579
- wasm.__wbindgen_add_to_stack_pointer(16);
580
- }
581
- }
582
-
583
- /**
584
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
585
- *
586
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
587
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
588
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
589
- * @param {Uint8Array} program
590
- * @param {WitnessMap} solved_witness
591
- * @returns {WitnessMap}
592
- */
593
- export function getPublicParametersWitness(program, solved_witness) {
594
- try {
595
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
596
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
597
- const len0 = WASM_VECTOR_LEN;
598
- wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
599
- var r0 = getInt32Memory0()[retptr / 4 + 0];
600
- var r1 = getInt32Memory0()[retptr / 4 + 1];
601
- var r2 = getInt32Memory0()[retptr / 4 + 2];
602
- if (r2) {
603
- throw takeObject(r1);
604
- }
605
- return takeObject(r0);
606
- } finally {
607
- wasm.__wbindgen_add_to_stack_pointer(16);
608
- }
609
- }
610
-
611
- /**
612
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
598
+ * Sets the package's logging level.
613
599
  *
614
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
615
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
616
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
617
- * @param {Uint8Array} program
618
- * @param {WitnessMap} solved_witness
619
- * @returns {WitnessMap}
600
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
620
601
  */
621
- export function getPublicWitness(program, solved_witness) {
602
+ export function initLogLevel(filter) {
622
603
  try {
623
604
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
624
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
605
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
625
606
  const len0 = WASM_VECTOR_LEN;
626
- wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
607
+ wasm.initLogLevel(retptr, ptr0, len0);
627
608
  var r0 = getInt32Memory0()[retptr / 4 + 0];
628
609
  var r1 = getInt32Memory0()[retptr / 4 + 1];
629
- var r2 = getInt32Memory0()[retptr / 4 + 2];
630
- if (r2) {
631
- throw takeObject(r1);
610
+ if (r1) {
611
+ throw takeObject(r0);
632
612
  }
633
- return takeObject(r0);
634
613
  } finally {
635
614
  wasm.__wbindgen_add_to_stack_pointer(16);
636
615
  }
637
616
  }
638
617
 
639
- function __wbg_adapter_76(arg0, arg1, arg2, arg3, arg4) {
618
+ function __wbg_adapter_75(arg0, arg1, arg2, arg3, arg4) {
640
619
  wasm.wasm_bindgen__convert__closures__invoke3_mut__h17fc532521b46256(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
641
620
  }
642
621
 
@@ -647,7 +626,7 @@ function handleError(f, args) {
647
626
  wasm.__wbindgen_exn_store(addHeapObject(e));
648
627
  }
649
628
  }
650
- function __wbg_adapter_93(arg0, arg1, arg2, arg3) {
629
+ function __wbg_adapter_92(arg0, arg1, arg2, arg3) {
651
630
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h0d187b0f08495587(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
652
631
  }
653
632
 
@@ -685,6 +664,23 @@ async function __wbg_load(module, imports) {
685
664
  function __wbg_get_imports() {
686
665
  const imports = {};
687
666
  imports.wbg = {};
667
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
668
+ takeObject(arg0);
669
+ };
670
+ imports.wbg.__wbindgen_is_array = function(arg0) {
671
+ const ret = Array.isArray(getObject(arg0));
672
+ return ret;
673
+ };
674
+ imports.wbg.__wbindgen_is_string = function(arg0) {
675
+ const ret = typeof(getObject(arg0)) === 'string';
676
+ return ret;
677
+ };
678
+ imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
679
+ const obj = getObject(arg1);
680
+ const ret = typeof(obj) === 'number' ? obj : undefined;
681
+ getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
682
+ getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
683
+ };
688
684
  imports.wbg.__wbindgen_cb_drop = function(arg0) {
689
685
  const obj = takeObject(arg0).original;
690
686
  if (obj.cnt-- == 1) {
@@ -694,25 +690,24 @@ function __wbg_get_imports() {
694
690
  const ret = false;
695
691
  return ret;
696
692
  };
697
- imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
698
- const obj = getObject(arg1);
699
- const ret = typeof(obj) === 'number' ? obj : undefined;
700
- getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
701
- getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
693
+ imports.wbg.__wbg_constructor_720343c738f4344c = function(arg0) {
694
+ const ret = new Error(takeObject(arg0));
695
+ return addHeapObject(ret);
702
696
  };
703
- imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
704
- takeObject(arg0);
697
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
698
+ const ret = getStringFromWasm0(arg0, arg1);
699
+ return addHeapObject(ret);
705
700
  };
706
- imports.wbg.__wbg_new_3b3e21164d5381ca = function() {
707
- const ret = new Map();
701
+ imports.wbg.__wbg_new_55c288bb849e1b31 = function() {
702
+ const ret = new Array();
708
703
  return addHeapObject(ret);
709
704
  };
710
705
  imports.wbg.__wbindgen_number_new = function(arg0) {
711
706
  const ret = arg0;
712
707
  return addHeapObject(ret);
713
708
  };
714
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
715
- const ret = getStringFromWasm0(arg0, arg1);
709
+ imports.wbg.__wbg_new_7379c57bfbea14d0 = function() {
710
+ const ret = new Map();
716
711
  return addHeapObject(ret);
717
712
  };
718
713
  imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
@@ -723,22 +718,6 @@ function __wbg_get_imports() {
723
718
  getInt32Memory0()[arg0 / 4 + 1] = len1;
724
719
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
725
720
  };
726
- imports.wbg.__wbg_constructor_f4bcf4c70838c703 = function(arg0) {
727
- const ret = new Error(takeObject(arg0));
728
- return addHeapObject(ret);
729
- };
730
- imports.wbg.__wbindgen_is_array = function(arg0) {
731
- const ret = Array.isArray(getObject(arg0));
732
- return ret;
733
- };
734
- imports.wbg.__wbindgen_is_string = function(arg0) {
735
- const ret = typeof(getObject(arg0)) === 'string';
736
- return ret;
737
- };
738
- imports.wbg.__wbg_new_e14625531a95427d = function() {
739
- const ret = new Array();
740
- return addHeapObject(ret);
741
- };
742
721
  imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
743
722
  const ret = new Error();
744
723
  return addHeapObject(ret);
@@ -812,7 +791,7 @@ function __wbg_get_imports() {
812
791
  const a = state0.a;
813
792
  state0.a = 0;
814
793
  try {
815
- return __wbg_adapter_76(a, state0.b, arg0, arg1, arg2);
794
+ return __wbg_adapter_75(a, state0.b, arg0, arg1, arg2);
816
795
  } finally {
817
796
  state0.a = a;
818
797
  }
@@ -852,7 +831,7 @@ function __wbg_get_imports() {
852
831
  const a = state0.a;
853
832
  state0.a = 0;
854
833
  try {
855
- return __wbg_adapter_93(a, state0.b, arg0, arg1);
834
+ return __wbg_adapter_92(a, state0.b, arg0, arg1);
856
835
  } finally {
857
836
  state0.a = a;
858
837
  }
@@ -881,7 +860,7 @@ function __wbg_get_imports() {
881
860
  const a = state0.a;
882
861
  state0.a = 0;
883
862
  try {
884
- return __wbg_adapter_93(a, state0.b, arg0, arg1);
863
+ return __wbg_adapter_92(a, state0.b, arg0, arg1);
885
864
  } finally {
886
865
  state0.a = a;
887
866
  }
@@ -922,8 +901,8 @@ function __wbg_get_imports() {
922
901
  imports.wbg.__wbindgen_throw = function(arg0, arg1) {
923
902
  throw new Error(getStringFromWasm0(arg0, arg1));
924
903
  };
925
- imports.wbg.__wbindgen_closure_wrapper747 = function(arg0, arg1, arg2) {
926
- const ret = makeMutClosure(arg0, arg1, 266, __wbg_adapter_22);
904
+ imports.wbg.__wbindgen_closure_wrapper727 = function(arg0, arg1, arg2) {
905
+ const ret = makeMutClosure(arg0, arg1, 267, __wbg_adapter_22);
927
906
  return addHeapObject(ret);
928
907
  };
929
908
 
Binary file
@@ -1,25 +1,24 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export function initLogLevel(a: number, b: number, c: number): void;
5
4
  export function executeCircuit(a: number, b: number, c: number, d: number): number;
6
5
  export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
7
6
  export function executeProgram(a: number, b: number, c: number, d: number): number;
7
+ export function buildInfo(): number;
8
+ export function getReturnWitness(a: number, b: number, c: number, d: number): void;
9
+ export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
10
+ export function getPublicWitness(a: number, b: number, c: number, d: number): void;
8
11
  export function and(a: number, b: number): number;
9
12
  export function xor(a: number, b: number): number;
10
13
  export function sha256_compression(a: number, b: number, c: number, d: number, e: number): void;
11
14
  export function blake2s256(a: number, b: number, c: number): void;
12
- export function keccak256(a: number, b: number, c: number): void;
13
15
  export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
14
16
  export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
15
17
  export function compressWitness(a: number, b: number): void;
16
18
  export function decompressWitness(a: number, b: number, c: number): void;
17
19
  export function compressWitnessStack(a: number, b: number): void;
18
20
  export function decompressWitnessStack(a: number, b: number, c: number): void;
19
- export function buildInfo(): number;
20
- export function getReturnWitness(a: number, b: number, c: number, d: number): void;
21
- export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
22
- export function getPublicWitness(a: number, b: number, c: number, d: number): void;
21
+ export function initLogLevel(a: number, b: number, c: number): void;
23
22
  export function __wbindgen_malloc(a: number): number;
24
23
  export function __wbindgen_realloc(a: number, b: number, c: number): number;
25
24
  export const __wbindgen_export_2: WebAssembly.Table;