@aztec/noir-acvm_js 0.0.0-test.1 → 0.0.1-commit.1142ef1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,11 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ /**
4
+ * Sets the package's logging level.
5
+ *
6
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
7
+ */
8
+ export function initLogLevel(filter: string): void;
3
9
  /**
4
10
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
5
11
  *
@@ -29,40 +35,29 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
29
35
  */
30
36
  export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
31
37
  /**
32
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
33
- *
34
- * @param {WitnessMap} witness_map - A witness map.
35
- * @returns {Uint8Array} A compressed witness map
36
- */
37
- export function compressWitness(witness_map: WitnessMap): Uint8Array;
38
- /**
39
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
40
- * This should be used to only fetch the witness map for the main function.
41
- *
42
- * @param {Uint8Array} compressed_witness - A compressed witness.
43
- * @returns {WitnessMap} The decompressed witness map.
44
- */
45
- export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
46
- /**
47
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
38
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
48
39
  *
49
- * @param {WitnessStack} witness_stack - A witness stack.
50
- * @returns {Uint8Array} A compressed witness stack
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.
51
43
  */
52
- export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
44
+ export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
53
45
  /**
54
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
46
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
55
47
  *
56
- * @param {Uint8Array} compressed_witness - A compressed witness.
57
- * @returns {WitnessStack} The decompressed witness stack.
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.
58
51
  */
59
- export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
52
+ export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
60
53
  /**
61
- * Sets the package's logging level.
54
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
62
55
  *
63
- * @param {LogLevel} level - The maximum level of logging to be emitted.
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.
64
59
  */
65
- export function initLogLevel(filter: string): void;
60
+ export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
66
61
  /**
67
62
  * Performs a bitwise AND operation between `lhs` and `rhs`
68
63
  */
@@ -88,34 +83,39 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
88
83
  */
89
84
  export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
90
85
  /**
91
- * Returns the `BuildInfo` object containing information about how the installed package was built.
92
- * @returns {BuildInfo} - Information on how the installed package was built.
86
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
87
+ *
88
+ * @param {WitnessMap} witness_map - A witness map.
89
+ * @returns {Uint8Array} A compressed witness map
93
90
  */
94
- export function buildInfo(): BuildInfo;
91
+ export function compressWitness(witness_map: WitnessMap): Uint8Array;
95
92
  /**
96
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
93
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
94
+ * This should be used to only fetch the witness map for the main function.
97
95
  *
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.
96
+ * @param {Uint8Array} compressed_witness - A compressed witness.
97
+ * @returns {WitnessMap} The decompressed witness map.
101
98
  */
102
- export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
99
+ export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
103
100
  /**
104
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
101
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
105
102
  *
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.
103
+ * @param {WitnessStack} witness_stack - A witness stack.
104
+ * @returns {Uint8Array} A compressed witness stack
109
105
  */
110
- export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
106
+ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
111
107
  /**
112
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
108
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
113
109
  *
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.
110
+ * @param {Uint8Array} compressed_witness - A compressed witness.
111
+ * @returns {WitnessStack} The decompressed witness stack.
117
112
  */
118
- export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
113
+ export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
114
+ /**
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.
117
+ */
118
+ export function buildInfo(): BuildInfo;
119
119
 
