@noir-lang/acvm_js 0.46.0 → 0.47.0-318314d.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 +54 -71
- package/nodejs/acvm_js.js +234 -685
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +8 -14
- package/package.json +1 -1
- package/web/acvm_js.d.ts +62 -85
- package/web/acvm_js.js +200 -587
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +8 -14
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export function initLogLevel(a: number, b: number, c: number): void;
|
|
5
5
|
export function buildInfo(): number;
|
|
6
|
+
export function compressWitness(a: number, b: number): void;
|
|
7
|
+
export function decompressWitness(a: number, b: number, c: number): void;
|
|
8
|
+
export function compressWitnessStack(a: number, b: number): void;
|
|
9
|
+
export function decompressWitnessStack(a: number, b: number, c: number): void;
|
|
6
10
|
export function and(a: number, b: number): number;
|
|
7
11
|
export function xor(a: number, b: number): number;
|
|
8
12
|
export function sha256(a: number, b: number, c: number): void;
|
|
@@ -10,28 +14,18 @@ export function blake2s256(a: number, b: number, c: number): void;
|
|
|
10
14
|
export function keccak256(a: number, b: number, c: number): void;
|
|
11
15
|
export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
|
12
16
|
export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
|
13
|
-
export function compressWitness(a: number, b: number): void;
|
|
14
|
-
export function decompressWitness(a: number, b: number, c: number): void;
|
|
15
|
-
export function compressWitnessStack(a: number, b: number): void;
|
|
16
|
-
export function decompressWitnessStack(a: number, b: number, c: number): void;
|
|
17
|
-
export function __wbg_wasmblackboxfunctionsolver_free(a: number): void;
|
|
18
|
-
export function createBlackBoxSolver(): number;
|
|
19
17
|
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
20
|
-
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number
|
|
21
|
-
export function executeCircuitWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number;
|
|
18
|
+
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
|
|
22
19
|
export function executeProgram(a: number, b: number, c: number, d: number): number;
|
|
23
|
-
export function executeProgramWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number;
|
|
24
20
|
export function getReturnWitness(a: number, b: number, c: number, d: number): void;
|
|
25
21
|
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
|
|
26
22
|
export function getPublicWitness(a: number, b: number, c: number, d: number): void;
|
|
27
|
-
export function __wbg_trap_free(a: number): void;
|
|
28
|
-
export function trap___wbg_wasmer_trap(): void;
|
|
29
23
|
export function __wbindgen_malloc(a: number): number;
|
|
30
24
|
export function __wbindgen_realloc(a: number, b: number, c: number): number;
|
|
31
25
|
export const __wbindgen_export_2: WebAssembly.Table;
|
|
32
|
-
export function
|
|
26
|
+
export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h36bac5ff3ea3c380(a: number, b: number, c: number): void;
|
|
33
27
|
export function __wbindgen_add_to_stack_pointer(a: number): number;
|
|
34
28
|
export function __wbindgen_free(a: number, b: number): void;
|
|
29
|
+
export function wasm_bindgen__convert__closures__invoke3_mut__h629417323d5efbaa(a: number, b: number, c: number, d: number, e: number): void;
|
|
35
30
|
export function __wbindgen_exn_store(a: number): void;
|
|
36
|
-
export function
|
|
37
|
-
export function wasm_bindgen__convert__closures__invoke2_mut__h188e918906ff9a40(a: number, b: number, c: number, d: number): void;
|
|
31
|
+
export function wasm_bindgen__convert__closures__invoke2_mut__h4efdd1050cfb3ea7(a: number, b: number, c: number, d: number): void;
|
package/package.json
CHANGED
package/web/acvm_js.d.ts
CHANGED
|
@@ -12,6 +12,35 @@ export function initLogLevel(filter: string): void;
|
|
|
12
12
|
*/
|
|
13
13
|
export function buildInfo(): BuildInfo;
|
|
14
14
|
/**
|
|
15
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
16
|
+
*
|
|
17
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
18
|
+
* @returns {Uint8Array} A compressed witness map
|
|
19
|
+
*/
|
|
20
|
+
export function compressWitness(witness_map: WitnessMap): Uint8Array;
|
|
21
|
+
/**
|
|
22
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
23
|
+
* This should be used to only fetch the witness map for the main function.
|
|
24
|
+
*
|
|
25
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
26
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
27
|
+
*/
|
|
28
|
+
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
|
|
29
|
+
/**
|
|
30
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
31
|
+
*
|
|
32
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
33
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
34
|
+
*/
|
|
35
|
+
export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
36
|
+
/**
|
|
37
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
38
|
+
*
|
|
39
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
40
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
41
|
+
*/
|
|
42
|
+
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
43
|
+
/**
|
|
15
44
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
16
45
|
* @param {string} lhs
|
|
17
46
|
* @param {string} rhs
|
|
@@ -62,39 +91,6 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
|
|
|
62
91
|
*/
|
|
63
92
|
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
64
93
|
/**
|
|
65
|
-
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
66
|
-
*
|
|
67
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
68
|
-
* @returns {Uint8Array} A compressed witness map
|
|
69
|
-
*/
|
|
70
|
-
export function compressWitness(witness_map: WitnessMap): Uint8Array;
|
|
71
|
-
/**
|
|
72
|
-
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
73
|
-
* This should be used to only fetch the witness map for the main function.
|
|
74
|
-
*
|
|
75
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
76
|
-
* @returns {WitnessMap} The decompressed witness map.
|
|
77
|
-
*/
|
|
78
|
-
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
|
|
79
|
-
/**
|
|
80
|
-
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
81
|
-
*
|
|
82
|
-
* @param {WitnessStack} witness_stack - A witness stack.
|
|
83
|
-
* @returns {Uint8Array} A compressed witness stack
|
|
84
|
-
*/
|
|
85
|
-
export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
86
|
-
/**
|
|
87
|
-
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
88
|
-
*
|
|
89
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
90
|
-
* @returns {WitnessStack} The decompressed witness stack.
|
|
91
|
-
*/
|
|
92
|
-
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
93
|
-
/**
|
|
94
|
-
* @returns {Promise<WasmBlackBoxFunctionSolver>}
|
|
95
|
-
*/
|
|
96
|
-
export function createBlackBoxSolver(): Promise<WasmBlackBoxFunctionSolver>;
|
|
97
|
-
/**
|
|
98
94
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
99
95
|
*
|
|
100
96
|
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
@@ -107,30 +103,22 @@ export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap,
|
|
|
107
103
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
108
104
|
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
109
105
|
*
|
|
110
|
-
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
|
|
111
106
|
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
112
107
|
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
113
108
|
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
114
109
|
* @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
110
|
*/
|
|
116
|
-
export function executeCircuitWithReturnWitness(
|
|
111
|
+
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
117
112
|
/**
|
|
118
113
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
119
114
|
*
|
|
120
|
-
* @param {
|
|
121
|
-
* @param {
|
|
122
|
-
* @param {
|
|
123
|
-
* @
|
|
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
|
-
/**
|
|
115
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
116
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
117
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
118
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
128
119
|
*/
|
|
129
120
|
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
130
121
|
/**
|
|
131
|
-
*/
|
|
132
|
-
export function executeProgramWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_executor: ForeignCallHandler): Promise<WitnessStack>;
|
|
133
|
-
/**
|
|
134
122
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
135
123
|
*
|
|
136
124
|
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
@@ -164,21 +152,6 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
164
152
|
*/
|
|
165
153
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
166
154
|
|
|
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
155
|
/**
|
|
183
156
|
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
184
157
|
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
@@ -193,6 +166,15 @@ export type BuildInfo = {
|
|
|
193
166
|
|
|
194
167
|
|
|
195
168
|
|
|
169
|
+
export type StackItem = {
|
|
170
|
+
index: number;
|
|
171
|
+
witness: WitnessMap;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export type WitnessStack = Array<StackItem>;
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
196
178
|
export type ForeignCallInput = string[]
|
|
197
179
|
export type ForeignCallOutput = string | string[]
|
|
198
180
|
|
|
@@ -218,26 +200,31 @@ export type ExecutionError = Error & {
|
|
|
218
200
|
|
|
219
201
|
|
|
220
202
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
witness: WitnessMap;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
export type WitnessStack = Array<StackItem>;
|
|
227
|
-
|
|
203
|
+
// Map from witness index to hex string value of witness.
|
|
204
|
+
export type WitnessMap = Map<number, string>;
|
|
228
205
|
|
|
229
206
|
/**
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
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;
|
|
233
214
|
}
|
|
234
215
|
|
|
216
|
+
|
|
217
|
+
|
|
235
218
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
236
219
|
|
|
237
220
|
export interface InitOutput {
|
|
238
221
|
readonly memory: WebAssembly.Memory;
|
|
239
222
|
readonly initLogLevel: (a: number, b: number, c: number) => void;
|
|
240
223
|
readonly buildInfo: () => number;
|
|
224
|
+
readonly compressWitness: (a: number, b: number) => void;
|
|
225
|
+
readonly decompressWitness: (a: number, b: number, c: number) => void;
|
|
226
|
+
readonly compressWitnessStack: (a: number, b: number) => void;
|
|
227
|
+
readonly decompressWitnessStack: (a: number, b: number, c: number) => void;
|
|
241
228
|
readonly and: (a: number, b: number) => number;
|
|
242
229
|
readonly xor: (a: number, b: number) => number;
|
|
243
230
|
readonly sha256: (a: number, b: number, c: number) => void;
|
|
@@ -245,31 +232,21 @@ export interface InitOutput {
|
|
|
245
232
|
readonly keccak256: (a: number, b: number, c: number) => void;
|
|
246
233
|
readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
247
234
|
readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
248
|
-
readonly compressWitness: (a: number, b: number) => void;
|
|
249
|
-
readonly decompressWitness: (a: number, b: number, c: number) => void;
|
|
250
|
-
readonly compressWitnessStack: (a: number, b: number) => void;
|
|
251
|
-
readonly decompressWitnessStack: (a: number, b: number, c: number) => void;
|
|
252
|
-
readonly __wbg_wasmblackboxfunctionsolver_free: (a: number) => void;
|
|
253
|
-
readonly createBlackBoxSolver: () => number;
|
|
254
235
|
readonly executeCircuit: (a: number, b: number, c: number, d: number) => number;
|
|
255
|
-
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: number, d: number
|
|
256
|
-
readonly executeCircuitWithBlackBoxSolver: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
236
|
+
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: number, d: number) => number;
|
|
257
237
|
readonly executeProgram: (a: number, b: number, c: number, d: number) => number;
|
|
258
|
-
readonly executeProgramWithBlackBoxSolver: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
259
238
|
readonly getReturnWitness: (a: number, b: number, c: number, d: number) => void;
|
|
260
239
|
readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void;
|
|
261
240
|
readonly getPublicWitness: (a: number, b: number, c: number, d: number) => void;
|
|
262
|
-
readonly __wbg_trap_free: (a: number) => void;
|
|
263
|
-
readonly trap___wbg_wasmer_trap: () => void;
|
|
264
241
|
readonly __wbindgen_malloc: (a: number) => number;
|
|
265
242
|
readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
|
|
266
243
|
readonly __wbindgen_export_2: WebAssembly.Table;
|
|
267
|
-
readonly
|
|
244
|
+
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h36bac5ff3ea3c380: (a: number, b: number, c: number) => void;
|
|
268
245
|
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
269
246
|
readonly __wbindgen_free: (a: number, b: number) => void;
|
|
247
|
+
readonly wasm_bindgen__convert__closures__invoke3_mut__h629417323d5efbaa: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
270
248
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
271
|
-
readonly
|
|
272
|
-
readonly wasm_bindgen__convert__closures__invoke2_mut__h188e918906ff9a40: (a: number, b: number, c: number, d: number) => void;
|
|
249
|
+
readonly wasm_bindgen__convert__closures__invoke2_mut__h4efdd1050cfb3ea7: (a: number, b: number, c: number, d: number) => void;
|
|
273
250
|
}
|
|
274
251
|
|
|
275
252
|
export type SyncInitInput = BufferSource | WebAssembly.Module;
|