@aztec/noir-acvm_js 4.0.0-nightly.20260120 → 4.0.0-nightly.20260122

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.
@@ -5,64 +5,6 @@
5
5
  * @returns {BuildInfo} - Information on how the installed package was built.
6
6
  */
7
7
  export function buildInfo(): BuildInfo;
8
- /**
9
- * Sets the package's logging level.
10
- *
11
- * @param {LogLevel} level - The maximum level of logging to be emitted.
12
- */
13
- export function initLogLevel(filter: string): void;
14
- /**
15
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
16
- *
17
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
18
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
19
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
20
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
21
- */
22
- export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
23
- /**
24
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
25
- * This method also extracts the public return values from the solved witness into its own return witness.
26
- *
27
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
28
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
29
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
30
- * @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.
31
- */
32
- export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
33
- /**
34
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
35
- *
36
- * @param {Uint8Array} program - A serialized representation of an ACIR program
37
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
38
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
39
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
40
- */
41
- export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
42
- /**
43
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
44
- *
45
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
46
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
47
- * @returns {WitnessMap} A witness map containing the circuit's return values.
48
- */
49
- export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
50
- /**
51
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
52
- *
53
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
54
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
55
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
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
- */
65
- export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
66
8
  /**
67
9
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
68
10
  *
@@ -116,6 +58,73 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
116
58
  * Verifies a ECDSA signature over the secp256r1 curve.
117
59
  */
118
60
  export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
61
+ /**
62
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
63
+ *
64
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
65
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
66
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
67
+ */
68
+ export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
69
+ /**
70
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
71
+ *
72
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
73
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
74
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
75
+ */
76
+ export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
77
+ /**
78
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
79
+ *
80
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
81
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
82
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
83
+ */
84
+ export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
85
+ /**
86
+ * Sets the package's logging level.
87
+ *
88
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
89
+ */
90
+ export function initLogLevel(filter: string): void;
91
+ /**
92
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
93
+ *
94
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
95
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
96
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
97
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
98
+ */
99
+ export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
100
+ /**
101
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
102
+ * This method also extracts the public return values from the solved witness into its own return witness.
103
+ *
104
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
105
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
106
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
107
+ * @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.
108
+ */
109
+ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
110
+ /**
111
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
112
+ *
113
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
114
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
115
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
116
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
117
+ */
118
+ export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
119
+
120
+ export type StackItem = {
121
+ index: number;
122
+ witness: WitnessMap;
123
+ }
124
+
125
+ export type WitnessStack = Array<StackItem>;
126
+
127
+
119
128
 
