@aztec/noir-acvm_js 0.0.1-commit.fce3e4f → 0.0.1-commit.fffb133c

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,63 +1,5 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- /**
4
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
5
- *
6
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
7
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
8
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
9
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
10
- */
11
- export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
12
- /**
13
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
14
- * This method also extracts the public return values from the solved witness into its own return witness.
15
- *
16
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
17
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
18
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
19
- * @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.
20
- */
21
- export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
22
- /**
23
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
24
- *
25
- * @param {Uint8Array} program - A serialized representation of an ACIR program
26
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
27
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
28
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
29
- */
30
- export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
31
- /**
32
- * Sets the package's logging level.
33
- *
34
- * @param {LogLevel} level - The maximum level of logging to be emitted.
35
- */
36
- export function initLogLevel(filter: string): void;
37
- /**
38
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
39
- *
40
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
41
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
42
- * @returns {WitnessMap} A witness map containing the circuit's return values.
43
- */
44
- export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
45
- /**
46
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
47
- *
48
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
49
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
50
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
51
- */
52
- export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
53
- /**
54
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
55
- *
56
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
57
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
58
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
59
- */
60
- export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
61
3
  /**
62
4
  * Returns the `BuildInfo` object containing information about how the installed package was built.
63
5
  * @returns {BuildInfo} - Information on how the installed package was built.
@@ -116,21 +58,64 @@ 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;
119
-
120
- // Map from witness index to hex string value of witness.
121
- export type WitnessMap = Map<number, string>;
122
-
123
61
  /**
124
- * An execution result containing two witnesses.
125
- * 1. The full solved witness of the execution.
126
- * 2. The return witness which contains the given public return values within the full witness.
62
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
63
+ *
64
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
65
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
66
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
67
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
127
68
  */
128
- export type SolvedAndReturnWitness = {
129
- solvedWitness: WitnessMap;
130
- returnWitness: WitnessMap;
131
- }
132
-
133
-
69
+ export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
70
+ /**
71
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
72
+ * This method also extracts the public return values from the solved witness into its own return witness.
73
+ *
74
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
75
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
76
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
77
+ * @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.
78
+ */
79
+ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
80
+ /**
81
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
82
+ *
83
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
84
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
85
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
86
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
87
+ */
88
+ export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
89
+ /**
90
+ * Sets the package's logging level.
91
+ *
92
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
93
+ */
94
+ export function initLogLevel(filter: string): void;
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;
134
119
 
