@aztec/noir-acvm_js 0.0.0-test.0 → 0.0.1-commit.24de95ac

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,5 +1,34 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ /**
4
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
5
+ *
6
+ * @param {WitnessMap} witness_map - A witness map.
7
+ * @returns {Uint8Array} A compressed witness map
8
+ */
9
+ export function compressWitness(witness_map: WitnessMap): Uint8Array;
10
+ /**
11
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
12
+ * This should be used to only fetch the witness map for the main function.
13
+ *
14
+ * @param {Uint8Array} compressed_witness - A compressed witness.
15
+ * @returns {WitnessMap} The decompressed witness map.
16
+ */
17
+ export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
18
+ /**
19
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
20
+ *
21
+ * @param {WitnessStack} witness_stack - A witness stack.
22
+ * @returns {Uint8Array} A compressed witness stack
23
+ */
24
+ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
25
+ /**
26
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
27
+ *
28
+ * @param {Uint8Array} compressed_witness - A compressed witness.
29
+ * @returns {WitnessStack} The decompressed witness stack.
30
+ */
31
+ export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
3
32
  /**
4
33
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
5
34
  *
@@ -29,40 +58,40 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
29
58
  */
30
59
  export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
31
60
  /**
32
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
61
+ * Sets the package's logging level.
33
62
  *
34
- * @param {WitnessMap} witness_map - A witness map.
35
- * @returns {Uint8Array} A compressed witness map
63
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
36
64
  */
37
- export function compressWitness(witness_map: WitnessMap): Uint8Array;
65
+ export function initLogLevel(filter: string): void;
38
66
  /**
39
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
40
- * This should be used to only fetch the witness map for the main function.
67
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
41
68
  *
42
- * @param {Uint8Array} compressed_witness - A compressed witness.
43
- * @returns {WitnessMap} The decompressed witness map.
69
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
70
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
71
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
44
72
  */
45
- export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
73
+ export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
46
74
  /**
47
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
75
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
48
76
  *
49
- * @param {WitnessStack} witness_stack - A witness stack.
50
- * @returns {Uint8Array} A compressed witness stack
77
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
78
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
79
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
51
80
  */
52
- export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
81
+ export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
53
82
  /**
54
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
83
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
55
84
  *
56
- * @param {Uint8Array} compressed_witness - A compressed witness.
57
- * @returns {WitnessStack} The decompressed witness stack.
85
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
86
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
87
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
58
88
  */
59
- export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
89
+ export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
60
90
  /**
61
- * Sets the package's logging level.
62
- *
63
- * @param {LogLevel} level - The maximum level of logging to be emitted.
91
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
92
+ * @returns {BuildInfo} - Information on how the installed package was built.
64
93
  */
65
- export function initLogLevel(filter: string): void;
94
+ export function buildInfo(): BuildInfo;
66
95
  /**
67
96
  * Performs a bitwise AND operation between `lhs` and `rhs`
68
97
  */
@@ -87,35 +116,6 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
87
116
  * Verifies a ECDSA signature over the secp256r1 curve.
88
117
  */
89
118
  export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
90
- /**
91
- * Returns the `BuildInfo` object containing information about how the installed package was built.
92
- * @returns {BuildInfo} - Information on how the installed package was built.
93
- */
94
- export function buildInfo(): BuildInfo;
95
- /**
96
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
97
- *
98
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
99
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
100
- * @returns {WitnessMap} A witness map containing the circuit's return values.
101
- */
102
- export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
103
- /**
104
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
105
- *
106
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
107
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
108
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
109
- */
110
- export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
111
- /**
112
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
113
- *
114
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
115
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
116
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
117
- */
118
- export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
119
119
 
