@noir-lang/acvm_js 1.0.0-beta.3-1fa0dd9.nightly → 1.0.0-beta.4-17958e3.nightly

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,29 +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
3
  /**
28
4
  * Returns the `BuildInfo` object containing information about how the installed package was built.
29
5
  * @returns {BuildInfo} - Information on how the installed package was built.
@@ -58,11 +34,29 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
58
34
  */
59
35
  export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
60
36
  /**
61
- * Sets the package's logging level.
37
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
62
38
  *
63
- * @param {LogLevel} level - The maximum level of logging to be emitted.
39
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
40
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
41
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
64
42
  */
65
- export function initLogLevel(filter: string): void;
43
+ export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
44
+ /**
45
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
46
+ *
47
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
48
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
49
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
50
+ */
51
+ export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
52
+ /**
53
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
54
+ *
55
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
56
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
57
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
58
+ */
59
+ export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
66
60
  /**
67
61
  * Performs a bitwise AND operation between `lhs` and `rhs`
68
62
  */
@@ -116,6 +110,12 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
116
110
  * @returns {WitnessStack} The decompressed witness stack.
117
111
  */
118
112
  export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
113
+ /**
114
+ * Sets the package's logging level.
115
+ *
116
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
117
+ */
118
+ export function initLogLevel(filter: string): void;
119
119
 
120
120
  /**
121
121
  * @typedef {Object} BuildInfo - Information about how the installed package was built
@@ -139,23 +139,23 @@ export type RawAssertionPayload = {
139
139
  export type ExecutionError = Error & {
140
140
  callStack?: string[];
141
141
  rawAssertionPayload?: RawAssertionPayload;
142
+ acirFunctionId?: number;
142
143
  brilligFunctionId?: number;
143
144
  };
144
145
 
145
146
 
146
147
 
147
- // Map from witness index to hex string value of witness.
148
- export type WitnessMap = Map<number, string>;
148
+ export type ForeignCallInput = string[]
149
+ export type ForeignCallOutput = string | string[]
149
150
 
150
151
  /**
151
- * An execution result containing two witnesses.
152
- * 1. The full solved witness of the execution.
153
- * 2. The return witness which contains the given public return values within the full witness.
154
- */
155
- export type SolvedAndReturnWitness = {
156
- solvedWitness: WitnessMap;
157
- returnWitness: WitnessMap;
158
- }
152
+ * A callback which performs an foreign call and returns the response.
153
+ * @callback ForeignCallHandler
154
+ * @param {string} name - The identifier for the type of foreign call being performed.
155
+ * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
156
+ * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
157
+ */
158
+ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
159
159
 
160
160
 
161
161
 
@@ -168,16 +168,17 @@ export type WitnessStack = Array<StackItem>;
168
168
 
169
169
 
170
170
 
171
- export type ForeignCallInput = string[]
172
- export type ForeignCallOutput = string | string[]
171
+ // Map from witness index to hex string value of witness.
172
+ export type WitnessMap = Map<number, string>;
173
173
 
174
174
  /**
175
- * A callback which performs an foreign call and returns the response.
176
- * @callback ForeignCallHandler
177
- * @param {string} name - The identifier for the type of foreign call being performed.
178
- * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
179
- * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
180
- */
181
- export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
175
+ * An execution result containing two witnesses.
176
+ * 1. The full solved witness of the execution.
177
+ * 2. The return witness which contains the given public return values within the full witness.
178
+ */
179
+ export type SolvedAndReturnWitness = {
180
+ solvedWitness: WitnessMap;
181
+ returnWitness: WitnessMap;
182
+ }
182
183
 
183
184
 
package/nodejs/acvm_js.js CHANGED
@@ -201,6 +201,14 @@ function debugString(val) {
201
201
  // TODO we could test for more things here, like `Set`s and `Map`s.
202
202
  return className;
203
203
  }
204
+ /**
205
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
206
+ * @returns {BuildInfo} - Information on how the installed package was built.
207
+ */
208
+ module.exports.buildInfo = function() {
209
+ const ret = wasm.buildInfo();
210
+ return ret;
211
+ };
204
212
 
