@aztec/noir-acvm_js 0.80.0 → 0.82.0

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,34 +1,5 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- /**
4
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
5
- *
6
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
7
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
8
- * @returns {WitnessMap} A witness map containing the circuit's return values.
9
- */
10
- export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
11
- /**
12
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
13
- *
14
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
15
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
16
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
17
- */
18
- export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
19
- /**
20
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
21
- *
22
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
23
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
24
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
25
- */
26
- export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
27
- /**
28
- * Returns the `BuildInfo` object containing information about how the installed package was built.
29
- * @returns {BuildInfo} - Information on how the installed package was built.
30
- */
31
- export function buildInfo(): BuildInfo;
32
3
  /**
33
4
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
34
5
  *
@@ -63,6 +34,30 @@ export function executeProgram(program: Uint8Array, initial_witness: WitnessMap,
63
34
  * @param {LogLevel} level - The maximum level of logging to be emitted.
64
35
  */
65
36
  export function initLogLevel(filter: string): void;
37
+ /**
38
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
39
+ *
40
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
41
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
42
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
43
+ */
44
+ export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
45
+ /**
46
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
47
+ *
48
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
49
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
50
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
51
+ */
52
+ export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
53
+ /**
54
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
55
+ *
56
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
57
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
58
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
59
+ */
60
+ export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
66
61
  /**
67
62
  * Performs a bitwise AND operation between `lhs` and `rhs`
68
63
  */
@@ -87,6 +82,11 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
87
82
  * Verifies a ECDSA signature over the secp256r1 curve.
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;
85
+ /**
86
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
87
+ * @returns {BuildInfo} - Information on how the installed package was built.
88
+ */
89
+ export function buildInfo(): BuildInfo;
90
90
  /**
91
91
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
92
92
  *
@@ -117,20 +117,6 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
117
117
  */
118
118
  export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
119
119
 
120
- /**
121
- * @typedef {Object} BuildInfo - Information about how the installed package was built
122
- * @property {string} gitHash - The hash of the git commit from which the package was built.
123
- * @property {string} version - The version of the package at the built git commit.
124
- * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
125
- */
126
- export type BuildInfo = {
127
- gitHash: string;
128
- version: string;
129
- dirty: string;
130
- }
131
-
132
-
133
-
134
120
  export type RawAssertionPayload = {
135
121
  selector: string;
136
122
  data: string[];
@@ -168,6 +154,20 @@ export type WitnessStack = Array<StackItem>;
168
154
 
169
155
 
170
156
 
157
+ /**
158
+ * @typedef {Object} BuildInfo - Information about how the installed package was built
159
+ * @property {string} gitHash - The hash of the git commit from which the package was built.
160
+ * @property {string} version - The version of the package at the built git commit.
161
+ * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
162
+ */
163
+ export type BuildInfo = {
164
+ gitHash: string;
165
+ version: string;
166
+ dirty: string;
167
+ }
168
+
169
+
170
+
171
171
  export type ForeignCallInput = string[]
172
172
  export type ForeignCallOutput = string | string[]
173
173
 
package/nodejs/acvm_js.js CHANGED
@@ -208,12 +208,71 @@ function passArray8ToWasm0(arg, malloc) {
208
208
  WASM_VECTOR_LEN = arg.length;
209
209
  return ptr;
210
210
  }
211
+ /**
212
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
213
+ *
214
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
215
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
216
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
217
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
218
+ */
219
+ module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
220
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
221
+ const len0 = WASM_VECTOR_LEN;
222
+ const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
223
+ return ret;
224
+ };
225
+
226
+ /**
227
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
228
+ * This method also extracts the public return values from the solved witness into its own return witness.
229
+ *
230
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
231
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
232
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
233
+ * @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
234
+ */
235
+ module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
236
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
237
+ const len0 = WASM_VECTOR_LEN;
238
+ const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
239
+ return ret;
240
+ };
241
+
242
+ /**
243
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
244
+ *
245
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
246
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
247
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
248
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
249
+ */
250
+ module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
251
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
252
+ const len0 = WASM_VECTOR_LEN;
253
+ const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
254
+ return ret;
255
+ };
211
256
 
212
257
  function takeFromExternrefTable0(idx) {
213
258
  const value = wasm.__wbindgen_export_2.get(idx);
214
259
  wasm.__externref_table_dealloc(idx);
215
260
  return value;
216
261
  }
