@aztec/noir-acvm_js 4.0.0-nightly.20260121 → 4.0.0-nightly.20260122

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.
@@ -5,34 +5,6 @@
5
5
  * @returns {BuildInfo} - Information on how the installed package was built.
6
6
  */
7
7
  export function buildInfo(): BuildInfo;
8
- /**
9
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
10
- *
11
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
12
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
13
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
14
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
15
- */
16
- export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
17
- /**
18
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
19
- * This method also extracts the public return values from the solved witness into its own return witness.
20
- *
21
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
22
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
23
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
24
- * @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.
25
- */
26
- export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
27
- /**
28
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
29
- *
30
- * @param {Uint8Array} program - A serialized representation of an ACIR program
31
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
32
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
33
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
34
- */
35
- export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
36
8
  /**
37
9
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
38
10
  *
@@ -86,12 +58,6 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
86
58
  * Verifies a ECDSA signature over the secp256r1 curve.
87
59
  */
88
60
  export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
89
- /**
90
- * Sets the package's logging level.
91
- *
92
- * @param {LogLevel} level - The maximum level of logging to be emitted.
93
- */
94
- export function initLogLevel(filter: string): void;
95
61
  /**
96
62
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
97
63
  *
@@ -116,6 +82,40 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
116
82
  * @returns {WitnessMap} A witness map containing the circuit's public inputs.
117
83
  */
118
84
  export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
85
+ /**
86
+ * Sets the package's logging level.
87
+ *
88
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
89
+ */
90
+ export function initLogLevel(filter: string): void;
91
+ /**
92
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
93
+ *
94
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
95
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
96
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
97
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
98
+ */
99
+ export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
100
+ /**
101
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
102
+ * This method also extracts the public return values from the solved witness into its own return witness.
103
+ *
104
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
105
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
106
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
107
+ * @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
108
+ */
109
+ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
110
+ /**
111
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
112
+ *
113
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
114
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
115
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
116
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
117
+ */
118
+ export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
119
119
 