120
120
  export type RawAssertionPayload = {
121
121
  selector: string;
@@ -125,34 +125,12 @@ export type RawAssertionPayload = {
125
125
  export type ExecutionError = Error & {
126
126
  callStack?: string[];
127
127
  rawAssertionPayload?: RawAssertionPayload;
128
+ acirFunctionId?: number;
128
129
  brilligFunctionId?: number;
129
130
  };
130
131
 
131
132
 
132
133
 
133
- export type StackItem = {
134
- index: number;
135
- witness: WitnessMap;
136
- }
137
-
138
- export type WitnessStack = Array<StackItem>;
139
-
140
-
141
-
142
- /**
143
- * @typedef {Object} BuildInfo - Information about how the installed package was built
144
- * @property {string} gitHash - The hash of the git commit from which the package was built.
145
- * @property {string} version - The version of the package at the built git commit.
146
- * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
147
- */
148
- export type BuildInfo = {
149
- gitHash: string;
150
- version: string;
151
- dirty: string;
152
- }
153
-
154
-
155
-
156
134
  export type ForeignCallInput = string[]
157
135
  export type ForeignCallOutput = string | string[]
158
136
 
@@ -181,3 +159,26 @@ export type SolvedAndReturnWitness = {
181
159
  }
182
160
 
183
161
 
162
+
163
+ export type StackItem = {
164
+ index: number;
165
+ witness: WitnessMap;
166
+ }
167
+
168
+ export type WitnessStack = Array<StackItem>;
169
+
170
+
171
+
172
+ /**
173
+ * @typedef {Object} BuildInfo - Information about how the installed package was built
174
+ * @property {string} gitHash - The hash of the git commit from which the package was built.
175
+ * @property {string} version - The version of the package at the built git commit.
176
+ * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
177
+ */
178
+ export type BuildInfo = {
179
+ gitHash: string;
180
+ version: string;
181
+ dirty: string;
182
+ }
183
+
184
+
package/nodejs/acvm_js.js CHANGED
@@ -202,58 +202,6 @@ function debugString(val) {
202
202
  return className;
203
203
  }
204
204
 
205
- function passArray8ToWasm0(arg, malloc) {
206
- const ptr = malloc(arg.length * 1, 1) >>> 0;
207
- getUint8ArrayMemory0().set(arg, ptr / 1);
208
- WASM_VECTOR_LEN = arg.length;
209
- return ptr;
210
- }
211
- /**
212
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
213
- *
214
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
215
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
216
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
217
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
218
- */
219
- module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
220
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
221
- const len0 = WASM_VECTOR_LEN;
222
- const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
223
- return ret;
224
- };
225
-
226
- /**
227
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
228
- * This method also extracts the public return values from the solved witness into its own return witness.
229
- *
230
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
231
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
232
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
233
- * @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
234
- */
235
- module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
236
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
237
- const len0 = WASM_VECTOR_LEN;
238
- const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
239
- return ret;
240
- };
241
-
242
- /**
243
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
244
- *
245
- * @param {Uint8Array} program - A serialized representation of an ACIR program
246
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
247
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
248
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
249
- */
250
- module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
251
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
252
- const len0 = WASM_VECTOR_LEN;
253
- const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
254
- return ret;
255
- };
256
-
257
205
  function takeFromExternrefTable0(idx) {
258
206
  const value = wasm.__wbindgen_export_2.get(idx);
259
207
  wasm.__externref_table_dealloc(idx);
@@ -280,6 +228,12 @@ module.exports.compressWitness = function(witness_map) {
280
228
  return v1;
281
229
  };
282
230
 
231
+ function passArray8ToWasm0(arg, malloc) {
232
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
233
+ getUint8ArrayMemory0().set(arg, ptr / 1);
234
+ WASM_VECTOR_LEN = arg.length;
235
+ return ptr;
236
+ }
283
237
  /**
284
238
  * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
285
239
  * This should be used to only fetch the witness map for the main function.
@@ -329,6 +283,52 @@ module.exports.decompressWitnessStack = function(compressed_witness) {
329
283
  return takeFromExternrefTable0(ret[0]);
330
284
  };
331
285
 
286
+ /**
287
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
288
+ *
289
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
290
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
291
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
292
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
293
+ */
294
+ module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
295
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
296
+ const len0 = WASM_VECTOR_LEN;
297
+ const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
298
+ return ret;
299
+ };
300
+
301
+ /**
302
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
303
+ * This method also extracts the public return values from the solved witness into its own return witness.
304
+ *
305
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
306
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
307
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
308
+ * @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
309
+ */
310
+ module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
311
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
312
+ const len0 = WASM_VECTOR_LEN;
313
+ const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
314
+ return ret;
315
+ };
316
+
317
+ /**
318
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
319
+ *
320
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
321
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
322
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
323
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
324
+ */
325
+ module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
326
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
327
+ const len0 = WASM_VECTOR_LEN;
328
+ const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
329
+ return ret;
330
+ };
331
+
332
332
  /**
333
333
  * Sets the package's logging level.
334
334
  *
@@ -343,6 +343,75 @@ module.exports.initLogLevel = function(filter) {
343
343
  }
344
344
  };
345
345
 
346
+ /**
347
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
348
+ *
349
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
350
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
351
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
352
+ * @param {Uint8Array} program
353
+ * @param {WitnessMap} witness_map
354
+ * @returns {WitnessMap}
355
+ */
356
+ module.exports.getReturnWitness = function(program, witness_map) {
357
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
358
+ const len0 = WASM_VECTOR_LEN;
359
+ const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
360
+ if (ret[2]) {
361
+ throw takeFromExternrefTable0(ret[1]);
362
+ }
363
+ return takeFromExternrefTable0(ret[0]);
364
+ };
365
+
366
+ /**
367
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
368
+ *
369
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
370
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
371
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
372
+ * @param {Uint8Array} program
373
+ * @param {WitnessMap} solved_witness
374
+ * @returns {WitnessMap}
375
+ */
376
+ module.exports.getPublicParametersWitness = function(program, solved_witness) {
377
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
378
+ const len0 = WASM_VECTOR_LEN;
379
+ const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
380
+ if (ret[2]) {
381
+ throw takeFromExternrefTable0(ret[1]);
382
+ }
383
+ return takeFromExternrefTable0(ret[0]);
384
+ };
385
+
386
+ /**
387
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
388
+ *
389
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
390
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
391
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
392
+ * @param {Uint8Array} program
393
+ * @param {WitnessMap} solved_witness
394
+ * @returns {WitnessMap}
395
+ */
396
+ module.exports.getPublicWitness = function(program, solved_witness) {
397
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
398
+ const len0 = WASM_VECTOR_LEN;
399
+ const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
400
+ if (ret[2]) {
401
+ throw takeFromExternrefTable0(ret[1]);
402
+ }
403
+ return takeFromExternrefTable0(ret[0]);
404
+ };
405
+
406
+ /**
407
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
408
+ * @returns {BuildInfo} - Information on how the installed package was built.
409
+ */
410
+ module.exports.buildInfo = function() {
411
+ const ret = wasm.buildInfo();
412
+ return ret;
413
+ };
414
+
346
415
  /**
347
416
  * Performs a bitwise AND operation between `lhs` and `rhs`
348
417
  * @param {string} lhs
@@ -458,85 +527,16 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
458
527
  return ret !== 0;
459
528
  };
460
529
 
461
- /**
462
- * Returns the `BuildInfo` object containing information about how the installed package was built.
463
- * @returns {BuildInfo} - Information on how the installed package was built.
464
- */
465
- module.exports.buildInfo = function() {
466
- const ret = wasm.buildInfo();
467
- return ret;
468
- };
469
-
470
- /**
471
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
472
- *
473
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
474
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
475
- * @returns {WitnessMap} A witness map containing the circuit's return values.
476
- * @param {Uint8Array} program
477
- * @param {WitnessMap} witness_map
478
- * @returns {WitnessMap}
479
- */
480
- module.exports.getReturnWitness = function(program, witness_map) {
481
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
482
- const len0 = WASM_VECTOR_LEN;
483
- const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
484
- if (ret[2]) {
485
- throw takeFromExternrefTable0(ret[1]);
486
- }
487
- return takeFromExternrefTable0(ret[0]);
488
- };
489
-
490
- /**
491
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
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 public parameters.
496
- * @param {Uint8Array} program
497
- * @param {WitnessMap} solved_witness
498
- * @returns {WitnessMap}
499
- */
500
- module.exports.getPublicParametersWitness = function(program, solved_witness) {
501
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
502
- const len0 = WASM_VECTOR_LEN;
503
- const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
504
- if (ret[2]) {
505
- throw takeFromExternrefTable0(ret[1]);
506
- }
507
- return takeFromExternrefTable0(ret[0]);
508
- };
509
-
510
- /**
511
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
512
- *
513
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
514
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
515
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
516
- * @param {Uint8Array} program
517
- * @param {WitnessMap} solved_witness
518
- * @returns {WitnessMap}
519
- */
520
- module.exports.getPublicWitness = function(program, solved_witness) {
521
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
522
- const len0 = WASM_VECTOR_LEN;
523
- const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
524
- if (ret[2]) {
525
- throw takeFromExternrefTable0(ret[1]);
526
- }
527
- return takeFromExternrefTable0(ret[0]);
528
- };
529
-
530
530
  function __wbg_adapter_30(arg0, arg1, arg2) {
531
- wasm.closure265_externref_shim(arg0, arg1, arg2);
531
+ wasm.closure584_externref_shim(arg0, arg1, arg2);
532
532
  }