205
213
  function passArray8ToWasm0(arg, malloc) {
206
214
  const ptr = malloc(arg.length * 1, 1) >>> 0;
@@ -208,6 +216,51 @@ function passArray8ToWasm0(arg, malloc) {
208
216
  WASM_VECTOR_LEN = arg.length;
209
217
  return ptr;
210
218
  }
219
+ /**
220
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
221
+ *
222
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
223
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
224
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
225
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
226
+ */
227
+ module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
228
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
229
+ const len0 = WASM_VECTOR_LEN;
230
+ const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
231
+ return ret;
232
+ };
233
+
234
+ /**
235
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
236
+ * This method also extracts the public return values from the solved witness into its own return witness.
237
+ *
238
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
239
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
240
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
241
+ * @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.
242
+ */
243
+ module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
244
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
245
+ const len0 = WASM_VECTOR_LEN;
246
+ const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
247
+ return ret;
248
+ };
249
+
250
+ /**
251
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
252
+ *
253
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
254
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
255
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
256
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
257
+ */
258
+ module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
259
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
260
+ const len0 = WASM_VECTOR_LEN;
261
+ const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
262
+ return ret;
263
+ };
211
264
 
212
265
  function takeFromExternrefTable0(idx) {
213
266
  const value = wasm.__wbindgen_export_2.get(idx);
@@ -274,75 +327,6 @@ module.exports.getPublicWitness = function(program, solved_witness) {
274
327
  return takeFromExternrefTable0(ret[0]);
275
328
  };
276
329
 
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
330
  /**
347
331
  * Performs a bitwise AND operation between `lhs` and `rhs`
348
332
  * @param {string} lhs
@@ -527,16 +511,30 @@ module.exports.decompressWitnessStack = function(compressed_witness) {
527
511
  return takeFromExternrefTable0(ret[0]);
528
512
  };
529
513
 
514
+ /**
515
+ * Sets the package's logging level.
516
+ *
517
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
518
+ */
519
+ module.exports.initLogLevel = function(filter) {
520
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
521
+ const len0 = WASM_VECTOR_LEN;
522
+ const ret = wasm.initLogLevel(ptr0, len0);
523
+ if (ret[1]) {
524
+ throw takeFromExternrefTable0(ret[0]);
525
+ }
526
+ };
527
+
530
528
  function __wbg_adapter_30(arg0, arg1, arg2) {
531
- wasm.closure249_externref_shim(arg0, arg1, arg2);
529
+ wasm.closure255_externref_shim(arg0, arg1, arg2);
532
530
  }
533
531
 
534
532
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
535
- wasm.closure810_externref_shim(arg0, arg1, arg2, arg3, arg4);
533
+ wasm.closure816_externref_shim(arg0, arg1, arg2, arg3, arg4);
536
534
  }
537
535
 
538
536
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
539
- wasm.closure814_externref_shim(arg0, arg1, arg2, arg3);
537
+ wasm.closure820_externref_shim(arg0, arg1, arg2, arg3);
540
538
  }
541
539
 
542
540
  module.exports.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
@@ -554,12 +552,12 @@ module.exports.__wbg_call_833bed5770ea2041 = function() { return handleError(fun
554
552
  return ret;
555
553
  }, arguments) };
556
554
 
557
- module.exports.__wbg_constructor_003f4a4118e07291 = function(arg0) {
555
+ module.exports.__wbg_constructor_6f67fe370a1d12e4 = function(arg0) {
558
556
  const ret = new Error(arg0);
559
557
  return ret;
560
558
  };
561
559
 
562
- module.exports.__wbg_constructor_c456dcccc52847dd = function(arg0) {
560
+ module.exports.__wbg_constructor_e1ce7ec5d0c26936 = function(arg0) {
563
561
  const ret = new Error(arg0);
564
562
  return ret;
565
563
  };
@@ -675,11 +673,6 @@ module.exports.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
675
673
  }
676
674
  };
677
675
 
