@aztec/noir-acvm_js 0.0.1-commit.c7c42ec → 0.0.1-commit.f295ac2

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.
@@ -6,34 +6,11 @@
6
6
  */
7
7
  export function buildInfo(): BuildInfo;
8
8
  /**
9
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
10
- *
11
- * @param {WitnessMap} witness_map - A witness map.
12
- * @returns {Uint8Array} A compressed witness map
13
- */
14
- export function compressWitness(witness_map: WitnessMap): Uint8Array;
15
- /**
16
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
17
- * This should be used to only fetch the witness map for the main function.
18
- *
19
- * @param {Uint8Array} compressed_witness - A compressed witness.
20
- * @returns {WitnessMap} The decompressed witness map.
21
- */
22
- export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
23
- /**
24
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
25
- *
26
- * @param {WitnessStack} witness_stack - A witness stack.
27
- * @returns {Uint8Array} A compressed witness stack
28
- */
29
- export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
30
- /**
31
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
9
+ * Sets the package's logging level.
32
10
  *
33
- * @param {Uint8Array} compressed_witness - A compressed witness.
34
- * @returns {WitnessStack} The decompressed witness stack.
11
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
35
12
  */
36
- export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
13
+ export function initLogLevel(filter: string): void;
37
14
  /**
38
15
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
39
16
  *
@@ -62,12 +39,6 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
62
39
  * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
63
40
  */
64
41
  export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
65
- /**
66
- * Sets the package's logging level.
67
- *
68
- * @param {LogLevel} level - The maximum level of logging to be emitted.
69
- */
70
- export function initLogLevel(filter: string): void;
71
42
  /**
72
43
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
73
44
  *
@@ -92,6 +63,35 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
92
63
  * @returns {WitnessMap} A witness map containing the circuit's public inputs.
93
64
  */
94
65
  export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
66
+ /**
67
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
68
+ *
69
+ * @param {WitnessMap} witness_map - A witness map.
70
+ * @returns {Uint8Array} A compressed witness map
71
+ */
72
+ export function compressWitness(witness_map: WitnessMap): Uint8Array;
73
+ /**
74
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
75
+ * This should be used to only fetch the witness map for the main function.
76
+ *
77
+ * @param {Uint8Array} compressed_witness - A compressed witness.
78
+ * @returns {WitnessMap} The decompressed witness map.
79
+ */
80
+ export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
81
+ /**
82
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
83
+ *
84
+ * @param {WitnessStack} witness_stack - A witness stack.
85
+ * @returns {Uint8Array} A compressed witness stack
86
+ */
87
+ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
88
+ /**
89
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
90
+ *
91
+ * @param {Uint8Array} compressed_witness - A compressed witness.
92
+ * @returns {WitnessStack} The decompressed witness stack.
93
+ */
94
+ export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
95
95
  /**
96
96
  * Performs a bitwise AND operation between `lhs` and `rhs`
97
97
  */