533
533
 
534
534
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
535
- wasm.closure826_externref_shim(arg0, arg1, arg2, arg3, arg4);
535
+ wasm.closure1179_externref_shim(arg0, arg1, arg2, arg3, arg4);
536
536
  }
537
537
 
538
538
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
539
- wasm.closure830_externref_shim(arg0, arg1, arg2, arg3);
539
+ wasm.closure1183_externref_shim(arg0, arg1, arg2, arg3);
540
540
  }
541
541
 
542
542
  module.exports.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
@@ -554,12 +554,12 @@ module.exports.__wbg_call_833bed5770ea2041 = function() { return handleError(fun
554
554
  return ret;
555
555
  }, arguments) };
556
556
 
557
- module.exports.__wbg_constructor_003f4a4118e07291 = function(arg0) {
557
+ module.exports.__wbg_constructor_590e27d4519f5f72 = function(arg0) {
558
558
  const ret = new Error(arg0);
559
559
  return ret;
560
560
  };
561
561
 
562
- module.exports.__wbg_constructor_c456dcccc52847dd = function(arg0) {
562
+ module.exports.__wbg_constructor_6f86ae2adbcd1779 = function(arg0) {
563
563
  const ret = new Error(arg0);
564
564
  return ret;
565
565
  };
@@ -675,11 +675,6 @@ module.exports.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
675
675
  }
676
676
  };
677
677
 