120
129
  /**
121
130
  * @typedef {Object} BuildInfo - Information about how the installed package was built
@@ -131,20 +140,6 @@ export type BuildInfo = {
131
140
 
132
141
 
133
142
 
134
- export type RawAssertionPayload = {
135
- selector: string;
136
- data: string[];
137
- };
138
-
139
- export type ExecutionError = Error & {
140
- callStack?: string[];
141
- rawAssertionPayload?: RawAssertionPayload;
142
- acirFunctionId?: number;
143
- brilligFunctionId?: number;
144
- };
145
-
146
-
147
-
148
143
  // Map from witness index to hex string value of witness.
149
144
  export type WitnessMap = Map<number, string>;
150
145
 
@@ -160,6 +155,20 @@ export type SolvedAndReturnWitness = {
160
155
 
161
156
 
162
157
 
158
+ export type RawAssertionPayload = {
159
+ selector: string;
160
+ data: string[];
161
+ };
162
+
163
+ export type ExecutionError = Error & {
164
+ callStack?: string[];
165
+ rawAssertionPayload?: RawAssertionPayload;
166
+ acirFunctionId?: number;
167
+ brilligFunctionId?: number;
168
+ };
169
+
170
+
171
+
163
172
  export type ForeignCallInput = string[]
164
173
  export type ForeignCallOutput = string | string[]
165
174
 
@@ -173,12 +182,3 @@ export type ForeignCallOutput = string | string[]
173
182
  export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
174
183
 
175
184
 
176
-
177
- export type StackItem = {
178
- index: number;
179
- witness: WitnessMap;
180
- }
181
-
182
- export type WitnessStack = Array<StackItem>;
183
-
184
-
package/nodejs/acvm_js.js CHANGED
@@ -215,131 +215,6 @@ function takeFromExternrefTable0(idx) {
215
215
  wasm.__externref_table_dealloc(idx);
216
216
  return value;
217
217
  }
218
- /**
219
- * Sets the package's logging level.
220
- *
221
- * @param {LogLevel} level - The maximum level of logging to be emitted.
222
- */
223
- module.exports.initLogLevel = function(filter) {
224
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
225
- const len0 = WASM_VECTOR_LEN;
226
- const ret = wasm.initLogLevel(ptr0, len0);
227
- if (ret[1]) {
228
- throw takeFromExternrefTable0(ret[0]);
229
- }
230
- };
231
-
232
- function passArray8ToWasm0(arg, malloc) {
233
- const ptr = malloc(arg.length * 1, 1) >>> 0;
234
- getUint8ArrayMemory0().set(arg, ptr / 1);
235
- WASM_VECTOR_LEN = arg.length;
236
- return ptr;
237
- }
238
- /**
239
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
240
- *
241
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
242
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
243
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
244
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
245
- */
246
- module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
247
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
248
- const len0 = WASM_VECTOR_LEN;
249
- const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
250
- return ret;
251
- };
252
-
253
- /**
254
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
255
- * This method also extracts the public return values from the solved witness into its own return witness.
256
- *
257
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
258
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
259
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
260
- * @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.
261
- */
262
- module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
263
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
264
- const len0 = WASM_VECTOR_LEN;
265
- const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
266
- return ret;
267
- };
268
-
269
- /**
270
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
271
- *
272
- * @param {Uint8Array} program - A serialized representation of an ACIR program
273
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
274
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
275
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
276
- */
277
- module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
278
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
279
- const len0 = WASM_VECTOR_LEN;
280
- const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
281
- return 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
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
296
- const len0 = WASM_VECTOR_LEN;
297
- const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
298
- if (ret[2]) {
299
- throw takeFromExternrefTable0(ret[1]);
300
- }
301
- return takeFromExternrefTable0(ret[0]);
302
- };
303
-
304
- /**
305
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
306
- *
307
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
308
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
309
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
310
- * @param {Uint8Array} program
311
- * @param {WitnessMap} solved_witness
312
- * @returns {WitnessMap}
313
- */
314
- module.exports.getPublicParametersWitness = function(program, solved_witness) {
315
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
316
- const len0 = WASM_VECTOR_LEN;
317
- const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
318
- if (ret[2]) {
319
- throw takeFromExternrefTable0(ret[1]);
320
- }
321
- return takeFromExternrefTable0(ret[0]);
322
- };
323
-
324
- /**
325
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
326
- *
327
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
328
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
329
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
330
- * @param {Uint8Array} program
331
- * @param {WitnessMap} solved_witness
332
- * @returns {WitnessMap}
333
- */
334
- module.exports.getPublicWitness = function(program, solved_witness) {
335
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
336
- const len0 = WASM_VECTOR_LEN;
337
- const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
338
- if (ret[2]) {
339
- throw takeFromExternrefTable0(ret[1]);
340
- }
341
- return takeFromExternrefTable0(ret[0]);
342
- };
343
218
 