262
+ /**
263
+ * Sets the package's logging level.
264
+ *
265
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
266
+ */
267
+ module.exports.initLogLevel = function(filter) {
268
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
269
+ const len0 = WASM_VECTOR_LEN;
270
+ const ret = wasm.initLogLevel(ptr0, len0);
271
+ if (ret[1]) {
272
+ throw takeFromExternrefTable0(ret[0]);
273
+ }
274
+ };
275
+
217
276
  /**
218
277
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
219
278
  *
@@ -274,75 +333,6 @@ module.exports.getPublicWitness = function(program, solved_witness) {
274
333
  return takeFromExternrefTable0(ret[0]);
275
334
  };
276
335
 
277
- /**
278
- * Returns the `BuildInfo` object containing information about how the installed package was built.
279
- * @returns {BuildInfo} - Information on how the installed package was built.
280
- */
281
- module.exports.buildInfo = function() {
282
- const ret = wasm.buildInfo();
283
- return ret;
284
- };
285
-
286
- /**
287
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
288
- *
289
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
290
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
291
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
292
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
293
- */
294
- module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
295
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
296
- const len0 = WASM_VECTOR_LEN;
297
- const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
298
- return ret;
299
- };
300
-
301
- /**
302
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
303
- * This method also extracts the public return values from the solved witness into its own return witness.
304
- *
305
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
306
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
307
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
308
- * @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.
309
- */
310
- module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
311
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
312
- const len0 = WASM_VECTOR_LEN;
313
- const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
314
- return ret;
315
- };
316
-
317
- /**
318
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
319
- *
320
- * @param {Uint8Array} program - A serialized representation of an ACIR program
321
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
322
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
323
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
324
- */
325
- module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
326
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
327
- const len0 = WASM_VECTOR_LEN;
328
- const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
329
- return ret;
330
- };
331
-
332
- /**
333
- * Sets the package's logging level.
334
- *
335
- * @param {LogLevel} level - The maximum level of logging to be emitted.
336
- */
337
- module.exports.initLogLevel = function(filter) {
338
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
339
- const len0 = WASM_VECTOR_LEN;
340
- const ret = wasm.initLogLevel(ptr0, len0);
341
- if (ret[1]) {
342
- throw takeFromExternrefTable0(ret[0]);
343
- }
344
- };
345
-
346
336
  /**
347
337
  * Performs a bitwise AND operation between `lhs` and `rhs`
348
338
  * @param {string} lhs
@@ -462,6 +452,15 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
462
452
  return ret !== 0;
463
453
  };
464
454
 
455
+ /**
456
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
457
+ * @returns {BuildInfo} - Information on how the installed package was built.
458
+ */
459
+ module.exports.buildInfo = function() {
460
+ const ret = wasm.buildInfo();
461
+ return ret;
462
+ };
463
+
465
464
  /**
466
465
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
467
466
  *
@@ -528,15 +527,15 @@ module.exports.decompressWitnessStack = function(compressed_witness) {
528
527
  };
529
528
 
530
529
  function __wbg_adapter_30(arg0, arg1, arg2) {
531
- wasm.closure249_externref_shim(arg0, arg1, arg2);
530
+ wasm.closure248_externref_shim(arg0, arg1, arg2);
532
531
  }
533
532
 
534
533
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
535
- wasm.closure810_externref_shim(arg0, arg1, arg2, arg3, arg4);
534
+ wasm.closure809_externref_shim(arg0, arg1, arg2, arg3, arg4);
536
535
  }
537
536
 
538
537
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
539
- wasm.closure814_externref_shim(arg0, arg1, arg2, arg3);
538
+ wasm.closure813_externref_shim(arg0, arg1, arg2, arg3);
540
539
  }
541
540
 
542
541
  module.exports.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
@@ -814,8 +813,8 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
814
813
  return ret;
815
814
  };
816
815
 
817
- module.exports.__wbindgen_closure_wrapper725 = function(arg0, arg1, arg2) {
818
- const ret = makeMutClosure(arg0, arg1, 250, __wbg_adapter_30);
816
+ module.exports.__wbindgen_closure_wrapper724 = function(arg0, arg1, arg2) {
817
+ const ret = makeMutClosure(arg0, arg1, 249, __wbg_adapter_30);
819
818
  return ret;
820
819
  };
821
820
 
Binary file
@@ -1,20 +1,20 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
5
- export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
6
- export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
7
- export const buildInfo: () => any;
8
4
  export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
9
5
  export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
10
6
  export const executeProgram: (a: number, b: number, c: any, d: any) => any;
11
7
  export const initLogLevel: (a: number, b: number) => [number, number];
8
+ export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
9
+ export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
10
+ export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
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 buildInfo: () => any;
18
18
  export const compressWitness: (a: any) => [number, number, number, number];
19
19
  export const decompressWitness: (a: number, b: number) => [number, number, number];
20
20
  export const compressWitnessStack: (a: any) => [number, number, number, number];
@@ -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 closure249_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure810_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure814_externref_shim: (a: number, b: number, c: any, d: any) => void;
30
+ export const closure248_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure809_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure813_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.80.0",
3
+ "version": "0.82.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -26,12 +26,12 @@
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"
@@ -42,11 +42,11 @@
42
42
  "@web/test-runner": "^0.18.1",
43
43
  "@web/test-runner-playwright": "^0.11.0",
44
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",
45
+ "eslint": "^9.22.0",
46
+ "eslint-plugin-prettier": "^5.2.3",
47
+ "mocha": "^11.1.0",
48
+ "prettier": "3.5.3",
49
49
  "ts-node": "^10.9.1",
50
- "typescript": "^5.4.2"
50
+ "typescript": "^5.8.2"
51
51
  }
52
52
  }
package/web/acvm_js.d.ts CHANGED
@@ -1,34 +1,5 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- /**
4
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
5
- *
6
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
7
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
8
- * @returns {WitnessMap} A witness map containing the circuit's return values.
9
- */
10
- export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
11
- /**
12
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
13
- *
14
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
15
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
16
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
17
- */
18
- export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
19
- /**
20
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
21
- *
22
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
23
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
24
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
25
- */
26
- export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
27
- /**
28
- * Returns the `BuildInfo` object containing information about how the installed package was built.
29
- * @returns {BuildInfo} - Information on how the installed package was built.
30
- */
31
- export function buildInfo(): BuildInfo;
32
3
  /**
33
4
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
34
5
  *
@@ -63,6 +34,30 @@ export function executeProgram(program: Uint8Array, initial_witness: WitnessMap,
63
34
  * @param {LogLevel} level - The maximum level of logging to be emitted.
64
35
  */