678
- module.exports.__wbg_new_3f4c5c451d69e970 = function() {
679
- const ret = new Map();
680
- return ret;
681
- };
682
-
683
678
  module.exports.__wbg_new_5e0be73521bc8c17 = function() {
684
679
  const ret = new Map();
685
680
  return ret;
@@ -695,7 +690,7 @@ module.exports.__wbg_new_8a6f238a6ece86ea = function() {
695
690
  return ret;
696
691
  };
697
692
 
698
- module.exports.__wbg_new_a324c5957dd8b845 = function() {
693
+ module.exports.__wbg_new_af7b60fde1e58f1b = function() {
699
694
  const ret = new Array();
700
695
  return ret;
701
696
  };
@@ -705,6 +700,11 @@ module.exports.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
705
700
  return ret;
706
701
  };
707
702
 
703
+ module.exports.__wbg_new_e2884e6fab20df40 = function() {
704
+ const ret = new Map();
705
+ return ret;
706
+ };
707
+
708
708
  module.exports.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
709
709
  const ret = new Function(getStringFromWasm0(arg0, arg1));
710
710
  return ret;
@@ -814,8 +814,8 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
814
814
  return ret;
815
815
  };
816
816
 
817
- module.exports.__wbindgen_closure_wrapper740 = function(arg0, arg1, arg2) {
818
- const ret = makeMutClosure(arg0, arg1, 266, __wbg_adapter_30);
817
+ module.exports.__wbindgen_closure_wrapper1979 = function(arg0, arg1, arg2) {
818
+ const ret = makeMutClosure(arg0, arg1, 585, __wbg_adapter_30);
819
819
  return ret;
820
820
  };
821
821
 
Binary file
@@ -1,24 +1,24 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
5
- export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
6
- export const executeProgram: (a: number, b: number, c: any, d: any) => any;
7
4
  export const compressWitness: (a: any) => [number, number, number, number];
8
5
  export const decompressWitness: (a: number, b: number) => [number, number, number];
9
6
  export const compressWitnessStack: (a: any) => [number, number, number, number];
10
7
  export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
8
+ export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
9
+ export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
10
+ export const executeProgram: (a: number, b: number, c: any, d: any) => any;
11
11
  export const initLogLevel: (a: number, b: number) => [number, number];
12
+ export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
13
+ export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
14
+ export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
15
+ export const buildInfo: () => any;
12
16
  export const and: (a: any, b: any) => any;
13
17
  export const xor: (a: any, b: any) => any;
14
18
  export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
15
19
  export const blake2s256: (a: number, b: number) => [number, number];
16
20
  export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
17
21
  export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
18
- export const buildInfo: () => any;
19
- export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
20
- export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
21
- export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
22
22
  export const __wbindgen_exn_store: (a: number) => void;
23
23
  export const __externref_table_alloc: () => number;
24
24
  export const __wbindgen_export_2: WebAssembly.Table;
@@ -27,7 +27,7 @@ export const __wbindgen_malloc: (a: number, b: number) => number;
27
27
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
28
28
  export const __wbindgen_export_6: WebAssembly.Table;
29
29
  export const __externref_table_dealloc: (a: number) => void;
30
- export const closure265_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure826_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure830_externref_shim: (a: number, b: number, c: any, d: any) => void;
30
+ export const closure584_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure1179_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure1183_externref_shim: (a: number, b: number, c: any, d: any) => void;
33
33
  export const __wbindgen_start: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/noir-acvm_js",
3
- "version": "0.0.0-test.0",
3
+ "version": "0.0.1-commit.24de95ac",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -26,27 +26,27 @@
26
26
  "package.json"
27
27
  ],
28
28
  "sideEffects": false,
29
- "packageManager": "yarn@3.5.1",
29
+ "packageManager": "yarn@4.5.2",
30
30
  "scripts": {
31
31
  "build": "bash ./build.sh",
32
32
  "test": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' mocha",
33
33
  "test:browser": "web-test-runner",
34
- "lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0",
34
+ "lint": "NODE_NO_WARNINGS=1 eslint . --max-warnings 0",
35
35
  "publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish",
36
36
  "nightly:version": "jq --arg new_version \"-$(git rev-parse --short HEAD)$1\" '.version = .version + $new_version' package.json > package-tmp.json && mv package-tmp.json package.json",
37
37
  "clean": "chmod u+w web nodejs || true && rm -rf web nodejs"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@esm-bundle/chai": "^4.3.4-fix.0",
41
- "@web/dev-server-esbuild": "^0.3.6",
42
- "@web/test-runner": "^0.18.1",
43
- "@web/test-runner-playwright": "^0.11.0",
41
+ "@web/dev-server-esbuild": "^1.0.4",
42
+ "@web/test-runner": "^0.20.2",
43
+ "@web/test-runner-playwright": "^0.11.1",
44
44
  "chai": "^4.4.1",
45
- "eslint": "^8.57.0",
46
- "eslint-plugin-prettier": "^5.1.3",
47
- "mocha": "^10.2.0",
48
- "prettier": "3.2.5",
49
- "ts-node": "^10.9.1",
50
- "typescript": "^5.4.2"
45
+ "eslint": "^9.28.0",
46
+ "eslint-plugin-prettier": "^5.4.1",
47
+ "mocha": "^11.5.0",
48
+ "prettier": "3.5.3",
49
+ "ts-node": "^10.9.2",
50
+ "typescript": "^5.8.3"
51
51
  }
52
52
  }
