@aztec/noir-acvm_js 4.0.0-nightly.20260112 → 4.0.0-nightly.20260114

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,39 +1,40 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * Sets the package's logging level.
5
- *
6
- * @param {LogLevel} level - The maximum level of logging to be emitted.
4
+ * Performs a bitwise AND operation between `lhs` and `rhs`
7
5
  */
8
- export function initLogLevel(filter: string): void;
6
+ export function and(lhs: string, rhs: string): string;
9
7
  /**
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.
8
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
16
9
  */
17
- export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
10
+ export function xor(lhs: string, rhs: string): string;
18
11
  /**
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.
12
+ * Sha256 compression function
26
13
  */
27
- export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
14
+ export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
28
15
  /**
29
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
16
+ * Calculates the Blake2s256 hash of the input bytes
17
+ */
18
+ export function blake2s256(inputs: Uint8Array): Uint8Array;
19
+ /**
20
+ * Verifies a ECDSA signature over the secp256k1 curve.
21
+ */
22
+ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
23
+ /**
24
+ * Verifies a ECDSA signature over the secp256r1 curve.
25
+ */
26
+ export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
27
+ /**
28
+ * Sets the package's logging level.
30
29
  *
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.
30
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
35
31
  */
36
- export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
32
+ export function initLogLevel(filter: string): void;
33
+ /**
34
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
35
+ * @returns {BuildInfo} - Information on how the installed package was built.
36
+ */
37
+ export function buildInfo(): BuildInfo;
37
38
  /**
38
39
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
39
40
  *
@@ -58,30 +59,6 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
58
59
  * @returns {WitnessMap} A witness map containing the circuit's public inputs.
59
60
  */
60
61
  export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
61
- /**
62
- * Performs a bitwise AND operation between `lhs` and `rhs`
63
- */
64
- export function and(lhs: string, rhs: string): string;
65
- /**
66
- * Performs a bitwise XOR operation between `lhs` and `rhs`
67
- */
68
- export function xor(lhs: string, rhs: string): string;
69
- /**
70
- * Sha256 compression function
71
- */
72
- export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
73
- /**
74
- * Calculates the Blake2s256 hash of the input bytes
75
- */
76
- export function blake2s256(inputs: Uint8Array): Uint8Array;
77
- /**
78
- * Verifies a ECDSA signature over the secp256k1 curve.
79
- */
80
- export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
81
- /**
82
- * Verifies a ECDSA signature over the secp256r1 curve.
83
- */
84
- export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
85
62
  /**
86
63
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
87
64
  *
@@ -112,10 +89,33 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
112
89
  */
113
90
  export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
114
91
  /**
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.
92
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
93
+ *
94
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
95
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
96
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
97
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
117
98
  */
118
- export function buildInfo(): BuildInfo;
99
+ export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
100
+ /**
101
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
102
+ * This method also extracts the public return values from the solved witness into its own return witness.
103
+ *
104
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
105
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
106
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
107
+ * @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
108
+ */
109
+ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
110
+ /**
111
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
112
+ *
113
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
114
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
115
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
116
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
117
+ */
118
+ export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
119
119
 