135
120
  export type StackItem = {
136
121
  index: number;
@@ -141,17 +126,17 @@ export type WitnessStack = Array<StackItem>;
141
126
 
142
127
 
143
128
 
144
- export type ForeignCallInput = string[]
145
- export type ForeignCallOutput = string | string[]
146
-
147
129
  /**
148
- * A callback which performs an foreign call and returns the response.
149
- * @callback ForeignCallHandler
150
- * @param {string} name - The identifier for the type of foreign call being performed.
151
- * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
152
- * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
153
- */
154
- export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
130
+ * @typedef {Object} BuildInfo - Information about how the installed package was built
131
+ * @property {string} gitHash - The hash of the git commit from which the package was built.
132
+ * @property {string} version - The version of the package at the built git commit.
133
+ * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
134
+ */
135
+ export type BuildInfo = {
136
+ gitHash: string;
137
+ version: string;
138
+ dirty: string;
139
+ }
155
140
 
156
141
 
157
142
 
@@ -169,16 +154,31 @@ export type ExecutionError = Error & {
169
154
 
170
155
 
171
156
 
157
+ // Map from witness index to hex string value of witness.
158
+ export type WitnessMap = Map<number, string>;
159
+
172
160
  /**
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.
161
+ * An execution result containing two witnesses.
162
+ * 1. The full solved witness of the execution.
163
+ * 2. The return witness which contains the given public return values within the full witness.
177
164
  */
178
- export type BuildInfo = {
179
- gitHash: string;
180
- version: string;
181
- dirty: string;
165
+ export type SolvedAndReturnWitness = {
166
+ solvedWitness: WitnessMap;
167
+ returnWitness: WitnessMap;
182
168
  }
183
169
 
184
170
 
171
+
172
+ export type ForeignCallInput = string[]
173
+ export type ForeignCallOutput = string | string[]
174
+
175
+ /**
176
+ * A callback which performs an foreign call and returns the response.
177
+ * @callback ForeignCallHandler
178
+ * @param {string} name - The identifier for the type of foreign call being performed.
179
+ * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
180
+ * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
181
+ */
182
+ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
183
+
184
+
package/nodejs/acvm_js.js CHANGED
@@ -201,56 +201,12 @@ function debugString(val) {
201
201
  // TODO we could test for more things here, like `Set`s and `Map`s.
202
202
  return className;
203
203
  }
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
204
  /**
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.
205
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
206
+ * @returns {BuildInfo} - Information on how the installed package was built.
249
207
  */
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);
208
+ module.exports.buildInfo = function() {
209
+ const ret = wasm.buildInfo();
254
210
  return ret;
255
211
  };
256
212
 
@@ -259,88 +215,6 @@ function takeFromExternrefTable0(idx) {
259
215
  wasm.__externref_table_dealloc(idx);
260
216
  return value;
261
217
  }
262
- /**
263
- * Sets the package's logging level.
264
- *
265
- * @param {LogLevel} level - The maximum level of logging to be emitted.
266
- */
267
- module.exports.initLogLevel = function(filter) {
268
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
269
- const len0 = WASM_VECTOR_LEN;
270
- const ret = wasm.initLogLevel(ptr0, len0);
271
- if (ret[1]) {
272
- throw takeFromExternrefTable0(ret[0]);
273
- }
274
- };
275
-
276
- /**
277
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
278
- *
279
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
280
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
281
- * @returns {WitnessMap} A witness map containing the circuit's return values.
282
- * @param {Uint8Array} program
283
- * @param {WitnessMap} witness_map
284
- * @returns {WitnessMap}
285
- */
286
- module.exports.getReturnWitness = function(program, witness_map) {
287
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
288
- const len0 = WASM_VECTOR_LEN;
289
- const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
290
- if (ret[2]) {
291
- throw takeFromExternrefTable0(ret[1]);
292
- }
293
- return takeFromExternrefTable0(ret[0]);
294
- };
295
-
296
- /**
297
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
298
- *
299
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
300
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
301
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
302
- * @param {Uint8Array} program
303
- * @param {WitnessMap} solved_witness
304
- * @returns {WitnessMap}
305
- */
306
- module.exports.getPublicParametersWitness = function(program, solved_witness) {
307
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
308
- const len0 = WASM_VECTOR_LEN;
309
- const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
310
- if (ret[2]) {
311
- throw takeFromExternrefTable0(ret[1]);
312
- }
313
- return takeFromExternrefTable0(ret[0]);
314
- };
315
-
316
- /**
317
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
318
- *
319
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
320
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
321
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
322
- * @param {Uint8Array} program
323
- * @param {WitnessMap} solved_witness
324
- * @returns {WitnessMap}
325
- */
326
- module.exports.getPublicWitness = function(program, solved_witness) {
327
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
328
- const len0 = WASM_VECTOR_LEN;
329
- const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
330
- if (ret[2]) {
331
- throw takeFromExternrefTable0(ret[1]);
332
- }
333
- return takeFromExternrefTable0(ret[0]);
334
- };
335
-
336
- /**
337
- * Returns the `BuildInfo` object containing information about how the installed package was built.
338
- * @returns {BuildInfo} - Information on how the installed package was built.
339
- */
340
- module.exports.buildInfo = function() {
341
- const ret = wasm.buildInfo();
342
- return ret;
343
- };
344
218
 
345
219
  function getArrayU8FromWasm0(ptr, len) {
346
220
  ptr = ptr >>> 0;
@@ -362,6 +236,12 @@ module.exports.compressWitness = function(witness_map) {
362
236
  return v1;
363
237
  };
364
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
+ }
365
245
  /**
366
246
  * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
367
247
  * This should be used to only fetch the witness map for the main function.
@@ -526,16 +406,136 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
526
406
  return ret !== 0;
527
407
  };
528
408
 
409
+ /**
410
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
411
+ *
412
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
413
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
414
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
415
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
416
+ */
417
+ module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
418
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
419
+ const len0 = WASM_VECTOR_LEN;
420
+ const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
421
+ return ret;
422
+ };
423
+
424
+ /**
425
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
426
+ * This method also extracts the public return values from the solved witness into its own return witness.
427
+ *
428
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
429
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
430
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
431
+ * @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.
432
+ */
433
+ module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
434
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
435
+ const len0 = WASM_VECTOR_LEN;
436
+ const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
437
+ return ret;
438
+ };
439
+
440
+ /**
441
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
442
+ *
443
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
444
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
445
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
446
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
447
+ */
448
+ module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
449
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
450
+ const len0 = WASM_VECTOR_LEN;
451
+ const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
452
+ return ret;
453
+ };
454
+
455
+ /**
456
+ * Sets the package's logging level.
457
+ *
458
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
459
+ */
460
+ module.exports.initLogLevel = function(filter) {
461
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
462
+ const len0 = WASM_VECTOR_LEN;
463
+ const ret = wasm.initLogLevel(ptr0, len0);
464
+ if (ret[1]) {
465
+ throw takeFromExternrefTable0(ret[0]);
466
+ }
467
+ };
468
+
469
+ /**
470
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
471
+ *
472
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
473
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
474
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
475
+ * @param {Uint8Array} program
476
+ * @param {WitnessMap} witness_map
477
+ * @returns {WitnessMap}
478
+ */
479
+ module.exports.getReturnWitness = function(program, witness_map) {
480
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
481
+ const len0 = WASM_VECTOR_LEN;
482
+ const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
483
+ if (ret[2]) {
484
+ throw takeFromExternrefTable0(ret[1]);
485
+ }
486
+ return takeFromExternrefTable0(ret[0]);
487
+ };
488
+
489
+ /**
490
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
491
+ *
492
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
493
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
494
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
495
+ * @param {Uint8Array} program
496
+ * @param {WitnessMap} solved_witness
497
+ * @returns {WitnessMap}
498
+ */
499
+ module.exports.getPublicParametersWitness = function(program, solved_witness) {
500
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
501
+ const len0 = WASM_VECTOR_LEN;
502
+ const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
503
+ if (ret[2]) {
504
+ throw takeFromExternrefTable0(ret[1]);
505
+ }
506
+ return takeFromExternrefTable0(ret[0]);
507
+ };
508
+
509
+ /**
510
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
511
+ *
512
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
513
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
514
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
515
+ * @param {Uint8Array} program
516
+ * @param {WitnessMap} solved_witness
517
+ * @returns {WitnessMap}
518
+ */
519
+ module.exports.getPublicWitness = function(program, solved_witness) {
520
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
521
+ const len0 = WASM_VECTOR_LEN;
522
+ const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
523
+ if (ret[2]) {
524
+ throw takeFromExternrefTable0(ret[1]);
525
+ }
526
+ return takeFromExternrefTable0(ret[0]);
527
+ };
528
+
529
529
  function __wbg_adapter_30(arg0, arg1, arg2) {
530
- wasm.closure576_externref_shim(arg0, arg1, arg2);
530
+ wasm.closure448_externref_shim(arg0, arg1, arg2);
531
531
  }
