@noir-lang/acvm_js 0.46.0 → 0.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
@@ -1,8 +1,13 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
+ export function executeCircuit(a: number, b: number, c: number, d: number): number;
5
+ export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
6
+ export function executeProgram(a: number, b: number, c: number, d: number): number;
7
+ export function getReturnWitness(a: number, b: number, c: number, d: number): void;
8
+ export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
9
+ export function getPublicWitness(a: number, b: number, c: number, d: number): void;
4
10
  export function initLogLevel(a: number, b: number, c: number): void;
5
- export function buildInfo(): number;
6
11
  export function and(a: number, b: number): number;
7
12
  export function xor(a: number, b: number): number;
8
13
  export function sha256(a: number, b: number, c: number): void;
@@ -10,28 +15,17 @@ export function blake2s256(a: number, b: number, c: number): void;
10
15
  export function keccak256(a: number, b: number, c: number): void;
11
16
  export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
12
17
  export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
18
+ export function buildInfo(): number;
13
19
  export function compressWitness(a: number, b: number): void;
14
20
  export function decompressWitness(a: number, b: number, c: number): void;
15
21
  export function compressWitnessStack(a: number, b: number): void;
16
22
  export function decompressWitnessStack(a: number, b: number, c: number): void;
17
- export function __wbg_wasmblackboxfunctionsolver_free(a: number): void;
18
- export function createBlackBoxSolver(): number;
19
- export function executeCircuit(a: number, b: number, c: number, d: number): number;
20
- export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number, e: number): number;
21
- export function executeCircuitWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number;
22
- export function executeProgram(a: number, b: number, c: number, d: number): number;
23
- export function executeProgramWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number;
24
- export function getReturnWitness(a: number, b: number, c: number, d: number): void;
25
- export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
26
- export function getPublicWitness(a: number, b: number, c: number, d: number): void;
27
- export function __wbg_trap_free(a: number): void;
28
- export function trap___wbg_wasmer_trap(): void;
29
23
  export function __wbindgen_malloc(a: number): number;
30
24
  export function __wbindgen_realloc(a: number, b: number, c: number): number;
31
25
  export const __wbindgen_export_2: WebAssembly.Table;
32
- export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hc5258430255de068(a: number, b: number, c: number): void;
26
+ export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h36bac5ff3ea3c380(a: number, b: number, c: number): void;
33
27
  export function __wbindgen_add_to_stack_pointer(a: number): number;
34
28
  export function __wbindgen_free(a: number, b: number): void;
29
+ export function wasm_bindgen__convert__closures__invoke3_mut__h629417323d5efbaa(a: number, b: number, c: number, d: number, e: number): void;
35
30
  export function __wbindgen_exn_store(a: number): void;
36
- export function wasm_bindgen__convert__closures__invoke3_mut__h1e7d8ac96c74bd35(a: number, b: number, c: number, d: number, e: number): void;
37
- export function wasm_bindgen__convert__closures__invoke2_mut__h188e918906ff9a40(a: number, b: number, c: number, d: number): void;
31
+ export function wasm_bindgen__convert__closures__invoke2_mut__h4efdd1050cfb3ea7(a: number, b: number, c: number, d: number): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noir-lang/acvm_js",
3
- "version": "0.46.0",
3
+ "version": "0.47.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/web/acvm_js.d.ts CHANGED
@@ -1,17 +1,73 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
5
+ *
6
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
7
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
8
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
9
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
10
+ */
11
+ export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
12
+ /**
13
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
14
+ * This method also extracts the public return values from the solved witness into its own return witness.
15
+ *
16
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
17
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
18
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
19
+ * @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.
20
+ */
21
+ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
22
+ /**
23
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
24
+ *
25
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
26
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
27
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
28
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
29
+ */
30
+ export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
31
+ /**
32
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
33
+ *
34
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
35
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
36
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
37
+ * @param {Uint8Array} program
38
+ * @param {WitnessMap} witness_map
39
+ * @returns {WitnessMap}
40
+ */
41
+ export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
42
+ /**
43
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
44
+ *
45
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
46
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
47
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
48
+ * @param {Uint8Array} program
49
+ * @param {WitnessMap} solved_witness
50
+ * @returns {WitnessMap}
51
+ */
52
+ export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
53
+ /**
54
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
55
+ *
56
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
57
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
58
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
59
+ * @param {Uint8Array} program
60
+ * @param {WitnessMap} solved_witness
61
+ * @returns {WitnessMap}
62
+ */
63
+ export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
64
+ /**
4
65
  * Sets the package's logging level.
5
66
  *
6
67
  * @param {LogLevel} level - The maximum level of logging to be emitted.
7
68
  */
