@noir-lang/acvm_js 1.0.0-beta.2-97afa52.nightly → 1.0.0-beta.2-8f20392.nightly
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/nodejs/acvm_js.d.ts +48 -48
- package/nodejs/acvm_js.js +119 -119
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +4 -4
- package/package.json +1 -1
- package/web/acvm_js.d.ts +52 -52
- package/web/acvm_js.js +116 -116
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +4 -4
package/nodejs/acvm_js.d.ts
CHANGED
|
@@ -1,40 +1,6 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
5
|
-
*
|
|
6
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
7
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
8
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
9
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
10
|
-
*/
|
|
11
|
-
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
12
|
-
/**
|
|
13
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
14
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
15
|
-
*
|
|
16
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
17
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
18
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
19
|
-
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
20
|
-
*/
|
|
21
|
-
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
22
|
-
/**
|
|
23
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
24
|
-
*
|
|
25
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
26
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
27
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
28
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
29
|
-
*/
|
|
30
|
-
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
31
|
-
/**
|
|
32
|
-
* Sets the package's logging level.
|
|
33
|
-
*
|
|
34
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
35
|
-
*/
|
|
36
|
-
export function initLogLevel(filter: string): void;
|
|
37
|
-
/**
|
|
38
4
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
39
5
|
*
|
|
40
6
|
* @param {WitnessMap} witness_map - A witness map.
|
|
@@ -64,6 +30,34 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
|
64
30
|
*/
|
|
65
31
|
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
66
32
|
/**
|
|
33
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
34
|
+
*
|
|
35
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
36
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
37
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
38
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
39
|
+
*/
|
|
40
|
+
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
41
|
+
/**
|
|
42
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
43
|
+
* This method also extracts the public return values from the solved witness into its own return 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 {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.
|
|
49
|
+
*/
|
|
50
|
+
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
51
|
+
/**
|
|
52
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
53
|
+
*
|
|
54
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
55
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
56
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
57
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
58
|
+
*/
|
|
59
|
+
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
60
|
+
/**
|
|
67
61
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
68
62
|
* @param {string} lhs
|
|
69
63
|
* @param {string} rhs
|
|
@@ -146,6 +140,12 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
146
140
|
* @returns {WitnessMap}
|
|
147
141
|
*/
|
|
148
142
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
143
|
+
/**
|
|
144
|
+
* Sets the package's logging level.
|
|
145
|
+
*
|
|
146
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
147
|
+
*/
|
|
148
|
+
export function initLogLevel(filter: string): void;
|
|
149
149
|
|
|
150
150
|
// Map from witness index to hex string value of witness.
|
|
151
151
|
export type WitnessMap = Map<number, string>;
|
|
@@ -162,20 +162,6 @@ export type SolvedAndReturnWitness = {
|
|
|
162
162
|
|
|
163
163
|
|
|
164
164
|
|
|
165
|
-
export type ForeignCallInput = string[]
|
|
166
|
-
export type ForeignCallOutput = string | string[]
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* A callback which performs an foreign call and returns the response.
|
|
170
|
-
* @callback ForeignCallHandler
|
|
171
|
-
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
172
|
-
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
173
|
-
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
174
|
-
*/
|
|
175
|
-
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
165
|
/**
|
|
180
166
|
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
181
167
|
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
@@ -211,3 +197,17 @@ export type StackItem = {
|
|
|
211
197
|
export type WitnessStack = Array<StackItem>;
|
|
212
198
|
|
|
213
199
|
|
|
200
|
+
|
|
201
|
+
export type ForeignCallInput = string[]
|
|
202
|
+
export type ForeignCallOutput = string | string[]
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* A callback which performs an foreign call and returns the response.
|
|
206
|
+
* @callback ForeignCallHandler
|
|
207
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
208
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
209
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
210
|
+
*/
|
|
211
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
212
|
+
|
|
213
|
+
|
package/nodejs/acvm_js.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
let imports = {};
|
|
2
2
|
imports['__wbindgen_placeholder__'] = module.exports;
|
|
3
3
|
let wasm;
|
|
4
|
-
const {
|
|
4
|
+
const { TextEncoder, TextDecoder } = require(`util`);
|
|
5
5
|
|
|
6
6
|
const heap = new Array(128).fill(undefined);
|
|
7
7
|
|
|
@@ -23,18 +23,7 @@ function takeObject(idx) {
|
|
|
23
23
|
return ret;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
28
|
-
const idx = heap_next;
|
|
29
|
-
heap_next = heap[idx];
|
|
30
|
-
|
|
31
|
-
heap[idx] = obj;
|
|
32
|
-
return idx;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
36
|
-
|
|
37
|
-
cachedTextDecoder.decode();
|
|
26
|
+
let WASM_VECTOR_LEN = 0;
|
|
38
27
|
|
|
39
28
|
let cachedUint8Memory0 = null;
|
|
40
29
|
|
|
@@ -45,13 +34,6 @@ function getUint8Memory0() {
|
|
|
45
34
|
return cachedUint8Memory0;
|
|
46
35
|
}
|
|
47
36
|
|
|
48
|
-
function getStringFromWasm0(ptr, len) {
|
|
49
|
-
ptr = ptr >>> 0;
|
|
50
|
-
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
let WASM_VECTOR_LEN = 0;
|
|
54
|
-
|
|
55
37
|
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
56
38
|
|
|
57
39
|
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
@@ -118,6 +100,24 @@ function getInt32Memory0() {
|
|
|
118
100
|
return cachedInt32Memory0;
|
|
119
101
|
}
|
|
120
102
|
|
|
103
|
+
function addHeapObject(obj) {
|
|
104
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
105
|
+
const idx = heap_next;
|
|
106
|
+
heap_next = heap[idx];
|
|
107
|
+
|
|
108
|
+
heap[idx] = obj;
|
|
109
|
+
return idx;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
113
|
+
|
|
114
|
+
cachedTextDecoder.decode();
|
|
115
|
+
|
|
116
|
+
function getStringFromWasm0(ptr, len) {
|
|
117
|
+
ptr = ptr >>> 0;
|
|
118
|
+
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
119
|
+
}
|
|
120
|
+
|
|
121
121
|
let cachedFloat64Memory0 = null;
|
|
122
122
|
|
|
123
123
|
function getFloat64Memory0() {
|
|
@@ -220,79 +220,6 @@ function __wbg_adapter_22(arg0, arg1, arg2) {
|
|
|
220
220
|
wasm.wasm_bindgen__convert__closures__invoke1_mut__hec5660d9489c77a2(arg0, arg1, addHeapObject(arg2));
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
224
|
-
const ptr = malloc(arg.length * 1) >>> 0;
|
|
225
|
-
getUint8Memory0().set(arg, ptr / 1);
|
|
226
|
-
WASM_VECTOR_LEN = arg.length;
|
|
227
|
-
return ptr;
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
231
|
-
*
|
|
232
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
233
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
234
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
235
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
236
|
-
*/
|
|
237
|
-
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
|
|
238
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
239
|
-
const len0 = WASM_VECTOR_LEN;
|
|
240
|
-
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
241
|
-
return takeObject(ret);
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
246
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
247
|
-
*
|
|
248
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
249
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
250
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
251
|
-
* @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.
|
|
252
|
-
*/
|
|
253
|
-
module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
|
|
254
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
255
|
-
const len0 = WASM_VECTOR_LEN;
|
|
256
|
-
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
257
|
-
return takeObject(ret);
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
262
|
-
*
|
|
263
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
264
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
265
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
266
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
267
|
-
*/
|
|
268
|
-
module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
|
|
269
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
270
|
-
const len0 = WASM_VECTOR_LEN;
|
|
271
|
-
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
272
|
-
return takeObject(ret);
|
|
273
|
-
};
|
|
274
|
-
|
|
275
|
-
/**
|
|
276
|
-
* Sets the package's logging level.
|
|
277
|
-
*
|
|
278
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
279
|
-
*/
|
|
280
|
-
module.exports.initLogLevel = function(filter) {
|
|
281
|
-
try {
|
|
282
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
283
|
-
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
284
|
-
const len0 = WASM_VECTOR_LEN;
|
|
285
|
-
wasm.initLogLevel(retptr, ptr0, len0);
|
|
286
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
287
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
288
|
-
if (r1) {
|
|
289
|
-
throw takeObject(r0);
|
|
290
|
-
}
|
|
291
|
-
} finally {
|
|
292
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
293
|
-
}
|
|
294
|
-
};
|
|
295
|
-
|
|
296
223
|
function getArrayU8FromWasm0(ptr, len) {
|
|
297
224
|
ptr = ptr >>> 0;
|
|
298
225
|
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
@@ -322,6 +249,12 @@ module.exports.compressWitness = function(witness_map) {
|
|
|
322
249
|
}
|
|
323
250
|
};
|
|
324
251
|
|
|
252
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
253
|
+
const ptr = malloc(arg.length * 1) >>> 0;
|
|
254
|
+
getUint8Memory0().set(arg, ptr / 1);
|
|
255
|
+
WASM_VECTOR_LEN = arg.length;
|
|
256
|
+
return ptr;
|
|
257
|
+
}
|
|
325
258
|
/**
|
|
326
259
|
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
327
260
|
* This should be used to only fetch the witness map for the main function.
|
|
@@ -396,6 +329,52 @@ module.exports.decompressWitnessStack = function(compressed_witness) {
|
|
|
396
329
|
}
|
|
397
330
|
};
|
|
398
331
|
|
|
332
|
+
/**
|
|
333
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
334
|
+
*
|
|
335
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
336
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
337
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
338
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
339
|
+
*/
|
|
340
|
+
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
|
|
341
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
342
|
+
const len0 = WASM_VECTOR_LEN;
|
|
343
|
+
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
344
|
+
return takeObject(ret);
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
349
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
350
|
+
*
|
|
351
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
352
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
353
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
354
|
+
* @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.
|
|
355
|
+
*/
|
|
356
|
+
module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
|
|
357
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
358
|
+
const len0 = WASM_VECTOR_LEN;
|
|
359
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
360
|
+
return takeObject(ret);
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
365
|
+
*
|
|
366
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
367
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
368
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
369
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
370
|
+
*/
|
|
371
|
+
module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
|
|
372
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
373
|
+
const len0 = WASM_VECTOR_LEN;
|
|
374
|
+
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
375
|
+
return takeObject(ret);
|
|
376
|
+
};
|
|
377
|
+
|
|
399
378
|
/**
|
|
400
379
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
401
380
|
* @param {string} lhs
|
|
@@ -618,6 +597,27 @@ module.exports.getPublicWitness = function(program, solved_witness) {
|
|
|
618
597
|
}
|
|
619
598
|
};
|
|
620
599
|
|
|
600
|
+
/**
|
|
601
|
+
* Sets the package's logging level.
|
|
602
|
+
*
|
|
603
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
604
|
+
*/
|
|
605
|
+
module.exports.initLogLevel = function(filter) {
|
|
606
|
+
try {
|
|
607
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
608
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
609
|
+
const len0 = WASM_VECTOR_LEN;
|
|
610
|
+
wasm.initLogLevel(retptr, ptr0, len0);
|
|
611
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
612
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
613
|
+
if (r1) {
|
|
614
|
+
throw takeObject(r0);
|
|
615
|
+
}
|
|
616
|
+
} finally {
|
|
617
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
618
|
+
}
|
|
619
|
+
};
|
|
620
|
+
|
|
621
621
|
function __wbg_adapter_75(arg0, arg1, arg2, arg3, arg4) {
|
|
622
622
|
wasm.wasm_bindgen__convert__closures__invoke3_mut__h083a66e5b0ae3ce9(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
|
|
623
623
|
}
|
|
@@ -637,14 +637,33 @@ module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
|
637
637
|
takeObject(arg0);
|
|
638
638
|
};
|
|
639
639
|
|
|
640
|
+
module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
641
|
+
const obj = takeObject(arg0).original;
|
|
642
|
+
if (obj.cnt-- == 1) {
|
|
643
|
+
obj.a = 0;
|
|
644
|
+
return true;
|
|
645
|
+
}
|
|
646
|
+
const ret = false;
|
|
647
|
+
return ret;
|
|
648
|
+
};
|
|
649
|
+
|
|
640
650
|
module.exports.__wbindgen_is_array = function(arg0) {
|
|
641
651
|
const ret = Array.isArray(getObject(arg0));
|
|
642
652
|
return ret;
|
|
643
653
|
};
|
|
644
654
|
|
|
645
|
-
module.exports.
|
|
646
|
-
const ret =
|
|
647
|
-
return
|
|
655
|
+
module.exports.__wbindgen_is_string = function(arg0) {
|
|
656
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
|
657
|
+
return ret;
|
|
658
|
+
};
|
|
659
|
+
|
|
660
|
+
module.exports.__wbindgen_string_get = function(arg0, arg1) {
|
|
661
|
+
const obj = getObject(arg1);
|
|
662
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
663
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
664
|
+
var len1 = WASM_VECTOR_LEN;
|
|
665
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
666
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
648
667
|
};
|
|
649
668
|
|
|
650
669
|
module.exports.__wbg_new_35cd49f1520efef9 = function() {
|
|
@@ -662,28 +681,9 @@ module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
|
662
681
|
return addHeapObject(ret);
|
|
663
682
|
};
|
|
664
683
|
|
|
665
|
-
module.exports.
|
|
666
|
-
const
|
|
667
|
-
|
|
668
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
669
|
-
var len1 = WASM_VECTOR_LEN;
|
|
670
|
-
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
671
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
672
|
-
};
|
|
673
|
-
|
|
674
|
-
module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
675
|
-
const obj = takeObject(arg0).original;
|
|
676
|
-
if (obj.cnt-- == 1) {
|
|
677
|
-
obj.a = 0;
|
|
678
|
-
return true;
|
|
679
|
-
}
|
|
680
|
-
const ret = false;
|
|
681
|
-
return ret;
|
|
682
|
-
};
|
|
683
|
-
|
|
684
|
-
module.exports.__wbindgen_is_string = function(arg0) {
|
|
685
|
-
const ret = typeof(getObject(arg0)) === 'string';
|
|
686
|
-
return ret;
|
|
684
|
+
module.exports.__wbg_constructor_7d42f5e2b3ae2f5e = function(arg0) {
|
|
685
|
+
const ret = new Error(takeObject(arg0));
|
|
686
|
+
return addHeapObject(ret);
|
|
687
687
|
};
|
|
688
688
|
|
|
689
689
|
module.exports.__wbindgen_number_get = function(arg0, arg1) {
|
|
@@ -916,7 +916,7 @@ module.exports.__wbindgen_throw = function(arg0, arg1) {
|
|
|
916
916
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
917
917
|
};
|
|
918
918
|
|
|
919
|
-
module.exports.
|
|
919
|
+
module.exports.__wbindgen_closure_wrapper783 = function(arg0, arg1, arg2) {
|
|
920
920
|
const ret = makeMutClosure(arg0, arg1, 301, __wbg_adapter_22);
|
|
921
921
|
return addHeapObject(ret);
|
|
922
922
|
};
|
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
5
|
-
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
|
|
6
|
-
export function executeProgram(a: number, b: number, c: number, d: number): number;
|
|
7
|
-
export function initLogLevel(a: number, b: number, c: number): void;
|
|
8
4
|
export function compressWitness(a: number, b: number): void;
|
|
9
5
|
export function decompressWitness(a: number, b: number, c: number): void;
|
|
10
6
|
export function compressWitnessStack(a: number, b: number): void;
|
|
11
7
|
export function decompressWitnessStack(a: number, b: number, c: 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;
|
|
12
11
|
export function and(a: number, b: number): number;
|
|
13
12
|
export function xor(a: number, b: number): number;
|
|
14
13
|
export function sha256_compression(a: number, b: number, c: number, d: number, e: number): void;
|
|
@@ -19,6 +18,7 @@ export function buildInfo(): number;
|
|
|
19
18
|
export function getReturnWitness(a: number, b: number, c: number, d: number): void;
|
|
20
19
|
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
|
|
21
20
|
export function getPublicWitness(a: number, b: number, c: number, d: number): void;
|
|
21
|
+
export function initLogLevel(a: number, b: number, c: number): void;
|
|
22
22
|
export function __wbindgen_malloc(a: number): number;
|
|
23
23
|
export function __wbindgen_realloc(a: number, b: number, c: number): number;
|
|
24
24
|
export const __wbindgen_export_2: WebAssembly.Table;
|
package/package.json
CHANGED
package/web/acvm_js.d.ts
CHANGED
|
@@ -1,40 +1,6 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
5
|
-
*
|
|
6
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
7
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
8
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
9
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
10
|
-
*/
|
|
11
|
-
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
12
|
-
/**
|
|
13
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
14
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
15
|
-
*
|
|
16
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
17
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
18
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
19
|
-
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
20
|
-
*/
|
|
21
|
-
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
22
|
-
/**
|
|
23
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
24
|
-
*
|
|
25
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
26
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
27
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
28
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
29
|
-
*/
|
|
30
|
-
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
31
|
-
/**
|
|
32
|
-
* Sets the package's logging level.
|
|
33
|
-
*
|
|
34
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
35
|
-
*/
|
|
36
|
-
export function initLogLevel(filter: string): void;
|
|
37
|
-
/**
|
|
38
4
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
39
5
|
*
|
|
40
6
|
* @param {WitnessMap} witness_map - A witness map.
|
|
@@ -64,6 +30,34 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
|
64
30
|
*/
|
|
65
31
|
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
66
32
|
/**
|
|
33
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
34
|
+
*
|
|
35
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
36
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
37
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
38
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
39
|
+
*/
|
|
40
|
+
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
41
|
+
/**
|
|
42
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
43
|
+
* This method also extracts the public return values from the solved witness into its own return 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 {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.
|
|
49
|
+
*/
|
|
50
|
+
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
51
|
+
/**
|
|
52
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
53
|
+
*
|
|
54
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
55
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
56
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
57
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
58
|
+
*/
|
|
59
|
+
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
60
|
+
/**
|
|
67
61
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
68
62
|
* @param {string} lhs
|
|
69
63
|
* @param {string} rhs
|
|
@@ -146,6 +140,12 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
146
140
|
* @returns {WitnessMap}
|
|
147
141
|
*/
|
|
148
142
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
143
|
+
/**
|
|
144
|
+
* Sets the package's logging level.
|
|
145
|
+
*
|
|
146
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
147
|
+
*/
|
|
148
|
+
export function initLogLevel(filter: string): void;
|
|
149
149
|
|
|
150
150
|
// Map from witness index to hex string value of witness.
|
|
151
151
|
export type WitnessMap = Map<number, string>;
|
|
@@ -162,20 +162,6 @@ export type SolvedAndReturnWitness = {
|
|
|
162
162
|
|
|
163
163
|
|
|
164
164
|
|
|
165
|
-
export type ForeignCallInput = string[]
|
|
166
|
-
export type ForeignCallOutput = string | string[]
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* A callback which performs an foreign call and returns the response.
|
|
170
|
-
* @callback ForeignCallHandler
|
|
171
|
-
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
172
|
-
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
173
|
-
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
174
|
-
*/
|
|
175
|
-
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
165
|
/**
|
|
180
166
|
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
181
167
|
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
@@ -212,18 +198,31 @@ export type WitnessStack = Array<StackItem>;
|
|
|
212
198
|
|
|
213
199
|
|
|
214
200
|
|
|
201
|
+
export type ForeignCallInput = string[]
|
|
202
|
+
export type ForeignCallOutput = string | string[]
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* A callback which performs an foreign call and returns the response.
|
|
206
|
+
* @callback ForeignCallHandler
|
|
207
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
208
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
209
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
210
|
+
*/
|
|
211
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
215
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
216
216
|
|
|
217
217
|
export interface InitOutput {
|
|
218
218
|
readonly memory: WebAssembly.Memory;
|
|
219
|
-
readonly executeCircuit: (a: number, b: number, c: number, d: number) => number;
|
|
220
|
-
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: number, d: number) => number;
|
|
221
|
-
readonly executeProgram: (a: number, b: number, c: number, d: number) => number;
|
|
222
|
-
readonly initLogLevel: (a: number, b: number, c: number) => void;
|
|
223
219
|
readonly compressWitness: (a: number, b: number) => void;
|
|
224
220
|
readonly decompressWitness: (a: number, b: number, c: number) => void;
|
|
225
221
|
readonly compressWitnessStack: (a: number, b: number) => void;
|
|
226
222
|
readonly decompressWitnessStack: (a: number, b: number, c: number) => void;
|
|
223
|
+
readonly executeCircuit: (a: number, b: number, c: number, d: number) => number;
|
|
224
|
+
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: number, d: number) => number;
|
|
225
|
+
readonly executeProgram: (a: number, b: number, c: number, d: number) => number;
|
|
227
226
|
readonly and: (a: number, b: number) => number;
|
|
228
227
|
readonly xor: (a: number, b: number) => number;
|
|
229
228
|
readonly sha256_compression: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
@@ -234,6 +233,7 @@ export interface InitOutput {
|
|
|
234
233
|
readonly getReturnWitness: (a: number, b: number, c: number, d: number) => void;
|
|
235
234
|
readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void;
|
|
236
235
|
readonly getPublicWitness: (a: number, b: number, c: number, d: number) => void;
|
|
236
|
+
readonly initLogLevel: (a: number, b: number, c: number) => void;
|
|
237
237
|
readonly __wbindgen_malloc: (a: number) => number;
|
|
238
238
|
readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
|
|
239
239
|
readonly __wbindgen_export_2: WebAssembly.Table;
|
package/web/acvm_js.js
CHANGED
|
@@ -20,18 +20,7 @@ function takeObject(idx) {
|
|
|
20
20
|
return ret;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
25
|
-
const idx = heap_next;
|
|
26
|
-
heap_next = heap[idx];
|
|
27
|
-
|
|
28
|
-
heap[idx] = obj;
|
|
29
|
-
return idx;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
|
33
|
-
|
|
34
|
-
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
|
|
23
|
+
let WASM_VECTOR_LEN = 0;
|
|
35
24
|
|
|
36
25
|
let cachedUint8Memory0 = null;
|
|
37
26
|
|
|
@@ -42,13 +31,6 @@ function getUint8Memory0() {
|
|
|
42
31
|
return cachedUint8Memory0;
|
|
43
32
|
}
|
|
44
33
|
|
|
45
|
-
function getStringFromWasm0(ptr, len) {
|
|
46
|
-
ptr = ptr >>> 0;
|
|
47
|
-
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
let WASM_VECTOR_LEN = 0;
|
|
51
|
-
|
|
52
34
|
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
|
|
53
35
|
|
|
54
36
|
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
@@ -115,6 +97,24 @@ function getInt32Memory0() {
|
|
|
115
97
|
return cachedInt32Memory0;
|
|
116
98
|
}
|
|
117
99
|
|
|
100
|
+
function addHeapObject(obj) {
|
|
101
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
102
|
+
const idx = heap_next;
|
|
103
|
+
heap_next = heap[idx];
|
|
104
|
+
|
|
105
|
+
heap[idx] = obj;
|
|
106
|
+
return idx;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
|
110
|
+
|
|
111
|
+
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
|
|
112
|
+
|
|
113
|
+
function getStringFromWasm0(ptr, len) {
|
|
114
|
+
ptr = ptr >>> 0;
|
|
115
|
+
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
118
|
let cachedFloat64Memory0 = null;
|
|
119
119
|
|
|
120
120
|
function getFloat64Memory0() {
|
|
@@ -217,79 +217,6 @@ function __wbg_adapter_22(arg0, arg1, arg2) {
|
|
|
217
217
|
wasm.wasm_bindgen__convert__closures__invoke1_mut__hec5660d9489c77a2(arg0, arg1, addHeapObject(arg2));
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
221
|
-
const ptr = malloc(arg.length * 1) >>> 0;
|
|
222
|
-
getUint8Memory0().set(arg, ptr / 1);
|
|
223
|
-
WASM_VECTOR_LEN = arg.length;
|
|
224
|
-
return ptr;
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
228
|
-
*
|
|
229
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
230
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
231
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
232
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
233
|
-
*/
|
|
234
|
-
export function executeCircuit(program, initial_witness, foreign_call_handler) {
|
|
235
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
236
|
-
const len0 = WASM_VECTOR_LEN;
|
|
237
|
-
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
238
|
-
return takeObject(ret);
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
243
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
244
|
-
*
|
|
245
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
246
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
247
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
248
|
-
* @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.
|
|
249
|
-
*/
|
|
250
|
-
export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
|
|
251
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
252
|
-
const len0 = WASM_VECTOR_LEN;
|
|
253
|
-
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
254
|
-
return takeObject(ret);
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
259
|
-
*
|
|
260
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
261
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
262
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
263
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
264
|
-
*/
|
|
265
|
-
export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
266
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
267
|
-
const len0 = WASM_VECTOR_LEN;
|
|
268
|
-
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
269
|
-
return takeObject(ret);
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* Sets the package's logging level.
|
|
274
|
-
*
|
|
275
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
276
|
-
*/
|
|
277
|
-
export function initLogLevel(filter) {
|
|
278
|
-
try {
|
|
279
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
280
|
-
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
281
|
-
const len0 = WASM_VECTOR_LEN;
|
|
282
|
-
wasm.initLogLevel(retptr, ptr0, len0);
|
|
283
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
284
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
285
|
-
if (r1) {
|
|
286
|
-
throw takeObject(r0);
|
|
287
|
-
}
|
|
288
|
-
} finally {
|
|
289
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
|
|
293
220
|
function getArrayU8FromWasm0(ptr, len) {
|
|
294
221
|
ptr = ptr >>> 0;
|
|
295
222
|
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
@@ -319,6 +246,12 @@ export function compressWitness(witness_map) {
|
|
|
319
246
|
}
|
|
320
247
|
}
|
|
321
248
|
|
|
249
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
250
|
+
const ptr = malloc(arg.length * 1) >>> 0;
|
|
251
|
+
getUint8Memory0().set(arg, ptr / 1);
|
|
252
|
+
WASM_VECTOR_LEN = arg.length;
|
|
253
|
+
return ptr;
|
|
254
|
+
}
|
|
322
255
|
/**
|
|
323
256
|
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
324
257
|
* This should be used to only fetch the witness map for the main function.
|
|
@@ -393,6 +326,52 @@ export function decompressWitnessStack(compressed_witness) {
|
|
|
393
326
|
}
|
|
394
327
|
}
|
|
395
328
|
|
|
329
|
+
/**
|
|
330
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
331
|
+
*
|
|
332
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
333
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
334
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
335
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
336
|
+
*/
|
|
337
|
+
export function executeCircuit(program, initial_witness, foreign_call_handler) {
|
|
338
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
339
|
+
const len0 = WASM_VECTOR_LEN;
|
|
340
|
+
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
341
|
+
return takeObject(ret);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
346
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
347
|
+
*
|
|
348
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
349
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
350
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
351
|
+
* @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.
|
|
352
|
+
*/
|
|
353
|
+
export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
|
|
354
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
355
|
+
const len0 = WASM_VECTOR_LEN;
|
|
356
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
357
|
+
return takeObject(ret);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
362
|
+
*
|
|
363
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
364
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
365
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
366
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
367
|
+
*/
|
|
368
|
+
export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
369
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
370
|
+
const len0 = WASM_VECTOR_LEN;
|
|
371
|
+
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
372
|
+
return takeObject(ret);
|
|
373
|
+
}
|
|
374
|
+
|
|
396
375
|
/**
|
|
397
376
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
398
377
|
* @param {string} lhs
|
|
@@ -615,6 +594,27 @@ export function getPublicWitness(program, solved_witness) {
|
|
|
615
594
|
}
|
|
616
595
|
}
|
|
617
596
|
|
|
597
|
+
/**
|
|
598
|
+
* Sets the package's logging level.
|
|
599
|
+
*
|
|
600
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
601
|
+
*/
|
|
602
|
+
export function initLogLevel(filter) {
|
|
603
|
+
try {
|
|
604
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
605
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
606
|
+
const len0 = WASM_VECTOR_LEN;
|
|
607
|
+
wasm.initLogLevel(retptr, ptr0, len0);
|
|
608
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
609
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
610
|
+
if (r1) {
|
|
611
|
+
throw takeObject(r0);
|
|
612
|
+
}
|
|
613
|
+
} finally {
|
|
614
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
|
|
618
618
|
function __wbg_adapter_75(arg0, arg1, arg2, arg3, arg4) {
|
|
619
619
|
wasm.wasm_bindgen__convert__closures__invoke3_mut__h083a66e5b0ae3ce9(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
|
|
620
620
|
}
|
|
@@ -667,13 +667,30 @@ function __wbg_get_imports() {
|
|
|
667
667
|
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
668
668
|
takeObject(arg0);
|
|
669
669
|
};
|
|
670
|
+
imports.wbg.__wbindgen_cb_drop = function(arg0) {
|
|
671
|
+
const obj = takeObject(arg0).original;
|
|
672
|
+
if (obj.cnt-- == 1) {
|
|
673
|
+
obj.a = 0;
|
|
674
|
+
return true;
|
|
675
|
+
}
|
|
676
|
+
const ret = false;
|
|
677
|
+
return ret;
|
|
678
|
+
};
|
|
670
679
|
imports.wbg.__wbindgen_is_array = function(arg0) {
|
|
671
680
|
const ret = Array.isArray(getObject(arg0));
|
|
672
681
|
return ret;
|
|
673
682
|
};
|
|
674
|
-
imports.wbg.
|
|
675
|
-
const ret =
|
|
676
|
-
return
|
|
683
|
+
imports.wbg.__wbindgen_is_string = function(arg0) {
|
|
684
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
|
685
|
+
return ret;
|
|
686
|
+
};
|
|
687
|
+
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
|
|
688
|
+
const obj = getObject(arg1);
|
|
689
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
690
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
691
|
+
var len1 = WASM_VECTOR_LEN;
|
|
692
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
693
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
677
694
|
};
|
|
678
695
|
imports.wbg.__wbg_new_35cd49f1520efef9 = function() {
|
|
679
696
|
const ret = new Map();
|
|
@@ -687,26 +704,9 @@ function __wbg_get_imports() {
|
|
|
687
704
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
688
705
|
return addHeapObject(ret);
|
|
689
706
|
};
|
|
690
|
-
imports.wbg.
|
|
691
|
-
const
|
|
692
|
-
|
|
693
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
694
|
-
var len1 = WASM_VECTOR_LEN;
|
|
695
|
-
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
696
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
697
|
-
};
|
|
698
|
-
imports.wbg.__wbindgen_cb_drop = function(arg0) {
|
|
699
|
-
const obj = takeObject(arg0).original;
|
|
700
|
-
if (obj.cnt-- == 1) {
|
|
701
|
-
obj.a = 0;
|
|
702
|
-
return true;
|
|
703
|
-
}
|
|
704
|
-
const ret = false;
|
|
705
|
-
return ret;
|
|
706
|
-
};
|
|
707
|
-
imports.wbg.__wbindgen_is_string = function(arg0) {
|
|
708
|
-
const ret = typeof(getObject(arg0)) === 'string';
|
|
709
|
-
return ret;
|
|
707
|
+
imports.wbg.__wbg_constructor_7d42f5e2b3ae2f5e = function(arg0) {
|
|
708
|
+
const ret = new Error(takeObject(arg0));
|
|
709
|
+
return addHeapObject(ret);
|
|
710
710
|
};
|
|
711
711
|
imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
|
|
712
712
|
const obj = getObject(arg1);
|
|
@@ -901,7 +901,7 @@ function __wbg_get_imports() {
|
|
|
901
901
|
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
902
902
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
903
903
|
};
|
|
904
|
-
imports.wbg.
|
|
904
|
+
imports.wbg.__wbindgen_closure_wrapper783 = function(arg0, arg1, arg2) {
|
|
905
905
|
const ret = makeMutClosure(arg0, arg1, 301, __wbg_adapter_22);
|
|
906
906
|
return addHeapObject(ret);
|
|
907
907
|
};
|
package/web/acvm_js_bg.wasm
CHANGED
|
Binary file
|
package/web/acvm_js_bg.wasm.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
5
|
-
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
|
|
6
|
-
export function executeProgram(a: number, b: number, c: number, d: number): number;
|
|
7
|
-
export function initLogLevel(a: number, b: number, c: number): void;
|
|
8
4
|
export function compressWitness(a: number, b: number): void;
|
|
9
5
|
export function decompressWitness(a: number, b: number, c: number): void;
|
|
10
6
|
export function compressWitnessStack(a: number, b: number): void;
|
|
11
7
|
export function decompressWitnessStack(a: number, b: number, c: 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;
|
|
12
11
|
export function and(a: number, b: number): number;
|
|
13
12
|
export function xor(a: number, b: number): number;
|
|
14
13
|
export function sha256_compression(a: number, b: number, c: number, d: number, e: number): void;
|
|
@@ -19,6 +18,7 @@ export function buildInfo(): number;
|
|
|
19
18
|
export function getReturnWitness(a: number, b: number, c: number, d: number): void;
|
|
20
19
|
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
|
|
21
20
|
export function getPublicWitness(a: number, b: number, c: number, d: number): void;
|
|
21
|
+
export function initLogLevel(a: number, b: number, c: number): void;
|
|
22
22
|
export function __wbindgen_malloc(a: number): number;
|
|
23
23
|
export function __wbindgen_realloc(a: number, b: number, c: number): number;
|
|
24
24
|
export const __wbindgen_export_2: WebAssembly.Table;
|