@noir-lang/acvm_js 0.43.0-9cc03a4.nightly → 0.44.0-1ec9cdc.nightly

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,75 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
5
- *
6
- * @param {WitnessMap} witness_map - A witness map.
7
- * @returns {Uint8Array} A compressed witness map
8
- */
9
- export function compressWitness(witness_map: WitnessMap): Uint8Array;
10
- /**
11
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
12
- * This should be used to only fetch the witness map for the main function.
13
- *
14
- * @param {Uint8Array} compressed_witness - A compressed witness.
15
- * @returns {WitnessMap} The decompressed witness map.
16
- */
17
- export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
18
- /**
19
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
20
- *
21
- * @param {WitnessStack} witness_stack - A witness stack.
22
- * @returns {Uint8Array} A compressed witness stack
23
- */
24
- export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
25
- /**
26
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
27
- *
28
- * @param {Uint8Array} compressed_witness - A compressed witness.
29
- * @returns {WitnessStack} The decompressed witness stack.
30
- */
31
- export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
32
- /**
33
- * @returns {Promise<WasmBlackBoxFunctionSolver>}
34
- */
35
- export function createBlackBoxSolver(): Promise<WasmBlackBoxFunctionSolver>;
36
- /**
37
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
38
- *
39
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
40
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
41
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
42
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
43
- */
44
- export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
45
- /**
46
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
47
- * This method also extracts the public return values from the solved witness into its own return witness.
48
- *
49
- * @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
50
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
51
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
52
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
53
- * @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.
54
- */
55
- export function executeCircuitWithReturnWitness(solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
56
- /**
57
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
58
- *
59
- * @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
60
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
61
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
62
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
63
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
64
- */
65
- export function executeCircuitWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
66
- /**
67
- */
68
- export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
69
- /**
70
- */
71
- export function executeProgramWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_executor: ForeignCallHandler): Promise<WitnessStack>;
72
- /**
73
4
  * Performs a bitwise AND operation between `lhs` and `rhs`
74
5
  * @param {string} lhs
75
6
  * @param {string} rhs
@@ -120,11 +51,10 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
120
51
  */
121
52
  export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
122
53
  /**
123
- * Sets the package's logging level.
124
- *
125
- * @param {LogLevel} level - The maximum level of logging to be emitted.
54
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
55
+ * @returns {BuildInfo} - Information on how the installed package was built.
126
56
  */
127
- export function initLogLevel(filter: string): void;
57
+ export function buildInfo(): BuildInfo;
128
58
  /**
129
59
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
130
60
  *
@@ -159,24 +89,80 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
159
89
  */
160
90
  export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
161
91
  /**
162
- * Returns the `BuildInfo` object containing information about how the installed package was built.
163
- * @returns {BuildInfo} - Information on how the installed package was built.
92
+ * Sets the package's logging level.
93
+ *
94
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
164
95
  */
165
- export function buildInfo(): BuildInfo;
166
-
167
- export type ForeignCallInput = string[]
168
- export type ForeignCallOutput = string | string[]
169
-
96
+ export function initLogLevel(filter: string): void;
170
97
  /**
171
- * A callback which performs an foreign call and returns the response.
172
- * @callback ForeignCallHandler
173
- * @param {string} name - The identifier for the type of foreign call being performed.
174
- * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
175
- * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
98
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
99
+ *
100
+ * @param {WitnessMap} witness_map - A witness map.
101
+ * @returns {Uint8Array} A compressed witness map
176
102
  */
177
- export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
178
-
179
-
103
+ export function compressWitness(witness_map: WitnessMap): Uint8Array;
104
+ /**
105
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
106
+ * This should be used to only fetch the witness map for the main function.
107
+ *
108
+ * @param {Uint8Array} compressed_witness - A compressed witness.
109
+ * @returns {WitnessMap} The decompressed witness map.
110
+ */
111
+ export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
112
+ /**
113
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
114
+ *
115
+ * @param {WitnessStack} witness_stack - A witness stack.
116
+ * @returns {Uint8Array} A compressed witness stack
117
+ */
118
+ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
119
+ /**
120
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
121
+ *
122
+ * @param {Uint8Array} compressed_witness - A compressed witness.
123
+ * @returns {WitnessStack} The decompressed witness stack.
124
+ */
125
+ export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
126
+ /**
127
+ * @returns {Promise<WasmBlackBoxFunctionSolver>}
128
+ */
129
+ export function createBlackBoxSolver(): Promise<WasmBlackBoxFunctionSolver>;
130
+ /**
131
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
132
+ *
133
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
134
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
135
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
136
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
137
+ */
138
+ export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
139
+ /**
140
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
141
+ * This method also extracts the public return values from the solved witness into its own return witness.
142
+ *
143
+ * @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
144
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
145
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
146
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
147
+ * @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.
148
+ */
149
+ export function executeCircuitWithReturnWitness(solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
150
+ /**
151
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
152
+ *
153
+ * @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
154
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
155
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
156
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
157
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
158
+ */
159
+ export function executeCircuitWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
160
+ /**
161
+ */
162
+ export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
163
+ /**
164
+ */
165
+ export function executeProgramWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_executor: ForeignCallHandler): Promise<WitnessStack>;
180
166
 
181
167
  export type ExecutionError = Error & {
182
168
  callStack?: string[];
@@ -213,6 +199,20 @@ export type BuildInfo = {
213
199
 
214
200
 
215
201
 
202
+ export type ForeignCallInput = string[]
203
+ export type ForeignCallOutput = string | string[]
204
+
205
+ /**
206
+ * A callback which performs an foreign call and returns the response.
207
+ * @callback ForeignCallHandler
208
+ * @param {string} name - The identifier for the type of foreign call being performed.
209
+ * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
210
+ * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
211
+ */
212
+ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
213
+
214
+
215
+
216
216
  export type StackItem = {
217
217
  index: number;
218
218
  witness: WitnessMap;