@noir-lang/acvm_js 1.0.0-beta.2-49a095d.nightly → 1.0.0-beta.2-44c35dc.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 +74 -74
- package/nodejs/acvm_js.js +199 -199
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +9 -9
- package/package.json +1 -1
- package/web/acvm_js.d.ts +83 -83
- package/web/acvm_js.js +193 -193
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +9 -9
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,75 +220,83 @@ 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
|
+
}
|
|
223
229
|
/**
|
|
224
|
-
*
|
|
230
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
225
231
|
*
|
|
226
|
-
* @param {
|
|
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.
|
|
227
236
|
*/
|
|
228
|
-
module.exports.
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
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
|
-
}
|
|
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
242
|
};
|
|
243
243
|
|
|
244
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
245
|
-
ptr = ptr >>> 0;
|
|
246
|
-
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
247
|
-
}
|
|
248
244
|
/**
|
|
249
|
-
*
|
|
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.
|
|
250
247
|
*
|
|
251
|
-
* @param {
|
|
252
|
-
* @
|
|
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.
|
|
253
252
|
*/
|
|
254
|
-
module.exports.
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
260
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
261
|
-
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
262
|
-
if (r3) {
|
|
263
|
-
throw takeObject(r2);
|
|
264
|
-
}
|
|
265
|
-
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
266
|
-
wasm.__wbindgen_free(r0, r1 * 1);
|
|
267
|
-
return v1;
|
|
268
|
-
} finally {
|
|
269
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
270
|
-
}
|
|
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);
|
|
271
258
|
};
|
|
272
259
|
|
|
273
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
274
|
-
const ptr = malloc(arg.length * 1) >>> 0;
|
|
275
|
-
getUint8Memory0().set(arg, ptr / 1);
|
|
276
|
-
WASM_VECTOR_LEN = arg.length;
|
|
277
|
-
return ptr;
|
|
278
|
-
}
|
|
279
260
|
/**
|
|
280
|
-
*
|
|
281
|
-
* This should be used to only fetch the witness map for the main function.
|
|
261
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
282
262
|
*
|
|
283
|
-
* @param {Uint8Array}
|
|
284
|
-
* @
|
|
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.
|
|
285
267
|
*/
|
|
286
|
-
module.exports.
|
|
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
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
277
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
278
|
+
*/
|
|
279
|
+
module.exports.buildInfo = function() {
|
|
280
|
+
const ret = wasm.buildInfo();
|
|
281
|
+
return takeObject(ret);
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
286
|
+
*
|
|
287
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
288
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
289
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
290
|
+
* @param {Uint8Array} program
|
|
291
|
+
* @param {WitnessMap} witness_map
|
|
292
|
+
* @returns {WitnessMap}
|
|
293
|
+
*/
|
|
294
|
+
module.exports.getReturnWitness = function(program, witness_map) {
|
|
287
295
|
try {
|
|
288
296
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
289
|
-
const ptr0 = passArray8ToWasm0(
|
|
297
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
290
298
|
const len0 = WASM_VECTOR_LEN;
|
|
291
|
-
wasm.
|
|
299
|
+
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
|
|
292
300
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
293
301
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
294
302
|
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
@@ -302,42 +310,49 @@ module.exports.decompressWitness = function(compressed_witness) {
|
|
|
302
310
|
};
|
|
303
311
|
|
|
304
312
|
/**
|
|
305
|
-
*
|
|
313
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
306
314
|
*
|
|
307
|
-
* @param {
|
|
308
|
-
* @
|
|
315
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
316
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
317
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
318
|
+
* @param {Uint8Array} program
|
|
319
|
+
* @param {WitnessMap} solved_witness
|
|
320
|
+
* @returns {WitnessMap}
|
|
309
321
|
*/
|
|
310
|
-
module.exports.
|
|
322
|
+
module.exports.getPublicParametersWitness = function(program, solved_witness) {
|
|
311
323
|
try {
|
|
312
324
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
313
|
-
|
|
325
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
326
|
+
const len0 = WASM_VECTOR_LEN;
|
|
327
|
+
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
314
328
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
315
329
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
316
330
|
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
throw takeObject(r2);
|
|
331
|
+
if (r2) {
|
|
332
|
+
throw takeObject(r1);
|
|
320
333
|
}
|
|
321
|
-
|
|
322
|
-
wasm.__wbindgen_free(r0, r1 * 1);
|
|
323
|
-
return v1;
|
|
334
|
+
return takeObject(r0);
|
|
324
335
|
} finally {
|
|
325
336
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
326
337
|
}
|
|
327
338
|
};
|
|
328
339
|
|
|
329
340
|
/**
|
|
330
|
-
*
|
|
341
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
331
342
|
*
|
|
332
|
-
* @param {Uint8Array}
|
|
333
|
-
* @
|
|
343
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
344
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
345
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
346
|
+
* @param {Uint8Array} program
|
|
347
|
+
* @param {WitnessMap} solved_witness
|
|
348
|
+
* @returns {WitnessMap}
|
|
334
349
|
*/
|
|
335
|
-
module.exports.
|
|
350
|
+
module.exports.getPublicWitness = function(program, solved_witness) {
|
|
336
351
|
try {
|
|
337
352
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
338
|
-
const ptr0 = passArray8ToWasm0(
|
|
353
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
339
354
|
const len0 = WASM_VECTOR_LEN;
|
|
340
|
-
wasm.
|
|
355
|
+
wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
341
356
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
342
357
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
343
358
|
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
@@ -350,52 +365,6 @@ module.exports.decompressWitnessStack = function(compressed_witness) {
|
|
|
350
365
|
}
|
|
351
366
|
};
|
|
352
367
|
|
|
353
|
-
/**
|
|
354
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
355
|
-
*
|
|
356
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
357
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
358
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
359
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
360
|
-
*/
|
|
361
|
-
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
|
|
362
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
363
|
-
const len0 = WASM_VECTOR_LEN;
|
|
364
|
-
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
365
|
-
return takeObject(ret);
|
|
366
|
-
};
|
|
367
|
-
|
|
368
|
-
/**
|
|
369
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
370
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
371
|
-
*
|
|
372
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
373
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
374
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
375
|
-
* @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.
|
|
376
|
-
*/
|
|
377
|
-
module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
|
|
378
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
379
|
-
const len0 = WASM_VECTOR_LEN;
|
|
380
|
-
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
381
|
-
return takeObject(ret);
|
|
382
|
-
};
|
|
383
|
-
|
|
384
|
-
/**
|
|
385
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
386
|
-
*
|
|
387
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
388
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
389
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
390
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
391
|
-
*/
|
|
392
|
-
module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
|
|
393
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
394
|
-
const len0 = WASM_VECTOR_LEN;
|
|
395
|
-
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
396
|
-
return takeObject(ret);
|
|
397
|
-
};
|
|
398
|
-
|
|
399
368
|
/**
|
|
400
369
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
401
370
|
* @param {string} lhs
|
|
@@ -462,6 +431,10 @@ module.exports.sha256_compression = function(inputs, state) {
|
|
|
462
431
|
}
|
|
463
432
|
};
|
|
464
433
|
|
|
434
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
435
|
+
ptr = ptr >>> 0;
|
|
436
|
+
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
437
|
+
}
|
|
465
438
|
/**
|
|
466
439
|
* Calculates the Blake2s256 hash of the input bytes
|
|
467
440
|
* @param {Uint8Array} inputs
|
|
@@ -526,30 +499,43 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
|
|
|
526
499
|
};
|
|
527
500
|
|
|
528
501
|
/**
|
|
529
|
-
*
|
|
530
|
-
*
|
|
502
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
503
|
+
*
|
|
504
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
505
|
+
* @returns {Uint8Array} A compressed witness map
|
|
531
506
|
*/
|
|
532
|
-
module.exports.
|
|
533
|
-
|
|
534
|
-
|
|
507
|
+
module.exports.compressWitness = function(witness_map) {
|
|
508
|
+
try {
|
|
509
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
510
|
+
wasm.compressWitness(retptr, addHeapObject(witness_map));
|
|
511
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
512
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
513
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
514
|
+
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
515
|
+
if (r3) {
|
|
516
|
+
throw takeObject(r2);
|
|
517
|
+
}
|
|
518
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
519
|
+
wasm.__wbindgen_free(r0, r1 * 1);
|
|
520
|
+
return v1;
|
|
521
|
+
} finally {
|
|
522
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
523
|
+
}
|
|
535
524
|
};
|
|
536
525
|
|
|
537
526
|
/**
|
|
538
|
-
*
|
|
527
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
528
|
+
* This should be used to only fetch the witness map for the main function.
|
|
539
529
|
*
|
|
540
|
-
* @param {Uint8Array}
|
|
541
|
-
* @
|
|
542
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
543
|
-
* @param {Uint8Array} program
|
|
544
|
-
* @param {WitnessMap} witness_map
|
|
545
|
-
* @returns {WitnessMap}
|
|
530
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
531
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
546
532
|
*/
|
|
547
|
-
module.exports.
|
|
533
|
+
module.exports.decompressWitness = function(compressed_witness) {
|
|
548
534
|
try {
|
|
549
535
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
550
|
-
const ptr0 = passArray8ToWasm0(
|
|
536
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
551
537
|
const len0 = WASM_VECTOR_LEN;
|
|
552
|
-
wasm.
|
|
538
|
+
wasm.decompressWitness(retptr, ptr0, len0);
|
|
553
539
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
554
540
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
555
541
|
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
@@ -563,49 +549,42 @@ module.exports.getReturnWitness = function(program, witness_map) {
|
|
|
563
549
|
};
|
|
564
550
|
|
|
565
551
|
/**
|
|
566
|
-
*
|
|
552
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
567
553
|
*
|
|
568
|
-
* @param {
|
|
569
|
-
* @
|
|
570
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
571
|
-
* @param {Uint8Array} program
|
|
572
|
-
* @param {WitnessMap} solved_witness
|
|
573
|
-
* @returns {WitnessMap}
|
|
554
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
555
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
574
556
|
*/
|
|
575
|
-
module.exports.
|
|
557
|
+
module.exports.compressWitnessStack = function(witness_stack) {
|
|
576
558
|
try {
|
|
577
559
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
578
|
-
|
|
579
|
-
const len0 = WASM_VECTOR_LEN;
|
|
580
|
-
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
560
|
+
wasm.compressWitnessStack(retptr, addHeapObject(witness_stack));
|
|
581
561
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
582
562
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
583
563
|
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
584
|
-
|
|
585
|
-
|
|
564
|
+
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
565
|
+
if (r3) {
|
|
566
|
+
throw takeObject(r2);
|
|
586
567
|
}
|
|
587
|
-
|
|
568
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
569
|
+
wasm.__wbindgen_free(r0, r1 * 1);
|
|
570
|
+
return v1;
|
|
588
571
|
} finally {
|
|
589
572
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
590
573
|
}
|
|
591
574
|
};
|
|
592
575
|
|
|
593
576
|
/**
|
|
594
|
-
*
|
|
577
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
595
578
|
*
|
|
596
|
-
* @param {Uint8Array}
|
|
597
|
-
* @
|
|
598
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
599
|
-
* @param {Uint8Array} program
|
|
600
|
-
* @param {WitnessMap} solved_witness
|
|
601
|
-
* @returns {WitnessMap}
|
|
579
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
580
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
602
581
|
*/
|
|
603
|
-
module.exports.
|
|
582
|
+
module.exports.decompressWitnessStack = function(compressed_witness) {
|
|
604
583
|
try {
|
|
605
584
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
606
|
-
const ptr0 = passArray8ToWasm0(
|
|
585
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
607
586
|
const len0 = WASM_VECTOR_LEN;
|
|
608
|
-
wasm.
|
|
587
|
+
wasm.decompressWitnessStack(retptr, ptr0, len0);
|
|
609
588
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
610
589
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
611
590
|
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
@@ -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
|
}
|
|
@@ -633,23 +633,27 @@ function __wbg_adapter_92(arg0, arg1, arg2, arg3) {
|
|
|
633
633
|
wasm.wasm_bindgen__convert__closures__invoke2_mut__h7636f3796134b93b(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
634
634
|
}
|
|
635
635
|
|
|
636
|
-
module.exports.__wbg_constructor_7d42f5e2b3ae2f5e = function(arg0) {
|
|
637
|
-
const ret = new Error(takeObject(arg0));
|
|
638
|
-
return addHeapObject(ret);
|
|
639
|
-
};
|
|
640
|
-
|
|
641
636
|
module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
642
637
|
takeObject(arg0);
|
|
643
638
|
};
|
|
644
639
|
|
|
640
|
+
module.exports.__wbindgen_is_array = function(arg0) {
|
|
641
|
+
const ret = Array.isArray(getObject(arg0));
|
|
642
|
+
return ret;
|
|
643
|
+
};
|
|
644
|
+
|
|
645
645
|
module.exports.__wbindgen_is_string = function(arg0) {
|
|
646
646
|
const ret = typeof(getObject(arg0)) === 'string';
|
|
647
647
|
return ret;
|
|
648
648
|
};
|
|
649
649
|
|
|
650
|
-
module.exports.
|
|
651
|
-
const
|
|
652
|
-
|
|
650
|
+
module.exports.__wbindgen_string_get = function(arg0, arg1) {
|
|
651
|
+
const obj = getObject(arg1);
|
|
652
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
653
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
654
|
+
var len1 = WASM_VECTOR_LEN;
|
|
655
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
656
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
653
657
|
};
|
|
654
658
|
|
|
655
659
|
module.exports.__wbg_new_35cd49f1520efef9 = function() {
|
|
@@ -667,15 +671,6 @@ module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
|
667
671
|
return addHeapObject(ret);
|
|
668
672
|
};
|
|
669
673
|
|
|
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
674
|
module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
680
675
|
const obj = takeObject(arg0).original;
|
|
681
676
|
if (obj.cnt-- == 1) {
|
|
@@ -686,11 +681,9 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
|
686
681
|
return ret;
|
|
687
682
|
};
|
|
688
683
|
|
|
689
|
-
module.exports.
|
|
690
|
-
const
|
|
691
|
-
|
|
692
|
-
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
693
|
-
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
684
|
+
module.exports.__wbg_constructor_7d42f5e2b3ae2f5e = function(arg0) {
|
|
685
|
+
const ret = new Error(takeObject(arg0));
|
|
686
|
+
return addHeapObject(ret);
|
|
694
687
|
};
|
|
695
688
|
|
|
696
689
|
module.exports.__wbg_new_3904a031fd091cf2 = function() {
|
|
@@ -698,6 +691,13 @@ module.exports.__wbg_new_3904a031fd091cf2 = function() {
|
|
|
698
691
|
return addHeapObject(ret);
|
|
699
692
|
};
|
|
700
693
|
|
|
694
|
+
module.exports.__wbindgen_number_get = function(arg0, arg1) {
|
|
695
|
+
const obj = getObject(arg1);
|
|
696
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
697
|
+
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
698
|
+
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
699
|
+
};
|
|
700
|
+
|
|
701
701
|
module.exports.__wbg_new_abda76e883ba8a5f = function() {
|
|
702
702
|
const ret = new Error();
|
|
703
703
|
return addHeapObject(ret);
|
|
@@ -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, 298, __wbg_adapter_22);
|
|
921
921
|
return addHeapObject(ret);
|
|
922
922
|
};
|
|
923
923
|
|
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export function initLogLevel(a: number, b: number, c: number): void;
|
|
5
|
-
export function compressWitness(a: number, b: number): void;
|
|
6
|
-
export function decompressWitness(a: number, b: number, c: number): void;
|
|
7
|
-
export function compressWitnessStack(a: number, b: number): void;
|
|
8
|
-
export function decompressWitnessStack(a: number, b: number, c: number): void;
|
|
9
4
|
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
10
5
|
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
|
|
11
6
|
export function executeProgram(a: number, b: number, c: number, d: number): number;
|
|
7
|
+
export function buildInfo(): number;
|
|
8
|
+
export function getReturnWitness(a: number, b: number, c: number, d: number): void;
|
|
9
|
+
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
|
|
10
|
+
export function getPublicWitness(a: number, b: number, c: number, d: number): void;
|
|
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;
|
|
15
14
|
export function blake2s256(a: number, b: number, c: number): void;
|
|
16
15
|
export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
|
17
16
|
export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
|
18
|
-
export function
|
|
19
|
-
export function
|
|
20
|
-
export function
|
|
21
|
-
export function
|
|
17
|
+
export function compressWitness(a: number, b: number): void;
|
|
18
|
+
export function decompressWitness(a: number, b: number, c: number): void;
|
|
19
|
+
export function compressWitnessStack(a: number, b: number): void;
|
|
20
|
+
export function decompressWitnessStack(a: number, b: number, c: 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;
|