@aztec/noir-acvm_js 0.0.1-commit.7d4e6cd → 0.0.1-commit.858058eac

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,16 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ /**
4
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
5
+ * @returns {BuildInfo} - Information on how the installed package was built.
6
+ */
7
+ export function buildInfo(): BuildInfo;
3
8
  /**
4
9
  * Sets the package's logging level.
5
10
  *
6
11
  * @param {LogLevel} level - The maximum level of logging to be emitted.
7
12
  */
8
13
  export function initLogLevel(filter: string): void;
9
- /**
10
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
11
- *
12
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
13
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
14
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
15
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
16
- */
17
- export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
18
- /**
19
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
20
- * This method also extracts the public return values from the solved witness into its own return witness.
21
- *
22
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
23
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
24
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
25
- * @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.
26
- */
27
- export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
28
- /**
29
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
30
- *
31
- * @param {Uint8Array} program - A serialized representation of an ACIR program
32
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
33
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
34
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
35
- */
36
- export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
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
14
  /**
62
15
  * Performs a bitwise AND operation between `lhs` and `rhs`
63
16
  */
@@ -112,22 +65,83 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
112
65
  */
113
66
  export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
114
67
  /**
115
- * Returns the `BuildInfo` object containing information about how the installed package was built.
116
- * @returns {BuildInfo} - Information on how the installed package was built.
68
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
69
+ *
70
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
71
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
72
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
73
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
117
74
  */
118
- export function buildInfo(): BuildInfo;
75
+ export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
76
+ /**
77
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
78
+ * This method also extracts the public return values from the solved witness into its own return witness.
79
+ *
80
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
81
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
82
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
83
+ * @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.
84
+ */
85
+ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
86
+ /**
87
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
88
+ *
89
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
90
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
91
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
92
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
93
+ */
94
+ export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
95
+ /**
96
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
97
+ *
98
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
99
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
100
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
101
+ */
102
+ export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
103
+ /**
104
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
105
+ *
106
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
107
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
108
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
109
+ */
110
+ export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
111
+ /**
112
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
113
+ *
114
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
115
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
116
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
117
+ */
118
+ export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
119
119
 
120
- export type RawAssertionPayload = {
121
- selector: string;
122
- data: string[];
123
- };
120
+ export type ForeignCallInput = string[]
121
+ export type ForeignCallOutput = string | string[]
124
122
 
125
- export type ExecutionError = Error & {
126
- callStack?: string[];
127
- rawAssertionPayload?: RawAssertionPayload;
128
- acirFunctionId?: number;
129
- brilligFunctionId?: number;
130
- };
123
+ /**
124
+ * A callback which performs an foreign call and returns the response.
125
+ * @callback ForeignCallHandler
126
+ * @param {string} name - The identifier for the type of foreign call being performed.
127
+ * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
128
+ * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
129
+ */
130
+ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
131
+
132
+
133
+
134
+ /**
135
+ * @typedef {Object} BuildInfo - Information about how the installed package was built
136
+ * @property {string} gitHash - The hash of the git commit from which the package was built.
137
+ * @property {string} version - The version of the package at the built git commit.
138
+ * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
139
+ */
140
+ export type BuildInfo = {
141
+ gitHash: string;
142
+ version: string;
143
+ dirty: string;
144
+ }
131
145
 
132
146
 
133
147
 