344
219
  function getArrayU8FromWasm0(ptr, len) {
345
220
  ptr = ptr >>> 0;
@@ -361,6 +236,12 @@ module.exports.compressWitness = function(witness_map) {
361
236
  return v1;
362
237
  };
363
238
 
239
+ function passArray8ToWasm0(arg, malloc) {
240
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
241
+ getUint8ArrayMemory0().set(arg, ptr / 1);
242
+ WASM_VECTOR_LEN = arg.length;
243
+ return ptr;
244
+ }
364
245
  /**
365
246
  * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
366
247
  * This should be used to only fetch the witness map for the main function.
@@ -525,16 +406,136 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
525
406
  return ret !== 0;
526
407
  };
527
408
 
409
+ /**
410
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
411
+ *
412
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
413
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
414
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
415
+ * @param {Uint8Array} program
416
+ * @param {WitnessMap} witness_map
417
+ * @returns {WitnessMap}
418
+ */
419
+ module.exports.getReturnWitness = function(program, witness_map) {
420
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
421
+ const len0 = WASM_VECTOR_LEN;
422
+ const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
423
+ if (ret[2]) {
424
+ throw takeFromExternrefTable0(ret[1]);
425
+ }
426
+ return takeFromExternrefTable0(ret[0]);
427
+ };
428
+
429
+ /**
430
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
431
+ *
432
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
433
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
434
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
435
+ * @param {Uint8Array} program
436
+ * @param {WitnessMap} solved_witness
437
+ * @returns {WitnessMap}
438
+ */
439
+ module.exports.getPublicParametersWitness = function(program, solved_witness) {
440
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
441
+ const len0 = WASM_VECTOR_LEN;
442
+ const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
443
+ if (ret[2]) {
444
+ throw takeFromExternrefTable0(ret[1]);
445
+ }
446
+ return takeFromExternrefTable0(ret[0]);
447
+ };
448
+
449
+ /**
450
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
451
+ *
452
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
453
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
454
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
455
+ * @param {Uint8Array} program
456
+ * @param {WitnessMap} solved_witness
457
+ * @returns {WitnessMap}
458
+ */
459
+ module.exports.getPublicWitness = function(program, solved_witness) {
460
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
461
+ const len0 = WASM_VECTOR_LEN;
462
+ const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
463
+ if (ret[2]) {
464
+ throw takeFromExternrefTable0(ret[1]);
465
+ }
466
+ return takeFromExternrefTable0(ret[0]);
467
+ };
468
+
469
+ /**
470
+ * Sets the package's logging level.
471
+ *
472
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
473
+ */
474
+ module.exports.initLogLevel = function(filter) {
475
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
476
+ const len0 = WASM_VECTOR_LEN;
477
+ const ret = wasm.initLogLevel(ptr0, len0);
478
+ if (ret[1]) {
479
+ throw takeFromExternrefTable0(ret[0]);
480
+ }
481
+ };
482
+
483
+ /**
484
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
485
+ *
486
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
487
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
488
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
489
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
490
+ */
491
+ module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
492
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
493
+ const len0 = WASM_VECTOR_LEN;
494
+ const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
495
+ return ret;
496
+ };
497
+
498
+ /**
499
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
500
+ * This method also extracts the public return values from the solved witness into its own return witness.
501
+ *
502
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
503
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
504
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
505
+ * @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.
506
+ */
507
+ module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
508
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
509
+ const len0 = WASM_VECTOR_LEN;
510
+ const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
511
+ return ret;
512
+ };
513
+
514
+ /**
515
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
516
+ *
517
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
518
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
519
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
520
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
521
+ */
522
+ module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
523
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
524
+ const len0 = WASM_VECTOR_LEN;
525
+ const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
526
+ return ret;
527
+ };
528
+
528
529
  function __wbg_adapter_30(arg0, arg1, arg2) {
529
- wasm.closure447_externref_shim(arg0, arg1, arg2);
530
+ wasm.closure448_externref_shim(arg0, arg1, arg2);
530
531
  }
531
532
 
532
533
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
533
- wasm.closure932_externref_shim(arg0, arg1, arg2, arg3, arg4);
534
+ wasm.closure933_externref_shim(arg0, arg1, arg2, arg3, arg4);
534
535
  }
535
536
 
536
537
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
537
- wasm.closure936_externref_shim(arg0, arg1, arg2, arg3);
538
+ wasm.closure937_externref_shim(arg0, arg1, arg2, arg3);
538
539
  }
539
540
 
540
541
  module.exports.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
@@ -812,8 +813,8 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
812
813
  return ret;
813
814
  };
814
815
 