120
120
  export type RawAssertionPayload = {
121
121
  selector: string;
@@ -125,30 +125,23 @@ export type RawAssertionPayload = {
125
125
  export type ExecutionError = Error & {
126
126
  callStack?: string[];
127
127
  rawAssertionPayload?: RawAssertionPayload;
128
+ acirFunctionId?: number;
128
129
  brilligFunctionId?: number;
129
130
  };
130
131
 
131
132
 
132
133
 
133
- export type StackItem = {
134
- index: number;
135
- witness: WitnessMap;
136
- }
137
-
138
- export type WitnessStack = Array<StackItem>;
139
-
140
-
134
+ // Map from witness index to hex string value of witness.
135
+ export type WitnessMap = Map<number, string>;
141
136
 
142
137
  /**
143
- * @typedef {Object} BuildInfo - Information about how the installed package was built
144
- * @property {string} gitHash - The hash of the git commit from which the package was built.
145
- * @property {string} version - The version of the package at the built git commit.
146
- * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
138
+ * An execution result containing two witnesses.
139
+ * 1. The full solved witness of the execution.
140
+ * 2. The return witness which contains the given public return values within the full witness.
147
141
  */
148
- export type BuildInfo = {
149
- gitHash: string;
150
- version: string;
151
- dirty: string;
142
+ export type SolvedAndReturnWitness = {
143
+ solvedWitness: WitnessMap;
144
+ returnWitness: WitnessMap;
152
145
  }
153
146
 
154
147
 
@@ -167,17 +160,25 @@ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => P
167
160
 
168
161
 
169
162
 
170
- // Map from witness index to hex string value of witness.
171
- export type WitnessMap = Map<number, string>;
163
+ export type StackItem = {
164
+ index: number;
165
+ witness: WitnessMap;
166
+ }
167
+
168
+ export type WitnessStack = Array<StackItem>;
169
+
170
+
172
171
 
173
172
  /**
174
- * An execution result containing two witnesses.
175
- * 1. The full solved witness of the execution.
176
- * 2. The return witness which contains the given public return values within the full witness.
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
177
  */
178
- export type SolvedAndReturnWitness = {
179
- solvedWitness: WitnessMap;
180
- returnWitness: WitnessMap;
178
+ export type BuildInfo = {
179
+ gitHash: string;
180
+ version: string;
181
+ dirty: string;
181
182
  }
182
183
 
183
184
 
package/nodejs/acvm_js.js CHANGED
@@ -202,6 +202,25 @@ function debugString(val) {
202
202
  return className;
203
203
  }
204
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
+
205
224
  function passArray8ToWasm0(arg, malloc) {
206
225
  const ptr = malloc(arg.length * 1, 1) >>> 0;
207
226
  getUint8ArrayMemory0().set(arg, ptr / 1);
@@ -254,43 +273,20 @@ module.exports.executeProgram = function(program, initial_witness, foreign_call_
254
273
  return ret;
255
274
  };
256
275
 
257
- function takeFromExternrefTable0(idx) {
258
- const value = wasm.__wbindgen_export_2.get(idx);
259
- wasm.__externref_table_dealloc(idx);
260
- return value;
261
- }
262
-
263
- function getArrayU8FromWasm0(ptr, len) {
264
- ptr = ptr >>> 0;
265
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
266
- }
267
- /**
268
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
269
- *
270
- * @param {WitnessMap} witness_map - A witness map.
271
- * @returns {Uint8Array} A compressed witness map
272
- */
273
- module.exports.compressWitness = function(witness_map) {
274
- const ret = wasm.compressWitness(witness_map);
275
- if (ret[3]) {
276
- throw takeFromExternrefTable0(ret[2]);
277
- }
278
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
279
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
280
- return v1;
281
- };
282
-
283
276
  /**
284
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
285
- * This should be used to only fetch the witness map for the main function.
277
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
286
278
  *
287
- * @param {Uint8Array} compressed_witness - A compressed witness.
288
- * @returns {WitnessMap} The decompressed witness map.
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}
289
285
  */
290
- module.exports.decompressWitness = function(compressed_witness) {
291
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
286
+ module.exports.getReturnWitness = function(program, witness_map) {
287
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
292
288
  const len0 = WASM_VECTOR_LEN;
293
- const ret = wasm.decompressWitness(ptr0, len0);
289
+ const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
294
290
  if (ret[2]) {
295
291
  throw takeFromExternrefTable0(ret[1]);
296
292
  }
@@ -298,31 +294,19 @@ module.exports.decompressWitness = function(compressed_witness) {
298
294
  };
299
295
 
300
296
  /**
301
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
302
- *
303
- * @param {WitnessStack} witness_stack - A witness stack.
304
- * @returns {Uint8Array} A compressed witness stack
305
- */
306
- module.exports.compressWitnessStack = function(witness_stack) {
307
- const ret = wasm.compressWitnessStack(witness_stack);
308
- if (ret[3]) {
309
- throw takeFromExternrefTable0(ret[2]);
310
- }
311
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
312
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
313
- return v1;
314
- };
315
-
316
- /**
317
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
297
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
318
298
  *
319
- * @param {Uint8Array} compressed_witness - A compressed witness.
320
- * @returns {WitnessStack} The decompressed witness stack.
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}
321
305
  */
322
- module.exports.decompressWitnessStack = function(compressed_witness) {
323
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
306
+ module.exports.getPublicParametersWitness = function(program, solved_witness) {
307
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
324
308
  const len0 = WASM_VECTOR_LEN;
325
- const ret = wasm.decompressWitnessStack(ptr0, len0);
309
+ const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
326
310
  if (ret[2]) {
327
311
  throw takeFromExternrefTable0(ret[1]);
328
312
  }
@@ -330,17 +314,23 @@ module.exports.decompressWitnessStack = function(compressed_witness) {
330
314
  };
331
315
 
332
316
  /**
333
- * Sets the package's logging level.
317
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
334
318
  *
335
- * @param {LogLevel} level - The maximum level of logging to be emitted.
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}
336
325
  */
337
- module.exports.initLogLevel = function(filter) {
338
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
326
+ module.exports.getPublicWitness = function(program, solved_witness) {
327
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
339
328
  const len0 = WASM_VECTOR_LEN;
340
- const ret = wasm.initLogLevel(ptr0, len0);
341
- if (ret[1]) {
342
- throw takeFromExternrefTable0(ret[0]);
329
+ const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
330
+ if (ret[2]) {
331
+ throw takeFromExternrefTable0(ret[1]);
343
332
  }
333
+ return takeFromExternrefTable0(ret[0]);
344
334
  };
345
335
 
346
336
  /**
@@ -402,6 +392,10 @@ module.exports.sha256_compression = function(inputs, state) {
402
392
  return v3;
403
393
  };
404
394
 
395
+ function getArrayU8FromWasm0(ptr, len) {
396
+ ptr = ptr >>> 0;
397
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
398
+ }
405
399
  /**
406
400
  * Calculates the Blake2s256 hash of the input bytes
407
401
  * @param {Uint8Array} inputs
@@ -459,28 +453,32 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
459
453
  };
460
454
 
461
455
  /**
462
- * Returns the `BuildInfo` object containing information about how the installed package was built.
463
- * @returns {BuildInfo} - Information on how the installed package was built.
456
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
457
+ *
458
+ * @param {WitnessMap} witness_map - A witness map.
459
+ * @returns {Uint8Array} A compressed witness map
464
460
  */
465
- module.exports.buildInfo = function() {
466
- const ret = wasm.buildInfo();
467
- return ret;
461
+ module.exports.compressWitness = function(witness_map) {
462
+ const ret = wasm.compressWitness(witness_map);
463
+ if (ret[3]) {
464
+ throw takeFromExternrefTable0(ret[2]);
465
+ }
466
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
467
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
468
+ return v1;
468
469
  };
469
470
 
470
471
  /**
471
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
472
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
473
+ * This should be used to only fetch the witness map for the main function.
472
474
  *
473
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
474
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
475
- * @returns {WitnessMap} A witness map containing the circuit's return values.
476
- * @param {Uint8Array} program
477
- * @param {WitnessMap} witness_map
478
- * @returns {WitnessMap}
475
+ * @param {Uint8Array} compressed_witness - A compressed witness.
476
+ * @returns {WitnessMap} The decompressed witness map.
479
477
  */
480
- module.exports.getReturnWitness = function(program, witness_map) {
481
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
478
+ module.exports.decompressWitness = function(compressed_witness) {
479
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
482
480
  const len0 = WASM_VECTOR_LEN;
483
- const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
481
+ const ret = wasm.decompressWitness(ptr0, len0);
484
482
  if (ret[2]) {
485
483
  throw takeFromExternrefTable0(ret[1]);
486
484
  }
@@ -488,55 +486,56 @@ module.exports.getReturnWitness = function(program, witness_map) {
488
486
  };
489
487
 
490
488
  /**
491
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
489
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
492
490
  *
493
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
494
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
495
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
496
- * @param {Uint8Array} program
497
- * @param {WitnessMap} solved_witness
498
- * @returns {WitnessMap}
491
+ * @param {WitnessStack} witness_stack - A witness stack.
492
+ * @returns {Uint8Array} A compressed witness stack
499
493
  */
500
- module.exports.getPublicParametersWitness = function(program, solved_witness) {
501
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
502
- const len0 = WASM_VECTOR_LEN;
503
- const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
504
- if (ret[2]) {
505
- throw takeFromExternrefTable0(ret[1]);
494
+ module.exports.compressWitnessStack = function(witness_stack) {
495
+ const ret = wasm.compressWitnessStack(witness_stack);
496
+ if (ret[3]) {
497
+ throw takeFromExternrefTable0(ret[2]);
506
498
  }
507
- return takeFromExternrefTable0(ret[0]);
499
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
500
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
501
+ return v1;
508
502
  };
509
503
 
510
504
  /**
511
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
505
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
512
506
  *
513
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
514
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
515
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
516
- * @param {Uint8Array} program
517
- * @param {WitnessMap} solved_witness
518
- * @returns {WitnessMap}
507
+ * @param {Uint8Array} compressed_witness - A compressed witness.
508
+ * @returns {WitnessStack} The decompressed witness stack.
519
509
  */
520
- module.exports.getPublicWitness = function(program, solved_witness) {
521
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
510
+ module.exports.decompressWitnessStack = function(compressed_witness) {
511
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
522
512
  const len0 = WASM_VECTOR_LEN;
523
- const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
513
+ const ret = wasm.decompressWitnessStack(ptr0, len0);
524
514
  if (ret[2]) {
525
515
  throw takeFromExternrefTable0(ret[1]);
526
516
  }
527
517
  return takeFromExternrefTable0(ret[0]);
528
518
  };
529
519
 
520
+ /**
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.
523
+ */
524
+ module.exports.buildInfo = function() {
525
+ const ret = wasm.buildInfo();
526
+ return ret;
527
+ };
528
+
530
529
  function __wbg_adapter_30(arg0, arg1, arg2) {
531
- wasm.closure265_externref_shim(arg0, arg1, arg2);
530
+ wasm.closure490_externref_shim(arg0, arg1, arg2);
532
531
  }
533
532
 
534
533
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
535
- wasm.closure826_externref_shim(arg0, arg1, arg2, arg3, arg4);
534
+ wasm.closure996_externref_shim(arg0, arg1, arg2, arg3, arg4);
536
535
  }
537
536
 
538
537
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
539
- wasm.closure830_externref_shim(arg0, arg1, arg2, arg3);
538
+ wasm.closure1000_externref_shim(arg0, arg1, arg2, arg3);
540
539
  }
541
540
 
542
541
  module.exports.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
@@ -554,12 +553,12 @@ module.exports.__wbg_call_833bed5770ea2041 = function() { return handleError(fun
554
553
  return ret;
555
554
  }, arguments) };
556
555
 
557
- module.exports.__wbg_constructor_003f4a4118e07291 = function(arg0) {
556
+ module.exports.__wbg_constructor_536364f6bcd4616b = function(arg0) {
558
557
  const ret = new Error(arg0);
559
558
  return ret;
560
559
  };
561
560
 
562
- module.exports.__wbg_constructor_c456dcccc52847dd = function(arg0) {
561
+ module.exports.__wbg_constructor_66e92e9c3ecae9e8 = function(arg0) {
563
562
  const ret = new Error(arg0);
564
563
  return ret;
565
564
  };
@@ -675,11 +674,6 @@ module.exports.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
675
674
  }
676
675
  };
677
676
 
678
- module.exports.__wbg_new_3f4c5c451d69e970 = function() {
679
- const ret = new Map();
680
- return ret;
681
- };
682
-
683
677
  module.exports.__wbg_new_5e0be73521bc8c17 = function() {
684
678
  const ret = new Map();
685
679
  return ret;
@@ -695,7 +689,7 @@ module.exports.__wbg_new_8a6f238a6ece86ea = function() {
695
689
  return ret;
696
690
  };
697
691
 
698
- module.exports.__wbg_new_a324c5957dd8b845 = function() {
692
+ module.exports.__wbg_new_9f501325818b4158 = function() {
699
693
  const ret = new Array();
700
694
  return ret;
701
695
  };
@@ -705,6 +699,11 @@ module.exports.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
705
699
  return ret;
706
700
  };
707
701
 
702
+ module.exports.__wbg_new_ec40611a7805f1f0 = function() {
703
+ const ret = new Map();
704
+ return ret;
705
+ };
706
+
708
707
  module.exports.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
709
708
  const ret = new Function(getStringFromWasm0(arg0, arg1));
710
709
  return ret;
@@ -814,8 +813,8 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
814
813
  return ret;
815
814
  };
816
815
 
817
- module.exports.__wbindgen_closure_wrapper740 = function(arg0, arg1, arg2) {
818
- const ret = makeMutClosure(arg0, arg1, 266, __wbg_adapter_30);
816
+ module.exports.__wbindgen_closure_wrapper1603 = function(arg0, arg1, arg2) {
817
+ const ret = makeMutClosure(arg0, arg1, 491, __wbg_adapter_30);
819
818
  return ret;
820
819
  };
821
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];
4
5
  export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
5
6
  export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
6
7
  export const executeProgram: (a: number, b: number, c: any, d: any) => any;
7
- export const compressWitness: (a: any) => [number, number, number, number];
8
- export const decompressWitness: (a: number, b: number) => [number, number, number];
9
- export const compressWitnessStack: (a: any) => [number, number, number, number];
10
- export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
11
- export const initLogLevel: (a: number, b: number) => [number, number];
8
+ export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
9
+ export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
10
+ export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
12
11
  export const and: (a: any, b: any) => any;
13
12
  export const xor: (a: any, b: any) => any;
14
13
  export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
15
14
  export const blake2s256: (a: number, b: number) => [number, number];
16
15
  export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
17
16
  export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
17
+ export const compressWitness: (a: any) => [number, number, number, number];
18
+ export const decompressWitness: (a: number, b: number) => [number, number, number];
19
+ export const compressWitnessStack: (a: any) => [number, number, number, number];
20
+ export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
18
21
  export const buildInfo: () => any;
19
- export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
20
- export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
21
- export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
22
22
  export const __wbindgen_exn_store: (a: number) => void;
23
23
  export const __externref_table_alloc: () => number;
24
24
  export const __wbindgen_export_2: WebAssembly.Table;
@@ -27,7 +27,7 @@ export const __wbindgen_malloc: (a: number, b: number) => number;
27
27
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
28
28
  export const __wbindgen_export_6: WebAssembly.Table;
29
29
  export const __externref_table_dealloc: (a: number) => void;
30
- export const closure265_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure826_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure830_externref_shim: (a: number, b: number, c: any, d: any) => void;
30
+ export const 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;
33
33
  export const __wbindgen_start: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/noir-acvm_js",
3
- "version": "0.0.0-test.1",
3
+ "version": "0.0.1-commit.1142ef1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -26,27 +26,27 @@
26
26
  "package.json"
27
27
  ],
28
28
  "sideEffects": false,
29
- "packageManager": "yarn@3.5.1",
29
+ "packageManager": "yarn@4.5.2",
30
30
  "scripts": {
31
31
  "build": "bash ./build.sh",
32
32
  "test": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' mocha",
33
33
  "test:browser": "web-test-runner",
34
- "lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0",
34
+ "lint": "NODE_NO_WARNINGS=1 eslint . --max-warnings 0",
35
35
  "publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish",
36
36
  "nightly:version": "jq --arg new_version \"-$(git rev-parse --short HEAD)$1\" '.version = .version + $new_version' package.json > package-tmp.json && mv package-tmp.json package.json",
37
37
  "clean": "chmod u+w web nodejs || true && rm -rf web nodejs"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@esm-bundle/chai": "^4.3.4-fix.0",
41
- "@web/dev-server-esbuild": "^0.3.6",
42
- "@web/test-runner": "^0.18.1",
43
- "@web/test-runner-playwright": "^0.11.0",
44
- "chai": "^4.4.1",
45
- "eslint": "^8.57.0",
46
- "eslint-plugin-prettier": "^5.1.3",
47
- "mocha": "^10.2.0",
48
- "prettier": "3.2.5",
49
- "ts-node": "^10.9.1",
50
- "typescript": "^5.4.2"
41
+ "@web/dev-server-esbuild": "^1.0.4",
42
+ "@web/test-runner": "^0.20.2",
43
+ "@web/test-runner-playwright": "^0.11.1",
44
+ "chai": "^6.2.2",
45
+ "eslint": "^9.39.2",
46
+ "eslint-plugin-prettier": "^5.5.4",
47
+ "mocha": "^11.7.5",
48
+ "prettier": "3.7.4",
49
+ "ts-node": "^10.9.2",
50
+ "typescript": "^5.8.3"
51
51
  }
52
52
  }
package/web/acvm_js.d.ts CHANGED
@@ -1,5 +1,11 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ /**
4
+ * Sets the package's logging level.
5
+ *
6
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
7
+ */
8
+ export function initLogLevel(filter: string): void;
3
9
  /**
4
10
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
5
11
  *
@@ -29,40 +35,29 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
29
35
  */
30
36
  export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
31
37
  /**
32
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
33
- *
34
- * @param {WitnessMap} witness_map - A witness map.
35
- * @returns {Uint8Array} A compressed witness map
36
- */
37
- export function compressWitness(witness_map: WitnessMap): Uint8Array;
38
- /**
39
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
40
- * This should be used to only fetch the witness map for the main function.
41
- *
42
- * @param {Uint8Array} compressed_witness - A compressed witness.
43
- * @returns {WitnessMap} The decompressed witness map.
44
- */
45
- export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
46
- /**
47
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
38
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
48
39
  *
49
- * @param {WitnessStack} witness_stack - A witness stack.
50
- * @returns {Uint8Array} A compressed witness stack
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.
51
43
  */
52
- export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
44
+ export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
53
45
  /**
54
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
46
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
55
47
  *
56
- * @param {Uint8Array} compressed_witness - A compressed witness.
57
- * @returns {WitnessStack} The decompressed witness stack.
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.
58
51
  */
59
- export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
52
+ export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
60
53
  /**
61
- * Sets the package's logging level.
54
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
62
55
  *
63
- * @param {LogLevel} level - The maximum level of logging to be emitted.
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.
64
59
  */
65
- export function initLogLevel(filter: string): void;
60
+ export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
66
61
  /**
67
62
  * Performs a bitwise AND operation between `lhs` and `rhs`
68
63
  */
@@ -88,34 +83,39 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
88
83
  */
89
84
  export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
90
85
  /**
91
- * Returns the `BuildInfo` object containing information about how the installed package was built.
92
- * @returns {BuildInfo} - Information on how the installed package was built.
86
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
87
+ *
88
+ * @param {WitnessMap} witness_map - A witness map.
89
+ * @returns {Uint8Array} A compressed witness map
93
90
  */
94
- export function buildInfo(): BuildInfo;
91
+ export function compressWitness(witness_map: WitnessMap): Uint8Array;
95
92
  /**
96
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
93
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
94
+ * This should be used to only fetch the witness map for the main function.
97
95
  *
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.
96
+ * @param {Uint8Array} compressed_witness - A compressed witness.
97
+ * @returns {WitnessMap} The decompressed witness map.
101
98
  */
102
- export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
99
+ export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
103
100
  /**
104
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
101
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
105
102
  *
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.
103
+ * @param {WitnessStack} witness_stack - A witness stack.
104
+ * @returns {Uint8Array} A compressed witness stack
109
105
  */
110
- export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
106
+ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
111
107
  /**
112
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
108
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
113
109
  *
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.
110
+ * @param {Uint8Array} compressed_witness - A compressed witness.
111
+ * @returns {WitnessStack} The decompressed witness stack.
117
112
  */
118
- export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
113
+ export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
114
+ /**
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.
117
+ */
118
+ export function buildInfo(): BuildInfo;
119
119
 
120
120
  export type RawAssertionPayload = {
121
121
  selector: string;
@@ -125,30 +125,23 @@ export type RawAssertionPayload = {
125
125
  export type ExecutionError = Error & {
126
126
  callStack?: string[];
127
127
  rawAssertionPayload?: RawAssertionPayload;
128
+ acirFunctionId?: number;
128
129
  brilligFunctionId?: number;
129
130
  };
130
131
 
131
132
 
132
133
 
133
- export type StackItem = {
134
- index: number;
135
- witness: WitnessMap;
136
- }
137
-
138
- export type WitnessStack = Array<StackItem>;
139
-
140
-
134
+ // Map from witness index to hex string value of witness.
135
+ export type WitnessMap = Map<number, string>;
141
136
 
142
137
  /**
143
- * @typedef {Object} BuildInfo - Information about how the installed package was built
144
- * @property {string} gitHash - The hash of the git commit from which the package was built.
145
- * @property {string} version - The version of the package at the built git commit.
146
- * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
138
+ * An execution result containing two witnesses.
139
+ * 1. The full solved witness of the execution.
140
+ * 2. The return witness which contains the given public return values within the full witness.
147
141
  */
148
- export type BuildInfo = {
149
- gitHash: string;
150
- version: string;
151
- dirty: string;
142
+ export type SolvedAndReturnWitness = {
143
+ solvedWitness: WitnessMap;
144
+ returnWitness: WitnessMap;
152
145
  }
153
146
 
154
147
 
@@ -167,17 +160,25 @@ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => P
167
160
 
168
161
 
169
162
 
170
- // Map from witness index to hex string value of witness.
171
- export type WitnessMap = Map<number, string>;
163
+ export type StackItem = {
164
+ index: number;
165
+ witness: WitnessMap;
166
+ }
167
+
168
+ export type WitnessStack = Array<StackItem>;
169
+
170
+
172
171
 
173
172
  /**
174
- * An execution result containing two witnesses.
175
- * 1. The full solved witness of the execution.
176
- * 2. The return witness which contains the given public return values within the full witness.
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
177
  */
178
- export type SolvedAndReturnWitness = {
179
- solvedWitness: WitnessMap;
180
- returnWitness: WitnessMap;
178
+ export type BuildInfo = {
179
+ gitHash: string;
180
+ version: string;
181
+ dirty: string;
181
182
  }
182
183
 
183
184
 
@@ -186,24 +187,24 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
186
187
 
187
188
  export interface InitOutput {
188
189
  readonly memory: WebAssembly.Memory;
190
+ readonly initLogLevel: (a: number, b: number) => [number, number];
189
191
  readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
190
192
  readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
191
193
  readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
192
- readonly compressWitness: (a: any) => [number, number, number, number];
193
- readonly decompressWitness: (a: number, b: number) => [number, number, number];
194
- readonly compressWitnessStack: (a: any) => [number, number, number, number];
195
- readonly decompressWitnessStack: (a: number, b: number) => [number, number, number];
196
- readonly initLogLevel: (a: number, b: number) => [number, number];
194
+ readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
195
+ readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
196
+ readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
197
197
  readonly and: (a: any, b: any) => any;
198
198
  readonly xor: (a: any, b: any) => any;
199
199
  readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
200
200
  readonly blake2s256: (a: number, b: number) => [number, number];
201
201
  readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
202
202
  readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
203
+ readonly compressWitness: (a: any) => [number, number, number, number];
204
+ readonly decompressWitness: (a: number, b: number) => [number, number, number];
205
+ readonly compressWitnessStack: (a: any) => [number, number, number, number];
206
+ readonly decompressWitnessStack: (a: number, b: number) => [number, number, number];
203
207
  readonly buildInfo: () => any;
204
- readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
205
- readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
206
- readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
207
208
  readonly __wbindgen_exn_store: (a: number) => void;
208
209
  readonly __externref_table_alloc: () => number;
209
210
  readonly __wbindgen_export_2: WebAssembly.Table;
@@ -212,9 +213,9 @@ export interface InitOutput {
212
213
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
213
214
  readonly __wbindgen_export_6: WebAssembly.Table;
214
215
  readonly __externref_table_dealloc: (a: number) => void;
215
- readonly closure265_externref_shim: (a: number, b: number, c: any) => void;
216
- readonly closure826_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
217
- readonly closure830_externref_shim: (a: number, b: number, c: any, d: any) => void;
216
+ readonly 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;
218
219
  readonly __wbindgen_start: () => void;
219
220
  }
220
221
 
package/web/acvm_js.js CHANGED
@@ -198,6 +198,25 @@ function debugString(val) {
198
198
  return className;
199
199
  }
200
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
+
201
220
  function passArray8ToWasm0(arg, malloc) {
202
221
  const ptr = malloc(arg.length * 1, 1) >>> 0;
203
222
  getUint8ArrayMemory0().set(arg, ptr / 1);
@@ -250,43 +269,20 @@ export function executeProgram(program, initial_witness, foreign_call_handler) {
250
269
  return ret;
251
270
  }
252
271
 
253
- function takeFromExternrefTable0(idx) {
254
- const value = wasm.__wbindgen_export_2.get(idx);
255
- wasm.__externref_table_dealloc(idx);
256
- return value;
257
- }
258
-
259
- function getArrayU8FromWasm0(ptr, len) {
260
- ptr = ptr >>> 0;
261
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
262
- }
263
- /**
264
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
265
- *
266
- * @param {WitnessMap} witness_map - A witness map.
267
- * @returns {Uint8Array} A compressed witness map
268
- */
269
- export function compressWitness(witness_map) {
270
- const ret = wasm.compressWitness(witness_map);
271
- if (ret[3]) {
272
- throw takeFromExternrefTable0(ret[2]);
273
- }
274
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
275
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
276
- return v1;
277
- }
278
-
279
272
  /**
280
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
281
- * This should be used to only fetch the witness map for the main function.
273
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
282
274
  *
283
- * @param {Uint8Array} compressed_witness - A compressed witness.
284
- * @returns {WitnessMap} The decompressed witness map.
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}
285
281
  */
286
- export function decompressWitness(compressed_witness) {
287
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
282
+ export function getReturnWitness(program, witness_map) {
283
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
288
284
  const len0 = WASM_VECTOR_LEN;
289
- const ret = wasm.decompressWitness(ptr0, len0);
285
+ const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
290
286
  if (ret[2]) {
291
287
  throw takeFromExternrefTable0(ret[1]);
292
288
  }
@@ -294,31 +290,19 @@ export function decompressWitness(compressed_witness) {
294
290
  }
295
291
 
296
292
  /**
297
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
298
- *
299
- * @param {WitnessStack} witness_stack - A witness stack.
300
- * @returns {Uint8Array} A compressed witness stack
301
- */
302
- export function compressWitnessStack(witness_stack) {
303
- const ret = wasm.compressWitnessStack(witness_stack);
304
- if (ret[3]) {
305
- throw takeFromExternrefTable0(ret[2]);
306
- }
307
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
308
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
309
- return v1;
310
- }
311
-
312
- /**
313
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
293
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
314
294
  *
315
- * @param {Uint8Array} compressed_witness - A compressed witness.
316
- * @returns {WitnessStack} The decompressed witness stack.
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}
317
301
  */
318
- export function decompressWitnessStack(compressed_witness) {
319
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
302
+ export function getPublicParametersWitness(program, solved_witness) {
303
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
320
304
  const len0 = WASM_VECTOR_LEN;
321
- const ret = wasm.decompressWitnessStack(ptr0, len0);
305
+ const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
322
306
  if (ret[2]) {
323
307
  throw takeFromExternrefTable0(ret[1]);
324
308
  }
@@ -326,17 +310,23 @@ export function decompressWitnessStack(compressed_witness) {
326
310
  }
327
311
 
328
312
  /**
329
- * Sets the package's logging level.
313
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
330
314
  *
331
- * @param {LogLevel} level - The maximum level of logging to be emitted.
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}
332
321
  */
333
- export function initLogLevel(filter) {
334
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
322
+ export function getPublicWitness(program, solved_witness) {
323
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
335
324
  const len0 = WASM_VECTOR_LEN;
336
- const ret = wasm.initLogLevel(ptr0, len0);
337
- if (ret[1]) {
338
- throw takeFromExternrefTable0(ret[0]);
325
+ const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
326
+ if (ret[2]) {
327
+ throw takeFromExternrefTable0(ret[1]);
339
328
  }
329
+ return takeFromExternrefTable0(ret[0]);
340
330
  }
341
331
 
342
332
  /**
@@ -398,6 +388,10 @@ export function sha256_compression(inputs, state) {
398
388
  return v3;
399
389
  }
400
390
 
391
+ function getArrayU8FromWasm0(ptr, len) {
392
+ ptr = ptr >>> 0;
393
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
394
+ }
401
395
  /**
402
396
  * Calculates the Blake2s256 hash of the input bytes
403
397
  * @param {Uint8Array} inputs
@@ -455,28 +449,32 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
455
449
  }
456
450
 
457
451
  /**
458
- * Returns the `BuildInfo` object containing information about how the installed package was built.
459
- * @returns {BuildInfo} - Information on how the installed package was built.
452
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
453
+ *
454
+ * @param {WitnessMap} witness_map - A witness map.
455
+ * @returns {Uint8Array} A compressed witness map
460
456
  */
461
- export function buildInfo() {
462
- const ret = wasm.buildInfo();
463
- return ret;
457
+ export function compressWitness(witness_map) {
458
+ const ret = wasm.compressWitness(witness_map);
459
+ if (ret[3]) {
460
+ throw takeFromExternrefTable0(ret[2]);
461
+ }
462
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
463
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
464
+ return v1;
464
465
  }
465
466
 
466
467
  /**
467
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
468
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
469
+ * This should be used to only fetch the witness map for the main function.
468
470
  *
469
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
470
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
471
- * @returns {WitnessMap} A witness map containing the circuit's return values.
472
- * @param {Uint8Array} program
473
- * @param {WitnessMap} witness_map
474
- * @returns {WitnessMap}
471
+ * @param {Uint8Array} compressed_witness - A compressed witness.
472
+ * @returns {WitnessMap} The decompressed witness map.
475
473
  */
476
- export function getReturnWitness(program, witness_map) {
477
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
474
+ export function decompressWitness(compressed_witness) {
475
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
478
476
  const len0 = WASM_VECTOR_LEN;
479
- const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
477
+ const ret = wasm.decompressWitness(ptr0, len0);
480
478
  if (ret[2]) {
481
479
  throw takeFromExternrefTable0(ret[1]);
482
480
  }
@@ -484,55 +482,56 @@ export function getReturnWitness(program, witness_map) {
484
482
  }
485
483
 
486
484
  /**
487
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
485
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
488
486
  *
489
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
490
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
491
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
492
- * @param {Uint8Array} program
493
- * @param {WitnessMap} solved_witness
494
- * @returns {WitnessMap}
487
+ * @param {WitnessStack} witness_stack - A witness stack.
488
+ * @returns {Uint8Array} A compressed witness stack
495
489
  */
496
- export function getPublicParametersWitness(program, solved_witness) {
497
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
498
- const len0 = WASM_VECTOR_LEN;
499
- const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
500
- if (ret[2]) {
501
- throw takeFromExternrefTable0(ret[1]);
490
+ export function compressWitnessStack(witness_stack) {
491
+ const ret = wasm.compressWitnessStack(witness_stack);
492
+ if (ret[3]) {
493
+ throw takeFromExternrefTable0(ret[2]);
502
494
  }
503
- return takeFromExternrefTable0(ret[0]);
495
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
496
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
497
+ return v1;
504
498
  }
505
499
 
506
500
  /**
507
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
501
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
508
502
  *
509
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
510
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
511
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
512
- * @param {Uint8Array} program
513
- * @param {WitnessMap} solved_witness
514
- * @returns {WitnessMap}
503
+ * @param {Uint8Array} compressed_witness - A compressed witness.
504
+ * @returns {WitnessStack} The decompressed witness stack.
515
505
  */
516
- export function getPublicWitness(program, solved_witness) {
517
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
506
+ export function decompressWitnessStack(compressed_witness) {
507
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
518
508
  const len0 = WASM_VECTOR_LEN;
519
- const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
509
+ const ret = wasm.decompressWitnessStack(ptr0, len0);
520
510
  if (ret[2]) {
521
511
  throw takeFromExternrefTable0(ret[1]);
522
512
  }
523
513
  return takeFromExternrefTable0(ret[0]);
524
514
  }
525
515
 
516
+ /**
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.
519
+ */
520
+ export function buildInfo() {
521
+ const ret = wasm.buildInfo();
522
+ return ret;
523
+ }
524
+
526
525
  function __wbg_adapter_30(arg0, arg1, arg2) {
527
- wasm.closure265_externref_shim(arg0, arg1, arg2);
526
+ wasm.closure490_externref_shim(arg0, arg1, arg2);
528
527
  }
529
528
 
530
529
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
531
- wasm.closure826_externref_shim(arg0, arg1, arg2, arg3, arg4);
530
+ wasm.closure996_externref_shim(arg0, arg1, arg2, arg3, arg4);
532
531
  }
533
532
 
534
533
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
535
- wasm.closure830_externref_shim(arg0, arg1, arg2, arg3);
534
+ wasm.closure1000_externref_shim(arg0, arg1, arg2, arg3);
536
535
  }
537
536
 
538
537
  async function __wbg_load(module, imports) {
@@ -581,11 +580,11 @@ function __wbg_get_imports() {
581
580
  const ret = arg0.call(arg1, arg2, arg3);
582
581
  return ret;
583
582
  }, arguments) };
584
- imports.wbg.__wbg_constructor_003f4a4118e07291 = function(arg0) {
583
+ imports.wbg.__wbg_constructor_536364f6bcd4616b = function(arg0) {
585
584
  const ret = new Error(arg0);
586
585
  return ret;
587
586
  };
588
- imports.wbg.__wbg_constructor_c456dcccc52847dd = function(arg0) {
587
+ imports.wbg.__wbg_constructor_66e92e9c3ecae9e8 = function(arg0) {
589
588
  const ret = new Error(arg0);
590
589
  return ret;
591
590
  };
@@ -686,10 +685,6 @@ function __wbg_get_imports() {
686
685
  state0.a = state0.b = 0;
687
686
  }
688
687
  };
689
- imports.wbg.__wbg_new_3f4c5c451d69e970 = function() {
690
- const ret = new Map();
691
- return ret;
692
- };
693
688
  imports.wbg.__wbg_new_5e0be73521bc8c17 = function() {
694
689
  const ret = new Map();
695
690
  return ret;
@@ -702,7 +697,7 @@ function __wbg_get_imports() {
702
697
  const ret = new Error();
703
698
  return ret;
704
699
  };
705
- imports.wbg.__wbg_new_a324c5957dd8b845 = function() {
700
+ imports.wbg.__wbg_new_9f501325818b4158 = function() {
706
701
  const ret = new Array();
707
702
  return ret;
708
703
  };
@@ -710,6 +705,10 @@ function __wbg_get_imports() {
710
705
  const ret = new Error(getStringFromWasm0(arg0, arg1));
711
706
  return ret;
712
707
  };
708
+ imports.wbg.__wbg_new_ec40611a7805f1f0 = function() {
709
+ const ret = new Map();
710
+ return ret;
711
+ };
713
712
  imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
714
713
  const ret = new Function(getStringFromWasm0(arg0, arg1));
715
714
  return ret;
@@ -798,8 +797,8 @@ function __wbg_get_imports() {
798
797
  const ret = false;
799
798
  return ret;
800
799
  };
801
- imports.wbg.__wbindgen_closure_wrapper740 = function(arg0, arg1, arg2) {
802
- const ret = makeMutClosure(arg0, arg1, 266, __wbg_adapter_30);
800
+ imports.wbg.__wbindgen_closure_wrapper1603 = function(arg0, arg1, arg2) {
801
+ const ret = makeMutClosure(arg0, arg1, 491, __wbg_adapter_30);
803
802
  return ret;
804
803
  };
805
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];
4
5
  export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
5
6
  export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
6
7
  export const executeProgram: (a: number, b: number, c: any, d: any) => any;
7
- export const compressWitness: (a: any) => [number, number, number, number];
8
- export const decompressWitness: (a: number, b: number) => [number, number, number];
9
- export const compressWitnessStack: (a: any) => [number, number, number, number];
10
- export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
11
- export const initLogLevel: (a: number, b: number) => [number, number];
8
+ export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
9
+ export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
10
+ export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
12
11
  export const and: (a: any, b: any) => any;
13
12
  export const xor: (a: any, b: any) => any;
14
13
  export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
15
14
  export const blake2s256: (a: number, b: number) => [number, number];
16
15
  export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
17
16
  export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
17
+ export const compressWitness: (a: any) => [number, number, number, number];
18
+ export const decompressWitness: (a: number, b: number) => [number, number, number];
19
+ export const compressWitnessStack: (a: any) => [number, number, number, number];
20
+ export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
18
21
  export const buildInfo: () => any;
19
- export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
20
- export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
21
- export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
22
22
  export const __wbindgen_exn_store: (a: number) => void;
23
23
  export const __externref_table_alloc: () => number;
24
24
  export const __wbindgen_export_2: WebAssembly.Table;
@@ -27,7 +27,7 @@ export const __wbindgen_malloc: (a: number, b: number) => number;
27
27
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
28
28
  export const __wbindgen_export_6: WebAssembly.Table;
29
29
  export const __externref_table_dealloc: (a: number) => void;
30
- export const closure265_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure826_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure830_externref_shim: (a: number, b: number, c: any, d: any) => void;
30
+ export const 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;
33
33
  export const __wbindgen_start: () => void;