678
- module.exports.__wbg_new_3f4c5c451d69e970 = function() {
679
- const ret = new Map();
680
- return ret;
681
- };
682
-
683
676
  module.exports.__wbg_new_5e0be73521bc8c17 = function() {
684
677
  const ret = new Map();
685
678
  return ret;
@@ -695,11 +688,16 @@ module.exports.__wbg_new_8a6f238a6ece86ea = function() {
695
688
  return ret;
696
689
  };
697
690
 
698
- module.exports.__wbg_new_a324c5957dd8b845 = function() {
691
+ module.exports.__wbg_new_afcb88b732711926 = function() {
699
692
  const ret = new Array();
700
693
  return ret;
701
694
  };
702
695
 
696
+ module.exports.__wbg_new_c4d92c865672cdba = function() {
697
+ const ret = new Map();
698
+ return ret;
699
+ };
700
+
703
701
  module.exports.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
704
702
  const ret = new Error(getStringFromWasm0(arg0, arg1));
705
703
  return ret;
@@ -814,8 +812,8 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
814
812
  return ret;
815
813
  };
816
814
 
817
- module.exports.__wbindgen_closure_wrapper725 = function(arg0, arg1, arg2) {
818
- const ret = makeMutClosure(arg0, arg1, 250, __wbg_adapter_30);
815
+ module.exports.__wbindgen_closure_wrapper739 = function(arg0, arg1, arg2) {
816
+ const ret = makeMutClosure(arg0, arg1, 256, __wbg_adapter_30);
819
817
  return ret;
820
818
  };
821
819
 
Binary file
@@ -1,14 +1,13 @@
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
4
  export const buildInfo: () => any;
8
5
  export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
9
6
  export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
10
7
  export const executeProgram: (a: number, b: number, c: any, d: any) => any;
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];
@@ -19,6 +18,7 @@ export const compressWitness: (a: any) => [number, number, number, number];
19
18
  export const decompressWitness: (a: number, b: number) => [number, number, number];
20
19
  export const compressWitnessStack: (a: any) => [number, number, number, number];
21
20
  export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
21
+ export const initLogLevel: (a: number, b: 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 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 closure255_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure816_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure820_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": "@noir-lang/acvm_js",
3
- "version": "1.0.0-beta.3-1fa0dd9.nightly",
3
+ "version": "1.0.0-beta.4-17958e3.nightly",
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",
49
- "ts-node": "^10.9.1",
50
- "typescript": "^5.4.2"
45
+ "eslint": "^9.24.0",
46
+ "eslint-plugin-prettier": "^5.2.6",
47
+ "mocha": "^11.1.0",
48
+ "prettier": "3.5.3",
49
+ "ts-node": "^10.9.2",
50
+ "typescript": "^5.8.3"
51
51
  }
52
52
  }
package/web/acvm_js.d.ts CHANGED
@@ -1,29 +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
3
  /**
28
4
  * Returns the `BuildInfo` object containing information about how the installed package was built.
29
5
  * @returns {BuildInfo} - Information on how the installed package was built.
@@ -58,11 +34,29 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
58
34
  */
59
35
  export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
60
36
  /**
61
- * Sets the package's logging level.
37
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
62
38
  *
63
- * @param {LogLevel} level - The maximum level of logging to be emitted.
39
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
40
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
41
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
64
42
  */
65
- export function initLogLevel(filter: string): void;
43
+ export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
44
+ /**
45
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
46
+ *
47
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
48
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
49
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
50
+ */
51
+ export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
52
+ /**
53
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
54
+ *
55
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
56
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
57
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
58
+ */
59
+ export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
66
60
  /**
67
61
  * Performs a bitwise AND operation between `lhs` and `rhs`
68
62
  */
@@ -116,6 +110,12 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
116
110
  * @returns {WitnessStack} The decompressed witness stack.
117
111
  */
118
112
  export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
113
+ /**
114
+ * Sets the package's logging level.
115
+ *
116
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
117
+ */
118
+ export function initLogLevel(filter: string): void;
119
119
 
120
120
  /**
121
121
  * @typedef {Object} BuildInfo - Information about how the installed package was built
@@ -139,23 +139,23 @@ export type RawAssertionPayload = {
139
139
  export type ExecutionError = Error & {
140
140
  callStack?: string[];
141
141
  rawAssertionPayload?: RawAssertionPayload;
142
+ acirFunctionId?: number;
142
143
  brilligFunctionId?: number;
143
144
  };
144
145
 
145
146
 
146
147
 
147
- // Map from witness index to hex string value of witness.
148
- export type WitnessMap = Map<number, string>;
148
+ export type ForeignCallInput = string[]
149
+ export type ForeignCallOutput = string | string[]
149
150
 
150
151
  /**
151
- * An execution result containing two witnesses.
152
- * 1. The full solved witness of the execution.
153
- * 2. The return witness which contains the given public return values within the full witness.
154
- */
155
- export type SolvedAndReturnWitness = {
156
- solvedWitness: WitnessMap;
157
- returnWitness: WitnessMap;
158
- }
152
+ * A callback which performs an foreign call and returns the response.
153
+ * @callback ForeignCallHandler
154
+ * @param {string} name - The identifier for the type of foreign call being performed.
155
+ * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
156
+ * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
157
+ */
158
+ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
159
159
 