@@ -146,20 +160,6 @@ export type SolvedAndReturnWitness = {
146
160
 
147
161
 
148
162
 
149
- export type ForeignCallInput = string[]
150
- export type ForeignCallOutput = string | string[]
151
-
152
- /**
153
- * A callback which performs an foreign call and returns the response.
154
- * @callback ForeignCallHandler
155
- * @param {string} name - The identifier for the type of foreign call being performed.
156
- * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
157
- * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
158
- */
159
- export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
160
-
161
-
162
-
163
163
  export type StackItem = {
164
164
  index: number;
165
165
  witness: WitnessMap;
@@ -169,16 +169,16 @@ export type WitnessStack = Array<StackItem>;
169
169
 
170
170
 
171
171
 
172
- /**
173
- * @typedef {Object} BuildInfo - Information about how the installed package was built
174
- * @property {string} gitHash - The hash of the git commit from which the package was built.
175
- * @property {string} version - The version of the package at the built git commit.
176
- * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
177
- */
178
- export type BuildInfo = {
179
- gitHash: string;
180
- version: string;
181
- dirty: string;
182
- }
172
+ export type RawAssertionPayload = {
173
+ selector: string;
174
+ data: string[];
175
+ };
176
+
177
+ export type ExecutionError = Error & {
178
+ callStack?: string[];
179
+ rawAssertionPayload?: RawAssertionPayload;
180
+ acirFunctionId?: number;
181
+ brilligFunctionId?: number;
182
+ };
183
183
 
184
184
 
package/nodejs/acvm_js.js CHANGED
@@ -201,6 +201,14 @@ 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
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
206
+ * @returns {BuildInfo} - Information on how the installed package was built.
207
+ */
208
+ module.exports.buildInfo = function() {
209
+ const ret = wasm.buildInfo();
210
+ return ret;
211
+ };
204
212
 
205
213
  function takeFromExternrefTable0(idx) {
206
214
  const value = wasm.__wbindgen_export_2.get(idx);
@@ -221,118 +229,6 @@ module.exports.initLogLevel = function(filter) {
221
229
  }
222
230
  };
223
231
 
224
- function passArray8ToWasm0(arg, malloc) {
225
- const ptr = malloc(arg.length * 1, 1) >>> 0;
226
- getUint8ArrayMemory0().set(arg, ptr / 1);
227
- WASM_VECTOR_LEN = arg.length;
228
- return ptr;
229
- }
230
- /**
231
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
232
- *
233
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
234
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
235
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
236
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
237
- */
238
- module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
239
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
240
- const len0 = WASM_VECTOR_LEN;
241
- const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
242
- return ret;
243
- };
244
-
245
- /**
246
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
247
- * This method also extracts the public return values from the solved witness into its own return witness.
248
- *
249
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
250
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
251
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
252
- * @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.
253
- */
254
- module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
255
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
256
- const len0 = WASM_VECTOR_LEN;
257
- const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
258
- return ret;
259
- };
260
-
261
- /**
262
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
263
- *
264
- * @param {Uint8Array} program - A serialized representation of an ACIR program
265
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
266
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
267
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
268
- */
269
- module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
270
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
271
- const len0 = WASM_VECTOR_LEN;
272
- const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
273
- return ret;
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
232
  /**
337
233
  * Performs a bitwise AND operation between `lhs` and `rhs`
338
234
  * @param {string} lhs
@@ -392,6 +288,13 @@ module.exports.sha256_compression = function(inputs, state) {
392
288
  return v3;
393
289
  };
394
290
 
291
+ function passArray8ToWasm0(arg, malloc) {
292
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
293
+ getUint8ArrayMemory0().set(arg, ptr / 1);
294
+ WASM_VECTOR_LEN = arg.length;
295
+ return ptr;
296
+ }
297
+
395
298
  function getArrayU8FromWasm0(ptr, len) {
396
299
  ptr = ptr >>> 0;
397
300
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
@@ -518,24 +421,121 @@ module.exports.decompressWitnessStack = function(compressed_witness) {
518
421
  };
519
422
 
520
423
  /**
521
- * Returns the `BuildInfo` object containing information about how the installed package was built.
522
- * @returns {BuildInfo} - Information on how the installed package was built.
424
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
425
+ *
426
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
427
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
428
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
429
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
523
430
  */
524
- module.exports.buildInfo = function() {
525
- const ret = wasm.buildInfo();
431
+ module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
432
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
433
+ const len0 = WASM_VECTOR_LEN;
434
+ const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
435
+ return ret;
436
+ };
437
+
438
+ /**
439
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
440
+ * This method also extracts the public return values from the solved witness into its own return witness.
441
+ *
442
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
443
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
444
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
445
+ * @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.
446
+ */
447
+ module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
448
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
449
+ const len0 = WASM_VECTOR_LEN;
450
+ const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
526
451
  return ret;