package/web/acvm_js.d.ts CHANGED
@@ -1,5 +1,34 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ /**
4
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
5
+ *
6
+ * @param {WitnessMap} witness_map - A witness map.
7
+ * @returns {Uint8Array} A compressed witness map
8
+ */
9
+ export function compressWitness(witness_map: WitnessMap): Uint8Array;
10
+ /**
11
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
12
+ * This should be used to only fetch the witness map for the main function.
13
+ *
14
+ * @param {Uint8Array} compressed_witness - A compressed witness.
15
+ * @returns {WitnessMap} The decompressed witness map.
16
+ */
17
+ export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
18
+ /**
19
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
20
+ *
21
+ * @param {WitnessStack} witness_stack - A witness stack.
22
+ * @returns {Uint8Array} A compressed witness stack
23
+ */
24
+ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
25
+ /**
26
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
27
+ *
28
+ * @param {Uint8Array} compressed_witness - A compressed witness.
29
+ * @returns {WitnessStack} The decompressed witness stack.
30
+ */
31
+ export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
3
32
  /**
4
33
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
5
34
  *
@@ -29,40 +58,40 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
29
58
  */
30
59
  export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
31
60
  /**
32
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
61
+ * Sets the package's logging level.
33
62
  *
34
- * @param {WitnessMap} witness_map - A witness map.
35
- * @returns {Uint8Array} A compressed witness map
63
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
36
64
  */
37
- export function compressWitness(witness_map: WitnessMap): Uint8Array;
65
+ export function initLogLevel(filter: string): void;
38
66
  /**
39
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
40
- * This should be used to only fetch the witness map for the main function.
67
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
41
68
  *
42
- * @param {Uint8Array} compressed_witness - A compressed witness.
43
- * @returns {WitnessMap} The decompressed witness map.
69
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
70
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
71
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
44
72
  */
45
- export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
73
+ export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
46
74
  /**
47
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
75
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
48
76
  *
49
- * @param {WitnessStack} witness_stack - A witness stack.
50
- * @returns {Uint8Array} A compressed witness stack
77
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
78
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
79
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
51
80
  */
52
- export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
81
+ export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
53
82
  /**
54
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
83
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
55
84
  *
56
- * @param {Uint8Array} compressed_witness - A compressed witness.
57
- * @returns {WitnessStack} The decompressed witness stack.
85
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
86
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
87
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
58
88
  */
59
- export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
89
+ export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
60
90
  /**
61
- * Sets the package's logging level.
62
- *
63
- * @param {LogLevel} level - The maximum level of logging to be emitted.
91
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
92
+ * @returns {BuildInfo} - Information on how the installed package was built.
64
93
  */
65
- export function initLogLevel(filter: string): void;
94
+ export function buildInfo(): BuildInfo;
66
95
  /**
67
96
  * Performs a bitwise AND operation between `lhs` and `rhs`
68
97
  */
@@ -87,35 +116,6 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
87
116
  * Verifies a ECDSA signature over the secp256r1 curve.
88
117
  */
89
118
  export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
90
- /**
91
- * Returns the `BuildInfo` object containing information about how the installed package was built.
92
- * @returns {BuildInfo} - Information on how the installed package was built.
93
- */
94
- export function buildInfo(): BuildInfo;
95
- /**
96
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
97
- *
98
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
99
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
100
- * @returns {WitnessMap} A witness map containing the circuit's return values.
101
- */
102
- export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
103
- /**
104
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
105
- *
106
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
107
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
108
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
109
- */
110
- export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
111
- /**
112
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
113
- *
114
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
115
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
116
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
117
- */
118
- export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
119
119
 