532
532
 
533
533
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
534
- wasm.closure1171_externref_shim(arg0, arg1, arg2, arg3, arg4);
534
+ wasm.closure933_externref_shim(arg0, arg1, arg2, arg3, arg4);
535
535
  }
536
536
 
537
537
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
538
- wasm.closure1175_externref_shim(arg0, arg1, arg2, arg3);
538
+ wasm.closure937_externref_shim(arg0, arg1, arg2, arg3);
539
539
  }
540
540
 
541
541
  module.exports.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
@@ -553,12 +553,12 @@ module.exports.__wbg_call_833bed5770ea2041 = function() { return handleError(fun
553
553
  return ret;
554
554
  }, arguments) };
555
555
 
556
- module.exports.__wbg_constructor_c63bcfd244db473f = function(arg0) {
556
+ module.exports.__wbg_constructor_536364f6bcd4616b = function(arg0) {
557
557
  const ret = new Error(arg0);
558
558
  return ret;
559
559
  };
560
560
 
561
- module.exports.__wbg_constructor_e54436b6bd1581f7 = function(arg0) {
561
+ module.exports.__wbg_constructor_66e92e9c3ecae9e8 = function(arg0) {
562
562
  const ret = new Error(arg0);
563
563
  return ret;
564
564
  };
@@ -674,11 +674,6 @@ module.exports.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
674
674
  }
675
675
  };