815
- module.exports.__wbindgen_closure_wrapper1447 = function(arg0, arg1, arg2) {
816
- const ret = makeMutClosure(arg0, arg1, 448, __wbg_adapter_30);
816
+ module.exports.__wbindgen_closure_wrapper1446 = function(arg0, arg1, arg2) {
817
+ const ret = makeMutClosure(arg0, arg1, 449, __wbg_adapter_30);
817
818
  return ret;
818
819
  };
819
820
 
Binary file
@@ -2,13 +2,6 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const buildInfo: () => any;
5
- export const initLogLevel: (a: number, b: number) => [number, number];
6
- export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
7
- export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
8
- export const executeProgram: (a: number, b: number, c: any, d: any) => any;
9
- export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
10
- export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
11
- export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
12
5
  export const compressWitness: (a: any) => [number, number, number, number];
13
6
  export const decompressWitness: (a: number, b: number) => [number, number, number];
14
7
  export const compressWitnessStack: (a: any) => [number, number, number, number];
@@ -19,6 +12,13 @@ export const sha256_compression: (a: number, b: number, c: number, d: number) =>
19
12
  export const blake2s256: (a: number, b: number) => [number, number];
20
13
  export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
21
14
  export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
15
+ export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
16
+ export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
17
+ export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
18
+ export const initLogLevel: (a: number, b: number) => [number, number];
19
+ export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
20
+ export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
21
+ export const executeProgram: (a: number, b: number, c: any, d: any) => any;
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 closure447_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure932_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure936_externref_shim: (a: number, b: number, c: any, d: any) => void;
30
+ export const closure448_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure933_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure937_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": "4.0.0-nightly.20260120",
3
+ "version": "4.0.0-nightly.20260122",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -43,9 +43,9 @@
43
43
  "@web/test-runner-playwright": "^0.11.1",
44
44
  "chai": "^6.2.2",
45
45
  "eslint": "^9.39.2",
46
- "eslint-plugin-prettier": "^5.5.4",
46
+ "eslint-plugin-prettier": "^5.5.5",
47
47
  "mocha": "^11.7.5",
48
- "prettier": "3.7.4",
48
+ "prettier": "3.8.0",
49
49
  "ts-node": "^10.9.2",
50
50
  "typescript": "^5.8.3"
51
51
  }
package/web/acvm_js.d.ts CHANGED
@@ -5,64 +5,6 @@
5
5
  * @returns {BuildInfo} - Information on how the installed package was built.
6
6
  */
7
7
  export function buildInfo(): BuildInfo;
8
- /**
9
- * Sets the package's logging level.
10
- *
11
- * @param {LogLevel} level - The maximum level of logging to be emitted.
12
- */
13
- export function initLogLevel(filter: string): void;
14
- /**
15
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
16
- *
17
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
18
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
19
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
20
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
21
- */
22
- export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
23
- /**
24
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
25
- * This method also extracts the public return values from the solved witness into its own return witness.
26
- *
27
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
28
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
29
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
30
- * @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.
31
- */
32
- export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
33
- /**
34
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
35
- *
36
- * @param {Uint8Array} program - A serialized representation of an ACIR program
37
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
38
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
39
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
40
- */
41
- export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
42
- /**
43
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
44
- *
45
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
46
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
47
- * @returns {WitnessMap} A witness map containing the circuit's return values.
48
- */
49
- export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
50
- /**
51
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
52
- *
53
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
54
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
55
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
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
- */
65
- export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
66
8
  /**
67
9
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
68
10
  *
@@ -116,6 +58,73 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
116
58
  * Verifies a ECDSA signature over the secp256r1 curve.
117
59
  */
118
60
  export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
61
+ /**
62
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
63
+ *
64
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
65
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
66
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
67
+ */
68
+ export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
69
+ /**
70
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
71
+ *
72
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
73
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
74
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
75
+ */
76
+ export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
77
+ /**
78
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
79
+ *
80
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
81
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
82
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
83
+ */
84
+ export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
85
+ /**
86
+ * Sets the package's logging level.
87
+ *
88
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
89
+ */
90
+ export function initLogLevel(filter: string): void;
91
+ /**
92
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
93
+ *
94
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
95
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
96
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
97
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
98
+ */
99
+ export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
100
+ /**
101
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
102
+ * This method also extracts the public return values from the solved witness into its own return witness.
103
+ *
104
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
105
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
106
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
107
+ * @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.
108
+ */
109
+ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
110
+ /**
111
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
112
+ *
113
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
114
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
115
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
116
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
117
+ */
118
+ export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
119
+
120
+ export type StackItem = {
121
+ index: number;
122
+ witness: WitnessMap;
123
+ }
124
+
125
+ export type WitnessStack = Array<StackItem>;
126
+
127
+
119
128
 