@@ -131,6 +131,20 @@ export type BuildInfo = {
131
131
 
132
132
 
133
133
 
134
+ export type RawAssertionPayload = {
135
+ selector: string;
136
+ data: string[];
137
+ };
138
+
139
+ export type ExecutionError = Error & {
140
+ callStack?: string[];
141
+ rawAssertionPayload?: RawAssertionPayload;
142
+ acirFunctionId?: number;
143
+ brilligFunctionId?: number;
144
+ };
145
+
146
+
147
+
134
148
  // Map from witness index to hex string value of witness.
135
149
  export type WitnessMap = Map<number, string>;
136
150
 
@@ -146,15 +160,6 @@ export type SolvedAndReturnWitness = {
146
160
 
147
161
 
148
162
 
149
- export type StackItem = {
150
- index: number;
151
- witness: WitnessMap;
152
- }
153
-
154
- export type WitnessStack = Array<StackItem>;
155
-
156
-
157
-
158
163
  export type ForeignCallInput = string[]
159
164
  export type ForeignCallOutput = string | string[]
160
165
 
@@ -169,16 +174,11 @@ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => P
169
174
 
170
175
 
171
176
 
172
- export type RawAssertionPayload = {
173
- selector: string;
174
- data: string[];
175
- };
177
+ export type StackItem = {
178
+ index: number;
179
+ witness: WitnessMap;
180
+ }
176
181
 
177
- export type ExecutionError = Error & {
178
- callStack?: string[];
179
- rawAssertionPayload?: RawAssertionPayload;
180
- acirFunctionId?: number;
181
- brilligFunctionId?: number;
182
- };
182
+ export type WitnessStack = Array<StackItem>;
183
183
 
184
184
 
package/nodejs/acvm_js.js CHANGED
@@ -215,25 +215,18 @@ function takeFromExternrefTable0(idx) {
215
215
  wasm.__externref_table_dealloc(idx);
216
216
  return value;
217
217
  }
218
-
219
- function getArrayU8FromWasm0(ptr, len) {
220
- ptr = ptr >>> 0;
221
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
222
- }
223
218
  /**
224
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
219
+ * Sets the package's logging level.
225
220
  *
226
- * @param {WitnessMap} witness_map - A witness map.
227
- * @returns {Uint8Array} A compressed witness map
221
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
228
222
  */
229
- module.exports.compressWitness = function(witness_map) {
230
- const ret = wasm.compressWitness(witness_map);
231
- if (ret[3]) {
232
- throw takeFromExternrefTable0(ret[2]);
223
+ module.exports.initLogLevel = function(filter) {
224
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
225
+ const len0 = WASM_VECTOR_LEN;
226
+ const ret = wasm.initLogLevel(ptr0, len0);
227
+ if (ret[1]) {
228
+ throw takeFromExternrefTable0(ret[0]);
233
229
  }
234
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
235
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
236
- return v1;
237
230
  };
238
231
 
239
232
  function passArray8ToWasm0(arg, malloc) {
@@ -242,55 +235,6 @@ function passArray8ToWasm0(arg, malloc) {
242
235
  WASM_VECTOR_LEN = arg.length;
243
236
  return ptr;
244
237
  }
245
- /**
246
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
247
- * This should be used to only fetch the witness map for the main function.
248
- *
249
- * @param {Uint8Array} compressed_witness - A compressed witness.
250
- * @returns {WitnessMap} The decompressed witness map.
251
- */
252
- module.exports.decompressWitness = function(compressed_witness) {
253
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
254
- const len0 = WASM_VECTOR_LEN;
255
- const ret = wasm.decompressWitness(ptr0, len0);
256
- if (ret[2]) {
257
- throw takeFromExternrefTable0(ret[1]);
258
- }
259
- return takeFromExternrefTable0(ret[0]);
260
- };
261
-
262
- /**
263
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
264
- *
265
- * @param {WitnessStack} witness_stack - A witness stack.
266
- * @returns {Uint8Array} A compressed witness stack
267
- */
268
- module.exports.compressWitnessStack = function(witness_stack) {
269
- const ret = wasm.compressWitnessStack(witness_stack);
270
- if (ret[3]) {
271
- throw takeFromExternrefTable0(ret[2]);
272
- }
273
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
274
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
275
- return v1;
276
- };
277
-
278
- /**
279
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
280
- *
281
- * @param {Uint8Array} compressed_witness - A compressed witness.
282
- * @returns {WitnessStack} The decompressed witness stack.
283
- */
284
- module.exports.decompressWitnessStack = function(compressed_witness) {
285
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
286
- const len0 = WASM_VECTOR_LEN;
287
- const ret = wasm.decompressWitnessStack(ptr0, len0);
288
- if (ret[2]) {
289
- throw takeFromExternrefTable0(ret[1]);
290
- }
291
- return takeFromExternrefTable0(ret[0]);
292
- };
293
-
294
238
  /**
295
239
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
296
240
  *
@@ -337,20 +281,6 @@ module.exports.executeProgram = function(program, initial_witness, foreign_call_
337
281
  return ret;
338
282
  };
339
283
 
340
- /**
341
- * Sets the package's logging level.
342
- *
343
- * @param {LogLevel} level - The maximum level of logging to be emitted.
344
- */
345
- module.exports.initLogLevel = function(filter) {
346
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
347
- const len0 = WASM_VECTOR_LEN;
348
- const ret = wasm.initLogLevel(ptr0, len0);
349
- if (ret[1]) {
350
- throw takeFromExternrefTable0(ret[0]);
351
- }
352
- };
353
-
354
284
  /**
355
285
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
356
286
  *
@@ -411,6 +341,75 @@ module.exports.getPublicWitness = function(program, solved_witness) {
411
341
  return takeFromExternrefTable0(ret[0]);
412
342
  };
413
343
 
344
+ function getArrayU8FromWasm0(ptr, len) {
345
+ ptr = ptr >>> 0;
346
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
347
+ }
348
+ /**
349
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
350
+ *
351
+ * @param {WitnessMap} witness_map - A witness map.
352
+ * @returns {Uint8Array} A compressed witness map
353
+ */
354
+ module.exports.compressWitness = function(witness_map) {
355
+ const ret = wasm.compressWitness(witness_map);
356
+ if (ret[3]) {
357
+ throw takeFromExternrefTable0(ret[2]);
358
+ }
359
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
360
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
361
+ return v1;
362
+ };
363
+
364
+ /**
365
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
366
+ * This should be used to only fetch the witness map for the main function.
367
+ *
368
+ * @param {Uint8Array} compressed_witness - A compressed witness.
369
+ * @returns {WitnessMap} The decompressed witness map.
370
+ */
371
+ module.exports.decompressWitness = function(compressed_witness) {
372
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
373
+ const len0 = WASM_VECTOR_LEN;
374
+ const ret = wasm.decompressWitness(ptr0, len0);
375
+ if (ret[2]) {
376
+ throw takeFromExternrefTable0(ret[1]);
377
+ }
378
+ return takeFromExternrefTable0(ret[0]);
379
+ };
380
+
381
+ /**
382
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
383
+ *
384
+ * @param {WitnessStack} witness_stack - A witness stack.
385
+ * @returns {Uint8Array} A compressed witness stack
386
+ */
387
+ module.exports.compressWitnessStack = function(witness_stack) {
388
+ const ret = wasm.compressWitnessStack(witness_stack);
389
+ if (ret[3]) {
390
+ throw takeFromExternrefTable0(ret[2]);
391
+ }
392
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
393
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
394
+ return v1;
395
+ };
396
+
397
+ /**
398
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
399
+ *
400
+ * @param {Uint8Array} compressed_witness - A compressed witness.
401
+ * @returns {WitnessStack} The decompressed witness stack.
402
+ */
403
+ module.exports.decompressWitnessStack = function(compressed_witness) {
404
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
405
+ const len0 = WASM_VECTOR_LEN;
406
+ const ret = wasm.decompressWitnessStack(ptr0, len0);
407
+ if (ret[2]) {
408
+ throw takeFromExternrefTable0(ret[1]);
409
+ }
410
+ return takeFromExternrefTable0(ret[0]);
411
+ };
412
+
414
413
  /**
415
414
  * Performs a bitwise AND operation between `lhs` and `rhs`
416
415
  * @param {string} lhs
@@ -527,15 +526,15 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
527
526
  };
528
527
 
529
528
  function __wbg_adapter_30(arg0, arg1, arg2) {
530
- wasm.closure576_externref_shim(arg0, arg1, arg2);
529
+ wasm.closure447_externref_shim(arg0, arg1, arg2);
531
530
  }
532
531
 
533
532
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
534
- wasm.closure1171_externref_shim(arg0, arg1, arg2, arg3, arg4);
533
+ wasm.closure932_externref_shim(arg0, arg1, arg2, arg3, arg4);
535
534
  }
536
535
 
537
536
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
538
- wasm.closure1175_externref_shim(arg0, arg1, arg2, arg3);
537
+ wasm.closure936_externref_shim(arg0, arg1, arg2, arg3);
539
538
  }
540
539
 
541
540
  module.exports.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
@@ -553,12 +552,12 @@ module.exports.__wbg_call_833bed5770ea2041 = function() { return handleError(fun
553
552
  return ret;
554
553
  }, arguments) };
555
554
 
556
- module.exports.__wbg_constructor_3aef6db465a4d40f = function(arg0) {
555
+ module.exports.__wbg_constructor_536364f6bcd4616b = function(arg0) {
557
556
  const ret = new Error(arg0);
558
557
  return ret;
559
558
  };
560
559
 
561
- module.exports.__wbg_constructor_9cd41836d6991f28 = function(arg0) {
560
+ module.exports.__wbg_constructor_66e92e9c3ecae9e8 = function(arg0) {
562
561
  const ret = new Error(arg0);
563
562
  return ret;
564
563
  };
@@ -689,7 +688,7 @@ module.exports.__wbg_new_8a6f238a6ece86ea = function() {
689
688
  return ret;
690
689
  };
691
690
 
692
- module.exports.__wbg_new_8e773a1674584163 = function() {
691
+ module.exports.__wbg_new_9f501325818b4158 = function() {
693
692
  const ret = new Array();
694
693
  return ret;
695
694
  };
@@ -699,7 +698,7 @@ module.exports.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
699
698
  return ret;
700
699
  };
701
700
 
702
- module.exports.__wbg_new_dd245daac54dc568 = function() {
701
+ module.exports.__wbg_new_ec40611a7805f1f0 = function() {
703
702
  const ret = new Map();
704
703
  return ret;
705
704
  };
@@ -813,8 +812,8 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
813
812
  return ret;
814
813
  };
815
814
 
816
- module.exports.__wbindgen_closure_wrapper1971 = function(arg0, arg1, arg2) {
817
- const ret = makeMutClosure(arg0, arg1, 577, __wbg_adapter_30);
815
+ module.exports.__wbindgen_closure_wrapper1447 = function(arg0, arg1, arg2) {
816
+ const ret = makeMutClosure(arg0, arg1, 448, __wbg_adapter_30);
818
817
  return ret;
819
818
  };
820
819
 
Binary file
@@ -2,17 +2,17 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const buildInfo: () => any;
5
- export const compressWitness: (a: any) => [number, number, number, number];
6
- export const decompressWitness: (a: number, b: number) => [number, number, number];
7
- export const compressWitnessStack: (a: any) => [number, number, number, number];
8
- export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
5
+ export const initLogLevel: (a: number, b: number) => [number, number];
9
6
  export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
10
7
  export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
11
8
  export const executeProgram: (a: number, b: number, c: any, d: any) => any;
12
- export const initLogLevel: (a: number, b: number) => [number, number];
13
9
  export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
14
10
  export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
15
11
  export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
12
+ export const compressWitness: (a: any) => [number, number, number, number];
13
+ export const decompressWitness: (a: number, b: number) => [number, number, number];
14
+ export const compressWitnessStack: (a: any) => [number, number, number, number];
15
+ export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
16
16
  export const and: (a: any, b: any) => any;
17
17
  export const xor: (a: any, b: any) => any;
18
18
  export const sha256_compression: (a: number, b: number, c: number, d: 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 closure576_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure1171_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure1175_externref_shim: (a: number, b: number, c: any, d: any) => 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;
33
33
  export const __wbindgen_start: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/noir-acvm_js",
3
- "version": "0.0.1-commit.c7c42ec",
3
+ "version": "0.0.1-commit.f295ac2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -41,11 +41,11 @@
41
41
  "@web/dev-server-esbuild": "^1.0.4",
42
42
  "@web/test-runner": "^0.20.2",
43
43
  "@web/test-runner-playwright": "^0.11.1",
44
- "chai": "^4.5.0",
45
- "eslint": "^9.39.1",
44
+ "chai": "^6.2.2",
45
+ "eslint": "^9.39.2",
46
46
  "eslint-plugin-prettier": "^5.5.4",
47
- "mocha": "^11.5.0",
48
- "prettier": "3.7.3",
47
+ "mocha": "^11.7.5",
48
+ "prettier": "3.7.4",
49
49
  "ts-node": "^10.9.2",
50
50
  "typescript": "^5.8.3"
51
51
  }
package/web/acvm_js.d.ts CHANGED
@@ -6,34 +6,11 @@
6
6
  */
7
7
  export function buildInfo(): BuildInfo;
8
8
  /**
9
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
10
- *
11
- * @param {WitnessMap} witness_map - A witness map.
12
- * @returns {Uint8Array} A compressed witness map
13
- */
14
- export function compressWitness(witness_map: WitnessMap): Uint8Array;
15
- /**
16
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
17
- * This should be used to only fetch the witness map for the main function.
18
- *
19
- * @param {Uint8Array} compressed_witness - A compressed witness.
20
- * @returns {WitnessMap} The decompressed witness map.
21
- */
22
- export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
23
- /**
24
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
25
- *
26
- * @param {WitnessStack} witness_stack - A witness stack.
27
- * @returns {Uint8Array} A compressed witness stack
28
- */
29
- export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
30
- /**
31
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
9
+ * Sets the package's logging level.
32
10
  *
33
- * @param {Uint8Array} compressed_witness - A compressed witness.
34
- * @returns {WitnessStack} The decompressed witness stack.
11
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
35
12
  */
36
- export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
13
+ export function initLogLevel(filter: string): void;
37
14
  /**
38
15
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
39
16
  *
@@ -62,12 +39,6 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
62
39
  * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
63
40
  */
64
41
  export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
65
- /**
66
- * Sets the package's logging level.
67
- *
68
- * @param {LogLevel} level - The maximum level of logging to be emitted.
69
- */
70
- export function initLogLevel(filter: string): void;
71
42
  /**
72
43
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
73
44
  *
@@ -92,6 +63,35 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
92
63
  * @returns {WitnessMap} A witness map containing the circuit's public inputs.
93
64
  */
94
65
  export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
66
+ /**
67
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
68
+ *
69
+ * @param {WitnessMap} witness_map - A witness map.
70
+ * @returns {Uint8Array} A compressed witness map
71
+ */
72
+ export function compressWitness(witness_map: WitnessMap): Uint8Array;
73
+ /**
74
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
75
+ * This should be used to only fetch the witness map for the main function.
76
+ *
77
+ * @param {Uint8Array} compressed_witness - A compressed witness.
78
+ * @returns {WitnessMap} The decompressed witness map.
79
+ */
80
+ export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
81
+ /**
82
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
83
+ *
84
+ * @param {WitnessStack} witness_stack - A witness stack.
85
+ * @returns {Uint8Array} A compressed witness stack
86
+ */
87
+ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
88
+ /**
89
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
90
+ *
91
+ * @param {Uint8Array} compressed_witness - A compressed witness.
92
+ * @returns {WitnessStack} The decompressed witness stack.
93
+ */
94
+ export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
95
95
  /**
96
96
  * Performs a bitwise AND operation between `lhs` and `rhs`
97
97
  */
@@ -131,6 +131,20 @@ export type BuildInfo = {
131
131
 
132
132
 
133
133
 
134
+ export type RawAssertionPayload = {
135
+ selector: string;
136
+ data: string[];
137
+ };
138
+
139
+ export type ExecutionError = Error & {
140
+ callStack?: string[];
141
+ rawAssertionPayload?: RawAssertionPayload;
142
+ acirFunctionId?: number;
143
+ brilligFunctionId?: number;
144
+ };
145
+
146
+
147
+
134
148
  // Map from witness index to hex string value of witness.
135
149
  export type WitnessMap = Map<number, string>;
136
150
 
@@ -146,15 +160,6 @@ export type SolvedAndReturnWitness = {
146
160
 
147
161
 
148
162
 
149
- export type StackItem = {
150
- index: number;
151
- witness: WitnessMap;
152
- }
153
-
154
- export type WitnessStack = Array<StackItem>;
155
-
156
-
157
-
158
163
  export type ForeignCallInput = string[]
159
164
  export type ForeignCallOutput = string | string[]
160
165
 
@@ -169,17 +174,12 @@ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => P
169
174
 
170
175
 
171
176
 
172
- export type RawAssertionPayload = {
173
- selector: string;
174
- data: string[];
175
- };
177
+ export type StackItem = {
178
+ index: number;
179
+ witness: WitnessMap;
180
+ }
176
181
 
177
- export type ExecutionError = Error & {
178
- callStack?: string[];
179
- rawAssertionPayload?: RawAssertionPayload;
180
- acirFunctionId?: number;
181
- brilligFunctionId?: number;
182
- };
182
+ export type WitnessStack = Array<StackItem>;
183
183
 
184
184
 
185
185
 
@@ -188,17 +188,17 @@ 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 compressWitness: (a: any) => [number, number, number, number];
192
- readonly decompressWitness: (a: number, b: number) => [number, number, number];
193
- readonly compressWitnessStack: (a: any) => [number, number, number, number];
194
- readonly decompressWitnessStack: (a: number, b: number) => [number, number, number];
191
+ readonly initLogLevel: (a: number, b: number) => [number, number];
195
192
  readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
196
193
  readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
197
194
  readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
198
- readonly initLogLevel: (a: number, b: number) => [number, number];
199
195
  readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
200
196
  readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
201
197
  readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
198
+ readonly compressWitness: (a: any) => [number, number, number, number];
199
+ readonly decompressWitness: (a: number, b: number) => [number, number, number];
200
+ readonly compressWitnessStack: (a: any) => [number, number, number, number];
201
+ readonly decompressWitnessStack: (a: number, b: number) => [number, number, number];
202
202
  readonly and: (a: any, b: any) => any;
203
203
  readonly xor: (a: any, b: any) => any;
204
204
  readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
@@ -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 closure576_externref_shim: (a: number, b: number, c: any) => void;
217
- readonly closure1171_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
218
- readonly closure1175_externref_shim: (a: number, b: number, c: any, d: any) => 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;
219
219
  readonly __wbindgen_start: () => void;
220
220
  }
221
221
 
package/web/acvm_js.js CHANGED
@@ -211,25 +211,18 @@ function takeFromExternrefTable0(idx) {
211
211
  wasm.__externref_table_dealloc(idx);
212
212
  return value;
213
213
  }
214
-
215
- function getArrayU8FromWasm0(ptr, len) {
216
- ptr = ptr >>> 0;
217
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
218
- }
219
214
  /**
220
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
215
+ * Sets the package's logging level.
221
216
  *
222
- * @param {WitnessMap} witness_map - A witness map.
223
- * @returns {Uint8Array} A compressed witness map
217
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
224
218
  */
225
- export function compressWitness(witness_map) {
226
- const ret = wasm.compressWitness(witness_map);
227
- if (ret[3]) {
228
- throw takeFromExternrefTable0(ret[2]);
219
+ export function initLogLevel(filter) {
220
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
221
+ const len0 = WASM_VECTOR_LEN;
222
+ const ret = wasm.initLogLevel(ptr0, len0);
223
+ if (ret[1]) {
224
+ throw takeFromExternrefTable0(ret[0]);
229
225
  }
230
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
231
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
232
- return v1;
233
226
  }
234
227
 
235
228
  function passArray8ToWasm0(arg, malloc) {
@@ -238,55 +231,6 @@ function passArray8ToWasm0(arg, malloc) {
238
231
  WASM_VECTOR_LEN = arg.length;
239
232
  return ptr;
240
233
  }
241
- /**
242
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
243
- * This should be used to only fetch the witness map for the main function.
244
- *
245
- * @param {Uint8Array} compressed_witness - A compressed witness.
246
- * @returns {WitnessMap} The decompressed witness map.
247
- */
248
- export function decompressWitness(compressed_witness) {
249
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
250
- const len0 = WASM_VECTOR_LEN;
251
- const ret = wasm.decompressWitness(ptr0, len0);
252
- if (ret[2]) {
253
- throw takeFromExternrefTable0(ret[1]);
254
- }
255
- return takeFromExternrefTable0(ret[0]);
256
- }
257
-
258
- /**
259
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
260
- *
261
- * @param {WitnessStack} witness_stack - A witness stack.
262
- * @returns {Uint8Array} A compressed witness stack
263
- */
264
- export function compressWitnessStack(witness_stack) {
265
- const ret = wasm.compressWitnessStack(witness_stack);
266
- if (ret[3]) {
267
- throw takeFromExternrefTable0(ret[2]);
268
- }
269
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
270
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
271
- return v1;
272
- }
273
-
274
- /**
275
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
276
- *
277
- * @param {Uint8Array} compressed_witness - A compressed witness.
278
- * @returns {WitnessStack} The decompressed witness stack.
279
- */
280
- export function decompressWitnessStack(compressed_witness) {
281
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
282
- const len0 = WASM_VECTOR_LEN;
283
- const ret = wasm.decompressWitnessStack(ptr0, len0);
284
- if (ret[2]) {
285
- throw takeFromExternrefTable0(ret[1]);
286
- }
287
- return takeFromExternrefTable0(ret[0]);
288
- }
289
-
290
234
  /**
291
235
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
292
236
  *
@@ -333,20 +277,6 @@ export function executeProgram(program, initial_witness, foreign_call_handler) {
333
277
  return ret;
334
278
  }
335
279
 
336
- /**
337
- * Sets the package's logging level.
338
- *
339
- * @param {LogLevel} level - The maximum level of logging to be emitted.
340
- */
341
- export function initLogLevel(filter) {
342
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
343
- const len0 = WASM_VECTOR_LEN;
344
- const ret = wasm.initLogLevel(ptr0, len0);
345
- if (ret[1]) {
346
- throw takeFromExternrefTable0(ret[0]);
347
- }
348
- }
349
-
350
280
  /**
351
281
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
352
282
  *
@@ -407,6 +337,75 @@ export function getPublicWitness(program, solved_witness) {
407
337
  return takeFromExternrefTable0(ret[0]);
408
338
  }
409
339
 
340
+ function getArrayU8FromWasm0(ptr, len) {
341
+ ptr = ptr >>> 0;
342
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
343
+ }
344
+ /**
345
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
346
+ *
347
+ * @param {WitnessMap} witness_map - A witness map.
348
+ * @returns {Uint8Array} A compressed witness map
349
+ */
350
+ export function compressWitness(witness_map) {
351
+ const ret = wasm.compressWitness(witness_map);
352
+ if (ret[3]) {
353
+ throw takeFromExternrefTable0(ret[2]);
354
+ }
355
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
356
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
357
+ return v1;
358
+ }
359
+
360
+ /**
361
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
362
+ * This should be used to only fetch the witness map for the main function.
363
+ *
364
+ * @param {Uint8Array} compressed_witness - A compressed witness.
365
+ * @returns {WitnessMap} The decompressed witness map.
366
+ */
367
+ export function decompressWitness(compressed_witness) {
368
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
369
+ const len0 = WASM_VECTOR_LEN;
370
+ const ret = wasm.decompressWitness(ptr0, len0);
371
+ if (ret[2]) {
372
+ throw takeFromExternrefTable0(ret[1]);
373
+ }
374
+ return takeFromExternrefTable0(ret[0]);
375
+ }
376
+
377
+ /**
378
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
379
+ *
380
+ * @param {WitnessStack} witness_stack - A witness stack.
381
+ * @returns {Uint8Array} A compressed witness stack
382
+ */
383
+ export function compressWitnessStack(witness_stack) {
384
+ const ret = wasm.compressWitnessStack(witness_stack);
385
+ if (ret[3]) {
386
+ throw takeFromExternrefTable0(ret[2]);
387
+ }
388
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
389
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
390
+ return v1;
391
+ }
392
+
393
+ /**
394
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
395
+ *
396
+ * @param {Uint8Array} compressed_witness - A compressed witness.
397
+ * @returns {WitnessStack} The decompressed witness stack.
398
+ */
399
+ export function decompressWitnessStack(compressed_witness) {
400
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
401
+ const len0 = WASM_VECTOR_LEN;
402
+ const ret = wasm.decompressWitnessStack(ptr0, len0);
403
+ if (ret[2]) {
404
+ throw takeFromExternrefTable0(ret[1]);
405
+ }
406
+ return takeFromExternrefTable0(ret[0]);
407
+ }
408
+
410
409
  /**
411
410
  * Performs a bitwise AND operation between `lhs` and `rhs`
412
411
  * @param {string} lhs
@@ -523,15 +522,15 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
523
522
  }
524
523
 
525
524
  function __wbg_adapter_30(arg0, arg1, arg2) {
526
- wasm.closure576_externref_shim(arg0, arg1, arg2);
525
+ wasm.closure447_externref_shim(arg0, arg1, arg2);
527
526
  }
528
527
 
529
528
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
530
- wasm.closure1171_externref_shim(arg0, arg1, arg2, arg3, arg4);
529
+ wasm.closure932_externref_shim(arg0, arg1, arg2, arg3, arg4);
531
530
  }
532
531
 
533
532
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
534
- wasm.closure1175_externref_shim(arg0, arg1, arg2, arg3);
533
+ wasm.closure936_externref_shim(arg0, arg1, arg2, arg3);
535
534
  }
536
535
 
537
536
  async function __wbg_load(module, imports) {
@@ -580,11 +579,11 @@ function __wbg_get_imports() {
580
579
  const ret = arg0.call(arg1, arg2, arg3);
581
580
  return ret;
582
581
  }, arguments) };
583
- imports.wbg.__wbg_constructor_3aef6db465a4d40f = function(arg0) {
582
+ imports.wbg.__wbg_constructor_536364f6bcd4616b = function(arg0) {
584
583
  const ret = new Error(arg0);
585
584
  return ret;
586
585
  };
587
- imports.wbg.__wbg_constructor_9cd41836d6991f28 = function(arg0) {
586
+ imports.wbg.__wbg_constructor_66e92e9c3ecae9e8 = function(arg0) {
588
587
  const ret = new Error(arg0);
589
588
  return ret;
590
589
  };
@@ -697,7 +696,7 @@ function __wbg_get_imports() {
697
696
  const ret = new Error();
698
697
  return ret;
699
698
  };
700
- imports.wbg.__wbg_new_8e773a1674584163 = function() {
699
+ imports.wbg.__wbg_new_9f501325818b4158 = function() {
701
700
  const ret = new Array();
702
701
  return ret;
703
702
  };
@@ -705,7 +704,7 @@ function __wbg_get_imports() {
705
704
  const ret = new Error(getStringFromWasm0(arg0, arg1));
706
705
  return ret;
707
706
  };
708
- imports.wbg.__wbg_new_dd245daac54dc568 = function() {
707
+ imports.wbg.__wbg_new_ec40611a7805f1f0 = function() {
709
708
  const ret = new Map();
710
709
  return ret;
711
710
  };
@@ -797,8 +796,8 @@ function __wbg_get_imports() {
797
796
  const ret = false;
798
797
  return ret;
799
798
  };
800
- imports.wbg.__wbindgen_closure_wrapper1971 = function(arg0, arg1, arg2) {
801
- const ret = makeMutClosure(arg0, arg1, 577, __wbg_adapter_30);
799
+ imports.wbg.__wbindgen_closure_wrapper1447 = function(arg0, arg1, arg2) {
800
+ const ret = makeMutClosure(arg0, arg1, 448, __wbg_adapter_30);
802
801
  return ret;
803
802
  };
804
803
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
Binary file
@@ -2,17 +2,17 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const buildInfo: () => any;
5
- export const compressWitness: (a: any) => [number, number, number, number];
6
- export const decompressWitness: (a: number, b: number) => [number, number, number];
7
- export const compressWitnessStack: (a: any) => [number, number, number, number];
8
- export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
5
+ export const initLogLevel: (a: number, b: number) => [number, number];
9
6
  export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
10
7
  export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
11
8
  export const executeProgram: (a: number, b: number, c: any, d: any) => any;
12
- export const initLogLevel: (a: number, b: number) => [number, number];
13
9
  export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
14
10
  export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
15
11
  export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
12
+ export const compressWitness: (a: any) => [number, number, number, number];
13
+ export const decompressWitness: (a: number, b: number) => [number, number, number];
14
+ export const compressWitnessStack: (a: any) => [number, number, number, number];
15
+ export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
16
16
  export const and: (a: any, b: any) => any;
17
17
  export const xor: (a: any, b: any) => any;
18
18
  export const sha256_compression: (a: number, b: number, c: number, d: 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 closure576_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure1171_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure1175_externref_shim: (a: number, b: number, c: any, d: any) => 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;
33
33
  export const __wbindgen_start: () => void;