160
160
 
161
161
 
@@ -168,17 +168,18 @@ export type WitnessStack = Array<StackItem>;
168
168
 
169
169
 
170
170
 
171
- export type ForeignCallInput = string[]
172
- export type ForeignCallOutput = string | string[]
171
+ // Map from witness index to hex string value of witness.
172
+ export type WitnessMap = Map<number, string>;
173
173
 
174
174
  /**
175
- * A callback which performs an foreign call and returns the response.
176
- * @callback ForeignCallHandler
177
- * @param {string} name - The identifier for the type of foreign call being performed.
178
- * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
179
- * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
180
- */
181
- export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
175
+ * An execution result containing two witnesses.
176
+ * 1. The full solved witness of the execution.
177
+ * 2. The return witness which contains the given public return values within the full witness.
178
+ */
179
+ export type SolvedAndReturnWitness = {
180
+ solvedWitness: WitnessMap;
181
+ returnWitness: WitnessMap;
182
+ }
182
183
 
183
184
 
184
185
 
@@ -186,14 +187,13 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
186
187
 
187
188
  export interface InitOutput {
188
189
  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
190
  readonly buildInfo: () => any;
193
191
  readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
194
192
  readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
195
193
  readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
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];
@@ -204,6 +204,7 @@ export interface InitOutput {
204
204
  readonly decompressWitness: (a: number, b: number) => [number, number, number];
205
205
  readonly compressWitnessStack: (a: any) => [number, number, number, number];
206
206
  readonly decompressWitnessStack: (a: number, b: number) => [number, number, number];
207
+ readonly initLogLevel: (a: number, b: 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 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;
216
+ readonly closure255_externref_shim: (a: number, b: number, c: any) => void;
217
+ readonly closure816_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
218
+ readonly closure820_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
@@ -197,6 +197,14 @@ function debugString(val) {
197
197
  // TODO we could test for more things here, like `Set`s and `Map`s.
198
198
  return className;
199
199
  }
200
+ /**
201
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
202
+ * @returns {BuildInfo} - Information on how the installed package was built.
203
+ */
204
+ export function buildInfo() {
205
+ const ret = wasm.buildInfo();
206
+ return ret;
207
+ }
200
208
 
201
209
  function passArray8ToWasm0(arg, malloc) {
202
210
  const ptr = malloc(arg.length * 1, 1) >>> 0;
@@ -204,6 +212,51 @@ function passArray8ToWasm0(arg, malloc) {
204
212
  WASM_VECTOR_LEN = arg.length;
205
213
  return ptr;
206
214
  }
215
+ /**
216
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
217
+ *
218
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
219
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
220
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
221
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
222
+ */
223
+ export function executeCircuit(program, initial_witness, foreign_call_handler) {
224
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
225
+ const len0 = WASM_VECTOR_LEN;
226
+ const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
227
+ return ret;
228
+ }
229
+
230
+ /**
231
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
232
+ * This method also extracts the public return values from the solved witness into its own return witness.
233
+ *
234
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
235
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
236
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
237
+ * @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.
238
+ */
239
+ export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
240
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
241
+ const len0 = WASM_VECTOR_LEN;
242
+ const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
243
+ return ret;
244
+ }
245
+
246
+ /**
247
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
248
+ *
249
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
250
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
251
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
252
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
253
+ */
254
+ export function executeProgram(program, initial_witness, foreign_call_handler) {
255
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
256
+ const len0 = WASM_VECTOR_LEN;
257
+ const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
258
+ return ret;
259
+ }
207
260
 
208
261
  function takeFromExternrefTable0(idx) {
209
262
  const value = wasm.__wbindgen_export_2.get(idx);
@@ -270,75 +323,6 @@ export function getPublicWitness(program, solved_witness) {
270
323
  return takeFromExternrefTable0(ret[0]);
271
324
  }
272
325
 
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
326
  /**
343
327
  * Performs a bitwise AND operation between `lhs` and `rhs`
344
328
  * @param {string} lhs
@@ -523,16 +507,30 @@ export function decompressWitnessStack(compressed_witness) {
523
507
  return takeFromExternrefTable0(ret[0]);
524
508
  }
525
509
 
510
+ /**
511
+ * Sets the package's logging level.
512
+ *
513
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
514
+ */
515
+ export function initLogLevel(filter) {
516
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
517
+ const len0 = WASM_VECTOR_LEN;
518
+ const ret = wasm.initLogLevel(ptr0, len0);
519
+ if (ret[1]) {
520
+ throw takeFromExternrefTable0(ret[0]);
521
+ }
522
+ }
523
+
526
524
  function __wbg_adapter_30(arg0, arg1, arg2) {
527
- wasm.closure249_externref_shim(arg0, arg1, arg2);
525
+ wasm.closure255_externref_shim(arg0, arg1, arg2);
528
526
  }
529
527
 
530
528
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
531
- wasm.closure810_externref_shim(arg0, arg1, arg2, arg3, arg4);
529
+ wasm.closure816_externref_shim(arg0, arg1, arg2, arg3, arg4);
532
530
  }
533
531
 
534
532
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
535
- wasm.closure814_externref_shim(arg0, arg1, arg2, arg3);
533
+ wasm.closure820_externref_shim(arg0, arg1, arg2, arg3);
536
534
  }
537
535
 
538
536
  async function __wbg_load(module, imports) {
@@ -581,11 +579,11 @@ function __wbg_get_imports() {
581
579
  const ret = arg0.call(arg1, arg2, arg3);
582
580
  return ret;
583
581
  }, arguments) };