8
69
  export function initLogLevel(filter: string): void;
9
70
  /**
10
- * Returns the `BuildInfo` object containing information about how the installed package was built.
11
- * @returns {BuildInfo} - Information on how the installed package was built.
12
- */
13
- export function buildInfo(): BuildInfo;
14
- /**
15
71
  * Performs a bitwise AND operation between `lhs` and `rhs`
16
72
  * @param {string} lhs
17
73
  * @param {string} rhs
@@ -62,6 +118,11 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
62
118
  */
63
119
  export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
64
120
  /**
121
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
122
+ * @returns {BuildInfo} - Information on how the installed package was built.
123
+ */
124
+ export function buildInfo(): BuildInfo;
125
+ /**
65
126
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
66
127
  *
67
128
  * @param {WitnessMap} witness_map - A witness map.
@@ -90,79 +151,17 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
90
151
  * @returns {WitnessStack} The decompressed witness stack.
91
152
  */
92
153
  export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
93
- /**
94
- * @returns {Promise<WasmBlackBoxFunctionSolver>}
95
- */
96
- export function createBlackBoxSolver(): Promise<WasmBlackBoxFunctionSolver>;
97
- /**
98
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
99
- *
100
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
101
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
102
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
103
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
104
- */
105
- export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
106
- /**
107
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
108
- * This method also extracts the public return values from the solved witness into its own return witness.
109
- *
110
- * @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
111
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
112
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
113
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
114
- * @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.
115
- */
116
- export function executeCircuitWithReturnWitness(solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
117
- /**
118
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
119
- *
120
- * @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
121
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
122
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
123
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
124
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
125
- */
126
- export function executeCircuitWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
127
- /**
128
- */
129
- export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
130
- /**
131
- */
132
- export function executeProgramWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_executor: ForeignCallHandler): Promise<WitnessStack>;
133
- /**
134
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
135
- *
136
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
137
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
138
- * @returns {WitnessMap} A witness map containing the circuit's return values.
139
- * @param {Uint8Array} program
140
- * @param {WitnessMap} witness_map
141
- * @returns {WitnessMap}
142
- */
143
- export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
144
- /**
145
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
146
- *
147
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
148
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
149
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
150
- * @param {Uint8Array} program
151
- * @param {WitnessMap} solved_witness
152
- * @returns {WitnessMap}
153
- */
154
- export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
155
- /**
156
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
157
- *
158
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
159
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
160
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
161
- * @param {Uint8Array} program
162
- * @param {WitnessMap} solved_witness
163
- * @returns {WitnessMap}
164
- */
165
- export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
154
+
155
+ export type RawAssertionPayload = {
156
+ selector: string;
157
+ data: string[];
158
+ };
159
+ export type ExecutionError = Error & {
160
+ callStack?: string[];
161
+ rawAssertionPayload?: RawAssertionPayload;
162
+ };
163
+
164
+
166
165
 
167
166
  // Map from witness index to hex string value of witness.
168
167
  export type WitnessMap = Map<number, string>;