120
120
  export type StackItem = {
121
121
  index: number;
@@ -140,20 +140,6 @@ export type BuildInfo = {
140
140
 
141
141
 
142
142
 
143
- export type RawAssertionPayload = {
144
- selector: string;
145
- data: string[];
146
- };
147
-
148
- export type ExecutionError = Error & {
149
- callStack?: string[];
150
- rawAssertionPayload?: RawAssertionPayload;
151
- acirFunctionId?: number;
152
- brilligFunctionId?: number;
153
- };
154
-
155
-
156
-
157
143
  // Map from witness index to hex string value of witness.
158
144
  export type WitnessMap = Map<number, string>;
159
145
 
@@ -169,6 +155,20 @@ export type SolvedAndReturnWitness = {
169
155
 
170
156
 
171
157
 
158
+ export type RawAssertionPayload = {
159
+ selector: string;
160
+ data: string[];
161
+ };
162
+
163
+ export type ExecutionError = Error & {
164
+ callStack?: string[];
165
+ rawAssertionPayload?: RawAssertionPayload;
166
+ acirFunctionId?: number;
167
+ brilligFunctionId?: number;
168
+ };
169
+
170
+
171
+
172
172
  export type ForeignCallInput = string[]
173
173
  export type ForeignCallOutput = string | string[]
174
174
 
package/nodejs/acvm_js.js CHANGED
@@ -210,58 +210,6 @@ module.exports.buildInfo = function() {
210
210
  return ret;
211
211
  };
212
212
 
213
- function passArray8ToWasm0(arg, malloc) {
214
- const ptr = malloc(arg.length * 1, 1) >>> 0;
215
- getUint8ArrayMemory0().set(arg, ptr / 1);
216
- WASM_VECTOR_LEN = arg.length;
217
- return ptr;
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
- };
264
-
265
213
  function takeFromExternrefTable0(idx) {
266
214
  const value = wasm.__wbindgen_export_2.get(idx);
267
215
  wasm.__externref_table_dealloc(idx);
@@ -288,6 +236,12 @@ module.exports.compressWitness = function(witness_map) {
288
236
  return v1;
289
237
  };
290
238
 
239
+ function passArray8ToWasm0(arg, malloc) {
240
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
241
+ getUint8ArrayMemory0().set(arg, ptr / 1);
242
+ WASM_VECTOR_LEN = arg.length;
243
+ return ptr;
244
+ }
291
245
  /**
292
246
  * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
293
247
  * This should be used to only fetch the witness map for the main function.
@@ -452,20 +406,6 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
452
406
  return ret !== 0;
453
407
  };
454
408
 
455
- /**
456
- * Sets the package's logging level.
457
- *
458
- * @param {LogLevel} level - The maximum level of logging to be emitted.
459
- */
460
- module.exports.initLogLevel = function(filter) {
461
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
462
- const len0 = WASM_VECTOR_LEN;
463
- const ret = wasm.initLogLevel(ptr0, len0);
464
- if (ret[1]) {
465
- throw takeFromExternrefTable0(ret[0]);
466
- }
467
- };
468
-
469
409
  /**
470
410
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
471
411
  *
@@ -526,16 +466,76 @@ module.exports.getPublicWitness = function(program, solved_witness) {
526
466
  return takeFromExternrefTable0(ret[0]);
527
467
  };
528
468
 
469
+ /**
470
+ * Sets the package's logging level.
471
+ *
472
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
473
+ */
474
+ module.exports.initLogLevel = function(filter) {
475
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
476
+ const len0 = WASM_VECTOR_LEN;
477
+ const ret = wasm.initLogLevel(ptr0, len0);
478
+ if (ret[1]) {
479
+ throw takeFromExternrefTable0(ret[0]);
480
+ }
481
+ };
482
+
483
+ /**
484
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
485
+ *
486
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
487
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
488
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
489
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
490
+ */
491
+ module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
492
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
493
+ const len0 = WASM_VECTOR_LEN;
494
+ const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
495
+ return ret;
496
+ };
497
+
498
+ /**
499
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
500
+ * This method also extracts the public return values from the solved witness into its own return witness.
501
+ *
502
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
503
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
504
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
505
+ * @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
506
+ */
507
+ module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
508
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
509
+ const len0 = WASM_VECTOR_LEN;
510
+ const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
511
+ return ret;
512
+ };
513
+
514
+ /**
515
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
516
+ *
517
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
518
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
519
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
520
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
521
+ */
522
+ module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
523
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
524
+ const len0 = WASM_VECTOR_LEN;
525
+ const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
526
+ return ret;
527
+ };
528
+
529
529
  function __wbg_adapter_30(arg0, arg1, arg2) {
530
- wasm.closure447_externref_shim(arg0, arg1, arg2);
530
+ wasm.closure448_externref_shim(arg0, arg1, arg2);
531
531
  }
532
532
 
533
533
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
534
- wasm.closure932_externref_shim(arg0, arg1, arg2, arg3, arg4);
534
+ wasm.closure933_externref_shim(arg0, arg1, arg2, arg3, arg4);
535
535
  }
536
536
 
537
537
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
538
- wasm.closure936_externref_shim(arg0, arg1, arg2, arg3);
538
+ wasm.closure937_externref_shim(arg0, arg1, arg2, arg3);
539
539
  }
540
540
 
541
541
  module.exports.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
@@ -813,8 +813,8 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
813
813
  return ret;
814
814
  };
815
815
 