120
120
  export type RawAssertionPayload = {
121
121
  selector: string;
@@ -125,34 +125,12 @@ export type RawAssertionPayload = {
125
125
  export type ExecutionError = Error & {
126
126
  callStack?: string[];
127
127
  rawAssertionPayload?: RawAssertionPayload;
128
+ acirFunctionId?: number;
128
129
  brilligFunctionId?: number;
129
130
  };
130
131
 
131
132
 
132
133
 
133
- export type StackItem = {
134
- index: number;
135
- witness: WitnessMap;
136
- }
137
-
138
- export type WitnessStack = Array<StackItem>;
139
-
140
-
141
-
142
- /**
143
- * @typedef {Object} BuildInfo - Information about how the installed package was built
144
- * @property {string} gitHash - The hash of the git commit from which the package was built.
145
- * @property {string} version - The version of the package at the built git commit.
146
- * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
147
- */
148
- export type BuildInfo = {
149
- gitHash: string;
150
- version: string;
151
- dirty: string;
152
- }
153
-
154
-
155
-
156
134
  export type ForeignCallInput = string[]
157
135
  export type ForeignCallOutput = string | string[]
158
136
 
@@ -182,28 +160,51 @@ export type SolvedAndReturnWitness = {
182
160
 
183
161
 
184
162
 
163
+ export type StackItem = {
164
+ index: number;
165
+ witness: WitnessMap;
166
+ }
167
+
168
+ export type WitnessStack = Array<StackItem>;
169
+
170
+
171
+
172
+ /**
173
+ * @typedef {Object} BuildInfo - Information about how the installed package was built
174
+ * @property {string} gitHash - The hash of the git commit from which the package was built.
175
+ * @property {string} version - The version of the package at the built git commit.
176
+ * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
177
+ */
178
+ export type BuildInfo = {
179
+ gitHash: string;
180
+ version: string;
181
+ dirty: string;
182
+ }
183
+
184
+
185
+
185
186
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
186
187
 
187
188
  export interface InitOutput {
188
189
  readonly memory: WebAssembly.Memory;
189
- readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
190
- readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
191
- readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
192
190
  readonly compressWitness: (a: any) => [number, number, number, number];
193
191
  readonly decompressWitness: (a: number, b: number) => [number, number, number];
194
192
  readonly compressWitnessStack: (a: any) => [number, number, number, number];
195
193
  readonly decompressWitnessStack: (a: number, b: number) => [number, number, number];
194
+ readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
195
+ readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
196
+ readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
196
197
  readonly initLogLevel: (a: number, b: number) => [number, number];
198
+ readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
199
+ readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
200
+ readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
201
+ readonly buildInfo: () => any;
197
202
  readonly and: (a: any, b: any) => any;
198
203
  readonly xor: (a: any, b: any) => any;
199
204
  readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
200
205
  readonly blake2s256: (a: number, b: number) => [number, number];
201
206
  readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
202
207
  readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
203
- readonly buildInfo: () => any;
204
- readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
205
- readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
206
- readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
207
208
  readonly __wbindgen_exn_store: (a: number) => void;
208
209
  readonly __externref_table_alloc: () => number;
209
210
  readonly __wbindgen_export_2: WebAssembly.Table;
@@ -212,9 +213,9 @@ export interface InitOutput {
212
213
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
213
214
  readonly __wbindgen_export_6: WebAssembly.Table;
214
215
  readonly __externref_table_dealloc: (a: number) => void;
215
- readonly closure265_externref_shim: (a: number, b: number, c: any) => void;
216
- readonly closure826_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
217
- readonly closure830_externref_shim: (a: number, b: number, c: any, d: any) => void;
216
+ readonly closure584_externref_shim: (a: number, b: number, c: any) => void;
217
+ readonly closure1179_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
218
+ readonly closure1183_externref_shim: (a: number, b: number, c: any, d: any) => void;
218
219
  readonly __wbindgen_start: () => void;
219
220
  }
220
221
 
package/web/acvm_js.js CHANGED
@@ -198,58 +198,6 @@ function debugString(val) {
198
198
  return className;
199
199
  }
200
200
 
201
- function passArray8ToWasm0(arg, malloc) {
202
- const ptr = malloc(arg.length * 1, 1) >>> 0;
203
- getUint8ArrayMemory0().set(arg, ptr / 1);
204
- WASM_VECTOR_LEN = arg.length;
205
- return ptr;
206
- }
207
- /**
208
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
209
- *
210
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
211
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
212
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
213
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
214
- */
215
- export function executeCircuit(program, initial_witness, foreign_call_handler) {
216
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
217
- const len0 = WASM_VECTOR_LEN;
218
- const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
219
- return ret;
220
- }
221
-
222
- /**
223
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
224
- * This method also extracts the public return values from the solved witness into its own return witness.
225
- *
226
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
227
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
228
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
229
- * @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
230
- */
231
- export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
232
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
233
- const len0 = WASM_VECTOR_LEN;
234
- const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
235
- return ret;
236
- }
237
-
238
- /**
239
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
240
- *
241
- * @param {Uint8Array} program - A serialized representation of an ACIR program
242
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
243
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
244
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
245
- */
246
- export function executeProgram(program, initial_witness, foreign_call_handler) {
247
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
248
- const len0 = WASM_VECTOR_LEN;
249
- const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
250
- return ret;
251
- }
252
-
253
201
  function takeFromExternrefTable0(idx) {
254
202
  const value = wasm.__wbindgen_export_2.get(idx);
255
203
  wasm.__externref_table_dealloc(idx);
@@ -276,6 +224,12 @@ export function compressWitness(witness_map) {
276
224
  return v1;
277
225
  }
278
226
 
227
+ function passArray8ToWasm0(arg, malloc) {
228
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
229
+ getUint8ArrayMemory0().set(arg, ptr / 1);
230
+ WASM_VECTOR_LEN = arg.length;
231
+ return ptr;
232
+ }
279
233
  /**
280
234
  * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
281
235
  * This should be used to only fetch the witness map for the main function.
@@ -325,6 +279,52 @@ export function decompressWitnessStack(compressed_witness) {
325
279
  return takeFromExternrefTable0(ret[0]);
326
280
  }
327
281
 
282
+ /**
283
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
284
+ *
285
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
286
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
287
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
288
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
289
+ */
290
+ export function executeCircuit(program, initial_witness, foreign_call_handler) {
291
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
292
+ const len0 = WASM_VECTOR_LEN;
293
+ const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
294
+ return ret;
295
+ }
296
+
297
+ /**
298
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
299
+ * This method also extracts the public return values from the solved witness into its own return witness.
300
+ *
301
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
302
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
303
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
304
+ * @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
305
+ */
306
+ export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
307
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
308
+ const len0 = WASM_VECTOR_LEN;
309
+ const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
310
+ return ret;
311
+ }
312
+
313
+ /**
314
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
315
+ *
316
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
317
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
318
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
319
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
320
+ */
321
+ export function executeProgram(program, initial_witness, foreign_call_handler) {
322
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
323
+ const len0 = WASM_VECTOR_LEN;
324
+ const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
325
+ return ret;
326
+ }
327
+
328
328
  /**
329
329
  * Sets the package's logging level.
330
330
  *
@@ -339,6 +339,75 @@ export function initLogLevel(filter) {
339
339
  }
340
340
  }
341
341
 
342
+ /**
343
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
344
+ *
345
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
346
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
347
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
348
+ * @param {Uint8Array} program
349
+ * @param {WitnessMap} witness_map
350
+ * @returns {WitnessMap}
351
+ */
352
+ export function getReturnWitness(program, witness_map) {
353
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
354
+ const len0 = WASM_VECTOR_LEN;
355
+ const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
356
+ if (ret[2]) {
357
+ throw takeFromExternrefTable0(ret[1]);
358
+ }
359
+ return takeFromExternrefTable0(ret[0]);
360
+ }
361
+
362
+ /**
363
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
364
+ *
365
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
366
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
367
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
368
+ * @param {Uint8Array} program
369
+ * @param {WitnessMap} solved_witness
370
+ * @returns {WitnessMap}
371
+ */
372
+ export function getPublicParametersWitness(program, solved_witness) {
373
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
374
+ const len0 = WASM_VECTOR_LEN;
375
+ const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
376
+ if (ret[2]) {
377
+ throw takeFromExternrefTable0(ret[1]);
378
+ }
379
+ return takeFromExternrefTable0(ret[0]);
380
+ }
381
+
382
+ /**
383
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
384
+ *
385
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
386
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
387
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
388
+ * @param {Uint8Array} program
389
+ * @param {WitnessMap} solved_witness
390
+ * @returns {WitnessMap}
391
+ */
392
+ export function getPublicWitness(program, solved_witness) {
393
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
394
+ const len0 = WASM_VECTOR_LEN;
395
+ const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
396
+ if (ret[2]) {
397
+ throw takeFromExternrefTable0(ret[1]);
398
+ }
399
+ return takeFromExternrefTable0(ret[0]);
400
+ }
401
+
402
+ /**
403
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
404
+ * @returns {BuildInfo} - Information on how the installed package was built.
405
+ */
406
+ export function buildInfo() {
407
+ const ret = wasm.buildInfo();
408
+ return ret;
409
+ }
410
+
342
411
  /**
343
412
  * Performs a bitwise AND operation between `lhs` and `rhs`
344
413
  * @param {string} lhs
@@ -454,85 +523,16 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
454
523
  return ret !== 0;
455
524
  }
456
525
 
457
- /**
458
- * Returns the `BuildInfo` object containing information about how the installed package was built.
459
- * @returns {BuildInfo} - Information on how the installed package was built.
460
- */
461
- export function buildInfo() {
462
- const ret = wasm.buildInfo();
463
- return ret;
464
- }
465
-
466
- /**
467
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
468
- *
469
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
470
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
471
- * @returns {WitnessMap} A witness map containing the circuit's return values.
472
- * @param {Uint8Array} program
473
- * @param {WitnessMap} witness_map
474
- * @returns {WitnessMap}
475
- */
476
- export function getReturnWitness(program, witness_map) {
477
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
478
- const len0 = WASM_VECTOR_LEN;
479
- const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
480
- if (ret[2]) {
481
- throw takeFromExternrefTable0(ret[1]);
482
- }
483
- return takeFromExternrefTable0(ret[0]);
484
- }
485
-
486
- /**
487
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
488
- *
489
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
490
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
491
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
492
- * @param {Uint8Array} program
493
- * @param {WitnessMap} solved_witness
494
- * @returns {WitnessMap}
495
- */
496
- export function getPublicParametersWitness(program, solved_witness) {
497
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
498
- const len0 = WASM_VECTOR_LEN;
499
- const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
500
- if (ret[2]) {
501
- throw takeFromExternrefTable0(ret[1]);
502
- }
503
- return takeFromExternrefTable0(ret[0]);
504
- }
505
-
506
- /**
507
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
508
- *
509
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
510
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
511
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
512
- * @param {Uint8Array} program
513
- * @param {WitnessMap} solved_witness
514
- * @returns {WitnessMap}
515
- */
516
- export function getPublicWitness(program, solved_witness) {
517
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
518
- const len0 = WASM_VECTOR_LEN;
519
- const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
520
- if (ret[2]) {
521
- throw takeFromExternrefTable0(ret[1]);
522
- }
523
- return takeFromExternrefTable0(ret[0]);
524
- }
525
-
526
526
  function __wbg_adapter_30(arg0, arg1, arg2) {
527
- wasm.closure265_externref_shim(arg0, arg1, arg2);
527
+ wasm.closure584_externref_shim(arg0, arg1, arg2);
528
528
  }
529
529
 
530
530
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
531
- wasm.closure826_externref_shim(arg0, arg1, arg2, arg3, arg4);
531
+ wasm.closure1179_externref_shim(arg0, arg1, arg2, arg3, arg4);
532
532
  }
533
533
 
534
534
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
535
- wasm.closure830_externref_shim(arg0, arg1, arg2, arg3);
535
+ wasm.closure1183_externref_shim(arg0, arg1, arg2, arg3);
536
536
  }
537
537
 
538
538
  async function __wbg_load(module, imports) {
@@ -581,11 +581,11 @@ function __wbg_get_imports() {
581
581
  const ret = arg0.call(arg1, arg2, arg3);
582
582
  return ret;
583
583
  }, arguments) };
