@aztec/noir-acvm_js 3.0.0-canary.a9708bd → 3.0.0-devnet.20251212
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 +88 -88
- package/nodejs/acvm_js.js +134 -134
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +10 -10
- package/package.json +3 -3
- package/web/acvm_js.d.ts +98 -98
- package/web/acvm_js.js +133 -133
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +10 -10
package/nodejs/acvm_js.d.ts
CHANGED
|
@@ -1,11 +1,68 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
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>;
|
|
3
31
|
/**
|
|
4
32
|
* Sets the package's logging level.
|
|
5
33
|
*
|
|
6
34
|
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
7
35
|
*/
|
|
8
36
|
export function initLogLevel(filter: string): void;
|
|
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
|
+
*/
|
|
44
|
+
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
45
|
+
/**
|
|
46
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
47
|
+
*
|
|
48
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
49
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
50
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
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
|
+
*/
|
|
60
|
+
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
61
|
+
/**
|
|
62
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
63
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
64
|
+
*/
|
|
65
|
+
export function buildInfo(): BuildInfo;
|
|
9
66
|
/**
|
|
10
67
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
11
68
|
*
|
|
@@ -35,34 +92,6 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
|
35
92
|
* @returns {WitnessStack} The decompressed witness stack.
|
|
36
93
|
*/
|
|
37
94
|
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
38
|
-
/**
|
|
39
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
40
|
-
*
|
|
41
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
42
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
43
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
44
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
45
|
-
*/
|
|
46
|
-
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
47
|
-
/**
|
|
48
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
49
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
50
|
-
*
|
|
51
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
52
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
53
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
54
|
-
* @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.
|
|
55
|
-
*/
|
|
56
|
-
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
57
|
-
/**
|
|
58
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
59
|
-
*
|
|
60
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
61
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
62
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
63
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
64
|
-
*/
|
|
65
|
-
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
66
95
|
/**
|
|
67
96
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
68
97
|
*/
|
|
@@ -87,35 +116,21 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
|
|
|
87
116
|
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
88
117
|
*/
|
|
89
118
|
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
119
|
+
|
|
120
|
+
// Map from witness index to hex string value of witness.
|
|
121
|
+
export type WitnessMap = Map<number, string>;
|
|
122
|
+
|
|
90
123
|
/**
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
|
|
94
|
-
export function buildInfo(): BuildInfo;
|
|
95
|
-
/**
|
|
96
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
97
|
-
*
|
|
98
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
99
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
100
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
101
|
-
*/
|
|
102
|
-
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
103
|
-
/**
|
|
104
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
105
|
-
*
|
|
106
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
107
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
108
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
109
|
-
*/
|
|
110
|
-
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
111
|
-
/**
|
|
112
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
113
|
-
*
|
|
114
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
115
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
116
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
124
|
+
* An execution result containing two witnesses.
|
|
125
|
+
* 1. The full solved witness of the execution.
|
|
126
|
+
* 2. The return witness which contains the given public return values within the full witness.
|
|
117
127
|
*/
|
|
118
|
-
export
|
|
128
|
+
export type SolvedAndReturnWitness = {
|
|
129
|
+
solvedWitness: WitnessMap;
|
|
130
|
+
returnWitness: WitnessMap;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
|
|
119
134
|
|
|
120
135
|
export type StackItem = {
|
|
121
136
|
index: number;
|
|
@@ -126,17 +141,17 @@ export type WitnessStack = Array<StackItem>;
|
|
|
126
141
|
|
|
127
142
|
|
|
128
143
|
|
|
144
|
+
export type ForeignCallInput = string[]
|
|
145
|
+
export type ForeignCallOutput = string | string[]
|
|
146
|
+
|
|
129
147
|
/**
|
|
130
|
-
*
|
|
131
|
-
* @
|
|
132
|
-
* @
|
|
133
|
-
* @
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
version: string;
|
|
138
|
-
dirty: string;
|
|
139
|
-
}
|
|
148
|
+
* A callback which performs an foreign call and returns the response.
|
|
149
|
+
* @callback ForeignCallHandler
|
|
150
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
151
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
152
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
153
|
+
*/
|
|
154
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
140
155
|
|
|
141
156
|
|
|
142
157
|
|
|
@@ -154,31 +169,16 @@ export type ExecutionError = Error & {
|
|
|
154
169
|
|
|
155
170
|
|
|
156
171
|
|
|
157
|
-
// Map from witness index to hex string value of witness.
|
|
158
|
-
export type WitnessMap = Map<number, string>;
|
|
159
|
-
|
|
160
172
|
/**
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
173
|
+
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
174
|
+
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
175
|
+
* @property {string} version - The version of the package at the built git commit.
|
|
176
|
+
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
164
177
|
*/
|
|
165
|
-
export type
|
|
166
|
-
|
|
167
|
-
|
|
178
|
+
export type BuildInfo = {
|
|
179
|
+
gitHash: string;
|
|
180
|
+
version: string;
|
|
181
|
+
dirty: string;
|
|
168
182
|
}
|
|
169
183
|
|
|
170
184
|
|
|
171
|
-
|
|
172
|
-
export type ForeignCallInput = string[]
|
|
173
|
-
export type ForeignCallOutput = string | string[]
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* A callback which performs an foreign call and returns the response.
|
|
177
|
-
* @callback ForeignCallHandler
|
|
178
|
-
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
179
|
-
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
180
|
-
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
181
|
-
*/
|
|
182
|
-
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
183
|
-
|
|
184
|
-
|
package/nodejs/acvm_js.js
CHANGED
|
@@ -202,6 +202,58 @@ function debugString(val) {
|
|
|
202
202
|
return className;
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
206
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
207
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
208
|
+
WASM_VECTOR_LEN = arg.length;
|
|
209
|
+
return ptr;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
213
|
+
*
|
|
214
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
215
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
216
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
217
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
218
|
+
*/
|
|
219
|
+
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
|
|
220
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
221
|
+
const len0 = WASM_VECTOR_LEN;
|
|
222
|
+
const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
|
|
223
|
+
return ret;
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
228
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
229
|
+
*
|
|
230
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
231
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
232
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
233
|
+
* @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.
|
|
234
|
+
*/
|
|
235
|
+
module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
|
|
236
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
237
|
+
const len0 = WASM_VECTOR_LEN;
|
|
238
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
|
|
239
|
+
return ret;
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
244
|
+
*
|
|
245
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
246
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
247
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
248
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
249
|
+
*/
|
|
250
|
+
module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
|
|
251
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
252
|
+
const len0 = WASM_VECTOR_LEN;
|
|
253
|
+
const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
|
|
254
|
+
return ret;
|
|
255
|
+
};
|
|
256
|
+
|
|
205
257
|
function takeFromExternrefTable0(idx) {
|
|
206
258
|
const value = wasm.__wbindgen_export_2.get(idx);
|
|
207
259
|
wasm.__externref_table_dealloc(idx);
|
|
@@ -221,6 +273,75 @@ module.exports.initLogLevel = function(filter) {
|
|
|
221
273
|
}
|
|
222
274
|
};
|
|
223
275
|
|
|
276
|
+
/**
|
|
277
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
278
|
+
*
|
|
279
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
280
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
281
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
282
|
+
* @param {Uint8Array} program
|
|
283
|
+
* @param {WitnessMap} witness_map
|
|
284
|
+
* @returns {WitnessMap}
|
|
285
|
+
*/
|
|
286
|
+
module.exports.getReturnWitness = function(program, witness_map) {
|
|
287
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
288
|
+
const len0 = WASM_VECTOR_LEN;
|
|
289
|
+
const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
|
|
290
|
+
if (ret[2]) {
|
|
291
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
292
|
+
}
|
|
293
|
+
return takeFromExternrefTable0(ret[0]);
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
298
|
+
*
|
|
299
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
300
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
301
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
302
|
+
* @param {Uint8Array} program
|
|
303
|
+
* @param {WitnessMap} solved_witness
|
|
304
|
+
* @returns {WitnessMap}
|
|
305
|
+
*/
|
|
306
|
+
module.exports.getPublicParametersWitness = function(program, solved_witness) {
|
|
307
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
308
|
+
const len0 = WASM_VECTOR_LEN;
|
|
309
|
+
const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
|
|
310
|
+
if (ret[2]) {
|
|
311
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
312
|
+
}
|
|
313
|
+
return takeFromExternrefTable0(ret[0]);
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
318
|
+
*
|
|
319
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
320
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
321
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
322
|
+
* @param {Uint8Array} program
|
|
323
|
+
* @param {WitnessMap} solved_witness
|
|
324
|
+
* @returns {WitnessMap}
|
|
325
|
+
*/
|
|
326
|
+
module.exports.getPublicWitness = function(program, solved_witness) {
|
|
327
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
328
|
+
const len0 = WASM_VECTOR_LEN;
|
|
329
|
+
const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
|
|
330
|
+
if (ret[2]) {
|
|
331
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
332
|
+
}
|
|
333
|
+
return takeFromExternrefTable0(ret[0]);
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
338
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
339
|
+
*/
|
|
340
|
+
module.exports.buildInfo = function() {
|
|
341
|
+
const ret = wasm.buildInfo();
|
|
342
|
+
return ret;
|
|
343
|
+
};
|
|
344
|
+
|
|
224
345
|
function getArrayU8FromWasm0(ptr, len) {
|
|
225
346
|
ptr = ptr >>> 0;
|
|
226
347
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
@@ -241,12 +362,6 @@ module.exports.compressWitness = function(witness_map) {
|
|
|
241
362
|
return v1;
|
|
242
363
|
};
|
|
243
364
|
|
|
244
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
245
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
246
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
247
|
-
WASM_VECTOR_LEN = arg.length;
|
|
248
|
-
return ptr;
|
|
249
|
-
}
|
|
250
365
|
/**
|
|
251
366
|
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
252
367
|
* This should be used to only fetch the witness map for the main function.
|
|
@@ -296,52 +411,6 @@ module.exports.decompressWitnessStack = function(compressed_witness) {
|
|
|
296
411
|
return takeFromExternrefTable0(ret[0]);
|
|
297
412
|
};
|
|
298
413
|
|
|
299
|
-
/**
|
|
300
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
301
|
-
*
|
|
302
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
303
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
304
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
305
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
306
|
-
*/
|
|
307
|
-
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
|
|
308
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
309
|
-
const len0 = WASM_VECTOR_LEN;
|
|
310
|
-
const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
|
|
311
|
-
return ret;
|
|
312
|
-
};
|
|
313
|
-
|
|
314
|
-
/**
|
|
315
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
316
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
317
|
-
*
|
|
318
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
319
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
320
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
321
|
-
* @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.
|
|
322
|
-
*/
|
|
323
|
-
module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
|
|
324
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
325
|
-
const len0 = WASM_VECTOR_LEN;
|
|
326
|
-
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
|
|
327
|
-
return ret;
|
|
328
|
-
};
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
332
|
-
*
|
|
333
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
334
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
335
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
336
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
337
|
-
*/
|
|
338
|
-
module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
|
|
339
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
340
|
-
const len0 = WASM_VECTOR_LEN;
|
|
341
|
-
const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
|
|
342
|
-
return ret;
|
|
343
|
-
};
|
|
344
|
-
|
|
345
414
|
/**
|
|
346
415
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
347
416
|
* @param {string} lhs
|
|
@@ -457,85 +526,16 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
|
|
|
457
526
|
return ret !== 0;
|
|
458
527
|
};
|
|
459
528
|
|
|
460
|
-
/**
|
|
461
|
-
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
462
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
463
|
-
*/
|
|
464
|
-
module.exports.buildInfo = function() {
|
|
465
|
-
const ret = wasm.buildInfo();
|
|
466
|
-
return ret;
|
|
467
|
-
};
|
|
468
|
-
|
|
469
|
-
/**
|
|
470
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
471
|
-
*
|
|
472
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
473
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
474
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
475
|
-
* @param {Uint8Array} program
|
|
476
|
-
* @param {WitnessMap} witness_map
|
|
477
|
-
* @returns {WitnessMap}
|
|
478
|
-
*/
|
|
479
|
-
module.exports.getReturnWitness = function(program, witness_map) {
|
|
480
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
481
|
-
const len0 = WASM_VECTOR_LEN;
|
|
482
|
-
const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
|
|
483
|
-
if (ret[2]) {
|
|
484
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
485
|
-
}
|
|
486
|
-
return takeFromExternrefTable0(ret[0]);
|
|
487
|
-
};
|
|
488
|
-
|
|
489
|
-
/**
|
|
490
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
491
|
-
*
|
|
492
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
493
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
494
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
495
|
-
* @param {Uint8Array} program
|
|
496
|
-
* @param {WitnessMap} solved_witness
|
|
497
|
-
* @returns {WitnessMap}
|
|
498
|
-
*/
|
|
499
|
-
module.exports.getPublicParametersWitness = function(program, solved_witness) {
|
|
500
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
501
|
-
const len0 = WASM_VECTOR_LEN;
|
|
502
|
-
const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
|
|
503
|
-
if (ret[2]) {
|
|
504
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
505
|
-
}
|
|
506
|
-
return takeFromExternrefTable0(ret[0]);
|
|
507
|
-
};
|
|
508
|
-
|
|
509
|
-
/**
|
|
510
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
511
|
-
*
|
|
512
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
513
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
514
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
515
|
-
* @param {Uint8Array} program
|
|
516
|
-
* @param {WitnessMap} solved_witness
|
|
517
|
-
* @returns {WitnessMap}
|
|
518
|
-
*/
|
|
519
|
-
module.exports.getPublicWitness = function(program, solved_witness) {
|
|
520
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
521
|
-
const len0 = WASM_VECTOR_LEN;
|
|
522
|
-
const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
|
|
523
|
-
if (ret[2]) {
|
|
524
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
525
|
-
}
|
|
526
|
-
return takeFromExternrefTable0(ret[0]);
|
|
527
|
-
};
|
|
528
|
-
|
|
529
529
|
function __wbg_adapter_30(arg0, arg1, arg2) {
|
|
530
|
-
wasm.
|
|
530
|
+
wasm.closure576_externref_shim(arg0, arg1, arg2);
|
|
531
531
|
}
|
|
532
532
|
|
|
533
533
|
function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
|
|
534
|
-
wasm.
|
|
534
|
+
wasm.closure1171_externref_shim(arg0, arg1, arg2, arg3, arg4);
|
|
535
535
|
}
|
|
536
536
|
|
|
537
537
|
function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
|
|
538
|
-
wasm.
|
|
538
|
+
wasm.closure1175_externref_shim(arg0, arg1, arg2, arg3);
|
|
539
539
|
}
|
|
540
540
|
|
|
541
541
|
module.exports.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
|
|
@@ -553,12 +553,12 @@ module.exports.__wbg_call_833bed5770ea2041 = function() { return handleError(fun
|
|
|
553
553
|
return ret;
|
|
554
554
|
}, arguments) };
|
|
555
555
|
|
|
556
|
-
module.exports.
|
|
556
|
+
module.exports.__wbg_constructor_c63bcfd244db473f = function(arg0) {
|
|
557
557
|
const ret = new Error(arg0);
|
|
558
558
|
return ret;
|
|
559
559
|
};
|
|
560
560
|
|
|
561
|
-
module.exports.
|
|
561
|
+
module.exports.__wbg_constructor_e54436b6bd1581f7 = function(arg0) {
|
|
562
562
|
const ret = new Error(arg0);
|
|
563
563
|
return ret;
|
|
564
564
|
};
|
|
@@ -674,6 +674,11 @@ module.exports.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
|
|
|
674
674
|
}
|
|
675
675
|
};
|
|
676
676
|
|
|
677
|
+
module.exports.__wbg_new_36c79b224aeafbf0 = function() {
|
|
678
|
+
const ret = new Array();
|
|
679
|
+
return ret;
|
|
680
|
+
};
|
|
681
|
+
|
|
677
682
|
module.exports.__wbg_new_5e0be73521bc8c17 = function() {
|
|
678
683
|
const ret = new Map();
|
|
679
684
|
return ret;
|
|
@@ -689,7 +694,7 @@ module.exports.__wbg_new_8a6f238a6ece86ea = function() {
|
|
|
689
694
|
return ret;
|
|
690
695
|
};
|
|
691
696
|
|
|
692
|
-
module.exports.
|
|
697
|
+
module.exports.__wbg_new_c08cf36011667e78 = function() {
|
|
693
698
|
const ret = new Map();
|
|
694
699
|
return ret;
|
|
695
700
|
};
|
|
@@ -699,11 +704,6 @@ module.exports.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
|
|
|
699
704
|
return ret;
|
|
700
705
|
};
|
|
701
706
|
|
|
702
|
-
module.exports.__wbg_new_d1312de2c48bf990 = function() {
|
|
703
|
-
const ret = new Array();
|
|
704
|
-
return ret;
|
|
705
|
-
};
|
|
706
|
-
|
|
707
707
|
module.exports.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
|
|
708
708
|
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
709
709
|
return ret;
|
|
@@ -813,8 +813,8 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
|
813
813
|
return ret;
|
|
814
814
|
};
|
|
815
815
|
|
|
816
|
-
module.exports.
|
|
817
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
816
|
+
module.exports.__wbindgen_closure_wrapper1970 = function(arg0, arg1, arg2) {
|
|
817
|
+
const ret = makeMutClosure(arg0, arg1, 577, __wbg_adapter_30);
|
|
818
818
|
return ret;
|
|
819
819
|
};
|
|
820
820
|
|
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
5
|
+
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
6
|
+
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
4
7
|
export const initLogLevel: (a: number, b: number) => [number, number];
|
|
8
|
+
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
9
|
+
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
10
|
+
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
11
|
+
export const buildInfo: () => any;
|
|
5
12
|
export const compressWitness: (a: any) => [number, number, number, number];
|
|
6
13
|
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
7
14
|
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
8
15
|
export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
9
|
-
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
10
|
-
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
11
|
-
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
12
16
|
export const and: (a: any, b: any) => any;
|
|
13
17
|
export const xor: (a: any, b: any) => any;
|
|
14
18
|
export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
15
19
|
export const blake2s256: (a: number, b: number) => [number, number];
|
|
16
20
|
export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
17
21
|
export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
18
|
-
export const buildInfo: () => any;
|
|
19
|
-
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
20
|
-
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
21
|
-
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
22
22
|
export const __wbindgen_exn_store: (a: number) => void;
|
|
23
23
|
export const __externref_table_alloc: () => number;
|
|
24
24
|
export const __wbindgen_export_2: WebAssembly.Table;
|
|
@@ -27,7 +27,7 @@ export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
|
27
27
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
28
28
|
export const __wbindgen_export_6: WebAssembly.Table;
|
|
29
29
|
export const __externref_table_dealloc: (a: number) => void;
|
|
30
|
-
export const
|
|
31
|
-
export const
|
|
32
|
-
export const
|
|
30
|
+
export const closure576_externref_shim: (a: number, b: number, c: any) => void;
|
|
31
|
+
export const closure1171_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
32
|
+
export const closure1175_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
33
33
|
export const __wbindgen_start: () => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/noir-acvm_js",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-devnet.20251212",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@esm-bundle/chai": "^4.3.4-fix.0",
|
|
41
|
-
"@web/dev-server-esbuild": "^0.
|
|
41
|
+
"@web/dev-server-esbuild": "^1.0.4",
|
|
42
42
|
"@web/test-runner": "^0.20.2",
|
|
43
|
-
"@web/test-runner-playwright": "^0.11.
|
|
43
|
+
"@web/test-runner-playwright": "^0.11.1",
|
|
44
44
|
"chai": "^4.4.1",
|
|
45
45
|
"eslint": "^9.28.0",
|
|
46
46
|
"eslint-plugin-prettier": "^5.4.1",
|
package/web/acvm_js.d.ts
CHANGED
|
@@ -1,11 +1,68 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
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>;
|
|
3
31
|
/**
|
|
4
32
|
* Sets the package's logging level.
|
|
5
33
|
*
|
|
6
34
|
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
7
35
|
*/
|
|
8
36
|
export function initLogLevel(filter: string): void;
|
|
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
|
+
*/
|
|
44
|
+
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
45
|
+
/**
|
|
46
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
47
|
+
*
|
|
48
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
49
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
50
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
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
|
+
*/
|
|
60
|
+
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
61
|
+
/**
|
|
62
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
63
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
64
|
+
*/
|
|
65
|
+
export function buildInfo(): BuildInfo;
|
|
9
66
|
/**
|
|
10
67
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
11
68
|
*
|
|
@@ -35,34 +92,6 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
|
35
92
|
* @returns {WitnessStack} The decompressed witness stack.
|
|
36
93
|
*/
|
|
37
94
|
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
38
|
-
/**
|
|
39
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
40
|
-
*
|
|
41
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
42
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
43
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
44
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
45
|
-
*/
|
|
46
|
-
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
47
|
-
/**
|
|
48
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
49
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
50
|
-
*
|
|
51
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
52
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
53
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
54
|
-
* @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.
|
|
55
|
-
*/
|
|
56
|
-
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
57
|
-
/**
|
|
58
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
59
|
-
*
|
|
60
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
61
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
62
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
63
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
64
|
-
*/
|
|
65
|
-
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
66
95
|
/**
|
|
67
96
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
68
97
|
*/
|
|
@@ -87,35 +116,21 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
|
|
|
87
116
|
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
88
117
|
*/
|
|
89
118
|
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
119
|
+
|
|
120
|
+
// Map from witness index to hex string value of witness.
|
|
121
|
+
export type WitnessMap = Map<number, string>;
|
|
122
|
+
|
|
90
123
|
/**
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
|
|
94
|
-
export function buildInfo(): BuildInfo;
|
|
95
|
-
/**
|
|
96
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
97
|
-
*
|
|
98
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
99
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
100
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
101
|
-
*/
|
|
102
|
-
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
103
|
-
/**
|
|
104
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
105
|
-
*
|
|
106
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
107
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
108
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
109
|
-
*/
|
|
110
|
-
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
111
|
-
/**
|
|
112
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
113
|
-
*
|
|
114
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
115
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
116
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
124
|
+
* An execution result containing two witnesses.
|
|
125
|
+
* 1. The full solved witness of the execution.
|
|
126
|
+
* 2. The return witness which contains the given public return values within the full witness.
|
|
117
127
|
*/
|
|
118
|
-
export
|
|
128
|
+
export type SolvedAndReturnWitness = {
|
|
129
|
+
solvedWitness: WitnessMap;
|
|
130
|
+
returnWitness: WitnessMap;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
|
|
119
134
|
|
|
120
135
|
export type StackItem = {
|
|
121
136
|
index: number;
|
|
@@ -126,17 +141,17 @@ export type WitnessStack = Array<StackItem>;
|
|
|
126
141
|
|
|
127
142
|
|
|
128
143
|
|
|
144
|
+
export type ForeignCallInput = string[]
|
|
145
|
+
export type ForeignCallOutput = string | string[]
|
|
146
|
+
|
|
129
147
|
/**
|
|
130
|
-
*
|
|
131
|
-
* @
|
|
132
|
-
* @
|
|
133
|
-
* @
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
version: string;
|
|
138
|
-
dirty: string;
|
|
139
|
-
}
|
|
148
|
+
* A callback which performs an foreign call and returns the response.
|
|
149
|
+
* @callback ForeignCallHandler
|
|
150
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
151
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
152
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
153
|
+
*/
|
|
154
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
140
155
|
|
|
141
156
|
|
|
142
157
|
|
|
@@ -154,57 +169,42 @@ export type ExecutionError = Error & {
|
|
|
154
169
|
|
|
155
170
|
|
|
156
171
|
|
|
157
|
-
// Map from witness index to hex string value of witness.
|
|
158
|
-
export type WitnessMap = Map<number, string>;
|
|
159
|
-
|
|
160
172
|
/**
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
173
|
+
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
174
|
+
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
175
|
+
* @property {string} version - The version of the package at the built git commit.
|
|
176
|
+
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
164
177
|
*/
|
|
165
|
-
export type
|
|
166
|
-
|
|
167
|
-
|
|
178
|
+
export type BuildInfo = {
|
|
179
|
+
gitHash: string;
|
|
180
|
+
version: string;
|
|
181
|
+
dirty: string;
|
|
168
182
|
}
|
|
169
183
|
|
|
170
184
|
|
|
171
185
|
|
|
172
|
-
export type ForeignCallInput = string[]
|
|
173
|
-
export type ForeignCallOutput = string | string[]
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* A callback which performs an foreign call and returns the response.
|
|
177
|
-
* @callback ForeignCallHandler
|
|
178
|
-
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
179
|
-
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
180
|
-
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
181
|
-
*/
|
|
182
|
-
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
186
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
187
187
|
|
|
188
188
|
export interface InitOutput {
|
|
189
189
|
readonly memory: WebAssembly.Memory;
|
|
190
|
+
readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
191
|
+
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
192
|
+
readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
190
193
|
readonly initLogLevel: (a: number, b: number) => [number, number];
|
|
194
|
+
readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
195
|
+
readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
196
|
+
readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
197
|
+
readonly buildInfo: () => any;
|
|
191
198
|
readonly compressWitness: (a: any) => [number, number, number, number];
|
|
192
199
|
readonly decompressWitness: (a: number, b: number) => [number, number, number];
|
|
193
200
|
readonly compressWitnessStack: (a: any) => [number, number, number, number];
|
|
194
201
|
readonly decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
195
|
-
readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
196
|
-
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
197
|
-
readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
198
202
|
readonly and: (a: any, b: any) => any;
|
|
199
203
|
readonly xor: (a: any, b: any) => any;
|
|
200
204
|
readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
201
205
|
readonly blake2s256: (a: number, b: number) => [number, number];
|
|
202
206
|
readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
203
207
|
readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
204
|
-
readonly buildInfo: () => any;
|
|
205
|
-
readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
206
|
-
readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
207
|
-
readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
208
208
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
209
209
|
readonly __externref_table_alloc: () => number;
|
|
210
210
|
readonly __wbindgen_export_2: WebAssembly.Table;
|
|
@@ -213,9 +213,9 @@ export interface InitOutput {
|
|
|
213
213
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
214
214
|
readonly __wbindgen_export_6: WebAssembly.Table;
|
|
215
215
|
readonly __externref_table_dealloc: (a: number) => void;
|
|
216
|
-
readonly
|
|
217
|
-
readonly
|
|
218
|
-
readonly
|
|
216
|
+
readonly closure576_externref_shim: (a: number, b: number, c: any) => void;
|
|
217
|
+
readonly closure1171_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
218
|
+
readonly closure1175_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
219
219
|
readonly __wbindgen_start: () => void;
|
|
220
220
|
}
|
|
221
221
|
|
package/web/acvm_js.js
CHANGED
|
@@ -198,6 +198,58 @@ function debugString(val) {
|
|
|
198
198
|
return className;
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
202
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
203
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
204
|
+
WASM_VECTOR_LEN = arg.length;
|
|
205
|
+
return ptr;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
209
|
+
*
|
|
210
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
211
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
212
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
213
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
214
|
+
*/
|
|
215
|
+
export function executeCircuit(program, initial_witness, foreign_call_handler) {
|
|
216
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
217
|
+
const len0 = WASM_VECTOR_LEN;
|
|
218
|
+
const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
|
|
219
|
+
return ret;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
224
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
225
|
+
*
|
|
226
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
227
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
228
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
229
|
+
* @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.
|
|
230
|
+
*/
|
|
231
|
+
export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
|
|
232
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
233
|
+
const len0 = WASM_VECTOR_LEN;
|
|
234
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
|
|
235
|
+
return ret;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
240
|
+
*
|
|
241
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
242
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
243
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
244
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
245
|
+
*/
|
|
246
|
+
export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
247
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
248
|
+
const len0 = WASM_VECTOR_LEN;
|
|
249
|
+
const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
|
|
250
|
+
return ret;
|
|
251
|
+
}
|
|
252
|
+
|
|
201
253
|
function takeFromExternrefTable0(idx) {
|
|
202
254
|
const value = wasm.__wbindgen_export_2.get(idx);
|
|
203
255
|
wasm.__externref_table_dealloc(idx);
|
|
@@ -217,6 +269,75 @@ export function initLogLevel(filter) {
|
|
|
217
269
|
}
|
|
218
270
|
}
|
|
219
271
|
|
|
272
|
+
/**
|
|
273
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
274
|
+
*
|
|
275
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
276
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
277
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
278
|
+
* @param {Uint8Array} program
|
|
279
|
+
* @param {WitnessMap} witness_map
|
|
280
|
+
* @returns {WitnessMap}
|
|
281
|
+
*/
|
|
282
|
+
export function getReturnWitness(program, witness_map) {
|
|
283
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
284
|
+
const len0 = WASM_VECTOR_LEN;
|
|
285
|
+
const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
|
|
286
|
+
if (ret[2]) {
|
|
287
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
288
|
+
}
|
|
289
|
+
return takeFromExternrefTable0(ret[0]);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
294
|
+
*
|
|
295
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
296
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
297
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
298
|
+
* @param {Uint8Array} program
|
|
299
|
+
* @param {WitnessMap} solved_witness
|
|
300
|
+
* @returns {WitnessMap}
|
|
301
|
+
*/
|
|
302
|
+
export function getPublicParametersWitness(program, solved_witness) {
|
|
303
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
304
|
+
const len0 = WASM_VECTOR_LEN;
|
|
305
|
+
const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
|
|
306
|
+
if (ret[2]) {
|
|
307
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
308
|
+
}
|
|
309
|
+
return takeFromExternrefTable0(ret[0]);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
314
|
+
*
|
|
315
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
316
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
317
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
318
|
+
* @param {Uint8Array} program
|
|
319
|
+
* @param {WitnessMap} solved_witness
|
|
320
|
+
* @returns {WitnessMap}
|
|
321
|
+
*/
|
|
322
|
+
export function getPublicWitness(program, solved_witness) {
|
|
323
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
324
|
+
const len0 = WASM_VECTOR_LEN;
|
|
325
|
+
const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
|
|
326
|
+
if (ret[2]) {
|
|
327
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
328
|
+
}
|
|
329
|
+
return takeFromExternrefTable0(ret[0]);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
334
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
335
|
+
*/
|
|
336
|
+
export function buildInfo() {
|
|
337
|
+
const ret = wasm.buildInfo();
|
|
338
|
+
return ret;
|
|
339
|
+
}
|
|
340
|
+
|
|
220
341
|
function getArrayU8FromWasm0(ptr, len) {
|
|
221
342
|
ptr = ptr >>> 0;
|
|
222
343
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
@@ -237,12 +358,6 @@ export function compressWitness(witness_map) {
|
|
|
237
358
|
return v1;
|
|
238
359
|
}
|
|
239
360
|
|
|
240
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
241
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
242
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
243
|
-
WASM_VECTOR_LEN = arg.length;
|
|
244
|
-
return ptr;
|
|
245
|
-
}
|
|
246
361
|
/**
|
|
247
362
|
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
248
363
|
* This should be used to only fetch the witness map for the main function.
|
|
@@ -292,52 +407,6 @@ export function decompressWitnessStack(compressed_witness) {
|
|
|
292
407
|
return takeFromExternrefTable0(ret[0]);
|
|
293
408
|
}
|
|
294
409
|
|
|
295
|
-
/**
|
|
296
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
297
|
-
*
|
|
298
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
299
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
300
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
301
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
302
|
-
*/
|
|
303
|
-
export function executeCircuit(program, initial_witness, foreign_call_handler) {
|
|
304
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
305
|
-
const len0 = WASM_VECTOR_LEN;
|
|
306
|
-
const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
|
|
307
|
-
return ret;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
/**
|
|
311
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
312
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
313
|
-
*
|
|
314
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
315
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
316
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
317
|
-
* @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.
|
|
318
|
-
*/
|
|
319
|
-
export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
|
|
320
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
321
|
-
const len0 = WASM_VECTOR_LEN;
|
|
322
|
-
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
|
|
323
|
-
return ret;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
/**
|
|
327
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
328
|
-
*
|
|
329
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
330
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
331
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
332
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
333
|
-
*/
|
|
334
|
-
export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
335
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
336
|
-
const len0 = WASM_VECTOR_LEN;
|
|
337
|
-
const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
|
|
338
|
-
return ret;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
410
|
/**
|
|
342
411
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
343
412
|
* @param {string} lhs
|
|
@@ -453,85 +522,16 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
|
|
|
453
522
|
return ret !== 0;
|
|
454
523
|
}
|
|
455
524
|
|
|
456
|
-
/**
|
|
457
|
-
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
458
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
459
|
-
*/
|
|
460
|
-
export function buildInfo() {
|
|
461
|
-
const ret = wasm.buildInfo();
|
|
462
|
-
return ret;
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
/**
|
|
466
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
467
|
-
*
|
|
468
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
469
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
470
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
471
|
-
* @param {Uint8Array} program
|
|
472
|
-
* @param {WitnessMap} witness_map
|
|
473
|
-
* @returns {WitnessMap}
|
|
474
|
-
*/
|
|
475
|
-
export function getReturnWitness(program, witness_map) {
|
|
476
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
477
|
-
const len0 = WASM_VECTOR_LEN;
|
|
478
|
-
const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
|
|
479
|
-
if (ret[2]) {
|
|
480
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
481
|
-
}
|
|
482
|
-
return takeFromExternrefTable0(ret[0]);
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
/**
|
|
486
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
487
|
-
*
|
|
488
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
489
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
490
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
491
|
-
* @param {Uint8Array} program
|
|
492
|
-
* @param {WitnessMap} solved_witness
|
|
493
|
-
* @returns {WitnessMap}
|
|
494
|
-
*/
|
|
495
|
-
export function getPublicParametersWitness(program, solved_witness) {
|
|
496
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
497
|
-
const len0 = WASM_VECTOR_LEN;
|
|
498
|
-
const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
|
|
499
|
-
if (ret[2]) {
|
|
500
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
501
|
-
}
|
|
502
|
-
return takeFromExternrefTable0(ret[0]);
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
/**
|
|
506
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
507
|
-
*
|
|
508
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
509
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
510
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
511
|
-
* @param {Uint8Array} program
|
|
512
|
-
* @param {WitnessMap} solved_witness
|
|
513
|
-
* @returns {WitnessMap}
|
|
514
|
-
*/
|
|
515
|
-
export function getPublicWitness(program, solved_witness) {
|
|
516
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
517
|
-
const len0 = WASM_VECTOR_LEN;
|
|
518
|
-
const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
|
|
519
|
-
if (ret[2]) {
|
|
520
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
521
|
-
}
|
|
522
|
-
return takeFromExternrefTable0(ret[0]);
|
|
523
|
-
}
|
|
524
|
-
|
|
525
525
|
function __wbg_adapter_30(arg0, arg1, arg2) {
|
|
526
|
-
wasm.
|
|
526
|
+
wasm.closure576_externref_shim(arg0, arg1, arg2);
|
|
527
527
|
}
|
|
528
528
|
|
|
529
529
|
function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
|
|
530
|
-
wasm.
|
|
530
|
+
wasm.closure1171_externref_shim(arg0, arg1, arg2, arg3, arg4);
|
|
531
531
|
}
|
|
532
532
|
|
|
533
533
|
function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
|
|
534
|
-
wasm.
|
|
534
|
+
wasm.closure1175_externref_shim(arg0, arg1, arg2, arg3);
|
|
535
535
|
}
|
|
536
536
|
|
|
537
537
|
async function __wbg_load(module, imports) {
|
|
@@ -580,11 +580,11 @@ function __wbg_get_imports() {
|
|
|
580
580
|
const ret = arg0.call(arg1, arg2, arg3);
|
|
581
581
|
return ret;
|
|
582
582
|
}, arguments) };
|
|
583
|
-
imports.wbg.
|
|
583
|
+
imports.wbg.__wbg_constructor_c63bcfd244db473f = function(arg0) {
|
|
584
584
|
const ret = new Error(arg0);
|
|
585
585
|
return ret;
|
|
586
586
|
};
|
|
587
|
-
imports.wbg.
|
|
587
|
+
imports.wbg.__wbg_constructor_e54436b6bd1581f7 = function(arg0) {
|
|
588
588
|
const ret = new Error(arg0);
|
|
589
589
|
return ret;
|
|
590
590
|
};
|
|
@@ -685,6 +685,10 @@ function __wbg_get_imports() {
|
|
|
685
685
|
state0.a = state0.b = 0;
|
|
686
686
|
}
|
|
687
687
|
};
|
|
688
|
+
imports.wbg.__wbg_new_36c79b224aeafbf0 = function() {
|
|
689
|
+
const ret = new Array();
|
|
690
|
+
return ret;
|
|
691
|
+
};
|
|
688
692
|
imports.wbg.__wbg_new_5e0be73521bc8c17 = function() {
|
|
689
693
|
const ret = new Map();
|
|
690
694
|
return ret;
|
|
@@ -697,7 +701,7 @@ function __wbg_get_imports() {
|
|
|
697
701
|
const ret = new Error();
|
|
698
702
|
return ret;
|
|
699
703
|
};
|
|
700
|
-
imports.wbg.
|
|
704
|
+
imports.wbg.__wbg_new_c08cf36011667e78 = function() {
|
|
701
705
|
const ret = new Map();
|
|
702
706
|
return ret;
|
|
703
707
|
};
|
|
@@ -705,10 +709,6 @@ function __wbg_get_imports() {
|
|
|
705
709
|
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
706
710
|
return ret;
|
|
707
711
|
};
|
|
708
|
-
imports.wbg.__wbg_new_d1312de2c48bf990 = function() {
|
|
709
|
-
const ret = new Array();
|
|
710
|
-
return ret;
|
|
711
|
-
};
|
|
712
712
|
imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
|
|
713
713
|
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
714
714
|
return ret;
|
|
@@ -797,8 +797,8 @@ function __wbg_get_imports() {
|
|
|
797
797
|
const ret = false;
|
|
798
798
|
return ret;
|
|
799
799
|
};
|
|
800
|
-
imports.wbg.
|
|
801
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
800
|
+
imports.wbg.__wbindgen_closure_wrapper1970 = function(arg0, arg1, arg2) {
|
|
801
|
+
const ret = makeMutClosure(arg0, arg1, 577, __wbg_adapter_30);
|
|
802
802
|
return ret;
|
|
803
803
|
};
|
|
804
804
|
imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
|
package/web/acvm_js_bg.wasm
CHANGED
|
Binary file
|
package/web/acvm_js_bg.wasm.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
5
|
+
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
6
|
+
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
4
7
|
export const initLogLevel: (a: number, b: number) => [number, number];
|
|
8
|
+
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
9
|
+
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
10
|
+
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
11
|
+
export const buildInfo: () => any;
|
|
5
12
|
export const compressWitness: (a: any) => [number, number, number, number];
|
|
6
13
|
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
7
14
|
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
8
15
|
export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
9
|
-
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
10
|
-
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
11
|
-
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
12
16
|
export const and: (a: any, b: any) => any;
|
|
13
17
|
export const xor: (a: any, b: any) => any;
|
|
14
18
|
export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
15
19
|
export const blake2s256: (a: number, b: number) => [number, number];
|
|
16
20
|
export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
17
21
|
export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
18
|
-
export const buildInfo: () => any;
|
|
19
|
-
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
20
|
-
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
21
|
-
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
22
22
|
export const __wbindgen_exn_store: (a: number) => void;
|
|
23
23
|
export const __externref_table_alloc: () => number;
|
|
24
24
|
export const __wbindgen_export_2: WebAssembly.Table;
|
|
@@ -27,7 +27,7 @@ export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
|
27
27
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
28
28
|
export const __wbindgen_export_6: WebAssembly.Table;
|
|
29
29
|
export const __externref_table_dealloc: (a: number) => void;
|
|
30
|
-
export const
|
|
31
|
-
export const
|
|
32
|
-
export const
|
|
30
|
+
export const closure576_externref_shim: (a: number, b: number, c: any) => void;
|
|
31
|
+
export const closure1171_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
32
|
+
export const closure1175_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
33
33
|
export const __wbindgen_start: () => void;
|