584
- imports.wbg.__wbg_constructor_003f4a4118e07291 = function(arg0) {
582
+ imports.wbg.__wbg_constructor_6f67fe370a1d12e4 = function(arg0) {
585
583
  const ret = new Error(arg0);
586
584
  return ret;
587
585
  };
588
- imports.wbg.__wbg_constructor_c456dcccc52847dd = function(arg0) {
586
+ imports.wbg.__wbg_constructor_e1ce7ec5d0c26936 = function(arg0) {
589
587
  const ret = new Error(arg0);
590
588
  return ret;
591
589
  };
@@ -686,10 +684,6 @@ function __wbg_get_imports() {
686
684
  state0.a = state0.b = 0;
687
685
  }
688
686
  };
689
- imports.wbg.__wbg_new_3f4c5c451d69e970 = function() {
690
- const ret = new Map();
691
- return ret;
692
- };
693
687
  imports.wbg.__wbg_new_5e0be73521bc8c17 = function() {
694
688
  const ret = new Map();
695
689
  return ret;
@@ -702,10 +696,14 @@ function __wbg_get_imports() {
702
696
  const ret = new Error();
703
697
  return ret;
704
698
  };
705
- imports.wbg.__wbg_new_a324c5957dd8b845 = function() {
699
+ imports.wbg.__wbg_new_afcb88b732711926 = function() {
706
700
  const ret = new Array();
707
701
  return ret;
708
702
  };
703
+ imports.wbg.__wbg_new_c4d92c865672cdba = function() {
704
+ const ret = new Map();
705
+ return ret;
706
+ };
709
707
  imports.wbg.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
710
708
  const ret = new Error(getStringFromWasm0(arg0, arg1));
711
709
  return ret;
@@ -798,8 +796,8 @@ function __wbg_get_imports() {
798
796
  const ret = false;
799
797
  return ret;
800
798
  };
801
- imports.wbg.__wbindgen_closure_wrapper725 = function(arg0, arg1, arg2) {
802
- const ret = makeMutClosure(arg0, arg1, 250, __wbg_adapter_30);
799
+ imports.wbg.__wbindgen_closure_wrapper739 = function(arg0, arg1, arg2) {
800
+ const ret = makeMutClosure(arg0, arg1, 256, __wbg_adapter_30);
803
801
  return ret;
804
802
  };
805
803
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
Binary file
@@ -1,14 +1,13 @@
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
4
  export const buildInfo: () => any;
8
5
  export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
9
6
  export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
10
7
  export const executeProgram: (a: number, b: number, c: any, d: any) => any;
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];
@@ -19,6 +18,7 @@ export const compressWitness: (a: any) => [number, number, number, number];
19
18
  export const decompressWitness: (a: number, b: number) => [number, number, number];
20
19
  export const compressWitnessStack: (a: any) => [number, number, number, number];
21
20
  export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
21
+ export const initLogLevel: (a: number, b: 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 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 closure255_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure816_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure820_externref_shim: (a: number, b: number, c: any, d: any) => void;
33
33
  export const __wbindgen_start: () => void;