584
- imports.wbg.__wbg_constructor_003f4a4118e07291 = function(arg0) {
584
+ imports.wbg.__wbg_constructor_590e27d4519f5f72 = function(arg0) {
585
585
  const ret = new Error(arg0);
586
586
  return ret;
587
587
  };
588
- imports.wbg.__wbg_constructor_c456dcccc52847dd = function(arg0) {
588
+ imports.wbg.__wbg_constructor_6f86ae2adbcd1779 = function(arg0) {
589
589
  const ret = new Error(arg0);
590
590
  return ret;
591
591
  };
@@ -686,10 +686,6 @@ function __wbg_get_imports() {
686
686
  state0.a = state0.b = 0;
687
687
  }
688
688
  };
689
- imports.wbg.__wbg_new_3f4c5c451d69e970 = function() {
690
- const ret = new Map();
691
- return ret;
692
- };
693
689
  imports.wbg.__wbg_new_5e0be73521bc8c17 = function() {
694
690
  const ret = new Map();
695
691
  return ret;
@@ -702,7 +698,7 @@ function __wbg_get_imports() {
702
698
  const ret = new Error();
703
699
  return ret;
704
700
  };
705
- imports.wbg.__wbg_new_a324c5957dd8b845 = function() {
701
+ imports.wbg.__wbg_new_af7b60fde1e58f1b = function() {
706
702
  const ret = new Array();
707
703
  return ret;
708
704
  };
@@ -710,6 +706,10 @@ function __wbg_get_imports() {
710
706
  const ret = new Error(getStringFromWasm0(arg0, arg1));
711
707
  return ret;
712
708
  };
709
+ imports.wbg.__wbg_new_e2884e6fab20df40 = function() {
710
+ const ret = new Map();
711
+ return ret;
712
+ };
713
713
  imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
714
714
  const ret = new Function(getStringFromWasm0(arg0, arg1));
715
715
  return ret;
@@ -798,8 +798,8 @@ function __wbg_get_imports() {
798
798
  const ret = false;
799
799
  return ret;
800
800
  };
801
- imports.wbg.__wbindgen_closure_wrapper740 = function(arg0, arg1, arg2) {
802
- const ret = makeMutClosure(arg0, arg1, 266, __wbg_adapter_30);
801
+ imports.wbg.__wbindgen_closure_wrapper1979 = function(arg0, arg1, arg2) {
802
+ const ret = makeMutClosure(arg0, arg1, 585, __wbg_adapter_30);
803
803
  return ret;
804
804
  };
805
805
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
Binary file
@@ -1,24 +1,24 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
5
- export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
6
- export const executeProgram: (a: number, b: number, c: any, d: any) => any;
7
4
  export const compressWitness: (a: any) => [number, number, number, number];
8
5
  export const decompressWitness: (a: number, b: number) => [number, number, number];
9
6
  export const compressWitnessStack: (a: any) => [number, number, number, number];
10
7
  export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
8
+ export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
9
+ export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
10
+ export const executeProgram: (a: number, b: number, c: any, d: any) => any;
11
11
  export const initLogLevel: (a: number, b: number) => [number, number];
12
+ export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
13
+ export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
14
+ export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
15
+ export const buildInfo: () => any;
12
16
  export const and: (a: any, b: any) => any;
13
17
  export const xor: (a: any, b: any) => any;
14
18
  export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
15
19
  export const blake2s256: (a: number, b: number) => [number, number];
16
20
  export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
17
21
  export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
18
- export const buildInfo: () => any;
19
- export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
20
- export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
21
- export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
22
22
  export const __wbindgen_exn_store: (a: number) => void;
23
23
  export const __externref_table_alloc: () => number;
24
24
  export const __wbindgen_export_2: WebAssembly.Table;
@@ -27,7 +27,7 @@ export const __wbindgen_malloc: (a: number, b: number) => number;
27
27
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
28
28
  export const __wbindgen_export_6: WebAssembly.Table;
29
29
  export const __externref_table_dealloc: (a: number) => void;
30
- export const closure265_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure826_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure830_externref_shim: (a: number, b: number, c: any, d: any) => void;
30
+ export const closure584_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure1179_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure1183_externref_shim: (a: number, b: number, c: any, d: any) => void;
33
33
  export const __wbindgen_start: () => void;