676
676
 
677
- module.exports.__wbg_new_36c79b224aeafbf0 = function() {
678
- const ret = new Array();
679
- return ret;
680
- };
681
-
682
677
  module.exports.__wbg_new_5e0be73521bc8c17 = function() {
683
678
  const ret = new Map();
684
679
  return ret;
@@ -694,8 +689,8 @@ module.exports.__wbg_new_8a6f238a6ece86ea = function() {
694
689
  return ret;
695
690
  };
696
691
 
697
- module.exports.__wbg_new_c08cf36011667e78 = function() {
698
- const ret = new Map();
692
+ module.exports.__wbg_new_9f501325818b4158 = function() {
693
+ const ret = new Array();
699
694
  return ret;
700
695
  };
701
696
 
@@ -704,6 +699,11 @@ module.exports.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
704
699
  return ret;
705
700
  };
706
701
 
702
+ module.exports.__wbg_new_ec40611a7805f1f0 = function() {
703
+ const ret = new Map();
704
+ return ret;
705
+ };
706
+
707
707
  module.exports.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
708
708
  const ret = new Function(getStringFromWasm0(arg0, arg1));
709
709
  return ret;
@@ -813,8 +813,8 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
813
813
  return ret;
814
814
  };
815
815
 
816
- module.exports.__wbindgen_closure_wrapper1970 = function(arg0, arg1, arg2) {
817
- const ret = makeMutClosure(arg0, arg1, 577, __wbg_adapter_30);
816
+ module.exports.__wbindgen_closure_wrapper1445 = function(arg0, arg1, arg2) {
817
+ const ret = makeMutClosure(arg0, arg1, 449, __wbg_adapter_30);
818
818
  return ret;
819
819
  };
820
820
 
Binary file
@@ -1,13 +1,6 @@
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
- export const initLogLevel: (a: number, b: number) => [number, number];
8
- export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
9
- export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
10
- export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
11
4
  export const buildInfo: () => any;
12
5
  export const compressWitness: (a: any) => [number, number, number, number];
13
6
  export const decompressWitness: (a: number, b: 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 executeCircuit: (a: number, b: number, c: any, d: any) => any;
16
+ export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
17
+ export const executeProgram: (a: number, b: number, c: any, d: any) => any;
18
+ export const initLogLevel: (a: number, b: number) => [number, number];
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 closure576_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure1171_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure1175_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": "0.0.1-commit.fce3e4f",
3
+ "version": "0.0.1-commit.fffb133c",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -41,11 +41,11 @@
41
41
  "@web/dev-server-esbuild": "^1.0.4",
42
42
  "@web/test-runner": "^0.20.2",
43
43
  "@web/test-runner-playwright": "^0.11.1",
44
- "chai": "^4.4.1",
45
- "eslint": "^9.28.0",
46
- "eslint-plugin-prettier": "^5.4.1",
47
- "mocha": "^11.5.0",
48
- "prettier": "3.5.3",
44
+ "chai": "^6.2.2",
45
+ "eslint": "^9.39.2",
46
+ "eslint-plugin-prettier": "^5.5.5",
47
+ "mocha": "^11.7.5",
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
@@ -1,63 +1,5 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- /**
4
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
5
- *
6
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
7
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
8
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
9
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
10
- */
11
- export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
12
- /**
13
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
14
- * This method also extracts the public return values from the solved witness into its own return witness.
15
- *
16
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
17
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
18
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
19
- * @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.
20
- */
21
- export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
22
- /**
23
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
24
- *
25
- * @param {Uint8Array} program - A serialized representation of an ACIR program
26
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
27
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
28
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
29
- */
30
- export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
31
- /**
32
- * Sets the package's logging level.
33
- *
34
- * @param {LogLevel} level - The maximum level of logging to be emitted.
35
- */
36
- export function initLogLevel(filter: string): void;
37
- /**
38
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
39
- *
40
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
41
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
42
- * @returns {WitnessMap} A witness map containing the circuit's return values.
43
- */
44
- export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
45
- /**
46
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
47
- *
48
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
49
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
50
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
51
- */
52
- export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
53
- /**
54
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
55
- *
56
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
57
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
58
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
59
- */
60
- export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
61
3
  /**
62
4
  * Returns the `BuildInfo` object containing information about how the installed package was built.
63
5
  * @returns {BuildInfo} - Information on how the installed package was built.
@@ -116,21 +58,64 @@ 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;
119
-
120
- // Map from witness index to hex string value of witness.
121
- export type WitnessMap = Map<number, string>;
122
-
123
61
  /**
124
- * An execution result containing two witnesses.
125
- * 1. The full solved witness of the execution.
126
- * 2. The return witness which contains the given public return values within the full witness.
62
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
63
+ *
64
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
65
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
66
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
67
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
127
68
  */
128
- export type SolvedAndReturnWitness = {
129
- solvedWitness: WitnessMap;
130
- returnWitness: WitnessMap;
131
- }
132
-
133
-
69
+ export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
70
+ /**
71
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
72
+ * This method also extracts the public return values from the solved witness into its own return witness.
73
+ *
74
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
75
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
76
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
77
+ * @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.
78
+ */
79
+ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
80
+ /**
81
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
82
+ *
83
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
84
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
85
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
86
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
87
+ */
88
+ export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
89
+ /**
90
+ * Sets the package's logging level.
91
+ *
92
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
93
+ */
94
+ export function initLogLevel(filter: string): void;
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;
134
119
 
135
120
  export type StackItem = {
136
121
  index: number;
@@ -141,17 +126,17 @@ export type WitnessStack = Array<StackItem>;
141
126
 
142
127
 
143
128
 
144
- export type ForeignCallInput = string[]
145
- export type ForeignCallOutput = string | string[]
146
-
147
129
  /**
148
- * A callback which performs an foreign call and returns the response.
149
- * @callback ForeignCallHandler
150
- * @param {string} name - The identifier for the type of foreign call being performed.
151
- * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
152
- * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
153
- */
154
- export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
130
+ * @typedef {Object} BuildInfo - Information about how the installed package was built
131
+ * @property {string} gitHash - The hash of the git commit from which the package was built.
132
+ * @property {string} version - The version of the package at the built git commit.
133
+ * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
134
+ */
135
+ export type BuildInfo = {
136
+ gitHash: string;
137
+ version: string;
138
+ dirty: string;
139
+ }
155
140
 
156
141
 
157
142
 
@@ -169,31 +154,39 @@ export type ExecutionError = Error & {
169
154
 
170
155
 
171
156
 
157
+ // Map from witness index to hex string value of witness.
158
+ export type WitnessMap = Map<number, string>;
159
+
172
160
  /**
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.
161
+ * An execution result containing two witnesses.
162
+ * 1. The full solved witness of the execution.
163
+ * 2. The return witness which contains the given public return values within the full witness.
177
164
  */
178
- export type BuildInfo = {
179
- gitHash: string;
180
- version: string;
181
- dirty: string;
165
+ export type SolvedAndReturnWitness = {
166
+ solvedWitness: WitnessMap;
167
+ returnWitness: WitnessMap;
182
168
  }
183
169
 
184
170
 
185
171
 
172
+ export type ForeignCallInput = string[]
173
+ export type ForeignCallOutput = string | string[]
174
+
175
+ /**
176
+ * A callback which performs an foreign call and returns the response.
177
+ * @callback ForeignCallHandler
178
+ * @param {string} name - The identifier for the type of foreign call being performed.
179
+ * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
180
+ * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
181
+ */
182
+ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
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
- readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
191
- readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
192
- readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
193
- readonly initLogLevel: (a: number, b: number) => [number, number];
194
- readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
195
- readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
196
- readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
197
190
  readonly buildInfo: () => any;
198
191
  readonly compressWitness: (a: any) => [number, number, number, number];
199
192
  readonly decompressWitness: (a: number, b: 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 executeCircuit: (a: number, b: number, c: any, d: any) => any;
202
+ readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
203
+ readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
204
+ readonly initLogLevel: (a: number, b: number) => [number, number];
205
+ readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
206
+ readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
207
+ readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
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 closure576_externref_shim: (a: number, b: number, c: any) => void;
217
- readonly closure1171_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
218
- readonly closure1175_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
@@ -197,56 +197,12 @@ function debugString(val) {
197
197
  // TODO we could test for more things here, like `Set`s and `Map`s.
198
198
  return className;
199
199
  }
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
200
  /**
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.
201
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
202
+ * @returns {BuildInfo} - Information on how the installed package was built.
245
203
  */
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);
204
+ export function buildInfo() {
205
+ const ret = wasm.buildInfo();
250
206
  return ret;
251
207
  }
252
208
 
@@ -255,88 +211,6 @@ function takeFromExternrefTable0(idx) {
255
211
  wasm.__externref_table_dealloc(idx);
256
212
  return value;
257
213
  }
258
- /**
259
- * Sets the package's logging level.
260
- *
261
- * @param {LogLevel} level - The maximum level of logging to be emitted.
262
- */
263
- export function initLogLevel(filter) {
264
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
265
- const len0 = WASM_VECTOR_LEN;
266
- const ret = wasm.initLogLevel(ptr0, len0);
267
- if (ret[1]) {
268
- throw takeFromExternrefTable0(ret[0]);
269
- }
270
- }
271
-
272
- /**
273
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
274
- *
275
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
276
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
277
- * @returns {WitnessMap} A witness map containing the circuit's return values.
278
- * @param {Uint8Array} program
279
- * @param {WitnessMap} witness_map
280
- * @returns {WitnessMap}
281
- */
282
- export function getReturnWitness(program, witness_map) {
283
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
284
- const len0 = WASM_VECTOR_LEN;
285
- const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
286
- if (ret[2]) {
287
- throw takeFromExternrefTable0(ret[1]);
288
- }
289
- return takeFromExternrefTable0(ret[0]);
290
- }
291
-
292
- /**
293
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
294
- *
295
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
296
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
297
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
298
- * @param {Uint8Array} program
299
- * @param {WitnessMap} solved_witness
300
- * @returns {WitnessMap}
301
- */
302
- export function getPublicParametersWitness(program, solved_witness) {
303
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
304
- const len0 = WASM_VECTOR_LEN;
305
- const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
306
- if (ret[2]) {
307
- throw takeFromExternrefTable0(ret[1]);
308
- }
309
- return takeFromExternrefTable0(ret[0]);
310
- }
311
-
312
- /**
313
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
314
- *
315
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
316
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
317
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
318
- * @param {Uint8Array} program
319
- * @param {WitnessMap} solved_witness
320
- * @returns {WitnessMap}
321
- */
322
- export function getPublicWitness(program, solved_witness) {
323
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
324
- const len0 = WASM_VECTOR_LEN;
325
- const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
326
- if (ret[2]) {
327
- throw takeFromExternrefTable0(ret[1]);
328
- }
329
- return takeFromExternrefTable0(ret[0]);
330
- }
331
-
332
- /**
333
- * Returns the `BuildInfo` object containing information about how the installed package was built.
334
- * @returns {BuildInfo} - Information on how the installed package was built.
335
- */
336
- export function buildInfo() {
337
- const ret = wasm.buildInfo();
338
- return ret;
339
- }
340
214
 
341
215
  function getArrayU8FromWasm0(ptr, len) {
342
216
  ptr = ptr >>> 0;
@@ -358,6 +232,12 @@ export function compressWitness(witness_map) {
358
232
  return v1;
359
233
  }
360
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
+ }
361
241
  /**
362
242
  * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
363
243
  * This should be used to only fetch the witness map for the main function.
@@ -522,16 +402,136 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
522
402
  return ret !== 0;
523
403
  }
524
404
 
405
+ /**
406
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
407
+ *
408
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
409
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
410
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
411
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
412
+ */
413
+ export function executeCircuit(program, initial_witness, foreign_call_handler) {
414
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
415
+ const len0 = WASM_VECTOR_LEN;
416
+ const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
417
+ return ret;
418
+ }
419
+
420
+ /**
421
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
422
+ * This method also extracts the public return values from the solved witness into its own return witness.
423
+ *
424
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
425
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
426
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
427
+ * @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.
428
+ */
429
+ export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
430
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
431
+ const len0 = WASM_VECTOR_LEN;
432
+ const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
433
+ return ret;
434
+ }
435
+
436
+ /**
437
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
438
+ *
439
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
440
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
441
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
442
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
443
+ */
444
+ export function executeProgram(program, initial_witness, foreign_call_handler) {
445
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
446
+ const len0 = WASM_VECTOR_LEN;
447
+ const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
448
+ return ret;
449
+ }
450
+
451
+ /**
452
+ * Sets the package's logging level.
453
+ *
454
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
455
+ */
456
+ export function initLogLevel(filter) {
457
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
458
+ const len0 = WASM_VECTOR_LEN;
459
+ const ret = wasm.initLogLevel(ptr0, len0);
460
+ if (ret[1]) {
461
+ throw takeFromExternrefTable0(ret[0]);
462
+ }
463
+ }
464
+
465
+ /**
466
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
467
+ *
468
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
469
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
470
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
471
+ * @param {Uint8Array} program
472
+ * @param {WitnessMap} witness_map
473
+ * @returns {WitnessMap}
474
+ */
475
+ export function getReturnWitness(program, witness_map) {
476
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
477
+ const len0 = WASM_VECTOR_LEN;
478
+ const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
479
+ if (ret[2]) {
480
+ throw takeFromExternrefTable0(ret[1]);
481
+ }
482
+ return takeFromExternrefTable0(ret[0]);
483
+ }
484
+
485
+ /**
486
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
487
+ *
488
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
489
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
490
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
491
+ * @param {Uint8Array} program
492
+ * @param {WitnessMap} solved_witness
493
+ * @returns {WitnessMap}
494
+ */
495
+ export function getPublicParametersWitness(program, solved_witness) {
496
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
497
+ const len0 = WASM_VECTOR_LEN;
498
+ const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
499
+ if (ret[2]) {
500
+ throw takeFromExternrefTable0(ret[1]);
501
+ }
502
+ return takeFromExternrefTable0(ret[0]);
503
+ }
504
+
505
+ /**
506
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
507
+ *
508
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
509
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
510
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
511
+ * @param {Uint8Array} program
512
+ * @param {WitnessMap} solved_witness
513
+ * @returns {WitnessMap}
514
+ */
515
+ export function getPublicWitness(program, solved_witness) {
516
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
517
+ const len0 = WASM_VECTOR_LEN;
518
+ const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
519
+ if (ret[2]) {
520
+ throw takeFromExternrefTable0(ret[1]);
521
+ }
522
+ return takeFromExternrefTable0(ret[0]);
523
+ }
524
+
525
525
  function __wbg_adapter_30(arg0, arg1, arg2) {
526
- wasm.closure576_externref_shim(arg0, arg1, arg2);
526
+ wasm.closure448_externref_shim(arg0, arg1, arg2);
527
527
  }
528
528
 
529
529
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
530
- wasm.closure1171_externref_shim(arg0, arg1, arg2, arg3, arg4);
530
+ wasm.closure933_externref_shim(arg0, arg1, arg2, arg3, arg4);
531
531
  }
532
532
 
533
533
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
534
- wasm.closure1175_externref_shim(arg0, arg1, arg2, arg3);
534
+ wasm.closure937_externref_shim(arg0, arg1, arg2, arg3);
535
535
  }
536
536
 
537
537
  async function __wbg_load(module, imports) {
@@ -580,11 +580,11 @@ function __wbg_get_imports() {
580
580
  const ret = arg0.call(arg1, arg2, arg3);
581
581
  return ret;
582
582
  }, arguments) };
583
- imports.wbg.__wbg_constructor_c63bcfd244db473f = function(arg0) {
583
+ imports.wbg.__wbg_constructor_536364f6bcd4616b = function(arg0) {
584
584
  const ret = new Error(arg0);
585
585
  return ret;
586
586
  };
587
- imports.wbg.__wbg_constructor_e54436b6bd1581f7 = function(arg0) {
587
+ imports.wbg.__wbg_constructor_66e92e9c3ecae9e8 = function(arg0) {
588
588
  const ret = new Error(arg0);
589
589
  return ret;
590
590
  };
@@ -685,10 +685,6 @@ function __wbg_get_imports() {
685
685
  state0.a = state0.b = 0;
686
686
  }
687
687
  };
688
- imports.wbg.__wbg_new_36c79b224aeafbf0 = function() {
689
- const ret = new Array();
690
- return ret;
691
- };
692
688
  imports.wbg.__wbg_new_5e0be73521bc8c17 = function() {
693
689
  const ret = new Map();
694
690
  return ret;
@@ -701,14 +697,18 @@ function __wbg_get_imports() {
701
697
  const ret = new Error();
702
698
  return ret;
703
699
  };
704
- imports.wbg.__wbg_new_c08cf36011667e78 = function() {
705
- const ret = new Map();
700
+ imports.wbg.__wbg_new_9f501325818b4158 = function() {
701
+ const ret = new Array();
706
702
  return ret;
707
703
  };
708
704
  imports.wbg.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
709
705
  const ret = new Error(getStringFromWasm0(arg0, arg1));
710
706
  return ret;
711
707
  };
708
+ imports.wbg.__wbg_new_ec40611a7805f1f0 = function() {
709
+ const ret = new Map();
710
+ return ret;
711
+ };
712
712
  imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
713
713
  const ret = new Function(getStringFromWasm0(arg0, arg1));
714
714
  return ret;
@@ -797,8 +797,8 @@ function __wbg_get_imports() {
797
797
  const ret = false;
798
798
  return ret;
799
799
  };
800
- imports.wbg.__wbindgen_closure_wrapper1970 = function(arg0, arg1, arg2) {
801
- const ret = makeMutClosure(arg0, arg1, 577, __wbg_adapter_30);
800
+ imports.wbg.__wbindgen_closure_wrapper1445 = function(arg0, arg1, arg2) {
801
+ const ret = makeMutClosure(arg0, arg1, 449, __wbg_adapter_30);
802
802
  return ret;
803
803
  };
804
804
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
Binary file
@@ -1,13 +1,6 @@
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
- export const initLogLevel: (a: number, b: number) => [number, number];
8
- export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
9
- export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
10
- export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
11
4
  export const buildInfo: () => any;
12
5
  export const compressWitness: (a: any) => [number, number, number, number];
13
6
  export const decompressWitness: (a: number, b: 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 executeCircuit: (a: number, b: number, c: any, d: any) => any;
16
+ export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
17
+ export const executeProgram: (a: number, b: number, c: any, d: any) => any;
18
+ export const initLogLevel: (a: number, b: number) => [number, number];
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 closure576_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure1171_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure1175_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;