816
- module.exports.__wbindgen_closure_wrapper1443 = function(arg0, arg1, arg2) {
817
- const ret = makeMutClosure(arg0, arg1, 448, __wbg_adapter_30);
816
+ module.exports.__wbindgen_closure_wrapper1446 = function(arg0, arg1, arg2) {
817
+ const ret = makeMutClosure(arg0, arg1, 449, __wbg_adapter_30);
818
818
  return ret;
819
819
  };
820
820
 
Binary file
@@ -2,9 +2,6 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const buildInfo: () => any;
5
- export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
6
- export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
7
- export const executeProgram: (a: number, b: number, c: any, d: any) => any;
8
5
  export const compressWitness: (a: any) => [number, number, number, number];
9
6
  export const decompressWitness: (a: number, b: number) => [number, number, number];
10
7
  export const compressWitnessStack: (a: any) => [number, number, number, number];
@@ -15,10 +12,13 @@ export const sha256_compression: (a: number, b: number, c: number, d: number) =>
15
12
  export const blake2s256: (a: number, b: number) => [number, number];
16
13
  export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
17
14
  export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
18
- export const initLogLevel: (a: number, b: number) => [number, number];
19
15
  export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
20
16
  export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
21
17
  export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
18
+ export const initLogLevel: (a: number, b: number) => [number, number];
19
+ export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
20
+ export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
21
+ export const executeProgram: (a: number, b: number, c: any, d: any) => any;
22
22
  export const __wbindgen_exn_store: (a: number) => void;
23
23
  export const __externref_table_alloc: () => number;
24
24
  export const __wbindgen_export_2: WebAssembly.Table;
@@ -27,7 +27,7 @@ export const __wbindgen_malloc: (a: number, b: number) => number;
27
27
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
28
28
  export const __wbindgen_export_6: WebAssembly.Table;
29
29
  export const __externref_table_dealloc: (a: number) => void;
30
- export const closure447_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure932_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure936_externref_shim: (a: number, b: number, c: any, d: any) => void;
30
+ export const closure448_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure933_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure937_externref_shim: (a: number, b: number, c: any, d: any) => void;
33
33
  export const __wbindgen_start: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/noir-acvm_js",
3
- "version": "4.0.0-nightly.20260121",
3
+ "version": "4.0.0-nightly.20260122",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -43,9 +43,9 @@
43
43
  "@web/test-runner-playwright": "^0.11.1",
44
44
  "chai": "^6.2.2",
45
45
  "eslint": "^9.39.2",
46
- "eslint-plugin-prettier": "^5.5.4",
46
+ "eslint-plugin-prettier": "^5.5.5",
47
47
  "mocha": "^11.7.5",
48
- "prettier": "3.7.4",
48
+ "prettier": "3.8.0",
49
49
  "ts-node": "^10.9.2",
50
50
  "typescript": "^5.8.3"
51
51
  }
package/web/acvm_js.d.ts CHANGED
@@ -5,34 +5,6 @@
5
5
  * @returns {BuildInfo} - Information on how the installed package was built.
6
6
  */
7
7
  export function buildInfo(): BuildInfo;
8
- /**
9
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
10
- *
11
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
12
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
13
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
14
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
15
- */
16
- export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
17
- /**
18
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
19
- * This method also extracts the public return values from the solved witness into its own return witness.
20
- *
21
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
22
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
23
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
24
- * @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.
25
- */
26
- export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
27
- /**
28
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
29
- *
30
- * @param {Uint8Array} program - A serialized representation of an ACIR program
31
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
32
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
33
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
34
- */
35
- export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
36
8
  /**
37
9
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
38
10
  *
@@ -86,12 +58,6 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
86
58
  * Verifies a ECDSA signature over the secp256r1 curve.
87
59
  */
88
60
  export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
89
- /**
90
- * Sets the package's logging level.
91
- *
92
- * @param {LogLevel} level - The maximum level of logging to be emitted.
93
- */
94
- export function initLogLevel(filter: string): void;
95
61
  /**
96
62
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
97
63
  *
@@ -116,6 +82,40 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
116
82
  * @returns {WitnessMap} A witness map containing the circuit's public inputs.
117
83
  */
118
84
  export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
85
+ /**
86
+ * Sets the package's logging level.
87
+ *
88
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
89
+ */
90
+ export function initLogLevel(filter: string): void;
91
+ /**
92
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
93
+ *
94
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
95
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
96
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
97
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
98
+ */
99
+ export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
100
+ /**
101
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
102
+ * This method also extracts the public return values from the solved witness into its own return witness.
103
+ *
104
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
105
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
106
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
107
+ * @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
108
+ */
109
+ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
110
+ /**
111
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
112
+ *
113
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
114
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
115
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
116
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
117
+ */
118
+ export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
119
119
 
