@noir-lang/acvm_js 0.46.0 → 0.47.0-03e25b4.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.
- package/nodejs/acvm_js.d.ts +95 -112
- package/nodejs/acvm_js.js +194 -645
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +10 -16
- package/package.json +1 -1
- package/web/acvm_js.d.ts +105 -128
- package/web/acvm_js.js +214 -601
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +10 -16
package/nodejs/acvm_js.d.ts
CHANGED
|
@@ -7,10 +7,66 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export function initLogLevel(filter: string): void;
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
11
|
+
*
|
|
12
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
13
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
14
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
15
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
12
16
|
*/
|
|
13
|
-
export function
|
|
17
|
+
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
18
|
+
/**
|
|
19
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
20
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
21
|
+
*
|
|
22
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
23
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
24
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
25
|
+
* @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.
|
|
26
|
+
*/
|
|
27
|
+
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
28
|
+
/**
|
|
29
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
30
|
+
*
|
|
31
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
32
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
33
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
34
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
35
|
+
*/
|
|
36
|
+
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
37
|
+
/**
|
|
38
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
39
|
+
*
|
|
40
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
41
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
42
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
43
|
+
* @param {Uint8Array} program
|
|
44
|
+
* @param {WitnessMap} witness_map
|
|
45
|
+
* @returns {WitnessMap}
|
|
46
|
+
*/
|
|
47
|
+
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
48
|
+
/**
|
|
49
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
50
|
+
*
|
|
51
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
52
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
53
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
54
|
+
* @param {Uint8Array} program
|
|
55
|
+
* @param {WitnessMap} solved_witness
|
|
56
|
+
* @returns {WitnessMap}
|
|
57
|
+
*/
|
|
58
|
+
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
59
|
+
/**
|
|
60
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
61
|
+
*
|
|
62
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
63
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
64
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
65
|
+
* @param {Uint8Array} program
|
|
66
|
+
* @param {WitnessMap} solved_witness
|
|
67
|
+
* @returns {WitnessMap}
|
|
68
|
+
*/
|
|
69
|
+
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
14
70
|
/**
|
|
15
71
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
16
72
|
* @param {string} lhs
|
|
@@ -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,108 +151,6 @@ 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;
|
|
166
|
-
|
|
167
|
-
// Map from witness index to hex string value of witness.
|
|
168
|
-
export type WitnessMap = Map<number, string>;
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* An execution result containing two witnesses.
|
|
172
|
-
* 1. The full solved witness of the execution.
|
|
173
|
-
* 2. The return witness which contains the given public return values within the full witness.
|
|
174
|
-
*/
|
|
175
|
-
export type SolvedAndReturnWitness = {
|
|
176
|
-
solvedWitness: WitnessMap;
|
|
177
|
-
returnWitness: WitnessMap;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
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;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
|
|
195
154
|
|
|
196
155
|
export type ForeignCallInput = string[]
|
|
197
156
|
export type ForeignCallOutput = string | string[]
|
|
@@ -207,6 +166,15 @@ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => P
|
|
|
207
166
|
|
|
208
167
|
|
|
209
168
|
|
|
169
|
+
export type StackItem = {
|
|
170
|
+
index: number;
|
|
171
|
+
witness: WitnessMap;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export type WitnessStack = Array<StackItem>;
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
210
178
|
export type RawAssertionPayload = {
|
|
211
179
|
selector: string;
|
|
212
180
|
data: string[];
|
|
@@ -218,16 +186,31 @@ export type ExecutionError = Error & {
|
|
|
218
186
|
|
|
219
187
|
|
|
220
188
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
189
|
+
// Map from witness index to hex string value of witness.
|
|
190
|
+
export type WitnessMap = Map<number, string>;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* An execution result containing two witnesses.
|
|
194
|
+
* 1. The full solved witness of the execution.
|
|
195
|
+
* 2. The return witness which contains the given public return values within the full witness.
|
|
196
|
+
*/
|
|
197
|
+
export type SolvedAndReturnWitness = {
|
|
198
|
+
solvedWitness: WitnessMap;
|
|
199
|
+
returnWitness: WitnessMap;
|
|
224
200
|
}
|
|
225
201
|
|
|
226
|
-
export type WitnessStack = Array<StackItem>;
|
|
227
202
|
|
|
228
203
|
|
|
229
204
|
/**
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
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;
|
|
233
214
|
}
|
|
215
|
+
|
|
216
|
+
|