@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.
@@ -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,27 +201,16 @@ 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
- }