@noir-lang/acvm_js 0.46.0 → 0.47.0-1fabcde.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 +89 -106
- package/nodejs/acvm_js.js +211 -662
- 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 +99 -122
- package/web/acvm_js.js +213 -600
- 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
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
11
|
+
*
|
|
12
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
13
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
14
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
15
|
+
* @param {Uint8Array} program
|
|
16
|
+
* @param {WitnessMap} witness_map
|
|
17
|
+
* @returns {WitnessMap}
|
|
12
18
|
*/
|
|
13
|
-
export function
|
|
19
|
+
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
20
|
+
/**
|
|
21
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
22
|
+
*
|
|
23
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
24
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
25
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
26
|
+
* @param {Uint8Array} program
|
|
27
|
+
* @param {WitnessMap} solved_witness
|
|
28
|
+
* @returns {WitnessMap}
|
|
29
|
+
*/
|
|
30
|
+
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
31
|
+
/**
|
|
32
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
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 public inputs.
|
|
37
|
+
* @param {Uint8Array} program
|
|
38
|
+
* @param {WitnessMap} solved_witness
|
|
39
|
+
* @returns {WitnessMap}
|
|
40
|
+
*/
|
|
41
|
+
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
42
|
+
/**
|
|
43
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
44
|
+
*
|
|
45
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
46
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
47
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
48
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
49
|
+
*/
|
|
50
|
+
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
51
|
+
/**
|
|
52
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
53
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
54
|
+
*
|
|
55
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
56
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
57
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
58
|
+
* @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.
|
|
59
|
+
*/
|
|
60
|
+
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
61
|
+
/**
|
|
62
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
63
|
+
*
|
|
64
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
65
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
66
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
67
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
68
|
+
*/
|
|
69
|
+
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
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,93 +151,25 @@ 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
154
|
|
|
167
|
-
|
|
168
|
-
|
|
155
|
+
export type RawAssertionPayload = {
|
|
156
|
+
selector: string;
|
|
157
|
+
data: string[];
|
|
158
|
+
};
|
|
159
|
+
export type ExecutionError = Error & {
|
|
160
|
+
callStack?: string[];
|
|
161
|
+
rawAssertionPayload?: RawAssertionPayload;
|
|
162
|
+
};
|
|
169
163
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
export type SolvedAndReturnWitness = {
|
|
176
|
-
solvedWitness: WitnessMap;
|
|
177
|
-
returnWitness: WitnessMap;
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
export type StackItem = {
|
|
167
|
+
index: number;
|
|
168
|
+
witness: WitnessMap;
|
|
178
169
|
}
|
|
179
170
|
|
|
171
|
+
export type WitnessStack = Array<StackItem>;
|
|
172
|
+
|
|
180
173
|
|
|
181
174
|
|
|
182
175
|
/**
|
|
@@ -207,27 +200,17 @@ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => P
|
|
|
207
200
|
|
|
208
201
|
|
|
209
202
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
data: string[];
|
|
213
|
-
};
|
|
214
|
-
export type ExecutionError = Error & {
|
|
215
|
-
callStack?: string[];
|
|
216
|
-
rawAssertionPayload?: RawAssertionPayload;
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
|
|
203
|
+
// Map from witness index to hex string value of witness.
|
|
204
|
+
export type WitnessMap = Map<number, string>;
|
|
220
205
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
206
|
+
/**
|
|
207
|
+
* An execution result containing two witnesses.
|
|
208
|
+
* 1. The full solved witness of the execution.
|
|
209
|
+
* 2. The return witness which contains the given public return values within the full witness.
|
|
210
|
+
*/
|
|
211
|
+
export type SolvedAndReturnWitness = {
|
|
212
|
+
solvedWitness: WitnessMap;
|
|
213
|
+
returnWitness: WitnessMap;
|
|
224
214
|
}
|
|
225
215
|
|
|
226
|
-
export type WitnessStack = Array<StackItem>;
|
|
227
|
-
|
|
228
216
|
|
|
229
|
-
/**
|
|
230
|
-
*/
|
|
231
|
-
export class WasmBlackBoxFunctionSolver {
|
|
232
|
-
free(): void;
|
|
233
|
-
}
|