120
120
  export type RawAssertionPayload = {
121
121
  selector: string;
@@ -131,6 +131,15 @@ export type ExecutionError = Error & {
131
131
 
132
132
 
133
133
 
134
+ export type StackItem = {
135
+ index: number;
136
+ witness: WitnessMap;
137
+ }
138
+
139
+ export type WitnessStack = Array<StackItem>;
140
+
141
+
142
+
134
143
  // Map from witness index to hex string value of witness.
135
144
  export type WitnessMap = Map<number, string>;
136
145
 
@@ -146,29 +155,6 @@ export type SolvedAndReturnWitness = {
146
155
 
147
156
 
148
157
 
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
- export type StackItem = {
164
- index: number;
165
- witness: WitnessMap;
166
- }
167
-
168
- export type WitnessStack = Array<StackItem>;
169
-
170
-
171
-
172
158
  /**
173
159
  * @typedef {Object} BuildInfo - Information about how the installed package was built
174
160
  * @property {string} gitHash - The hash of the git commit from which the package was built.
@@ -182,3 +168,17 @@ export type BuildInfo = {
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,138 +201,6 @@ 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 takeFromExternrefTable0(idx) {
206
- const value = wasm.__wbindgen_export_2.get(idx);
207
- wasm.__externref_table_dealloc(idx);
208
- return value;
209
- }
210
- /**
211
- * Sets the package's logging level.
212
- *
213
- * @param {LogLevel} level - The maximum level of logging to be emitted.
214
- */
215
- module.exports.initLogLevel = function(filter) {
216
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
217
- const len0 = WASM_VECTOR_LEN;
218
- const ret = wasm.initLogLevel(ptr0, len0);
219
- if (ret[1]) {
220
- throw takeFromExternrefTable0(ret[0]);
221
- }
222
- };
223
-
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
204
  /**
337
205
  * Performs a bitwise AND operation between `lhs` and `rhs`
338
206
  * @param {string} lhs
@@ -392,6 +260,13 @@ module.exports.sha256_compression = function(inputs, state) {
392
260
  return v3;
393
261
  };
394
262
 
263
+ function passArray8ToWasm0(arg, malloc) {
264
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
265
+ getUint8ArrayMemory0().set(arg, ptr / 1);
266
+ WASM_VECTOR_LEN = arg.length;
267
+ return ptr;
268
+ }
269
+
395
270
  function getArrayU8FromWasm0(ptr, len) {
396
271
  ptr = ptr >>> 0;
397
272
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
@@ -452,6 +327,94 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
452
327
  return ret !== 0;
453
328
  };
454
329
 
330
+ function takeFromExternrefTable0(idx) {
331
+ const value = wasm.__wbindgen_export_2.get(idx);
332
+ wasm.__externref_table_dealloc(idx);
333
+ return value;
334
+ }
335
+ /**
336
+ * Sets the package's logging level.
337
+ *
338
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
339
+ */
340
+ module.exports.initLogLevel = function(filter) {
341
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
342
+ const len0 = WASM_VECTOR_LEN;
343
+ const ret = wasm.initLogLevel(ptr0, len0);
344
+ if (ret[1]) {
345
+ throw takeFromExternrefTable0(ret[0]);
346
+ }
347
+ };
348
+
349
+ /**
350
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
351
+ * @returns {BuildInfo} - Information on how the installed package was built.
352
+ */
353
+ module.exports.buildInfo = function() {
354
+ const ret = wasm.buildInfo();
355
+ return ret;
356
+ };
357
+
358
+ /**
359
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
360
+ *
361
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
362
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
363
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
364
+ * @param {Uint8Array} program
365
+ * @param {WitnessMap} witness_map
366
+ * @returns {WitnessMap}
367
+ */
368
+ module.exports.getReturnWitness = function(program, witness_map) {
369
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
370
+ const len0 = WASM_VECTOR_LEN;
371
+ const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
372
+ if (ret[2]) {
373
+ throw takeFromExternrefTable0(ret[1]);
374
+ }
375
+ return takeFromExternrefTable0(ret[0]);
376
+ };
377
+
378
+ /**
379
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
380
+ *
381
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
382
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
383
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
384
+ * @param {Uint8Array} program
385
+ * @param {WitnessMap} solved_witness
386
+ * @returns {WitnessMap}
387
+ */
388
+ module.exports.getPublicParametersWitness = function(program, solved_witness) {
389
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
390
+ const len0 = WASM_VECTOR_LEN;
391
+ const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
392
+ if (ret[2]) {
393
+ throw takeFromExternrefTable0(ret[1]);
394
+ }
395
+ return takeFromExternrefTable0(ret[0]);
396
+ };
397
+
398
+ /**
399
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
400
+ *
401
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
402
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
403
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
404
+ * @param {Uint8Array} program
405
+ * @param {WitnessMap} solved_witness
406
+ * @returns {WitnessMap}
407
+ */
408
+ module.exports.getPublicWitness = function(program, solved_witness) {
409
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
410
+ const len0 = WASM_VECTOR_LEN;
411
+ const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
412
+ if (ret[2]) {
413
+ throw takeFromExternrefTable0(ret[1]);
414
+ }
415
+ return takeFromExternrefTable0(ret[0]);
416
+ };
417
+
455
418
  /**
456
419
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
457
420
  *
@@ -518,24 +481,61 @@ module.exports.decompressWitnessStack = function(compressed_witness) {
518
481
  };
519
482
 
520
483
  /**
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.
484
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
485
+ *
486
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
487
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
488
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
489
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
523
490
  */
524
- module.exports.buildInfo = function() {
525
- const ret = wasm.buildInfo();
491
+ module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
492
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
493
+ const len0 = WASM_VECTOR_LEN;
494
+ const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
495
+ return ret;
496
+ };
497
+
498
+ /**
499
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
500
+ * This method also extracts the public return values from the solved witness into its own return witness.
501
+ *
502
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
503
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
504
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
505
+ * @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
506
+ */
507
+ module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
508
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
509
+ const len0 = WASM_VECTOR_LEN;
510
+ const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
511
+ return ret;
512
+ };
513
+
514
+ /**
515
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
516
+ *
517
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
518
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
519
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
520
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
521
+ */
522
+ module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
523
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
524
+ const len0 = WASM_VECTOR_LEN;
525
+ const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
526
526
  return ret;
527
527
  };
528
528
 
529
529
  function __wbg_adapter_30(arg0, arg1, arg2) {
530
- wasm.closure490_externref_shim(arg0, arg1, arg2);
530
+ wasm.closure441_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.closure925_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.closure929_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_wrapper1431 = function(arg0, arg1, arg2) {
817
+ const ret = makeMutClosure(arg0, arg1, 442, __wbg_adapter_30);
818
818
  return ret;
819
819
  };
820
820
 
Binary file
@@ -1,24 +1,24 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- 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
4
  export const and: (a: any, b: any) => any;
12
5
  export const xor: (a: any, b: any) => any;
13
6
  export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
14
7
  export const blake2s256: (a: number, b: number) => [number, number];
15
8
  export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
16
9
  export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
10
+ export const initLogLevel: (a: number, b: number) => [number, number];
11
+ export const buildInfo: () => any;
12
+ export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
13
+ export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
14
+ export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
17
15
  export const compressWitness: (a: any) => [number, number, number, number];
18
16
  export const decompressWitness: (a: number, b: number) => [number, number, number];
19
17
  export const compressWitnessStack: (a: any) => [number, number, number, number];
20
18
  export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
21
- export const buildInfo: () => any;
19
+ export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
20
+ export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
21
+ export const executeProgram: (a: number, b: number, c: any, d: any) => any;
22
22
  export const __wbindgen_exn_store: (a: number) => void;
23
23
  export const __externref_table_alloc: () => number;
24
24
  export const __wbindgen_export_2: WebAssembly.Table;
@@ -27,7 +27,7 @@ export const __wbindgen_malloc: (a: number, b: number) => number;
27
27
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
28
28
  export const __wbindgen_export_6: WebAssembly.Table;
29
29
  export const __externref_table_dealloc: (a: number) => void;
30
- export const 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 closure441_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure925_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure929_externref_shim: (a: number, b: number, c: any, d: any) => void;
33
33
  export const __wbindgen_start: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/noir-acvm_js",
3
- "version": "4.0.0-nightly.20260112",
3
+ "version": "4.0.0-nightly.20260114",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/web/acvm_js.d.ts CHANGED
@@ -1,39 +1,40 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * Sets the package's logging level.
5
- *
6
- * @param {LogLevel} level - The maximum level of logging to be emitted.
4
+ * Performs a bitwise AND operation between `lhs` and `rhs`
7
5
  */
8
- export function initLogLevel(filter: string): void;
6
+ export function and(lhs: string, rhs: string): string;
9
7
  /**
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.
8
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
16
9
  */
17
- export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
10
+ export function xor(lhs: string, rhs: string): string;
18
11
  /**
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.
12
+ * Sha256 compression function
26
13
  */
27
- export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
14
+ export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
28
15
  /**
29
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
16
+ * Calculates the Blake2s256 hash of the input bytes
17
+ */
18
+ export function blake2s256(inputs: Uint8Array): Uint8Array;
19
+ /**
20
+ * Verifies a ECDSA signature over the secp256k1 curve.
21
+ */
22
+ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
23
+ /**
24
+ * Verifies a ECDSA signature over the secp256r1 curve.
25
+ */
26
+ export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
27
+ /**
28
+ * Sets the package's logging level.
30
29
  *
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.
30
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
35
31
  */
36
- export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
32
+ export function initLogLevel(filter: string): void;
33
+ /**
34
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
35
+ * @returns {BuildInfo} - Information on how the installed package was built.
36
+ */
37
+ export function buildInfo(): BuildInfo;
37
38
  /**
38
39
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
39
40
  *
@@ -58,30 +59,6 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
58
59
  * @returns {WitnessMap} A witness map containing the circuit's public inputs.
59
60
  */
60
61
  export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
61
- /**
62
- * Performs a bitwise AND operation between `lhs` and `rhs`
63
- */
64
- export function and(lhs: string, rhs: string): string;
65
- /**
66
- * Performs a bitwise XOR operation between `lhs` and `rhs`
67
- */
68
- export function xor(lhs: string, rhs: string): string;
69
- /**
70
- * Sha256 compression function
71
- */
72
- export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
73
- /**
74
- * Calculates the Blake2s256 hash of the input bytes
75
- */
76
- export function blake2s256(inputs: Uint8Array): Uint8Array;
77
- /**
78
- * Verifies a ECDSA signature over the secp256k1 curve.
79
- */
80
- export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
81
- /**
82
- * Verifies a ECDSA signature over the secp256r1 curve.
83
- */
84
- export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
85
62
  /**
86
63
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
87
64
  *
@@ -112,10 +89,33 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
112
89
  */
113
90
  export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
114
91
  /**
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.
92
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
93
+ *
94
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
95
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
96
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
97
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
117
98
  */
118
- export function buildInfo(): BuildInfo;
99
+ export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
100
+ /**
101
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
102
+ * This method also extracts the public return values from the solved witness into its own return witness.
103
+ *
104
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
105
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
106
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
107
+ * @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
108
+ */
109
+ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
110
+ /**
111
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
112
+ *
113
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
114
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
115
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
116
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
117
+ */
118
+ export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
119
119
 
120
120
  export type RawAssertionPayload = {
121
121
  selector: string;
@@ -131,6 +131,15 @@ export type ExecutionError = Error & {
131
131
 
132
132
 
133
133
 
134
+ export type StackItem = {
135
+ index: number;
136
+ witness: WitnessMap;
137
+ }
138
+
139
+ export type WitnessStack = Array<StackItem>;
140
+
141
+
142
+
134
143
  // Map from witness index to hex string value of witness.
135
144
  export type WitnessMap = Map<number, string>;
136
145
 
@@ -146,29 +155,6 @@ export type SolvedAndReturnWitness = {
146
155
 
147
156
 
148
157
 
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
- export type StackItem = {
164
- index: number;
165
- witness: WitnessMap;
166
- }
167
-
168
- export type WitnessStack = Array<StackItem>;
169
-
170
-
171
-
172
158
  /**
173
159
  * @typedef {Object} BuildInfo - Information about how the installed package was built
174
160
  * @property {string} gitHash - The hash of the git commit from which the package was built.
@@ -183,28 +169,42 @@ export type BuildInfo = {
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 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
190
  readonly and: (a: any, b: any) => any;
198
191
  readonly xor: (a: any, b: any) => any;
199
192
  readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
200
193
  readonly blake2s256: (a: number, b: number) => [number, number];
201
194
  readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
202
195
  readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
196
+ readonly initLogLevel: (a: number, b: number) => [number, number];
197
+ readonly buildInfo: () => any;
198
+ readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
199
+ readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
200
+ readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
203
201
  readonly compressWitness: (a: any) => [number, number, number, number];
204
202
  readonly decompressWitness: (a: number, b: number) => [number, number, number];
205
203
  readonly compressWitnessStack: (a: any) => [number, number, number, number];
206
204
  readonly decompressWitnessStack: (a: number, b: number) => [number, number, number];
207
- readonly buildInfo: () => any;
205
+ readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
206
+ readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
207
+ readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
208
208
  readonly __wbindgen_exn_store: (a: number) => void;
209
209
  readonly __externref_table_alloc: () => number;
210
210
  readonly __wbindgen_export_2: WebAssembly.Table;
@@ -213,9 +213,9 @@ export interface InitOutput {
213
213
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
214
214
  readonly __wbindgen_export_6: WebAssembly.Table;
215
215
  readonly __externref_table_dealloc: (a: number) => void;
216
- readonly 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 closure441_externref_shim: (a: number, b: number, c: any) => void;
217
+ readonly closure925_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
218
+ readonly closure929_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,138 +197,6 @@ 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 takeFromExternrefTable0(idx) {
202
- const value = wasm.__wbindgen_export_2.get(idx);
203
- wasm.__externref_table_dealloc(idx);
204
- return value;
205
- }
206
- /**
207
- * Sets the package's logging level.
208
- *
209
- * @param {LogLevel} level - The maximum level of logging to be emitted.
210
- */
211
- export function initLogLevel(filter) {
212
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
213
- const len0 = WASM_VECTOR_LEN;
214
- const ret = wasm.initLogLevel(ptr0, len0);
215
- if (ret[1]) {
216
- throw takeFromExternrefTable0(ret[0]);
217
- }
218
- }
219
-
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
200
  /**
333
201
  * Performs a bitwise AND operation between `lhs` and `rhs`
334
202
  * @param {string} lhs
@@ -388,6 +256,13 @@ export function sha256_compression(inputs, state) {
388
256
  return v3;
389
257
  }
390
258
 
259
+ function passArray8ToWasm0(arg, malloc) {
260
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
261
+ getUint8ArrayMemory0().set(arg, ptr / 1);
262
+ WASM_VECTOR_LEN = arg.length;
263
+ return ptr;
264
+ }
265
+
391
266
  function getArrayU8FromWasm0(ptr, len) {
392
267
  ptr = ptr >>> 0;
393
268
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
@@ -448,6 +323,94 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
448
323
  return ret !== 0;
449
324
  }
450
325
 
326
+ function takeFromExternrefTable0(idx) {
327
+ const value = wasm.__wbindgen_export_2.get(idx);
328
+ wasm.__externref_table_dealloc(idx);
329
+ return value;
330
+ }
331
+ /**
332
+ * Sets the package's logging level.
333
+ *
334
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
335
+ */
336
+ export function initLogLevel(filter) {
337
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
338
+ const len0 = WASM_VECTOR_LEN;
339
+ const ret = wasm.initLogLevel(ptr0, len0);
340
+ if (ret[1]) {
341
+ throw takeFromExternrefTable0(ret[0]);
342
+ }
343
+ }
344
+
345
+ /**
346
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
347
+ * @returns {BuildInfo} - Information on how the installed package was built.
348
+ */
349
+ export function buildInfo() {
350
+ const ret = wasm.buildInfo();
351
+ return ret;
352
+ }
353
+
354
+ /**
355
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
356
+ *
357
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
358
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
359
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
360
+ * @param {Uint8Array} program
361
+ * @param {WitnessMap} witness_map
362
+ * @returns {WitnessMap}
363
+ */
364
+ export function getReturnWitness(program, witness_map) {
365
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
366
+ const len0 = WASM_VECTOR_LEN;
367
+ const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
368
+ if (ret[2]) {
369
+ throw takeFromExternrefTable0(ret[1]);
370
+ }
371
+ return takeFromExternrefTable0(ret[0]);
372
+ }
373
+
374
+ /**
375
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
376
+ *
377
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
378
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
379
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
380
+ * @param {Uint8Array} program
381
+ * @param {WitnessMap} solved_witness
382
+ * @returns {WitnessMap}
383
+ */
384
+ export function getPublicParametersWitness(program, solved_witness) {
385
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
386
+ const len0 = WASM_VECTOR_LEN;
387
+ const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
388
+ if (ret[2]) {
389
+ throw takeFromExternrefTable0(ret[1]);
390
+ }
391
+ return takeFromExternrefTable0(ret[0]);
392
+ }
393
+
394
+ /**
395
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
396
+ *
397
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
398
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
399
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
400
+ * @param {Uint8Array} program
401
+ * @param {WitnessMap} solved_witness
402
+ * @returns {WitnessMap}
403
+ */
404
+ export function getPublicWitness(program, solved_witness) {
405
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
406
+ const len0 = WASM_VECTOR_LEN;
407
+ const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
408
+ if (ret[2]) {
409
+ throw takeFromExternrefTable0(ret[1]);
410
+ }
411
+ return takeFromExternrefTable0(ret[0]);
412
+ }
413
+
451
414
  /**
452
415
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
453
416
  *
@@ -514,24 +477,61 @@ export function decompressWitnessStack(compressed_witness) {
514
477
  }
515
478
 
516
479
  /**
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.
480
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
481
+ *
482
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
483
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
484
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
485
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
519
486
  */
520
- export function buildInfo() {
521
- const ret = wasm.buildInfo();
487
+ export function executeCircuit(program, initial_witness, foreign_call_handler) {
488
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
489
+ const len0 = WASM_VECTOR_LEN;
490
+ const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
491
+ return ret;
492
+ }
493
+
494
+ /**
495
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
496
+ * This method also extracts the public return values from the solved witness into its own return witness.
497
+ *
498
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
499
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
500
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
501
+ * @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
502
+ */
503
+ export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
504
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
505
+ const len0 = WASM_VECTOR_LEN;
506
+ const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
507
+ return ret;
508
+ }
509
+
510
+ /**
511
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
512
+ *
513
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
514
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
515
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
516
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
517
+ */
518
+ export function executeProgram(program, initial_witness, foreign_call_handler) {
519
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
520
+ const len0 = WASM_VECTOR_LEN;
521
+ const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
522
522
  return ret;
523
523
  }
524
524
 
525
525
  function __wbg_adapter_30(arg0, arg1, arg2) {
526
- wasm.closure490_externref_shim(arg0, arg1, arg2);
526
+ wasm.closure441_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.closure925_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.closure929_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_wrapper1431 = function(arg0, arg1, arg2) {
801
+ const ret = makeMutClosure(arg0, arg1, 442, __wbg_adapter_30);
802
802
  return ret;
803
803
  };
804
804
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
Binary file
@@ -1,24 +1,24 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const 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
4
  export const and: (a: any, b: any) => any;
12
5
  export const xor: (a: any, b: any) => any;
13
6
  export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
14
7
  export const blake2s256: (a: number, b: number) => [number, number];
15
8
  export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
16
9
  export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
10
+ export const initLogLevel: (a: number, b: number) => [number, number];
11
+ export const buildInfo: () => any;
12
+ export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
13
+ export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
14
+ export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
17
15
  export const compressWitness: (a: any) => [number, number, number, number];
18
16
  export const decompressWitness: (a: number, b: number) => [number, number, number];
19
17
  export const compressWitnessStack: (a: any) => [number, number, number, number];
20
18
  export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
21
- export const buildInfo: () => any;
19
+ export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
20
+ export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
21
+ export const executeProgram: (a: number, b: number, c: any, d: any) => any;
22
22
  export const __wbindgen_exn_store: (a: number) => void;
23
23
  export const __externref_table_alloc: () => number;
24
24
  export const __wbindgen_export_2: WebAssembly.Table;
@@ -27,7 +27,7 @@ export const __wbindgen_malloc: (a: number, b: number) => number;
27
27
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
28
28
  export const __wbindgen_export_6: WebAssembly.Table;
29
29
  export const __externref_table_dealloc: (a: number) => void;
30
- export const 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 closure441_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure925_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure929_externref_shim: (a: number, b: number, c: any, d: any) => void;
33
33
  export const __wbindgen_start: () => void;