65
36
  export function initLogLevel(filter: string): void;
37
+ /**
38
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
39
+ *
40
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
41
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
42
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
43
+ */
44
+ export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
45
+ /**
46
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
47
+ *
48
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
49
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
50
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
51
+ */
52
+ export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
53
+ /**
54
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
55
+ *
56
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
57
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
58
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
59
+ */
60
+ export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
66
61
  /**
67
62
  * Performs a bitwise AND operation between `lhs` and `rhs`
68
63
  */
@@ -87,6 +82,11 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
87
82
  * Verifies a ECDSA signature over the secp256r1 curve.
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;
85
+ /**
86
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
87
+ * @returns {BuildInfo} - Information on how the installed package was built.
88
+ */
89
+ export function buildInfo(): BuildInfo;
90
90
  /**
91
91
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
92
92
  *
@@ -117,20 +117,6 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
117
117
  */
118
118
  export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
119
119
 
120
- /**
121
- * @typedef {Object} BuildInfo - Information about how the installed package was built
122
- * @property {string} gitHash - The hash of the git commit from which the package was built.
123
- * @property {string} version - The version of the package at the built git commit.
124
- * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
125
- */
126
- export type BuildInfo = {
127
- gitHash: string;
128
- version: string;
129
- dirty: string;
130
- }
131
-
132
-
133
-
134
120
  export type RawAssertionPayload = {
135
121
  selector: string;
136
122
  data: string[];
@@ -168,6 +154,20 @@ export type WitnessStack = Array<StackItem>;
168
154
 
169
155
 
170
156
 
157
+ /**
158
+ * @typedef {Object} BuildInfo - Information about how the installed package was built
159
+ * @property {string} gitHash - The hash of the git commit from which the package was built.
160
+ * @property {string} version - The version of the package at the built git commit.
161
+ * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
162
+ */
163
+ export type BuildInfo = {
164
+ gitHash: string;
165
+ version: string;
166
+ dirty: string;
167
+ }
168
+
169
+
170
+
171
171
  export type ForeignCallInput = string[]
172
172
  export type ForeignCallOutput = string | string[]
173
173
 
@@ -186,20 +186,20 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
186
186
 
187
187
  export interface InitOutput {
188
188
  readonly memory: WebAssembly.Memory;
189
- readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
190
- readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
191
- readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
192
- readonly buildInfo: () => any;
193
189
  readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
194
190
  readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
195
191
  readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
196
192
  readonly initLogLevel: (a: number, b: number) => [number, number];
193
+ readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
194
+ readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
195
+ readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
197
196
  readonly and: (a: any, b: any) => any;
198
197
  readonly xor: (a: any, b: any) => any;
199
198
  readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
200
199
  readonly blake2s256: (a: number, b: number) => [number, number];
201
200
  readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
202
201
  readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
202
+ readonly buildInfo: () => any;
203
203
  readonly compressWitness: (a: any) => [number, number, number, number];
204
204
  readonly decompressWitness: (a: number, b: number) => [number, number, number];
205
205
  readonly compressWitnessStack: (a: any) => [number, number, number, number];
@@ -212,9 +212,9 @@ export interface InitOutput {
212
212
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
213
213
  readonly __wbindgen_export_6: WebAssembly.Table;
214
214
  readonly __externref_table_dealloc: (a: number) => void;
215
- readonly closure249_externref_shim: (a: number, b: number, c: any) => void;
216
- readonly closure810_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
217
- readonly closure814_externref_shim: (a: number, b: number, c: any, d: any) => void;
215
+ readonly closure248_externref_shim: (a: number, b: number, c: any) => void;
216
+ readonly closure809_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
217
+ readonly closure813_externref_shim: (a: number, b: number, c: any, d: any) => void;
218
218
  readonly __wbindgen_start: () => void;
219
219
  }
220
220
 
package/web/acvm_js.js CHANGED
@@ -204,12 +204,71 @@ function passArray8ToWasm0(arg, malloc) {
204
204
  WASM_VECTOR_LEN = arg.length;
205
205
  return ptr;
206
206
  }
207
+ /**
208
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
209
+ *
210
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
211
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
212
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
213
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
214
+ */
215
+ export function executeCircuit(program, initial_witness, foreign_call_handler) {
216
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
217
+ const len0 = WASM_VECTOR_LEN;
218
+ const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
219
+ return ret;
220
+ }
221
+
222
+ /**
223
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
224
+ * This method also extracts the public return values from the solved witness into its own return witness.
225
+ *
226
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
227
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
228
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
229
+ * @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
230
+ */
231
+ export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
232
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
233
+ const len0 = WASM_VECTOR_LEN;
234
+ const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
235
+ return ret;
236
+ }
237
+
238
+ /**
239
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
240
+ *
241
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
242
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
243
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
244
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
245
+ */
246
+ export function executeProgram(program, initial_witness, foreign_call_handler) {
247
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
248
+ const len0 = WASM_VECTOR_LEN;
249
+ const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
250
+ return ret;
251
+ }
207
252
 
208
253
  function takeFromExternrefTable0(idx) {
209
254
  const value = wasm.__wbindgen_export_2.get(idx);
210
255
  wasm.__externref_table_dealloc(idx);
211
256
  return value;
212
257
  }
258
+ /**
259
+ * Sets the package's logging level.
260
+ *
261
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
262
+ */
263
+ export function initLogLevel(filter) {
264
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
265
+ const len0 = WASM_VECTOR_LEN;
266
+ const ret = wasm.initLogLevel(ptr0, len0);
267
+ if (ret[1]) {
268
+ throw takeFromExternrefTable0(ret[0]);
269
+ }
270
+ }
271
+
213
272
  /**
214
273
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
215
274
  *
@@ -270,75 +329,6 @@ export function getPublicWitness(program, solved_witness) {
270
329
  return takeFromExternrefTable0(ret[0]);
271
330
  }
272
331
 
273
- /**
274
- * Returns the `BuildInfo` object containing information about how the installed package was built.
275
- * @returns {BuildInfo} - Information on how the installed package was built.
276
- */
277
- export function buildInfo() {
278
- const ret = wasm.buildInfo();
279
- return ret;
280
- }
281
-
282
- /**
283
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
284
- *
285
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
286
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
287
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
288
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
289
- */
290
- export function executeCircuit(program, initial_witness, foreign_call_handler) {
291
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
292
- const len0 = WASM_VECTOR_LEN;
293
- const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
294
- return ret;
295
- }
296
-
297
- /**
298
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
299
- * This method also extracts the public return values from the solved witness into its own return witness.
300
- *
301
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
302
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
303
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
304
- * @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.
305
- */
306
- export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
307
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
308
- const len0 = WASM_VECTOR_LEN;
309
- const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
310
- return ret;
311
- }
312
-
313
- /**
314
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
315
- *
316
- * @param {Uint8Array} program - A serialized representation of an ACIR program
317
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
318
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
319
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
320
- */
321
- export function executeProgram(program, initial_witness, foreign_call_handler) {
322
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
323
- const len0 = WASM_VECTOR_LEN;
324
- const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
325
- return ret;
326
- }
327
-
328
- /**
329
- * Sets the package's logging level.
330
- *
331
- * @param {LogLevel} level - The maximum level of logging to be emitted.
332
- */
333
- export function initLogLevel(filter) {
334
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
335
- const len0 = WASM_VECTOR_LEN;
336
- const ret = wasm.initLogLevel(ptr0, len0);
337
- if (ret[1]) {
338
- throw takeFromExternrefTable0(ret[0]);
339
- }
340
- }
341
-
342
332
  /**
343
333
  * Performs a bitwise AND operation between `lhs` and `rhs`
344
334
  * @param {string} lhs
@@ -458,6 +448,15 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
458
448
  return ret !== 0;
459
449
  }
460
450
 
451
+ /**
452
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
453
+ * @returns {BuildInfo} - Information on how the installed package was built.
454
+ */
455
+ export function buildInfo() {
456
+ const ret = wasm.buildInfo();
457
+ return ret;
458
+ }
459
+
461
460
  /**
462
461
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
463
462
  *
@@ -524,15 +523,15 @@ export function decompressWitnessStack(compressed_witness) {
524
523
  }
525
524
 
526
525
  function __wbg_adapter_30(arg0, arg1, arg2) {
527
- wasm.closure249_externref_shim(arg0, arg1, arg2);
526
+ wasm.closure248_externref_shim(arg0, arg1, arg2);
528
527
  }
529
528
 
530
529
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
531
- wasm.closure810_externref_shim(arg0, arg1, arg2, arg3, arg4);
530
+ wasm.closure809_externref_shim(arg0, arg1, arg2, arg3, arg4);
532
531
  }
533
532
 
534
533
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
535
- wasm.closure814_externref_shim(arg0, arg1, arg2, arg3);
534
+ wasm.closure813_externref_shim(arg0, arg1, arg2, arg3);
536
535
  }
537
536
 
538
537
  async function __wbg_load(module, imports) {
@@ -798,8 +797,8 @@ function __wbg_get_imports() {
798
797
  const ret = false;
799
798
  return ret;
800
799
  };
801
- imports.wbg.__wbindgen_closure_wrapper725 = function(arg0, arg1, arg2) {
802
- const ret = makeMutClosure(arg0, arg1, 250, __wbg_adapter_30);
800
+ imports.wbg.__wbindgen_closure_wrapper724 = function(arg0, arg1, arg2) {
801
+ const ret = makeMutClosure(arg0, arg1, 249, __wbg_adapter_30);
803
802
  return ret;
804
803
  };
805
804
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
Binary file
@@ -1,20 +1,20 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
5
- export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
6
- export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
7
- export const buildInfo: () => any;
8
4
  export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
9
5
  export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
10
6
  export const executeProgram: (a: number, b: number, c: any, d: any) => any;
11
7
  export const initLogLevel: (a: number, b: number) => [number, number];
8
+ export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
9
+ export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
10
+ export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
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 buildInfo: () => any;
18
18
  export const compressWitness: (a: any) => [number, number, number, number];
19
19
  export const decompressWitness: (a: number, b: number) => [number, number, number];
20
20
  export const compressWitnessStack: (a: any) => [number, number, number, number];
@@ -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 closure249_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure810_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure814_externref_shim: (a: number, b: number, c: any, d: any) => void;
30
+ export const closure248_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure809_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure813_externref_shim: (a: number, b: number, c: any, d: any) => void;
33
33
  export const __wbindgen_start: () => void;