@noir-lang/acvm_js 1.0.0-beta.2-8f20392.nightly → 1.0.0-beta.2-582f56e.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 +44 -44
- package/nodejs/acvm_js.js +117 -117
- 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 +48 -48
- package/web/acvm_js.js +115 -115
- 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,34 +1,11 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
7
|
-
* @returns {Uint8Array} A compressed witness map
|
|
8
|
-
*/
|
|
9
|
-
export function compressWitness(witness_map: WitnessMap): Uint8Array;
|
|
10
|
-
/**
|
|
11
|
-
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
12
|
-
* This should be used to only fetch the witness map for the main function.
|
|
13
|
-
*
|
|
14
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
15
|
-
* @returns {WitnessMap} The decompressed witness map.
|
|
16
|
-
*/
|
|
17
|
-
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
|
|
18
|
-
/**
|
|
19
|
-
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
20
|
-
*
|
|
21
|
-
* @param {WitnessStack} witness_stack - A witness stack.
|
|
22
|
-
* @returns {Uint8Array} A compressed witness stack
|
|
23
|
-
*/
|
|
24
|
-
export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
25
|
-
/**
|
|
26
|
-
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
4
|
+
* Sets the package's logging level.
|
|
27
5
|
*
|
|
28
|
-
* @param {
|
|
29
|
-
* @returns {WitnessStack} The decompressed witness stack.
|
|
6
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
30
7
|
*/
|
|
31
|
-
export function
|
|
8
|
+
export function initLogLevel(filter: string): void;
|
|
32
9
|
/**
|
|
33
10
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
34
11
|
*
|
|
@@ -58,6 +35,35 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
|
|
|
58
35
|
*/
|
|
59
36
|
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
60
37
|
/**
|
|
38
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
39
|
+
*
|
|
40
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
41
|
+
* @returns {Uint8Array} A compressed witness map
|
|
42
|
+
*/
|
|
43
|
+
export function compressWitness(witness_map: WitnessMap): Uint8Array;
|
|
44
|
+
/**
|
|
45
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
46
|
+
* This should be used to only fetch the witness map for the main function.
|
|
47
|
+
*
|
|
48
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
49
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
50
|
+
*/
|
|
51
|
+
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
|
|
52
|
+
/**
|
|
53
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
54
|
+
*
|
|
55
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
56
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
57
|
+
*/
|
|
58
|
+
export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
59
|
+
/**
|
|
60
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
61
|
+
*
|
|
62
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
63
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
64
|
+
*/
|
|
65
|
+
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
66
|
+
/**
|
|
61
67
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
62
68
|
* @param {string} lhs
|
|
63
69
|
* @param {string} rhs
|
|
@@ -140,12 +146,20 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
140
146
|
* @returns {WitnessMap}
|
|
141
147
|
*/
|
|
142
148
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
149
|
+
|
|
150
|
+
export type ForeignCallInput = string[]
|
|
151
|
+
export type ForeignCallOutput = string | string[]
|
|
152
|
+
|
|
143
153
|
/**
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
* @param {
|
|
154
|
+
* A callback which performs an foreign call and returns the response.
|
|
155
|
+
* @callback ForeignCallHandler
|
|
156
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
157
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
158
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
147
159
|
*/
|
|
148
|
-
export
|
|
160
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
161
|
+
|
|
162
|
+
|
|
149
163
|
|
|
150
164
|
// Map from witness index to hex string value of witness.
|
|
151
165
|
export type WitnessMap = Map<number, string>;
|
|
@@ -197,17 +211,3 @@ export type StackItem = {
|
|
|
197
211
|
export type WitnessStack = Array<StackItem>;
|
|
198
212
|
|
|
199
213
|
|
|
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 { TextDecoder, TextEncoder } = require(`util`);
|
|
5
5
|
|
|
6
6
|
const heap = new Array(128).fill(undefined);
|
|
7
7
|
|
|
@@ -23,7 +23,18 @@ function takeObject(idx) {
|
|
|
23
23
|
return ret;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
function addHeapObject(obj) {
|
|
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();
|
|
27
38
|
|
|
28
39
|
let cachedUint8Memory0 = null;
|
|
29
40
|
|
|
@@ -34,6 +45,13 @@ function getUint8Memory0() {
|
|
|
34
45
|
return cachedUint8Memory0;
|
|
35
46
|
}
|
|
36
47
|
|
|
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
|
+
|
|
37
55
|
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
38
56
|
|
|
39
57
|
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
@@ -100,24 +118,6 @@ function getInt32Memory0() {
|
|
|
100
118
|
return cachedInt32Memory0;
|
|
101
119
|
}
|
|
102
120
|
|
|
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,6 +220,79 @@ 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
|
+
/**
|
|
224
|
+
* Sets the package's logging level.
|
|
225
|
+
*
|
|
226
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
227
|
+
*/
|
|
228
|
+
module.exports.initLogLevel = function(filter) {
|
|
229
|
+
try {
|
|
230
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
231
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
232
|
+
const len0 = WASM_VECTOR_LEN;
|
|
233
|
+
wasm.initLogLevel(retptr, ptr0, len0);
|
|
234
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
235
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
236
|
+
if (r1) {
|
|
237
|
+
throw takeObject(r0);
|
|
238
|
+
}
|
|
239
|
+
} finally {
|
|
240
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
|
|
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
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
252
|
+
*
|
|
253
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
254
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
255
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
256
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
257
|
+
*/
|
|
258
|
+
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
|
|
259
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
260
|
+
const len0 = WASM_VECTOR_LEN;
|
|
261
|
+
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
262
|
+
return takeObject(ret);
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
267
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
268
|
+
*
|
|
269
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
270
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
271
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
272
|
+
* @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.
|
|
273
|
+
*/
|
|
274
|
+
module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
|
|
275
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
276
|
+
const len0 = WASM_VECTOR_LEN;
|
|
277
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
278
|
+
return takeObject(ret);
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
283
|
+
*
|
|
284
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
285
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
286
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
287
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
288
|
+
*/
|
|
289
|
+
module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
|
|
290
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
291
|
+
const len0 = WASM_VECTOR_LEN;
|
|
292
|
+
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
293
|
+
return takeObject(ret);
|
|
294
|
+
};
|
|
295
|
+
|
|
223
296
|
function getArrayU8FromWasm0(ptr, len) {
|
|
224
297
|
ptr = ptr >>> 0;
|
|
225
298
|
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
@@ -249,12 +322,6 @@ module.exports.compressWitness = function(witness_map) {
|
|
|
249
322
|
}
|
|
250
323
|
};
|
|
251
324
|
|
|
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
|
-
}
|
|
258
325
|
/**
|
|
259
326
|
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
260
327
|
* This should be used to only fetch the witness map for the main function.
|
|
@@ -329,52 +396,6 @@ module.exports.decompressWitnessStack = function(compressed_witness) {
|
|
|
329
396
|
}
|
|
330
397
|
};
|
|
331
398
|
|
|
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
|
-
|
|
378
399
|
/**
|
|
379
400
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
380
401
|
* @param {string} lhs
|
|
@@ -597,27 +618,6 @@ module.exports.getPublicWitness = function(program, solved_witness) {
|
|
|
597
618
|
}
|
|
598
619
|
};
|
|
599
620
|
|
|
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,13 +637,8 @@ module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
|
637
637
|
takeObject(arg0);
|
|
638
638
|
};
|
|
639
639
|
|
|
640
|
-
module.exports.
|
|
641
|
-
const
|
|
642
|
-
if (obj.cnt-- == 1) {
|
|
643
|
-
obj.a = 0;
|
|
644
|
-
return true;
|
|
645
|
-
}
|
|
646
|
-
const ret = false;
|
|
640
|
+
module.exports.__wbindgen_is_string = function(arg0) {
|
|
641
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
|
647
642
|
return ret;
|
|
648
643
|
};
|
|
649
644
|
|
|
@@ -652,18 +647,9 @@ module.exports.__wbindgen_is_array = function(arg0) {
|
|
|
652
647
|
return ret;
|
|
653
648
|
};
|
|
654
649
|
|
|
655
|
-
module.exports.
|
|
656
|
-
const ret =
|
|
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;
|
|
650
|
+
module.exports.__wbg_constructor_7d42f5e2b3ae2f5e = function(arg0) {
|
|
651
|
+
const ret = new Error(takeObject(arg0));
|
|
652
|
+
return addHeapObject(ret);
|
|
667
653
|
};
|
|
668
654
|
|
|
669
655
|
module.exports.__wbg_new_35cd49f1520efef9 = function() {
|
|
@@ -681,9 +667,23 @@ module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
|
681
667
|
return addHeapObject(ret);
|
|
682
668
|
};
|
|
683
669
|
|
|
684
|
-
module.exports.
|
|
685
|
-
const
|
|
686
|
-
|
|
670
|
+
module.exports.__wbindgen_string_get = function(arg0, arg1) {
|
|
671
|
+
const obj = getObject(arg1);
|
|
672
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
673
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
674
|
+
var len1 = WASM_VECTOR_LEN;
|
|
675
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
676
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
677
|
+
};
|
|
678
|
+
|
|
679
|
+
module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
680
|
+
const obj = takeObject(arg0).original;
|
|
681
|
+
if (obj.cnt-- == 1) {
|
|
682
|
+
obj.a = 0;
|
|
683
|
+
return true;
|
|
684
|
+
}
|
|
685
|
+
const ret = false;
|
|
686
|
+
return ret;
|
|
687
687
|
};
|
|
688
688
|
|
|
689
689
|
module.exports.__wbindgen_number_get = function(arg0, arg1) {
|
|
@@ -916,8 +916,8 @@ module.exports.__wbindgen_throw = function(arg0, arg1) {
|
|
|
916
916
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
917
917
|
};
|
|
918
918
|
|
|
919
|
-
module.exports.
|
|
920
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
919
|
+
module.exports.__wbindgen_closure_wrapper782 = function(arg0, arg1, arg2) {
|
|
920
|
+
const ret = makeMutClosure(arg0, arg1, 300, __wbg_adapter_22);
|
|
921
921
|
return addHeapObject(ret);
|
|
922
922
|
};
|
|
923
923
|
|
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export function initLogLevel(a: number, b: number, c: number): void;
|
|
5
|
+
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
6
|
+
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
|
|
7
|
+
export function executeProgram(a: number, b: number, c: number, d: number): number;
|
|
4
8
|
export function compressWitness(a: number, b: number): void;
|
|
5
9
|
export function decompressWitness(a: number, b: number, c: number): void;
|
|
6
10
|
export function compressWitnessStack(a: number, b: number): void;
|
|
7
11
|
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;
|
|
11
12
|
export function and(a: number, b: number): number;
|
|
12
13
|
export function xor(a: number, b: number): number;
|
|
13
14
|
export function sha256_compression(a: number, b: number, c: number, d: number, e: number): void;
|
|
@@ -18,7 +19,6 @@ export function buildInfo(): number;
|
|
|
18
19
|
export function getReturnWitness(a: number, b: number, c: number, d: number): void;
|
|
19
20
|
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
|
|
20
21
|
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,34 +1,11 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
7
|
-
* @returns {Uint8Array} A compressed witness map
|
|
8
|
-
*/
|
|
9
|
-
export function compressWitness(witness_map: WitnessMap): Uint8Array;
|
|
10
|
-
/**
|
|
11
|
-
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
12
|
-
* This should be used to only fetch the witness map for the main function.
|
|
13
|
-
*
|
|
14
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
15
|
-
* @returns {WitnessMap} The decompressed witness map.
|
|
16
|
-
*/
|
|
17
|
-
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
|
|
18
|
-
/**
|
|
19
|
-
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
20
|
-
*
|
|
21
|
-
* @param {WitnessStack} witness_stack - A witness stack.
|
|
22
|
-
* @returns {Uint8Array} A compressed witness stack
|
|
23
|
-
*/
|
|
24
|
-
export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
25
|
-
/**
|
|
26
|
-
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
4
|
+
* Sets the package's logging level.
|
|
27
5
|
*
|
|
28
|
-
* @param {
|
|
29
|
-
* @returns {WitnessStack} The decompressed witness stack.
|
|
6
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
30
7
|
*/
|
|
31
|
-
export function
|
|
8
|
+
export function initLogLevel(filter: string): void;
|
|
32
9
|
/**
|
|
33
10
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
34
11
|
*
|
|
@@ -58,6 +35,35 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
|
|
|
58
35
|
*/
|
|
59
36
|
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
60
37
|
/**
|
|
38
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
39
|
+
*
|
|
40
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
41
|
+
* @returns {Uint8Array} A compressed witness map
|
|
42
|
+
*/
|
|
43
|
+
export function compressWitness(witness_map: WitnessMap): Uint8Array;
|
|
44
|
+
/**
|
|
45
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
46
|
+
* This should be used to only fetch the witness map for the main function.
|
|
47
|
+
*
|
|
48
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
49
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
50
|
+
*/
|
|
51
|
+
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
|
|
52
|
+
/**
|
|
53
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
54
|
+
*
|
|
55
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
56
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
57
|
+
*/
|
|
58
|
+
export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
59
|
+
/**
|
|
60
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
61
|
+
*
|
|
62
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
63
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
64
|
+
*/
|
|
65
|
+
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
66
|
+
/**
|
|
61
67
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
62
68
|
* @param {string} lhs
|
|
63
69
|
* @param {string} rhs
|
|
@@ -140,12 +146,20 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
140
146
|
* @returns {WitnessMap}
|
|
141
147
|
*/
|
|
142
148
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
149
|
+
|
|
150
|
+
export type ForeignCallInput = string[]
|
|
151
|
+
export type ForeignCallOutput = string | string[]
|
|
152
|
+
|
|
143
153
|
/**
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
* @param {
|
|
154
|
+
* A callback which performs an foreign call and returns the response.
|
|
155
|
+
* @callback ForeignCallHandler
|
|
156
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
157
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
158
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
147
159
|
*/
|
|
148
|
-
export
|
|
160
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
161
|
+
|
|
162
|
+
|
|
149
163
|
|
|
150
164
|
// Map from witness index to hex string value of witness.
|
|
151
165
|
export type WitnessMap = Map<number, string>;
|
|
@@ -198,31 +212,18 @@ export type WitnessStack = Array<StackItem>;
|
|
|
198
212
|
|
|
199
213
|
|
|
200
214
|
|
|
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 initLogLevel: (a: number, b: number, c: number) => void;
|
|
220
|
+
readonly executeCircuit: (a: number, b: number, c: number, d: number) => number;
|
|
221
|
+
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: number, d: number) => number;
|
|
222
|
+
readonly executeProgram: (a: number, b: number, c: number, d: number) => number;
|
|
219
223
|
readonly compressWitness: (a: number, b: number) => void;
|
|
220
224
|
readonly decompressWitness: (a: number, b: number, c: number) => void;
|
|
221
225
|
readonly compressWitnessStack: (a: number, b: number) => void;
|
|
222
226
|
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;
|
|
226
227
|
readonly and: (a: number, b: number) => number;
|
|
227
228
|
readonly xor: (a: number, b: number) => number;
|
|
228
229
|
readonly sha256_compression: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
@@ -233,7 +234,6 @@ export interface InitOutput {
|
|
|
233
234
|
readonly getReturnWitness: (a: number, b: number, c: number, d: number) => void;
|
|
234
235
|
readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void;
|
|
235
236
|
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,7 +20,18 @@ function takeObject(idx) {
|
|
|
20
20
|
return ret;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
function addHeapObject(obj) {
|
|
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(); };
|
|
24
35
|
|
|
25
36
|
let cachedUint8Memory0 = null;
|
|
26
37
|
|
|
@@ -31,6 +42,13 @@ function getUint8Memory0() {
|
|
|
31
42
|
return cachedUint8Memory0;
|
|
32
43
|
}
|
|
33
44
|
|
|
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
|
+
|
|
34
52
|
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
|
|
35
53
|
|
|
36
54
|
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
@@ -97,24 +115,6 @@ function getInt32Memory0() {
|
|
|
97
115
|
return cachedInt32Memory0;
|
|
98
116
|
}
|
|
99
117
|
|
|
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,6 +217,79 @@ 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
|
+
/**
|
|
221
|
+
* Sets the package's logging level.
|
|
222
|
+
*
|
|
223
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
224
|
+
*/
|
|
225
|
+
export function initLogLevel(filter) {
|
|
226
|
+
try {
|
|
227
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
228
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
229
|
+
const len0 = WASM_VECTOR_LEN;
|
|
230
|
+
wasm.initLogLevel(retptr, ptr0, len0);
|
|
231
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
232
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
233
|
+
if (r1) {
|
|
234
|
+
throw takeObject(r0);
|
|
235
|
+
}
|
|
236
|
+
} finally {
|
|
237
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
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
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
249
|
+
*
|
|
250
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
251
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
252
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
253
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
254
|
+
*/
|
|
255
|
+
export function executeCircuit(program, initial_witness, foreign_call_handler) {
|
|
256
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
257
|
+
const len0 = WASM_VECTOR_LEN;
|
|
258
|
+
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
259
|
+
return takeObject(ret);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
264
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
265
|
+
*
|
|
266
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
267
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
268
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
269
|
+
* @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.
|
|
270
|
+
*/
|
|
271
|
+
export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
|
|
272
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
273
|
+
const len0 = WASM_VECTOR_LEN;
|
|
274
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
275
|
+
return takeObject(ret);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
280
|
+
*
|
|
281
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
282
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
283
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
284
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
285
|
+
*/
|
|
286
|
+
export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
287
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
288
|
+
const len0 = WASM_VECTOR_LEN;
|
|
289
|
+
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
290
|
+
return takeObject(ret);
|
|
291
|
+
}
|
|
292
|
+
|
|
220
293
|
function getArrayU8FromWasm0(ptr, len) {
|
|
221
294
|
ptr = ptr >>> 0;
|
|
222
295
|
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
@@ -246,12 +319,6 @@ export function compressWitness(witness_map) {
|
|
|
246
319
|
}
|
|
247
320
|
}
|
|
248
321
|
|
|
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
|
-
}
|
|
255
322
|
/**
|
|
256
323
|
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
257
324
|
* This should be used to only fetch the witness map for the main function.
|
|
@@ -326,52 +393,6 @@ export function decompressWitnessStack(compressed_witness) {
|
|
|
326
393
|
}
|
|
327
394
|
}
|
|
328
395
|
|
|
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
|
-
|
|
375
396
|
/**
|
|
376
397
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
377
398
|
* @param {string} lhs
|
|
@@ -594,27 +615,6 @@ export function getPublicWitness(program, solved_witness) {
|
|
|
594
615
|
}
|
|
595
616
|
}
|
|
596
617
|
|
|
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,30 +667,17 @@ function __wbg_get_imports() {
|
|
|
667
667
|
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
668
668
|
takeObject(arg0);
|
|
669
669
|
};
|
|
670
|
-
imports.wbg.
|
|
671
|
-
const
|
|
672
|
-
if (obj.cnt-- == 1) {
|
|
673
|
-
obj.a = 0;
|
|
674
|
-
return true;
|
|
675
|
-
}
|
|
676
|
-
const ret = false;
|
|
670
|
+
imports.wbg.__wbindgen_is_string = function(arg0) {
|
|
671
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
|
677
672
|
return ret;
|
|
678
673
|
};
|
|
679
674
|
imports.wbg.__wbindgen_is_array = function(arg0) {
|
|
680
675
|
const ret = Array.isArray(getObject(arg0));
|
|
681
676
|
return ret;
|
|
682
677
|
};
|
|
683
|
-
imports.wbg.
|
|
684
|
-
const ret =
|
|
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;
|
|
678
|
+
imports.wbg.__wbg_constructor_7d42f5e2b3ae2f5e = function(arg0) {
|
|
679
|
+
const ret = new Error(takeObject(arg0));
|
|
680
|
+
return addHeapObject(ret);
|
|
694
681
|
};
|
|
695
682
|
imports.wbg.__wbg_new_35cd49f1520efef9 = function() {
|
|
696
683
|
const ret = new Map();
|
|
@@ -704,9 +691,22 @@ function __wbg_get_imports() {
|
|
|
704
691
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
705
692
|
return addHeapObject(ret);
|
|
706
693
|
};
|
|
707
|
-
imports.wbg.
|
|
708
|
-
const
|
|
709
|
-
|
|
694
|
+
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
|
|
695
|
+
const obj = getObject(arg1);
|
|
696
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
697
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
698
|
+
var len1 = WASM_VECTOR_LEN;
|
|
699
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
700
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
701
|
+
};
|
|
702
|
+
imports.wbg.__wbindgen_cb_drop = function(arg0) {
|
|
703
|
+
const obj = takeObject(arg0).original;
|
|
704
|
+
if (obj.cnt-- == 1) {
|
|
705
|
+
obj.a = 0;
|
|
706
|
+
return true;
|
|
707
|
+
}
|
|
708
|
+
const ret = false;
|
|
709
|
+
return ret;
|
|
710
710
|
};
|
|
711
711
|
imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
|
|
712
712
|
const obj = getObject(arg1);
|
|
@@ -901,8 +901,8 @@ 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.
|
|
905
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
904
|
+
imports.wbg.__wbindgen_closure_wrapper782 = function(arg0, arg1, arg2) {
|
|
905
|
+
const ret = makeMutClosure(arg0, arg1, 300, __wbg_adapter_22);
|
|
906
906
|
return addHeapObject(ret);
|
|
907
907
|
};
|
|
908
908
|
|
package/web/acvm_js_bg.wasm
CHANGED
|
Binary file
|
package/web/acvm_js_bg.wasm.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export function initLogLevel(a: number, b: number, c: number): void;
|
|
5
|
+
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
6
|
+
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
|
|
7
|
+
export function executeProgram(a: number, b: number, c: number, d: number): number;
|
|
4
8
|
export function compressWitness(a: number, b: number): void;
|
|
5
9
|
export function decompressWitness(a: number, b: number, c: number): void;
|
|
6
10
|
export function compressWitnessStack(a: number, b: number): void;
|
|
7
11
|
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;
|
|
11
12
|
export function and(a: number, b: number): number;
|
|
12
13
|
export function xor(a: number, b: number): number;
|
|
13
14
|
export function sha256_compression(a: number, b: number, c: number, d: number, e: number): void;
|
|
@@ -18,7 +19,6 @@ export function buildInfo(): number;
|
|
|
18
19
|
export function getReturnWitness(a: number, b: number, c: number, d: number): void;
|
|
19
20
|
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
|
|
20
21
|
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;
|