120
129
  /**
121
130
  * @typedef {Object} BuildInfo - Information about how the installed package was built
@@ -131,20 +140,6 @@ export type BuildInfo = {
131
140
 
132
141
 
133
142
 
134
- export type RawAssertionPayload = {
135
- selector: string;
136
- data: string[];
137
- };
138
-
139
- export type ExecutionError = Error & {
140
- callStack?: string[];
141
- rawAssertionPayload?: RawAssertionPayload;
142
- acirFunctionId?: number;
143
- brilligFunctionId?: number;
144
- };
145
-
146
-
147
-
148
143
  // Map from witness index to hex string value of witness.
149
144
  export type WitnessMap = Map<number, string>;
150
145
 
@@ -160,6 +155,20 @@ export type SolvedAndReturnWitness = {
160
155
 
161
156
 
162
157
 
158
+ export type RawAssertionPayload = {
159
+ selector: string;
160
+ data: string[];
161
+ };
162
+
163
+ export type ExecutionError = Error & {
164
+ callStack?: string[];
165
+ rawAssertionPayload?: RawAssertionPayload;
166
+ acirFunctionId?: number;
167
+ brilligFunctionId?: number;
168
+ };
169
+
170
+
171
+
163
172
  export type ForeignCallInput = string[]
164
173
  export type ForeignCallOutput = string | string[]
165
174
 
@@ -174,27 +183,11 @@ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => P
174
183
 
175
184
 
176
185
 
177
- export type StackItem = {
178
- index: number;
179
- witness: WitnessMap;
180
- }
181
-
182
- export type WitnessStack = Array<StackItem>;
183
-
184
-
185
-
186
186
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
187
187
 
188
188
  export interface InitOutput {
189
189
  readonly memory: WebAssembly.Memory;
190
190
  readonly buildInfo: () => any;
191
- readonly initLogLevel: (a: number, b: number) => [number, number];
192
- readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
193
- readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
194
- readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
195
- readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
196
- readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
197
- readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
198
191
  readonly compressWitness: (a: any) => [number, number, number, number];
199
192
  readonly decompressWitness: (a: number, b: number) => [number, number, number];
200
193
  readonly compressWitnessStack: (a: any) => [number, number, number, number];
@@ -205,6 +198,13 @@ export interface InitOutput {
205
198
  readonly blake2s256: (a: number, b: number) => [number, number];
206
199
  readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
207
200
  readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
201
+ readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
202
+ readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
203
+ readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
204
+ readonly initLogLevel: (a: number, b: number) => [number, number];
205
+ readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
206
+ readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
207
+ readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
208
208
  readonly __wbindgen_exn_store: (a: number) => void;
209
209
  readonly __externref_table_alloc: () => number;
210
210
  readonly __wbindgen_export_2: WebAssembly.Table;
@@ -213,9 +213,9 @@ export interface InitOutput {
213
213
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
214
214
  readonly __wbindgen_export_6: WebAssembly.Table;
215
215
  readonly __externref_table_dealloc: (a: number) => void;
216
- readonly closure447_externref_shim: (a: number, b: number, c: any) => void;
217
- readonly closure932_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
218
- readonly closure936_externref_shim: (a: number, b: number, c: any, d: any) => void;
216
+ readonly closure448_externref_shim: (a: number, b: number, c: any) => void;
217
+ readonly closure933_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
218
+ readonly closure937_externref_shim: (a: number, b: number, c: any, d: any) => void;
219
219
  readonly __wbindgen_start: () => void;
220
220
  }
221
221
 
package/web/acvm_js.js CHANGED
@@ -211,131 +211,6 @@ function takeFromExternrefTable0(idx) {
211
211
  wasm.__externref_table_dealloc(idx);
212
212
  return value;
213
213
  }
214
- /**
215
- * Sets the package's logging level.
216
- *
217
- * @param {LogLevel} level - The maximum level of logging to be emitted.
218
- */
219
- export function initLogLevel(filter) {
220
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
221
- const len0 = WASM_VECTOR_LEN;
222
- const ret = wasm.initLogLevel(ptr0, len0);
223
- if (ret[1]) {
224
- throw takeFromExternrefTable0(ret[0]);
225
- }
226
- }
227
-
228
- function passArray8ToWasm0(arg, malloc) {
229
- const ptr = malloc(arg.length * 1, 1) >>> 0;
230
- getUint8ArrayMemory0().set(arg, ptr / 1);
231
- WASM_VECTOR_LEN = arg.length;
232
- return ptr;
233
- }
234
- /**
235
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
236
- *
237
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
238
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
239
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
240
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
241
- */
242
- export function executeCircuit(program, initial_witness, foreign_call_handler) {
243
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
244
- const len0 = WASM_VECTOR_LEN;
245
- const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
246
- return ret;
247
- }
248
-
249
- /**
250
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
251
- * This method also extracts the public return values from the solved witness into its own return witness.
252
- *
253
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
254
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
255
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
256
- * @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.
257
- */
258
- export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
259
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
260
- const len0 = WASM_VECTOR_LEN;
261
- const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
262
- return ret;
263
- }
264
-
265
- /**
266
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
267
- *
268
- * @param {Uint8Array} program - A serialized representation of an ACIR program
269
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
270
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
271
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
272
- */
273
- export function executeProgram(program, initial_witness, foreign_call_handler) {
274
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
275
- const len0 = WASM_VECTOR_LEN;
276
- const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
277
- return ret;
278
- }
279
-
280
- /**
281
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
282
- *
283
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
284
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
285
- * @returns {WitnessMap} A witness map containing the circuit's return values.
286
- * @param {Uint8Array} program
287
- * @param {WitnessMap} witness_map
288
- * @returns {WitnessMap}
289
- */
290
- export function getReturnWitness(program, witness_map) {
291
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
292
- const len0 = WASM_VECTOR_LEN;
293
- const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
294
- if (ret[2]) {
295
- throw takeFromExternrefTable0(ret[1]);
296
- }
297
- return takeFromExternrefTable0(ret[0]);
298
- }
299
-
300
- /**
301
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
302
- *
303
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
304
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
305
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
306
- * @param {Uint8Array} program
307
- * @param {WitnessMap} solved_witness
308
- * @returns {WitnessMap}
309
- */
310
- export function getPublicParametersWitness(program, solved_witness) {
311
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
312
- const len0 = WASM_VECTOR_LEN;
313
- const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
314
- if (ret[2]) {
315
- throw takeFromExternrefTable0(ret[1]);
316
- }
317
- return takeFromExternrefTable0(ret[0]);
318
- }
319
-
320
- /**
321
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
322
- *
323
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
324
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
325
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
326
- * @param {Uint8Array} program
327
- * @param {WitnessMap} solved_witness
328
- * @returns {WitnessMap}
329
- */
330
- export function getPublicWitness(program, solved_witness) {
331
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
332
- const len0 = WASM_VECTOR_LEN;
333
- const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
334
- if (ret[2]) {
335
- throw takeFromExternrefTable0(ret[1]);
336
- }
337
- return takeFromExternrefTable0(ret[0]);
338
- }
339
214
 