120
120
  export type StackItem = {
121
121
  index: number;
@@ -140,20 +140,6 @@ export type BuildInfo = {
140
140
 
141
141
 
142
142
 
143
- export type RawAssertionPayload = {
144
- selector: string;
145
- data: string[];
146
- };
147
-
148
- export type ExecutionError = Error & {
149
- callStack?: string[];
150
- rawAssertionPayload?: RawAssertionPayload;
151
- acirFunctionId?: number;
152
- brilligFunctionId?: number;
153
- };
154
-
155
-
156
-
157
143
  // Map from witness index to hex string value of witness.
158
144
  export type WitnessMap = Map<number, string>;
159
145
 
@@ -169,6 +155,20 @@ export type SolvedAndReturnWitness = {
169
155
 
170
156
 
171
157
 
158
+ export type RawAssertionPayload = {
159
+ selector: string;
160
+ data: string[];
161
+ };
162
+
163
+ export type ExecutionError = Error & {
164
+ callStack?: string[];
165
+ rawAssertionPayload?: RawAssertionPayload;
166
+ acirFunctionId?: number;
167
+ brilligFunctionId?: number;
168
+ };
169
+
170
+
171
+
172
172
  export type ForeignCallInput = string[]
173
173
  export type ForeignCallOutput = string | string[]
174
174
 
@@ -188,9 +188,6 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
188
188
  export interface InitOutput {
189
189
  readonly memory: WebAssembly.Memory;
190
190
  readonly buildInfo: () => any;
191
- readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
192
- readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
193
- readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
194
191
  readonly compressWitness: (a: any) => [number, number, number, number];
195
192
  readonly decompressWitness: (a: number, b: number) => [number, number, number];
196
193
  readonly compressWitnessStack: (a: any) => [number, number, number, number];
@@ -201,10 +198,13 @@ export interface InitOutput {
201
198
  readonly blake2s256: (a: number, b: number) => [number, number];
202
199
  readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
203
200
  readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
204
- readonly initLogLevel: (a: number, b: number) => [number, number];
205
201
  readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
206
202
  readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
207
203
  readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
204
+ readonly initLogLevel: (a: number, b: number) => [number, number];
205
+ readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
206
+ readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
207
+ readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
208
208
  readonly __wbindgen_exn_store: (a: number) => void;
209
209
  readonly __externref_table_alloc: () => number;
210
210
  readonly __wbindgen_export_2: WebAssembly.Table;
@@ -213,9 +213,9 @@ export interface InitOutput {
213
213
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
214
214
  readonly __wbindgen_export_6: WebAssembly.Table;
215
215
  readonly __externref_table_dealloc: (a: number) => void;
216
- readonly closure447_externref_shim: (a: number, b: number, c: any) => void;
217
- readonly closure932_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
218
- readonly closure936_externref_shim: (a: number, b: number, c: any, d: any) => void;
216
+ readonly closure448_externref_shim: (a: number, b: number, c: any) => void;
217
+ readonly closure933_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
218
+ readonly closure937_externref_shim: (a: number, b: number, c: any, d: any) => void;
219
219
  readonly __wbindgen_start: () => void;
220
220
  }
221
221
 
package/web/acvm_js.js CHANGED
@@ -206,58 +206,6 @@ export function buildInfo() {
206
206
  return ret;
207
207
  }
208
208
 
209
- function passArray8ToWasm0(arg, malloc) {
210
- const ptr = malloc(arg.length * 1, 1) >>> 0;
211
- getUint8ArrayMemory0().set(arg, ptr / 1);
212
- WASM_VECTOR_LEN = arg.length;
213
- return ptr;
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
- }
260
-
261
209
  function takeFromExternrefTable0(idx) {
262
210
  const value = wasm.__wbindgen_export_2.get(idx);
263
211
  wasm.__externref_table_dealloc(idx);
@@ -284,6 +232,12 @@ export function compressWitness(witness_map) {
284
232
  return v1;
285
233
  }
286
234
 
235
+ function passArray8ToWasm0(arg, malloc) {
236
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
237
+ getUint8ArrayMemory0().set(arg, ptr / 1);
238
+ WASM_VECTOR_LEN = arg.length;
239
+ return ptr;
240
+ }
287
241
  /**
288
242
  * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
289
243
  * This should be used to only fetch the witness map for the main function.
@@ -448,20 +402,6 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
448
402
  return ret !== 0;
449
403
  }
450
404
 
451
- /**
452
- * Sets the package's logging level.
453
- *
454
- * @param {LogLevel} level - The maximum level of logging to be emitted.
455
- */
456
- export function initLogLevel(filter) {
457
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
458
- const len0 = WASM_VECTOR_LEN;
459
- const ret = wasm.initLogLevel(ptr0, len0);
460
- if (ret[1]) {
461
- throw takeFromExternrefTable0(ret[0]);
462
- }
463
- }
464
-
465
405
  /**
466
406
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
467
407
  *
@@ -522,16 +462,76 @@ export function getPublicWitness(program, solved_witness) {
522
462
  return takeFromExternrefTable0(ret[0]);
523
463
  }
524
464
 
465
+ /**
466
+ * Sets the package's logging level.
467
+ *
468
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
469
+ */
470
+ export function initLogLevel(filter) {
471
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
472
+ const len0 = WASM_VECTOR_LEN;
473
+ const ret = wasm.initLogLevel(ptr0, len0);
474
+ if (ret[1]) {
475
+ throw takeFromExternrefTable0(ret[0]);
476
+ }
477
+ }
478
+
479
+ /**
480
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
481
+ *
482
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
483
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
484
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
485
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
486
+ */
487
+ export function executeCircuit(program, initial_witness, foreign_call_handler) {
488
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
489
+ const len0 = WASM_VECTOR_LEN;
490
+ const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
491
+ return ret;
492
+ }
493
+
494
+ /**
495
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
496
+ * This method also extracts the public return values from the solved witness into its own return witness.
497
+ *
498
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
499
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
500
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
501
+ * @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
502
+ */
503
+ export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
504
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
505
+ const len0 = WASM_VECTOR_LEN;
506
+ const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
507
+ return ret;
508
+ }
509
+
510
+ /**
511
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
512
+ *
513
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
514
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
515
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
516
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
517
+ */
518
+ export function executeProgram(program, initial_witness, foreign_call_handler) {
519
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
520
+ const len0 = WASM_VECTOR_LEN;
521
+ const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
522
+ return ret;
523
+ }
524
+
525
525
  function __wbg_adapter_30(arg0, arg1, arg2) {
526
- wasm.closure447_externref_shim(arg0, arg1, arg2);
526
+ wasm.closure448_externref_shim(arg0, arg1, arg2);
527
527
  }
528
528
 
529
529
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
530
- wasm.closure932_externref_shim(arg0, arg1, arg2, arg3, arg4);
530
+ wasm.closure933_externref_shim(arg0, arg1, arg2, arg3, arg4);
531
531
  }
532
532
 
533
533
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
534
- wasm.closure936_externref_shim(arg0, arg1, arg2, arg3);
534
+ wasm.closure937_externref_shim(arg0, arg1, arg2, arg3);
535
535
  }
536
536
 
537
537
  async function __wbg_load(module, imports) {
@@ -797,8 +797,8 @@ function __wbg_get_imports() {
797
797
  const ret = false;
798
798
  return ret;
799
799
  };
800
- imports.wbg.__wbindgen_closure_wrapper1443 = function(arg0, arg1, arg2) {
801
- const ret = makeMutClosure(arg0, arg1, 448, __wbg_adapter_30);
800
+ imports.wbg.__wbindgen_closure_wrapper1446 = function(arg0, arg1, arg2) {
801
+ const ret = makeMutClosure(arg0, arg1, 449, __wbg_adapter_30);
802
802
  return ret;
803
803
  };
804
804
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
Binary file
@@ -2,9 +2,6 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const buildInfo: () => any;
5
- export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
6
- export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
7
- export const executeProgram: (a: number, b: number, c: any, d: any) => any;
8
5
  export const compressWitness: (a: any) => [number, number, number, number];
9
6
  export const decompressWitness: (a: number, b: number) => [number, number, number];
10
7
  export const compressWitnessStack: (a: any) => [number, number, number, number];
@@ -15,10 +12,13 @@ export const sha256_compression: (a: number, b: number, c: number, d: number) =>
15
12
  export const blake2s256: (a: number, b: number) => [number, number];
16
13
  export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
17
14
  export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
18
- export const initLogLevel: (a: number, b: number) => [number, number];
19
15
  export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
20
16
  export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
21
17
  export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
18
+ export const initLogLevel: (a: number, b: number) => [number, number];
19
+ export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
20
+ export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
21
+ export const executeProgram: (a: number, b: number, c: any, d: any) => any;
22
22
  export const __wbindgen_exn_store: (a: number) => void;
23
23
  export const __externref_table_alloc: () => number;
24
24
  export const __wbindgen_export_2: WebAssembly.Table;
@@ -27,7 +27,7 @@ export const __wbindgen_malloc: (a: number, b: number) => number;
27
27
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
28
28
  export const __wbindgen_export_6: WebAssembly.Table;
29
29
  export const __externref_table_dealloc: (a: number) => void;
30
- export const closure447_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure932_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure936_externref_shim: (a: number, b: number, c: any, d: any) => void;
30
+ export const closure448_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure933_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure937_externref_shim: (a: number, b: number, c: any, d: any) => void;
33
33
  export const __wbindgen_start: () => void;