527
452
  };
528
453
 
454
+ /**
455
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
456
+ *
457
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
458
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
459
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
460
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
461
+ */
462
+ module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
463
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
464
+ const len0 = WASM_VECTOR_LEN;
465
+ const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
466
+ return ret;
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.closure490_externref_shim(arg0, arg1, arg2);
530
+ wasm.closure445_externref_shim(arg0, arg1, arg2);
531
531
  }
532
532
 
533
533
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
534
- wasm.closure996_externref_shim(arg0, arg1, arg2, arg3, arg4);
534
+ wasm.closure921_externref_shim(arg0, arg1, arg2, arg3, arg4);
535
535
  }
536
536
 
537
537
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
538
- wasm.closure1000_externref_shim(arg0, arg1, arg2, arg3);
538
+ wasm.closure925_externref_shim(arg0, arg1, arg2, arg3);
539
539
  }
540
540
 
541
541
  module.exports.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
@@ -813,8 +813,8 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
813
813
  return ret;
814
814
  };
815
815
 
816
- module.exports.__wbindgen_closure_wrapper1603 = function(arg0, arg1, arg2) {
817
- const ret = makeMutClosure(arg0, arg1, 491, __wbg_adapter_30);
816
+ module.exports.__wbindgen_closure_wrapper1365 = function(arg0, arg1, arg2) {
817
+ const ret = makeMutClosure(arg0, arg1, 446, __wbg_adapter_30);
818
818
  return ret;
819
819
  };
820
820
 
Binary file
@@ -1,13 +1,8 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
+ export const buildInfo: () => any;
4
5
  export const initLogLevel: (a: number, b: number) => [number, number];
5
- export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
6
- export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
7
- export const executeProgram: (a: number, b: number, c: any, d: any) => any;
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
6
  export const and: (a: any, b: any) => any;
12
7
  export const xor: (a: any, b: any) => any;
13
8
  export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
@@ -18,7 +13,12 @@ export const compressWitness: (a: any) => [number, number, number, number];
18
13
  export const decompressWitness: (a: number, b: number) => [number, number, number];
19
14
  export const compressWitnessStack: (a: any) => [number, number, number, number];
20
15
  export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
21
- export const buildInfo: () => any;
16
+ export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
17
+ export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
18
+ export const executeProgram: (a: number, b: number, c: any, d: any) => any;
19
+ export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
20
+ export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
21
+ export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
22
22
  export const __wbindgen_exn_store: (a: number) => void;
23
23
  export const __externref_table_alloc: () => number;
24
24
  export const __wbindgen_export_2: WebAssembly.Table;
@@ -27,7 +27,7 @@ export const __wbindgen_malloc: (a: number, b: number) => number;
27
27
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
28
28
  export const __wbindgen_export_6: WebAssembly.Table;
29
29
  export const __externref_table_dealloc: (a: number) => void;
30
- export const closure490_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure996_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure1000_externref_shim: (a: number, b: number, c: any, d: any) => void;
30
+ export const closure445_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure921_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure925_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.7d4e6cd",
3
+ "version": "0.0.1-commit.858058eac",
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.1",
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,16 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ /**
4
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
5
+ * @returns {BuildInfo} - Information on how the installed package was built.
6
+ */
7
+ export function buildInfo(): BuildInfo;
3
8
  /**
4
9
  * Sets the package's logging level.
5
10
  *
6
11
  * @param {LogLevel} level - The maximum level of logging to be emitted.
7
12
  */
8
13
  export function initLogLevel(filter: string): void;
9
- /**
10
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
11
- *
12
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
13
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
14
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
15
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
16
- */
17
- export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
18
- /**
19
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
20
- * This method also extracts the public return values from the solved witness into its own return witness.
21
- *
22
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
23
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
24
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
25
- * @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.
26
- */
27
- export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
28
- /**
29
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
30
- *
31
- * @param {Uint8Array} program - A serialized representation of an ACIR program
32
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
33
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
34
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
35
- */
36
- export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
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
14
  /**
62
15
  * Performs a bitwise AND operation between `lhs` and `rhs`
63
16
  */
@@ -112,22 +65,83 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
112
65
  */
113
66
  export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
114
67
  /**
115
- * Returns the `BuildInfo` object containing information about how the installed package was built.
116
- * @returns {BuildInfo} - Information on how the installed package was built.
68
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
69
+ *
70
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
71
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
72
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
73
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
117
74
  */
118
- export function buildInfo(): BuildInfo;
75
+ export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
76
+ /**
77
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
78
+ * This method also extracts the public return values from the solved witness into its own return witness.
79
+ *
80
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
81
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
82
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
83
+ * @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.
84
+ */
85
+ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
86
+ /**
87
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
88
+ *
89
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
90
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
91
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
92
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
93
+ */
94
+ export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
95
+ /**
96
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
97
+ *
98
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
99
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
100
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
101
+ */
102
+ export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
103
+ /**
104
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
105
+ *
106
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
107
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
108
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
109
+ */
110
+ export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
111
+ /**
112
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
113
+ *
114
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
115
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
116
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
117
+ */
118
+ export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
119
119
 
120
- export type RawAssertionPayload = {
121
- selector: string;
122
- data: string[];
123
- };
120
+ export type ForeignCallInput = string[]
121
+ export type ForeignCallOutput = string | string[]
124
122
 
125
- export type ExecutionError = Error & {
126
- callStack?: string[];
127
- rawAssertionPayload?: RawAssertionPayload;
128
- acirFunctionId?: number;
129
- brilligFunctionId?: number;
130
- };
123
+ /**
124
+ * A callback which performs an foreign call and returns the response.
125
+ * @callback ForeignCallHandler
126
+ * @param {string} name - The identifier for the type of foreign call being performed.
127
+ * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
128
+ * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
129
+ */
130
+ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
131
+
132
+
133
+
134
+ /**
135
+ * @typedef {Object} BuildInfo - Information about how the installed package was built
136
+ * @property {string} gitHash - The hash of the git commit from which the package was built.
137
+ * @property {string} version - The version of the package at the built git commit.
138
+ * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
139
+ */
140
+ export type BuildInfo = {
141
+ gitHash: string;
142
+ version: string;
143
+ dirty: string;
144
+ }
131
145
 
132
146
 
133
147
 
@@ -146,20 +160,6 @@ export type SolvedAndReturnWitness = {
146
160
 
147
161
 
148
162
 
149
- export type ForeignCallInput = string[]
150
- export type ForeignCallOutput = string | string[]
151
-
152
- /**
153
- * A callback which performs an foreign call and returns the response.
154
- * @callback ForeignCallHandler
155
- * @param {string} name - The identifier for the type of foreign call being performed.
156
- * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
157
- * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
158
- */
159
- export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
160
-
161
-
162
-
163
163
  export type StackItem = {
164
164
  index: number;
165
165
  witness: WitnessMap;
@@ -169,17 +169,17 @@ export type WitnessStack = Array<StackItem>;
169
169
 
170
170
 
171
171
 
172
- /**
173
- * @typedef {Object} BuildInfo - Information about how the installed package was built
174
- * @property {string} gitHash - The hash of the git commit from which the package was built.
175
- * @property {string} version - The version of the package at the built git commit.
176
- * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
177
- */
178
- export type BuildInfo = {
179
- gitHash: string;
180
- version: string;
181
- dirty: string;
182
- }
172
+ export type RawAssertionPayload = {
173
+ selector: string;
174
+ data: string[];
175
+ };
176
+
177
+ export type ExecutionError = Error & {
178
+ callStack?: string[];
179
+ rawAssertionPayload?: RawAssertionPayload;
180
+ acirFunctionId?: number;
181
+ brilligFunctionId?: number;
182
+ };
183
183
 
184
184
 
185
185
 
@@ -187,13 +187,8 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
187
187
 
188
188
  export interface InitOutput {
189
189
  readonly memory: WebAssembly.Memory;
190
+ readonly buildInfo: () => any;
190
191
  readonly initLogLevel: (a: number, b: number) => [number, number];
191
- readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
192
- readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
193
- readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
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
192
  readonly and: (a: any, b: any) => any;
198
193
  readonly xor: (a: any, b: any) => any;
199
194
  readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
@@ -204,7 +199,12 @@ export interface InitOutput {
204
199
  readonly decompressWitness: (a: number, b: number) => [number, number, number];
205
200
  readonly compressWitnessStack: (a: any) => [number, number, number, number];
206
201
  readonly decompressWitnessStack: (a: number, b: number) => [number, number, number];
207
- readonly buildInfo: () => any;
202
+ readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
203
+ readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
204
+ readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
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 closure490_externref_shim: (a: number, b: number, c: any) => void;
217
- readonly closure996_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
218
- readonly closure1000_externref_shim: (a: number, b: number, c: any, d: any) => void;
216
+ readonly closure445_externref_shim: (a: number, b: number, c: any) => void;
217
+ readonly closure921_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
218
+ readonly closure925_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,6 +197,14 @@ 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
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
202
+ * @returns {BuildInfo} - Information on how the installed package was built.
203
+ */
204
+ export function buildInfo() {
205
+ const ret = wasm.buildInfo();
206
+ return ret;
207
+ }
200
208
 
201
209
  function takeFromExternrefTable0(idx) {
202
210
  const value = wasm.__wbindgen_export_2.get(idx);
@@ -217,118 +225,6 @@ export function initLogLevel(filter) {
217
225
  }
218
226
  }
219
227
 
220
- function passArray8ToWasm0(arg, malloc) {
221
- const ptr = malloc(arg.length * 1, 1) >>> 0;
222
- getUint8ArrayMemory0().set(arg, ptr / 1);
223
- WASM_VECTOR_LEN = arg.length;
224
- return ptr;
225
- }
226
- /**
227
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
228
- *
229
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
230
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
231
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
232
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
233
- */
234
- export function executeCircuit(program, initial_witness, foreign_call_handler) {
235
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
236
- const len0 = WASM_VECTOR_LEN;
237
- const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
238
- return ret;
239
- }
240
-
241
- /**
242
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
243
- * This method also extracts the public return values from the solved witness into its own return witness.
244
- *
245
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
246
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
247
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
248
- * @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.
249
- */
250
- export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
251
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
252
- const len0 = WASM_VECTOR_LEN;
253
- const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
254
- return ret;
255
- }
256
-
257
- /**
258
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
259
- *
260
- * @param {Uint8Array} program - A serialized representation of an ACIR program
261
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
262
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
263
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
264
- */
265
- export function executeProgram(program, initial_witness, foreign_call_handler) {
266
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
267
- const len0 = WASM_VECTOR_LEN;
268
- const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
269
- return ret;
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
228
  /**
333
229
  * Performs a bitwise AND operation between `lhs` and `rhs`
334
230
  * @param {string} lhs
@@ -388,6 +284,13 @@ export function sha256_compression(inputs, state) {
388
284
  return v3;
389
285
  }
390
286
 
287
+ function passArray8ToWasm0(arg, malloc) {
288
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
289
+ getUint8ArrayMemory0().set(arg, ptr / 1);
290
+ WASM_VECTOR_LEN = arg.length;
291
+ return ptr;
292
+ }
293
+
391
294
  function getArrayU8FromWasm0(ptr, len) {
392
295
  ptr = ptr >>> 0;
393
296
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
@@ -514,24 +417,121 @@ export function decompressWitnessStack(compressed_witness) {
514
417
  }
515
418
 
516
419
  /**
517
- * Returns the `BuildInfo` object containing information about how the installed package was built.
518
- * @returns {BuildInfo} - Information on how the installed package was built.
420
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
421
+ *
422
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
423
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
424
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
425
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
519
426
  */
520
- export function buildInfo() {
521
- const ret = wasm.buildInfo();
427
+ export function executeCircuit(program, initial_witness, foreign_call_handler) {
428
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
429
+ const len0 = WASM_VECTOR_LEN;
430
+ const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
431
+ return ret;
432
+ }
433
+
434
+ /**
435
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
436
+ * This method also extracts the public return values from the solved witness into its own return witness.
437
+ *
438
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
439
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
440
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
441
+ * @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.
442
+ */
443
+ export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
444
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
445
+ const len0 = WASM_VECTOR_LEN;
446
+ const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
522
447
  return ret;
523
448
  }
524
449
 
450
+ /**
451
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
452
+ *
453
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
454
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
455
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
456
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
457
+ */
458
+ export function executeProgram(program, initial_witness, foreign_call_handler) {
459
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
460
+ const len0 = WASM_VECTOR_LEN;
461
+ const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
462
+ return ret;
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.closure490_externref_shim(arg0, arg1, arg2);
526
+ wasm.closure445_externref_shim(arg0, arg1, arg2);
527
527
  }
528
528
 
529
529
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
530
- wasm.closure996_externref_shim(arg0, arg1, arg2, arg3, arg4);
530
+ wasm.closure921_externref_shim(arg0, arg1, arg2, arg3, arg4);
531
531
  }
532
532
 
533
533
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
534
- wasm.closure1000_externref_shim(arg0, arg1, arg2, arg3);
534
+ wasm.closure925_externref_shim(arg0, arg1, arg2, arg3);
535
535
  }
536
536
 
537
537
  async function __wbg_load(module, imports) {
@@ -797,8 +797,8 @@ function __wbg_get_imports() {
797
797
  const ret = false;
798
798
  return ret;
799
799
  };
800
- imports.wbg.__wbindgen_closure_wrapper1603 = function(arg0, arg1, arg2) {
801
- const ret = makeMutClosure(arg0, arg1, 491, __wbg_adapter_30);
800
+ imports.wbg.__wbindgen_closure_wrapper1365 = function(arg0, arg1, arg2) {
801
+ const ret = makeMutClosure(arg0, arg1, 446, __wbg_adapter_30);
802
802
  return ret;
803
803
  };
804
804
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
Binary file
@@ -1,13 +1,8 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
+ export const buildInfo: () => any;
4
5
  export const initLogLevel: (a: number, b: number) => [number, number];
5
- export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
6
- export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
7
- export const executeProgram: (a: number, b: number, c: any, d: any) => any;
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
6
  export const and: (a: any, b: any) => any;
12
7
  export const xor: (a: any, b: any) => any;
13
8
  export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
@@ -18,7 +13,12 @@ export const compressWitness: (a: any) => [number, number, number, number];
18
13
  export const decompressWitness: (a: number, b: number) => [number, number, number];
19
14
  export const compressWitnessStack: (a: any) => [number, number, number, number];
20
15
  export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
21
- export const buildInfo: () => any;
16
+ export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
17
+ export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
18
+ export const executeProgram: (a: number, b: number, c: any, d: any) => any;
19
+ export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
20
+ export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
21
+ export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
22
22
  export const __wbindgen_exn_store: (a: number) => void;
23
23
  export const __externref_table_alloc: () => number;
24
24
  export const __wbindgen_export_2: WebAssembly.Table;
@@ -27,7 +27,7 @@ export const __wbindgen_malloc: (a: number, b: number) => number;
27
27
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
28
28
  export const __wbindgen_export_6: WebAssembly.Table;
29
29
  export const __externref_table_dealloc: (a: number) => void;
30
- export const closure490_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure996_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure1000_externref_shim: (a: number, b: number, c: any, d: any) => void;
30
+ export const closure445_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure921_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure925_externref_shim: (a: number, b: number, c: any, d: any) => void;
33
33
  export const __wbindgen_start: () => void;