@noir-lang/acvm_js 0.48.0 → 0.49.0
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 +83 -83
- package/nodejs/acvm_js.js +169 -168
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +7 -7
- package/package.json +1 -1
- package/web/acvm_js.d.ts +90 -90
- package/web/acvm_js.js +167 -166
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +7 -7
package/nodejs/acvm_js.d.ts
CHANGED
|
@@ -1,73 +1,17 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
5
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
6
|
+
*/
|
|
7
|
+
export function buildInfo(): BuildInfo;
|
|
8
|
+
/**
|
|
4
9
|
* Sets the package's logging level.
|
|
5
10
|
*
|
|
6
11
|
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
7
12
|
*/
|
|
8
13
|
export function initLogLevel(filter: string): void;
|
|
9
14
|
/**
|
|
10
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
11
|
-
*
|
|
12
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
13
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
14
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
15
|
-
* @param {Uint8Array} program
|
|
16
|
-
* @param {WitnessMap} witness_map
|
|
17
|
-
* @returns {WitnessMap}
|
|
18
|
-
*/
|
|
19
|
-
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
20
|
-
/**
|
|
21
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
22
|
-
*
|
|
23
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
24
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
25
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
26
|
-
* @param {Uint8Array} program
|
|
27
|
-
* @param {WitnessMap} solved_witness
|
|
28
|
-
* @returns {WitnessMap}
|
|
29
|
-
*/
|
|
30
|
-
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
31
|
-
/**
|
|
32
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
33
|
-
*
|
|
34
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
35
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
36
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
37
|
-
* @param {Uint8Array} program
|
|
38
|
-
* @param {WitnessMap} solved_witness
|
|
39
|
-
* @returns {WitnessMap}
|
|
40
|
-
*/
|
|
41
|
-
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
42
|
-
/**
|
|
43
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
44
|
-
*
|
|
45
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
46
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
47
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
48
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
49
|
-
*/
|
|
50
|
-
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
51
|
-
/**
|
|
52
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
53
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
54
|
-
*
|
|
55
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
56
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
57
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
58
|
-
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
59
|
-
*/
|
|
60
|
-
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
61
|
-
/**
|
|
62
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
63
|
-
*
|
|
64
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
65
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
66
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
67
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
68
|
-
*/
|
|
69
|
-
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
70
|
-
/**
|
|
71
15
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
72
16
|
* @param {string} lhs
|
|
73
17
|
* @param {string} rhs
|
|
@@ -118,10 +62,33 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
|
|
|
118
62
|
*/
|
|
119
63
|
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
120
64
|
/**
|
|
121
|
-
*
|
|
122
|
-
*
|
|
65
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
66
|
+
*
|
|
67
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
68
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
69
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
70
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
123
71
|
*/
|
|
124
|
-
export function
|
|
72
|
+
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
73
|
+
/**
|
|
74
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
75
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
76
|
+
*
|
|
77
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
78
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
79
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
80
|
+
* @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.
|
|
81
|
+
*/
|
|
82
|
+
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
83
|
+
/**
|
|
84
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
85
|
+
*
|
|
86
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
87
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
88
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
89
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
90
|
+
*/
|
|
91
|
+
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
125
92
|
/**
|
|
126
93
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
127
94
|
*
|
|
@@ -151,15 +118,51 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
|
151
118
|
* @returns {WitnessStack} The decompressed witness stack.
|
|
152
119
|
*/
|
|
153
120
|
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
121
|
+
/**
|
|
122
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
123
|
+
*
|
|
124
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
125
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
126
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
127
|
+
* @param {Uint8Array} program
|
|
128
|
+
* @param {WitnessMap} witness_map
|
|
129
|
+
* @returns {WitnessMap}
|
|
130
|
+
*/
|
|
131
|
+
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
132
|
+
/**
|
|
133
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
134
|
+
*
|
|
135
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
136
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
137
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
138
|
+
* @param {Uint8Array} program
|
|
139
|
+
* @param {WitnessMap} solved_witness
|
|
140
|
+
* @returns {WitnessMap}
|
|
141
|
+
*/
|
|
142
|
+
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
143
|
+
/**
|
|
144
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
145
|
+
*
|
|
146
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
147
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
148
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
149
|
+
* @param {Uint8Array} program
|
|
150
|
+
* @param {WitnessMap} solved_witness
|
|
151
|
+
* @returns {WitnessMap}
|
|
152
|
+
*/
|
|
153
|
+
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
154
154
|
|
|
155
|
-
export type
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
155
|
+
export type ForeignCallInput = string[]
|
|
156
|
+
export type ForeignCallOutput = string | string[]
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* A callback which performs an foreign call and returns the response.
|
|
160
|
+
* @callback ForeignCallHandler
|
|
161
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
162
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
163
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
164
|
+
*/
|
|
165
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
163
166
|
|
|
164
167
|
|
|
165
168
|
|
|
@@ -186,17 +189,14 @@ export type BuildInfo = {
|
|
|
186
189
|
|
|
187
190
|
|
|
188
191
|
|
|
189
|
-
export type
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
198
|
-
*/
|
|
199
|
-
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
192
|
+
export type RawAssertionPayload = {
|
|
193
|
+
selector: string;
|
|
194
|
+
data: string[];
|
|
195
|
+
};
|
|
196
|
+
export type ExecutionError = Error & {
|
|
197
|
+
callStack?: string[];
|
|
198
|
+
rawAssertionPayload?: RawAssertionPayload;
|
|
199
|
+
};
|
|
200
200
|
|
|
201
201
|
|
|
202
202
|
|
package/nodejs/acvm_js.js
CHANGED
|
@@ -45,6 +45,15 @@ function getInt32Memory0() {
|
|
|
45
45
|
return cachedInt32Memory0;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
function addHeapObject(obj) {
|
|
49
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
50
|
+
const idx = heap_next;
|
|
51
|
+
heap_next = heap[idx];
|
|
52
|
+
|
|
53
|
+
heap[idx] = obj;
|
|
54
|
+
return idx;
|
|
55
|
+
}
|
|
56
|
+
|
|
48
57
|
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
49
58
|
|
|
50
59
|
cachedTextDecoder.decode();
|
|
@@ -63,15 +72,6 @@ function getStringFromWasm0(ptr, len) {
|
|
|
63
72
|
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
64
73
|
}
|
|
65
74
|
|
|
66
|
-
function addHeapObject(obj) {
|
|
67
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
68
|
-
const idx = heap_next;
|
|
69
|
-
heap_next = heap[idx];
|
|
70
|
-
|
|
71
|
-
heap[idx] = obj;
|
|
72
|
-
return idx;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
75
|
let WASM_VECTOR_LEN = 0;
|
|
76
76
|
|
|
77
77
|
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
@@ -220,6 +220,15 @@ function __wbg_adapter_22(arg0, arg1, arg2) {
|
|
|
220
220
|
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h36bac5ff3ea3c380(arg0, arg1, addHeapObject(arg2));
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
+
/**
|
|
224
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
225
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
226
|
+
*/
|
|
227
|
+
module.exports.buildInfo = function() {
|
|
228
|
+
const ret = wasm.buildInfo();
|
|
229
|
+
return takeObject(ret);
|
|
230
|
+
};
|
|
231
|
+
|
|
223
232
|
/**
|
|
224
233
|
* Sets the package's logging level.
|
|
225
234
|
*
|
|
@@ -241,142 +250,6 @@ module.exports.initLogLevel = function(filter) {
|
|
|
241
250
|
}
|
|
242
251
|
};
|
|
243
252
|
|
|
244
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
245
|
-
const ptr = malloc(arg.length * 1) >>> 0;
|
|
246
|
-
getUint8Memory0().set(arg, ptr / 1);
|
|
247
|
-
WASM_VECTOR_LEN = arg.length;
|
|
248
|
-
return ptr;
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
252
|
-
*
|
|
253
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
254
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
255
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
256
|
-
* @param {Uint8Array} program
|
|
257
|
-
* @param {WitnessMap} witness_map
|
|
258
|
-
* @returns {WitnessMap}
|
|
259
|
-
*/
|
|
260
|
-
module.exports.getReturnWitness = function(program, witness_map) {
|
|
261
|
-
try {
|
|
262
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
263
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
264
|
-
const len0 = WASM_VECTOR_LEN;
|
|
265
|
-
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
|
|
266
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
267
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
268
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
269
|
-
if (r2) {
|
|
270
|
-
throw takeObject(r1);
|
|
271
|
-
}
|
|
272
|
-
return takeObject(r0);
|
|
273
|
-
} finally {
|
|
274
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
275
|
-
}
|
|
276
|
-
};
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
280
|
-
*
|
|
281
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
282
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
283
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
284
|
-
* @param {Uint8Array} program
|
|
285
|
-
* @param {WitnessMap} solved_witness
|
|
286
|
-
* @returns {WitnessMap}
|
|
287
|
-
*/
|
|
288
|
-
module.exports.getPublicParametersWitness = function(program, solved_witness) {
|
|
289
|
-
try {
|
|
290
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
291
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
292
|
-
const len0 = WASM_VECTOR_LEN;
|
|
293
|
-
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
294
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
295
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
296
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
297
|
-
if (r2) {
|
|
298
|
-
throw takeObject(r1);
|
|
299
|
-
}
|
|
300
|
-
return takeObject(r0);
|
|
301
|
-
} finally {
|
|
302
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
303
|
-
}
|
|
304
|
-
};
|
|
305
|
-
|
|
306
|
-
/**
|
|
307
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
308
|
-
*
|
|
309
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
310
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
311
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
312
|
-
* @param {Uint8Array} program
|
|
313
|
-
* @param {WitnessMap} solved_witness
|
|
314
|
-
* @returns {WitnessMap}
|
|
315
|
-
*/
|
|
316
|
-
module.exports.getPublicWitness = function(program, solved_witness) {
|
|
317
|
-
try {
|
|
318
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
319
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
320
|
-
const len0 = WASM_VECTOR_LEN;
|
|
321
|
-
wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
322
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
323
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
324
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
325
|
-
if (r2) {
|
|
326
|
-
throw takeObject(r1);
|
|
327
|
-
}
|
|
328
|
-
return takeObject(r0);
|
|
329
|
-
} finally {
|
|
330
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
331
|
-
}
|
|
332
|
-
};
|
|
333
|
-
|
|
334
|
-
/**
|
|
335
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
336
|
-
*
|
|
337
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
338
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
339
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
340
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
341
|
-
*/
|
|
342
|
-
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
|
|
343
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
344
|
-
const len0 = WASM_VECTOR_LEN;
|
|
345
|
-
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
346
|
-
return takeObject(ret);
|
|
347
|
-
};
|
|
348
|
-
|
|
349
|
-
/**
|
|
350
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
351
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
352
|
-
*
|
|
353
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
354
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
355
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
356
|
-
* @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.
|
|
357
|
-
*/
|
|
358
|
-
module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
|
|
359
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
360
|
-
const len0 = WASM_VECTOR_LEN;
|
|
361
|
-
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
362
|
-
return takeObject(ret);
|
|
363
|
-
};
|
|
364
|
-
|
|
365
|
-
/**
|
|
366
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
367
|
-
*
|
|
368
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
369
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
370
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
371
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
372
|
-
*/
|
|
373
|
-
module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
|
|
374
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
375
|
-
const len0 = WASM_VECTOR_LEN;
|
|
376
|
-
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
377
|
-
return takeObject(ret);
|
|
378
|
-
};
|
|
379
|
-
|
|
380
253
|
/**
|
|
381
254
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
382
255
|
* @param {string} lhs
|
|
@@ -399,6 +272,13 @@ module.exports.xor = function(lhs, rhs) {
|
|
|
399
272
|
return takeObject(ret);
|
|
400
273
|
};
|
|
401
274
|
|
|
275
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
276
|
+
const ptr = malloc(arg.length * 1) >>> 0;
|
|
277
|
+
getUint8Memory0().set(arg, ptr / 1);
|
|
278
|
+
WASM_VECTOR_LEN = arg.length;
|
|
279
|
+
return ptr;
|
|
280
|
+
}
|
|
281
|
+
|
|
402
282
|
function getArrayU8FromWasm0(ptr, len) {
|
|
403
283
|
ptr = ptr >>> 0;
|
|
404
284
|
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
@@ -509,11 +389,48 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
|
|
|
509
389
|
};
|
|
510
390
|
|
|
511
391
|
/**
|
|
512
|
-
*
|
|
513
|
-
*
|
|
392
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
393
|
+
*
|
|
394
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
395
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
396
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
397
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
514
398
|
*/
|
|
515
|
-
module.exports.
|
|
516
|
-
const
|
|
399
|
+
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
|
|
400
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
401
|
+
const len0 = WASM_VECTOR_LEN;
|
|
402
|
+
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
403
|
+
return takeObject(ret);
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
408
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
409
|
+
*
|
|
410
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
411
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
412
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
413
|
+
* @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.
|
|
414
|
+
*/
|
|
415
|
+
module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
|
|
416
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
417
|
+
const len0 = WASM_VECTOR_LEN;
|
|
418
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
419
|
+
return takeObject(ret);
|
|
420
|
+
};
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
424
|
+
*
|
|
425
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
426
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
427
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
428
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
429
|
+
*/
|
|
430
|
+
module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
|
|
431
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
432
|
+
const len0 = WASM_VECTOR_LEN;
|
|
433
|
+
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
517
434
|
return takeObject(ret);
|
|
518
435
|
};
|
|
519
436
|
|
|
@@ -616,6 +533,90 @@ module.exports.decompressWitnessStack = function(compressed_witness) {
|
|
|
616
533
|
}
|
|
617
534
|
};
|
|
618
535
|
|
|
536
|
+
/**
|
|
537
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
538
|
+
*
|
|
539
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
540
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
541
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
542
|
+
* @param {Uint8Array} program
|
|
543
|
+
* @param {WitnessMap} witness_map
|
|
544
|
+
* @returns {WitnessMap}
|
|
545
|
+
*/
|
|
546
|
+
module.exports.getReturnWitness = function(program, witness_map) {
|
|
547
|
+
try {
|
|
548
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
549
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
550
|
+
const len0 = WASM_VECTOR_LEN;
|
|
551
|
+
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
|
|
552
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
553
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
554
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
555
|
+
if (r2) {
|
|
556
|
+
throw takeObject(r1);
|
|
557
|
+
}
|
|
558
|
+
return takeObject(r0);
|
|
559
|
+
} finally {
|
|
560
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
561
|
+
}
|
|
562
|
+
};
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
566
|
+
*
|
|
567
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
568
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
569
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
570
|
+
* @param {Uint8Array} program
|
|
571
|
+
* @param {WitnessMap} solved_witness
|
|
572
|
+
* @returns {WitnessMap}
|
|
573
|
+
*/
|
|
574
|
+
module.exports.getPublicParametersWitness = function(program, solved_witness) {
|
|
575
|
+
try {
|
|
576
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
577
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
578
|
+
const len0 = WASM_VECTOR_LEN;
|
|
579
|
+
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
580
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
581
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
582
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
583
|
+
if (r2) {
|
|
584
|
+
throw takeObject(r1);
|
|
585
|
+
}
|
|
586
|
+
return takeObject(r0);
|
|
587
|
+
} finally {
|
|
588
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
589
|
+
}
|
|
590
|
+
};
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
594
|
+
*
|
|
595
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
596
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
597
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
598
|
+
* @param {Uint8Array} program
|
|
599
|
+
* @param {WitnessMap} solved_witness
|
|
600
|
+
* @returns {WitnessMap}
|
|
601
|
+
*/
|
|
602
|
+
module.exports.getPublicWitness = function(program, solved_witness) {
|
|
603
|
+
try {
|
|
604
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
605
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
606
|
+
const len0 = WASM_VECTOR_LEN;
|
|
607
|
+
wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
608
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
609
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
610
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
611
|
+
if (r2) {
|
|
612
|
+
throw takeObject(r1);
|
|
613
|
+
}
|
|
614
|
+
return takeObject(r0);
|
|
615
|
+
} finally {
|
|
616
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
617
|
+
}
|
|
618
|
+
};
|
|
619
|
+
|
|
619
620
|
function __wbg_adapter_76(arg0, arg1, arg2, arg3, arg4) {
|
|
620
621
|
wasm.wasm_bindgen__convert__closures__invoke3_mut__h629417323d5efbaa(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
|
|
621
622
|
}
|
|
@@ -645,6 +646,16 @@ module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
|
645
646
|
takeObject(arg0);
|
|
646
647
|
};
|
|
647
648
|
|
|
649
|
+
module.exports.__wbindgen_is_string = function(arg0) {
|
|
650
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
|
651
|
+
return ret;
|
|
652
|
+
};
|
|
653
|
+
|
|
654
|
+
module.exports.__wbindgen_is_array = function(arg0) {
|
|
655
|
+
const ret = Array.isArray(getObject(arg0));
|
|
656
|
+
return ret;
|
|
657
|
+
};
|
|
658
|
+
|
|
648
659
|
module.exports.__wbindgen_number_get = function(arg0, arg1) {
|
|
649
660
|
const obj = getObject(arg1);
|
|
650
661
|
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
@@ -652,19 +663,14 @@ module.exports.__wbindgen_number_get = function(arg0, arg1) {
|
|
|
652
663
|
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
653
664
|
};
|
|
654
665
|
|
|
655
|
-
module.exports.
|
|
656
|
-
const ret = new
|
|
666
|
+
module.exports.__wbg_new_baa0339c0c5c310a = function() {
|
|
667
|
+
const ret = new Array();
|
|
657
668
|
return addHeapObject(ret);
|
|
658
669
|
};
|
|
659
670
|
|
|
660
|
-
module.exports.
|
|
661
|
-
const ret =
|
|
662
|
-
return ret;
|
|
663
|
-
};
|
|
664
|
-
|
|
665
|
-
module.exports.__wbindgen_is_string = function(arg0) {
|
|
666
|
-
const ret = typeof(getObject(arg0)) === 'string';
|
|
667
|
-
return ret;
|
|
671
|
+
module.exports.__wbindgen_number_new = function(arg0) {
|
|
672
|
+
const ret = arg0;
|
|
673
|
+
return addHeapObject(ret);
|
|
668
674
|
};
|
|
669
675
|
|
|
670
676
|
module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
@@ -672,17 +678,12 @@ module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
|
672
678
|
return addHeapObject(ret);
|
|
673
679
|
};
|
|
674
680
|
|
|
675
|
-
module.exports.
|
|
676
|
-
const ret = new
|
|
677
|
-
return addHeapObject(ret);
|
|
678
|
-
};
|
|
679
|
-
|
|
680
|
-
module.exports.__wbindgen_number_new = function(arg0) {
|
|
681
|
-
const ret = arg0;
|
|
681
|
+
module.exports.__wbg_constructor_9e0f49809a0dd2f4 = function(arg0) {
|
|
682
|
+
const ret = new Error(takeObject(arg0));
|
|
682
683
|
return addHeapObject(ret);
|
|
683
684
|
};
|
|
684
685
|
|
|
685
|
-
module.exports.
|
|
686
|
+
module.exports.__wbg_new_cd95aa9a75b6fbe6 = function() {
|
|
686
687
|
const ret = new Map();
|
|
687
688
|
return addHeapObject(ret);
|
|
688
689
|
};
|
|
@@ -914,7 +915,7 @@ module.exports.__wbindgen_throw = function(arg0, arg1) {
|
|
|
914
915
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
915
916
|
};
|
|
916
917
|
|
|
917
|
-
module.exports.
|
|
918
|
+
module.exports.__wbindgen_closure_wrapper734 = function(arg0, arg1, arg2) {
|
|
918
919
|
const ret = makeMutClosure(arg0, arg1, 256, __wbg_adapter_22);
|
|
919
920
|
return addHeapObject(ret);
|
|
920
921
|
};
|
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export function buildInfo(): number;
|
|
4
5
|
export function initLogLevel(a: number, b: number, c: number): void;
|
|
5
|
-
export function getReturnWitness(a: number, b: number, c: number, d: number): void;
|
|
6
|
-
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
|
|
7
|
-
export function getPublicWitness(a: number, b: number, c: number, d: number): void;
|
|
8
|
-
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
9
|
-
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
|
|
10
|
-
export function executeProgram(a: number, b: number, c: number, d: number): number;
|
|
11
6
|
export function and(a: number, b: number): number;
|
|
12
7
|
export function xor(a: number, b: number): number;
|
|
13
8
|
export function sha256(a: number, b: number, c: number): void;
|
|
@@ -15,11 +10,16 @@ export function blake2s256(a: number, b: number, c: number): void;
|
|
|
15
10
|
export function keccak256(a: number, b: number, c: number): void;
|
|
16
11
|
export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
|
17
12
|
export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
|
18
|
-
export function
|
|
13
|
+
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
14
|
+
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
|
|
15
|
+
export function executeProgram(a: number, b: number, c: number, d: number): number;
|
|
19
16
|
export function compressWitness(a: number, b: number): void;
|
|
20
17
|
export function decompressWitness(a: number, b: number, c: number): void;
|
|
21
18
|
export function compressWitnessStack(a: number, b: number): void;
|
|
22
19
|
export function decompressWitnessStack(a: number, b: number, c: number): void;
|
|
20
|
+
export function getReturnWitness(a: number, b: number, c: number, d: number): void;
|
|
21
|
+
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
|
|
22
|
+
export function getPublicWitness(a: number, b: number, c: number, d: number): void;
|
|
23
23
|
export function __wbindgen_malloc(a: number): number;
|
|
24
24
|
export function __wbindgen_realloc(a: number, b: number, c: number): number;
|
|
25
25
|
export const __wbindgen_export_2: WebAssembly.Table;
|
package/package.json
CHANGED
package/web/acvm_js.d.ts
CHANGED
|
@@ -1,73 +1,17 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
5
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
6
|
+
*/
|
|
7
|
+
export function buildInfo(): BuildInfo;
|
|
8
|
+
/**
|
|
4
9
|
* Sets the package's logging level.
|
|
5
10
|
*
|
|
6
11
|
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
7
12
|
*/
|
|
8
13
|
export function initLogLevel(filter: string): void;
|
|
9
14
|
/**
|
|
10
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
11
|
-
*
|
|
12
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
13
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
14
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
15
|
-
* @param {Uint8Array} program
|
|
16
|
-
* @param {WitnessMap} witness_map
|
|
17
|
-
* @returns {WitnessMap}
|
|
18
|
-
*/
|
|
19
|
-
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
20
|
-
/**
|
|
21
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
22
|
-
*
|
|
23
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
24
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
25
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
26
|
-
* @param {Uint8Array} program
|
|
27
|
-
* @param {WitnessMap} solved_witness
|
|
28
|
-
* @returns {WitnessMap}
|
|
29
|
-
*/
|
|
30
|
-
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
31
|
-
/**
|
|
32
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
33
|
-
*
|
|
34
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
35
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
36
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
37
|
-
* @param {Uint8Array} program
|
|
38
|
-
* @param {WitnessMap} solved_witness
|
|
39
|
-
* @returns {WitnessMap}
|
|
40
|
-
*/
|
|
41
|
-
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
42
|
-
/**
|
|
43
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
44
|
-
*
|
|
45
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
46
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
47
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
48
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
49
|
-
*/
|
|
50
|
-
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
51
|
-
/**
|
|
52
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
53
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
54
|
-
*
|
|
55
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
56
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
57
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
58
|
-
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
59
|
-
*/
|
|
60
|
-
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
61
|
-
/**
|
|
62
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
63
|
-
*
|
|
64
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
65
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
66
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
67
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
68
|
-
*/
|
|
69
|
-
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
70
|
-
/**
|
|
71
15
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
72
16
|
* @param {string} lhs
|
|
73
17
|
* @param {string} rhs
|
|
@@ -118,10 +62,33 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
|
|
|
118
62
|
*/
|
|
119
63
|
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
120
64
|
/**
|
|
121
|
-
*
|
|
122
|
-
*
|
|
65
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
66
|
+
*
|
|
67
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
68
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
69
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
70
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
123
71
|
*/
|
|
124
|
-
export function
|
|
72
|
+
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
73
|
+
/**
|
|
74
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
75
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
76
|
+
*
|
|
77
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
78
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
79
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
80
|
+
* @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.
|
|
81
|
+
*/
|
|
82
|
+
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
83
|
+
/**
|
|
84
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
85
|
+
*
|
|
86
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
87
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
88
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
89
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
90
|
+
*/
|
|
91
|
+
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
125
92
|
/**
|
|
126
93
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
127
94
|
*
|
|
@@ -151,15 +118,51 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
|
151
118
|
* @returns {WitnessStack} The decompressed witness stack.
|
|
152
119
|
*/
|
|
153
120
|
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
121
|
+
/**
|
|
122
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
123
|
+
*
|
|
124
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
125
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
126
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
127
|
+
* @param {Uint8Array} program
|
|
128
|
+
* @param {WitnessMap} witness_map
|
|
129
|
+
* @returns {WitnessMap}
|
|
130
|
+
*/
|
|
131
|
+
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
132
|
+
/**
|
|
133
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
134
|
+
*
|
|
135
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
136
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
137
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
138
|
+
* @param {Uint8Array} program
|
|
139
|
+
* @param {WitnessMap} solved_witness
|
|
140
|
+
* @returns {WitnessMap}
|
|
141
|
+
*/
|
|
142
|
+
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
143
|
+
/**
|
|
144
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
145
|
+
*
|
|
146
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
147
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
148
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
149
|
+
* @param {Uint8Array} program
|
|
150
|
+
* @param {WitnessMap} solved_witness
|
|
151
|
+
* @returns {WitnessMap}
|
|
152
|
+
*/
|
|
153
|
+
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
154
154
|
|
|
155
|
-
export type
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
155
|
+
export type ForeignCallInput = string[]
|
|
156
|
+
export type ForeignCallOutput = string | string[]
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* A callback which performs an foreign call and returns the response.
|
|
160
|
+
* @callback ForeignCallHandler
|
|
161
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
162
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
163
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
164
|
+
*/
|
|
165
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
163
166
|
|
|
164
167
|
|
|
165
168
|
|
|
@@ -186,17 +189,14 @@ export type BuildInfo = {
|
|
|
186
189
|
|
|
187
190
|
|
|
188
191
|
|
|
189
|
-
export type
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
198
|
-
*/
|
|
199
|
-
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
192
|
+
export type RawAssertionPayload = {
|
|
193
|
+
selector: string;
|
|
194
|
+
data: string[];
|
|
195
|
+
};
|
|
196
|
+
export type ExecutionError = Error & {
|
|
197
|
+
callStack?: string[];
|
|
198
|
+
rawAssertionPayload?: RawAssertionPayload;
|
|
199
|
+
};
|
|
200
200
|
|
|
201
201
|
|
|
202
202
|
|
|
@@ -219,13 +219,8 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
219
219
|
|
|
220
220
|
export interface InitOutput {
|
|
221
221
|
readonly memory: WebAssembly.Memory;
|
|
222
|
+
readonly buildInfo: () => number;
|
|
222
223
|
readonly initLogLevel: (a: number, b: number, c: number) => void;
|
|
223
|
-
readonly getReturnWitness: (a: number, b: number, c: number, d: number) => void;
|
|
224
|
-
readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void;
|
|
225
|
-
readonly getPublicWitness: (a: number, b: number, c: number, d: number) => void;
|
|
226
|
-
readonly executeCircuit: (a: number, b: number, c: number, d: number) => number;
|
|
227
|
-
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: number, d: number) => number;
|
|
228
|
-
readonly executeProgram: (a: number, b: number, c: number, d: number) => number;
|
|
229
224
|
readonly and: (a: number, b: number) => number;
|
|
230
225
|
readonly xor: (a: number, b: number) => number;
|
|
231
226
|
readonly sha256: (a: number, b: number, c: number) => void;
|
|
@@ -233,11 +228,16 @@ export interface InitOutput {
|
|
|
233
228
|
readonly keccak256: (a: number, b: number, c: number) => void;
|
|
234
229
|
readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
235
230
|
readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
236
|
-
readonly
|
|
231
|
+
readonly executeCircuit: (a: number, b: number, c: number, d: number) => number;
|
|
232
|
+
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: number, d: number) => number;
|
|
233
|
+
readonly executeProgram: (a: number, b: number, c: number, d: number) => number;
|
|
237
234
|
readonly compressWitness: (a: number, b: number) => void;
|
|
238
235
|
readonly decompressWitness: (a: number, b: number, c: number) => void;
|
|
239
236
|
readonly compressWitnessStack: (a: number, b: number) => void;
|
|
240
237
|
readonly decompressWitnessStack: (a: number, b: number, c: number) => void;
|
|
238
|
+
readonly getReturnWitness: (a: number, b: number, c: number, d: number) => void;
|
|
239
|
+
readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void;
|
|
240
|
+
readonly getPublicWitness: (a: number, b: number, c: number, d: number) => void;
|
|
241
241
|
readonly __wbindgen_malloc: (a: number) => number;
|
|
242
242
|
readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
|
|
243
243
|
readonly __wbindgen_export_2: WebAssembly.Table;
|
package/web/acvm_js.js
CHANGED
|
@@ -42,6 +42,15 @@ function getInt32Memory0() {
|
|
|
42
42
|
return cachedInt32Memory0;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
function addHeapObject(obj) {
|
|
46
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
47
|
+
const idx = heap_next;
|
|
48
|
+
heap_next = heap[idx];
|
|
49
|
+
|
|
50
|
+
heap[idx] = obj;
|
|
51
|
+
return idx;
|
|
52
|
+
}
|
|
53
|
+
|
|
45
54
|
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
|
46
55
|
|
|
47
56
|
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
|
|
@@ -60,15 +69,6 @@ function getStringFromWasm0(ptr, len) {
|
|
|
60
69
|
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
61
70
|
}
|
|
62
71
|
|
|
63
|
-
function addHeapObject(obj) {
|
|
64
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
65
|
-
const idx = heap_next;
|
|
66
|
-
heap_next = heap[idx];
|
|
67
|
-
|
|
68
|
-
heap[idx] = obj;
|
|
69
|
-
return idx;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
72
|
let WASM_VECTOR_LEN = 0;
|
|
73
73
|
|
|
74
74
|
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
|
|
@@ -217,6 +217,15 @@ function __wbg_adapter_22(arg0, arg1, arg2) {
|
|
|
217
217
|
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h36bac5ff3ea3c380(arg0, arg1, addHeapObject(arg2));
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
+
/**
|
|
221
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
222
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
223
|
+
*/
|
|
224
|
+
export function buildInfo() {
|
|
225
|
+
const ret = wasm.buildInfo();
|
|
226
|
+
return takeObject(ret);
|
|
227
|
+
}
|
|
228
|
+
|
|
220
229
|
/**
|
|
221
230
|
* Sets the package's logging level.
|
|
222
231
|
*
|
|
@@ -238,142 +247,6 @@ export function initLogLevel(filter) {
|
|
|
238
247
|
}
|
|
239
248
|
}
|
|
240
249
|
|
|
241
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
242
|
-
const ptr = malloc(arg.length * 1) >>> 0;
|
|
243
|
-
getUint8Memory0().set(arg, ptr / 1);
|
|
244
|
-
WASM_VECTOR_LEN = arg.length;
|
|
245
|
-
return ptr;
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
249
|
-
*
|
|
250
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
251
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
252
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
253
|
-
* @param {Uint8Array} program
|
|
254
|
-
* @param {WitnessMap} witness_map
|
|
255
|
-
* @returns {WitnessMap}
|
|
256
|
-
*/
|
|
257
|
-
export function getReturnWitness(program, witness_map) {
|
|
258
|
-
try {
|
|
259
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
260
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
261
|
-
const len0 = WASM_VECTOR_LEN;
|
|
262
|
-
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
|
|
263
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
264
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
265
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
266
|
-
if (r2) {
|
|
267
|
-
throw takeObject(r1);
|
|
268
|
-
}
|
|
269
|
-
return takeObject(r0);
|
|
270
|
-
} finally {
|
|
271
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
/**
|
|
276
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
277
|
-
*
|
|
278
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
279
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
280
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
281
|
-
* @param {Uint8Array} program
|
|
282
|
-
* @param {WitnessMap} solved_witness
|
|
283
|
-
* @returns {WitnessMap}
|
|
284
|
-
*/
|
|
285
|
-
export function getPublicParametersWitness(program, solved_witness) {
|
|
286
|
-
try {
|
|
287
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
288
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
289
|
-
const len0 = WASM_VECTOR_LEN;
|
|
290
|
-
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
291
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
292
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
293
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
294
|
-
if (r2) {
|
|
295
|
-
throw takeObject(r1);
|
|
296
|
-
}
|
|
297
|
-
return takeObject(r0);
|
|
298
|
-
} finally {
|
|
299
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
/**
|
|
304
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
305
|
-
*
|
|
306
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
307
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
308
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
309
|
-
* @param {Uint8Array} program
|
|
310
|
-
* @param {WitnessMap} solved_witness
|
|
311
|
-
* @returns {WitnessMap}
|
|
312
|
-
*/
|
|
313
|
-
export function getPublicWitness(program, solved_witness) {
|
|
314
|
-
try {
|
|
315
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
316
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
317
|
-
const len0 = WASM_VECTOR_LEN;
|
|
318
|
-
wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
319
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
320
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
321
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
322
|
-
if (r2) {
|
|
323
|
-
throw takeObject(r1);
|
|
324
|
-
}
|
|
325
|
-
return takeObject(r0);
|
|
326
|
-
} finally {
|
|
327
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
/**
|
|
332
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
333
|
-
*
|
|
334
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
335
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
336
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
337
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
338
|
-
*/
|
|
339
|
-
export function executeCircuit(program, initial_witness, foreign_call_handler) {
|
|
340
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
341
|
-
const len0 = WASM_VECTOR_LEN;
|
|
342
|
-
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
343
|
-
return takeObject(ret);
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
/**
|
|
347
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
348
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
349
|
-
*
|
|
350
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
351
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
352
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
353
|
-
* @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.
|
|
354
|
-
*/
|
|
355
|
-
export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
|
|
356
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
357
|
-
const len0 = WASM_VECTOR_LEN;
|
|
358
|
-
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
359
|
-
return takeObject(ret);
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
364
|
-
*
|
|
365
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
366
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
367
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
368
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
369
|
-
*/
|
|
370
|
-
export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
371
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
372
|
-
const len0 = WASM_VECTOR_LEN;
|
|
373
|
-
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
374
|
-
return takeObject(ret);
|
|
375
|
-
}
|
|
376
|
-
|
|
377
250
|
/**
|
|
378
251
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
379
252
|
* @param {string} lhs
|
|
@@ -396,6 +269,13 @@ export function xor(lhs, rhs) {
|
|
|
396
269
|
return takeObject(ret);
|
|
397
270
|
}
|
|
398
271
|
|
|
272
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
273
|
+
const ptr = malloc(arg.length * 1) >>> 0;
|
|
274
|
+
getUint8Memory0().set(arg, ptr / 1);
|
|
275
|
+
WASM_VECTOR_LEN = arg.length;
|
|
276
|
+
return ptr;
|
|
277
|
+
}
|
|
278
|
+
|
|
399
279
|
function getArrayU8FromWasm0(ptr, len) {
|
|
400
280
|
ptr = ptr >>> 0;
|
|
401
281
|
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
@@ -506,11 +386,48 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
|
|
|
506
386
|
}
|
|
507
387
|
|
|
508
388
|
/**
|
|
509
|
-
*
|
|
510
|
-
*
|
|
389
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
390
|
+
*
|
|
391
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
392
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
393
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
394
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
511
395
|
*/
|
|
512
|
-
export function
|
|
513
|
-
const
|
|
396
|
+
export function executeCircuit(program, initial_witness, foreign_call_handler) {
|
|
397
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
398
|
+
const len0 = WASM_VECTOR_LEN;
|
|
399
|
+
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
400
|
+
return takeObject(ret);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
405
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
406
|
+
*
|
|
407
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
408
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
409
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
410
|
+
* @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.
|
|
411
|
+
*/
|
|
412
|
+
export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
|
|
413
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
414
|
+
const len0 = WASM_VECTOR_LEN;
|
|
415
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
416
|
+
return takeObject(ret);
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
421
|
+
*
|
|
422
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
423
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
424
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
425
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
426
|
+
*/
|
|
427
|
+
export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
428
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
429
|
+
const len0 = WASM_VECTOR_LEN;
|
|
430
|
+
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
514
431
|
return takeObject(ret);
|
|
515
432
|
}
|
|
516
433
|
|
|
@@ -613,6 +530,90 @@ export function decompressWitnessStack(compressed_witness) {
|
|
|
613
530
|
}
|
|
614
531
|
}
|
|
615
532
|
|
|
533
|
+
/**
|
|
534
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
535
|
+
*
|
|
536
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
537
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
538
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
539
|
+
* @param {Uint8Array} program
|
|
540
|
+
* @param {WitnessMap} witness_map
|
|
541
|
+
* @returns {WitnessMap}
|
|
542
|
+
*/
|
|
543
|
+
export function getReturnWitness(program, witness_map) {
|
|
544
|
+
try {
|
|
545
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
546
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
547
|
+
const len0 = WASM_VECTOR_LEN;
|
|
548
|
+
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
|
|
549
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
550
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
551
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
552
|
+
if (r2) {
|
|
553
|
+
throw takeObject(r1);
|
|
554
|
+
}
|
|
555
|
+
return takeObject(r0);
|
|
556
|
+
} finally {
|
|
557
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
/**
|
|
562
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
563
|
+
*
|
|
564
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
565
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
566
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
567
|
+
* @param {Uint8Array} program
|
|
568
|
+
* @param {WitnessMap} solved_witness
|
|
569
|
+
* @returns {WitnessMap}
|
|
570
|
+
*/
|
|
571
|
+
export function getPublicParametersWitness(program, solved_witness) {
|
|
572
|
+
try {
|
|
573
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
574
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
575
|
+
const len0 = WASM_VECTOR_LEN;
|
|
576
|
+
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
577
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
578
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
579
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
580
|
+
if (r2) {
|
|
581
|
+
throw takeObject(r1);
|
|
582
|
+
}
|
|
583
|
+
return takeObject(r0);
|
|
584
|
+
} finally {
|
|
585
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
591
|
+
*
|
|
592
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
593
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
594
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
595
|
+
* @param {Uint8Array} program
|
|
596
|
+
* @param {WitnessMap} solved_witness
|
|
597
|
+
* @returns {WitnessMap}
|
|
598
|
+
*/
|
|
599
|
+
export function getPublicWitness(program, solved_witness) {
|
|
600
|
+
try {
|
|
601
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
602
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
603
|
+
const len0 = WASM_VECTOR_LEN;
|
|
604
|
+
wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
605
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
606
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
607
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
608
|
+
if (r2) {
|
|
609
|
+
throw takeObject(r1);
|
|
610
|
+
}
|
|
611
|
+
return takeObject(r0);
|
|
612
|
+
} finally {
|
|
613
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
|
|
616
617
|
function __wbg_adapter_76(arg0, arg1, arg2, arg3, arg4) {
|
|
617
618
|
wasm.wasm_bindgen__convert__closures__invoke3_mut__h629417323d5efbaa(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
|
|
618
619
|
}
|
|
@@ -674,37 +675,37 @@ function __wbg_get_imports() {
|
|
|
674
675
|
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
675
676
|
takeObject(arg0);
|
|
676
677
|
};
|
|
678
|
+
imports.wbg.__wbindgen_is_string = function(arg0) {
|
|
679
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
|
680
|
+
return ret;
|
|
681
|
+
};
|
|
682
|
+
imports.wbg.__wbindgen_is_array = function(arg0) {
|
|
683
|
+
const ret = Array.isArray(getObject(arg0));
|
|
684
|
+
return ret;
|
|
685
|
+
};
|
|
677
686
|
imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
|
|
678
687
|
const obj = getObject(arg1);
|
|
679
688
|
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
680
689
|
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
681
690
|
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
682
691
|
};
|
|
683
|
-
imports.wbg.
|
|
684
|
-
const ret = new
|
|
692
|
+
imports.wbg.__wbg_new_baa0339c0c5c310a = function() {
|
|
693
|
+
const ret = new Array();
|
|
685
694
|
return addHeapObject(ret);
|
|
686
695
|
};
|
|
687
|
-
imports.wbg.
|
|
688
|
-
const ret =
|
|
689
|
-
return ret;
|
|
690
|
-
};
|
|
691
|
-
imports.wbg.__wbindgen_is_string = function(arg0) {
|
|
692
|
-
const ret = typeof(getObject(arg0)) === 'string';
|
|
693
|
-
return ret;
|
|
696
|
+
imports.wbg.__wbindgen_number_new = function(arg0) {
|
|
697
|
+
const ret = arg0;
|
|
698
|
+
return addHeapObject(ret);
|
|
694
699
|
};
|
|
695
700
|
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
696
701
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
697
702
|
return addHeapObject(ret);
|
|
698
703
|
};
|
|
699
|
-
imports.wbg.
|
|
700
|
-
const ret = new
|
|
701
|
-
return addHeapObject(ret);
|
|
702
|
-
};
|
|
703
|
-
imports.wbg.__wbindgen_number_new = function(arg0) {
|
|
704
|
-
const ret = arg0;
|
|
704
|
+
imports.wbg.__wbg_constructor_9e0f49809a0dd2f4 = function(arg0) {
|
|
705
|
+
const ret = new Error(takeObject(arg0));
|
|
705
706
|
return addHeapObject(ret);
|
|
706
707
|
};
|
|
707
|
-
imports.wbg.
|
|
708
|
+
imports.wbg.__wbg_new_cd95aa9a75b6fbe6 = function() {
|
|
708
709
|
const ret = new Map();
|
|
709
710
|
return addHeapObject(ret);
|
|
710
711
|
};
|
|
@@ -899,7 +900,7 @@ function __wbg_get_imports() {
|
|
|
899
900
|
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
900
901
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
901
902
|
};
|
|
902
|
-
imports.wbg.
|
|
903
|
+
imports.wbg.__wbindgen_closure_wrapper734 = function(arg0, arg1, arg2) {
|
|
903
904
|
const ret = makeMutClosure(arg0, arg1, 256, __wbg_adapter_22);
|
|
904
905
|
return addHeapObject(ret);
|
|
905
906
|
};
|
package/web/acvm_js_bg.wasm
CHANGED
|
Binary file
|
package/web/acvm_js_bg.wasm.d.ts
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export function buildInfo(): number;
|
|
4
5
|
export function initLogLevel(a: number, b: number, c: number): void;
|
|
5
|
-
export function getReturnWitness(a: number, b: number, c: number, d: number): void;
|
|
6
|
-
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
|
|
7
|
-
export function getPublicWitness(a: number, b: number, c: number, d: number): void;
|
|
8
|
-
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
9
|
-
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
|
|
10
|
-
export function executeProgram(a: number, b: number, c: number, d: number): number;
|
|
11
6
|
export function and(a: number, b: number): number;
|
|
12
7
|
export function xor(a: number, b: number): number;
|
|
13
8
|
export function sha256(a: number, b: number, c: number): void;
|
|
@@ -15,11 +10,16 @@ export function blake2s256(a: number, b: number, c: number): void;
|
|
|
15
10
|
export function keccak256(a: number, b: number, c: number): void;
|
|
16
11
|
export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
|
17
12
|
export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
|
18
|
-
export function
|
|
13
|
+
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
14
|
+
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
|
|
15
|
+
export function executeProgram(a: number, b: number, c: number, d: number): number;
|
|
19
16
|
export function compressWitness(a: number, b: number): void;
|
|
20
17
|
export function decompressWitness(a: number, b: number, c: number): void;
|
|
21
18
|
export function compressWitnessStack(a: number, b: number): void;
|
|
22
19
|
export function decompressWitnessStack(a: number, b: number, c: number): void;
|
|
20
|
+
export function getReturnWitness(a: number, b: number, c: number, d: number): void;
|
|
21
|
+
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
|
|
22
|
+
export function getPublicWitness(a: number, b: number, c: number, d: number): void;
|
|
23
23
|
export function __wbindgen_malloc(a: number): number;
|
|
24
24
|
export function __wbindgen_realloc(a: number, b: number, c: number): number;
|
|
25
25
|
export const __wbindgen_export_2: WebAssembly.Table;
|