340
215
  function getArrayU8FromWasm0(ptr, len) {
341
216
  ptr = ptr >>> 0;
@@ -357,6 +232,12 @@ export function compressWitness(witness_map) {
357
232
  return v1;
358
233
  }
359
234
 
235
+ function passArray8ToWasm0(arg, malloc) {
236
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
237
+ getUint8ArrayMemory0().set(arg, ptr / 1);
238
+ WASM_VECTOR_LEN = arg.length;
239
+ return ptr;
240
+ }
360
241
  /**
361
242
  * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
362
243
  * This should be used to only fetch the witness map for the main function.
@@ -521,16 +402,136 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
521
402
  return ret !== 0;
522
403
  }
523
404
 
405
+ /**
406
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
407
+ *
408
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
409
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
410
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
411
+ * @param {Uint8Array} program
412
+ * @param {WitnessMap} witness_map
413
+ * @returns {WitnessMap}
414
+ */
415
+ export function getReturnWitness(program, witness_map) {
416
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
417
+ const len0 = WASM_VECTOR_LEN;
418
+ const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
419
+ if (ret[2]) {
420
+ throw takeFromExternrefTable0(ret[1]);
421
+ }
422
+ return takeFromExternrefTable0(ret[0]);
423
+ }
424
+
425
+ /**
426
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
427
+ *
428
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
429
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
430
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
431
+ * @param {Uint8Array} program
432
+ * @param {WitnessMap} solved_witness
433
+ * @returns {WitnessMap}
434
+ */
435
+ export function getPublicParametersWitness(program, solved_witness) {
436
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
437
+ const len0 = WASM_VECTOR_LEN;
438
+ const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
439
+ if (ret[2]) {
440
+ throw takeFromExternrefTable0(ret[1]);
441
+ }
442
+ return takeFromExternrefTable0(ret[0]);
443
+ }
444
+
445
+ /**
446
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
447
+ *
448
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
449
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
450
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
451
+ * @param {Uint8Array} program
452
+ * @param {WitnessMap} solved_witness
453
+ * @returns {WitnessMap}
454
+ */
455
+ export function getPublicWitness(program, solved_witness) {
456
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
457
+ const len0 = WASM_VECTOR_LEN;
458
+ const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
459
+ if (ret[2]) {
460
+ throw takeFromExternrefTable0(ret[1]);
461
+ }
462
+ return takeFromExternrefTable0(ret[0]);
463
+ }
464
+
465
+ /**
466
+ * Sets the package's logging level.
467
+ *
468
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
469
+ */
470
+ export function initLogLevel(filter) {
471
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
472
+ const len0 = WASM_VECTOR_LEN;
473
+ const ret = wasm.initLogLevel(ptr0, len0);
474
+ if (ret[1]) {
475
+ throw takeFromExternrefTable0(ret[0]);
476
+ }
477
+ }
478
+
479
+ /**
480
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
481
+ *
482
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
483
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
484
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
485
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
486
+ */
487
+ export function executeCircuit(program, initial_witness, foreign_call_handler) {
488
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
489
+ const len0 = WASM_VECTOR_LEN;
490
+ const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
491
+ return ret;
492
+ }
493
+
494
+ /**
495
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
496
+ * This method also extracts the public return values from the solved witness into its own return witness.
497
+ *
498
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
499
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
500
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
501
+ * @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.
502
+ */
503
+ export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
504
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
505
+ const len0 = WASM_VECTOR_LEN;
506
+ const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
507
+ return ret;
508
+ }
509
+
510
+ /**
511
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
512
+ *
513
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
514
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
515
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
516
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
517
+ */
518
+ export function executeProgram(program, initial_witness, foreign_call_handler) {
519
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
520
+ const len0 = WASM_VECTOR_LEN;
521
+ const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
522
+ return ret;
523
+ }
524
+
524
525
  function __wbg_adapter_30(arg0, arg1, arg2) {
525
- wasm.closure447_externref_shim(arg0, arg1, arg2);
526
+ wasm.closure448_externref_shim(arg0, arg1, arg2);
526
527
  }