@@ -179,18 +178,13 @@ export type SolvedAndReturnWitness = {
179
178
 
180
179
 
181
180
 
182
- /**
183
- * @typedef {Object} BuildInfo - Information about how the installed package was built
184
- * @property {string} gitHash - The hash of the git commit from which the package was built.
185
- * @property {string} version - The version of the package at the built git commit.
186
- * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
187
- */
188
- export type BuildInfo = {
189
- gitHash: string;
190
- version: string;
191
- dirty: string;
181
+ export type StackItem = {
182
+ index: number;
183
+ witness: WitnessMap;
192
184
  }
193
185
 
186
+ export type WitnessStack = Array<StackItem>;
187
+
194
188
 
195
189
 
196
190
  export type ForeignCallInput = string[]
@@ -207,37 +201,31 @@ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => P
207
201
 
208
202
 
209
203
 
210
- export type RawAssertionPayload = {
211
- selector: string;
212
- data: string[];
213
- };
214
- export type ExecutionError = Error & {
215
- callStack?: string[];
216
- rawAssertionPayload?: RawAssertionPayload;
217
- };
218
-
219
-
220
-
221
- export type StackItem = {
222
- index: number;
223
- witness: WitnessMap;
204
+ /**
205
+ * @typedef {Object} BuildInfo - Information about how the installed package was built
206
+ * @property {string} gitHash - The hash of the git commit from which the package was built.
207
+ * @property {string} version - The version of the package at the built git commit.
208
+ * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
209
+ */
210
+ export type BuildInfo = {
211
+ gitHash: string;
212
+ version: string;
213
+ dirty: string;
224
214
  }
225
215
 
226
- export type WitnessStack = Array<StackItem>;
227
-
228
216
 
229
- /**
230
- */
231
- export class WasmBlackBoxFunctionSolver {
232
- free(): void;
233
- }
234
217
 
235
218
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
236
219
 
237
220
  export interface InitOutput {
238
221
  readonly memory: WebAssembly.Memory;
222
+ readonly executeCircuit: (a: number, b: number, c: number, d: number) => number;
223
+ readonly executeCircuitWithReturnWitness: (a: number, b: number, c: number, d: number) => number;
224
+ readonly executeProgram: (a: number, b: number, c: number, d: number) => number;
225
+ readonly getReturnWitness: (a: number, b: number, c: number, d: number) => void;
226
+ readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void;
227
+ readonly getPublicWitness: (a: number, b: number, c: number, d: number) => void;
239
228
  readonly initLogLevel: (a: number, b: number, c: number) => void;
240
- readonly buildInfo: () => number;
241
229
  readonly and: (a: number, b: number) => number;
242
230
  readonly xor: (a: number, b: number) => number;
243
231
  readonly sha256: (a: number, b: number, c: number) => void;
@@ -245,31 +233,20 @@ export interface InitOutput {
245
233
  readonly keccak256: (a: number, b: number, c: number) => void;
246
234
  readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
247
235
  readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
236
+ readonly buildInfo: () => number;
248
237
  readonly compressWitness: (a: number, b: number) => void;
249
238
  readonly decompressWitness: (a: number, b: number, c: number) => void;
250
239
  readonly compressWitnessStack: (a: number, b: number) => void;
251
240
  readonly decompressWitnessStack: (a: number, b: number, c: number) => void;
252
- readonly __wbg_wasmblackboxfunctionsolver_free: (a: number) => void;
253
- readonly createBlackBoxSolver: () => number;
254
- readonly executeCircuit: (a: number, b: number, c: number, d: number) => number;
255
- readonly executeCircuitWithReturnWitness: (a: number, b: number, c: number, d: number, e: number) => number;
256
- readonly executeCircuitWithBlackBoxSolver: (a: number, b: number, c: number, d: number, e: number) => number;
257
- readonly executeProgram: (a: number, b: number, c: number, d: number) => number;
258
- readonly executeProgramWithBlackBoxSolver: (a: number, b: number, c: number, d: number, e: number) => number;
259
- readonly getReturnWitness: (a: number, b: number, c: number, d: number) => void;
260
- readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void;
261
- readonly getPublicWitness: (a: number, b: number, c: number, d: number) => void;
262
- readonly __wbg_trap_free: (a: number) => void;
263
- readonly trap___wbg_wasmer_trap: () => void;
264
241
  readonly __wbindgen_malloc: (a: number) => number;
265
242
  readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
266
243
  readonly __wbindgen_export_2: WebAssembly.Table;
267
- readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hc5258430255de068: (a: number, b: number, c: number) => void;
244
+ readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h36bac5ff3ea3c380: (a: number, b: number, c: number) => void;
268
245
  readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
269
246
  readonly __wbindgen_free: (a: number, b: number) => void;
247
+ readonly wasm_bindgen__convert__closures__invoke3_mut__h629417323d5efbaa: (a: number, b: number, c: number, d: number, e: number) => void;
270
248
  readonly __wbindgen_exn_store: (a: number) => void;
271
- readonly wasm_bindgen__convert__closures__invoke3_mut__h1e7d8ac96c74bd35: (a: number, b: number, c: number, d: number, e: number) => void;
272
- readonly wasm_bindgen__convert__closures__invoke2_mut__h188e918906ff9a40: (a: number, b: number, c: number, d: number) => void;
249
+ readonly wasm_bindgen__convert__closures__invoke2_mut__h4efdd1050cfb3ea7: (a: number, b: number, c: number, d: number) => void;
273
250
  }
274
251
 
275
252
  export type SyncInitInput = BufferSource | WebAssembly.Module;