@noir-lang/acvm_js 0.45.0 → 0.46.0-1849389.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 +87 -99
- package/nodejs/acvm_js.js +224 -675
- 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 +97 -115
- package/web/acvm_js.js +206 -593
- 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
|
@@ -1,6 +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
|
+
/**
|
|
65
|
+
* Sets the package's logging level.
|
|
66
|
+
*
|
|
67
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
68
|
+
*/
|
|
69
|
+
export function initLogLevel(filter: string): void;
|
|
70
|
+
/**
|
|
4
71
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
5
72
|
* @param {string} lhs
|
|
6
73
|
* @param {string} rhs
|
|
@@ -56,45 +123,6 @@ export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_byte
|
|
|
56
123
|
*/
|
|
57
124
|
export function buildInfo(): BuildInfo;
|
|
58
125
|
/**
|
|
59
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
60
|
-
*
|
|
61
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
62
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
63
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
64
|
-
* @param {Uint8Array} program
|
|
65
|
-
* @param {WitnessMap} witness_map
|
|
66
|
-
* @returns {WitnessMap}
|
|
67
|
-
*/
|
|
68
|
-
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
69
|
-
/**
|
|
70
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
71
|
-
*
|
|
72
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
73
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
74
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
75
|
-
* @param {Uint8Array} program
|
|
76
|
-
* @param {WitnessMap} solved_witness
|
|
77
|
-
* @returns {WitnessMap}
|
|
78
|
-
*/
|
|
79
|
-
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
80
|
-
/**
|
|
81
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
82
|
-
*
|
|
83
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
84
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
85
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
86
|
-
* @param {Uint8Array} program
|
|
87
|
-
* @param {WitnessMap} solved_witness
|
|
88
|
-
* @returns {WitnessMap}
|
|
89
|
-
*/
|
|
90
|
-
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
91
|
-
/**
|
|
92
|
-
* Sets the package's logging level.
|
|
93
|
-
*
|
|
94
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
95
|
-
*/
|
|
96
|
-
export function initLogLevel(filter: string): void;
|
|
97
|
-
/**
|
|
98
126
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
99
127
|
*
|
|
100
128
|
* @param {WitnessMap} witness_map - A witness map.
|
|
@@ -123,49 +151,14 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
|
123
151
|
* @returns {WitnessStack} The decompressed witness stack.
|
|
124
152
|
*/
|
|
125
153
|
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>;
|
|
166
154
|
|
|
155
|
+
export type RawAssertionPayload = {
|
|
156
|
+
selector: string;
|
|
157
|
+
data: string[];
|
|
158
|
+
};
|
|
167
159
|
export type ExecutionError = Error & {
|
|
168
160
|
callStack?: string[];
|
|
161
|
+
rawAssertionPayload?: RawAssertionPayload;
|
|
169
162
|
};
|
|
170
163
|
|
|
171
164
|
|
|
@@ -185,18 +178,13 @@ export type SolvedAndReturnWitness = {
|
|
|
185
178
|
|
|
186
179
|
|
|
187
180
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
* @property {string} version - The version of the package at the built git commit.
|
|
192
|
-
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
193
|
-
*/
|
|
194
|
-
export type BuildInfo = {
|
|
195
|
-
gitHash: string;
|
|
196
|
-
version: string;
|
|
197
|
-
dirty: string;
|
|
181
|
+
export type StackItem = {
|
|
182
|
+
index: number;
|
|
183
|
+
witness: WitnessMap;
|
|
198
184
|
}
|
|
199
185
|
|
|
186
|
+
export type WitnessStack = Array<StackItem>;
|
|
187
|
+
|
|
200
188
|
|
|
201
189
|
|
|
202
190
|
export type ForeignCallInput = string[]
|
|
@@ -213,16 +201,16 @@ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => P
|
|
|
213
201
|
|
|
214
202
|
|
|
215
203
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
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;
|
|
219
214
|
}
|
|
220
215
|
|
|
221
|
-
export type WitnessStack = Array<StackItem>;
|
|
222
|
-
|
|
223
216
|
|
|
224
|
-
/**
|
|
225
|
-
*/
|
|
226
|
-
export class WasmBlackBoxFunctionSolver {
|
|
227
|
-
free(): void;
|
|
228
|
-
}
|