527
528
 
528
529
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
529
- wasm.closure932_externref_shim(arg0, arg1, arg2, arg3, arg4);
530
+ wasm.closure933_externref_shim(arg0, arg1, arg2, arg3, arg4);
530
531
  }
531
532
 
532
533
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
533
- wasm.closure936_externref_shim(arg0, arg1, arg2, arg3);
534
+ wasm.closure937_externref_shim(arg0, arg1, arg2, arg3);
534
535
  }
535
536
 
536
537
  async function __wbg_load(module, imports) {
@@ -796,8 +797,8 @@ function __wbg_get_imports() {
796
797
  const ret = false;
797
798
  return ret;
798
799
  };
799
- imports.wbg.__wbindgen_closure_wrapper1447 = function(arg0, arg1, arg2) {
800
- const ret = makeMutClosure(arg0, arg1, 448, __wbg_adapter_30);
800
+ imports.wbg.__wbindgen_closure_wrapper1446 = function(arg0, arg1, arg2) {
801
+ const ret = makeMutClosure(arg0, arg1, 449, __wbg_adapter_30);
801
802
  return ret;
802
803
  };
803
804
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
Binary file
@@ -2,13 +2,6 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const buildInfo: () => any;
5
- export const initLogLevel: (a: number, b: number) => [number, number];
6
- export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
7
- export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
8
- export const executeProgram: (a: number, b: number, c: any, d: any) => any;
9
- export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
10
- export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
11
- export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
12
5
  export const compressWitness: (a: any) => [number, number, number, number];
13
6
  export const decompressWitness: (a: number, b: number) => [number, number, number];
14
7
  export const compressWitnessStack: (a: any) => [number, number, number, number];
@@ -19,6 +12,13 @@ export const sha256_compression: (a: number, b: number, c: number, d: number) =>
19
12
  export const blake2s256: (a: number, b: number) => [number, number];
20
13
  export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
21
14
  export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
15
+ export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
16
+ export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
17
+ export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
18
+ export const initLogLevel: (a: number, b: number) => [number, number];
19
+ export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
20
+ export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
21
+ export const executeProgram: (a: number, b: number, c: any, d: any) => any;
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 closure447_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure932_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure936_externref_shim: (a: number, b: number, c: any, d: any) => void;
30
+ export const closure448_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure933_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure937_externref_shim: (a: number, b: number, c: any, d: any) => void;
33
33
  export const __wbindgen_start: () => void;