@provablehq/wasm 0.11.11 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mainnet/aleo_wasm.d.ts +16 -14
- package/dist/mainnet/aleo_wasm.wasm +0 -0
- package/dist/mainnet/index.cjs +65 -63
- package/dist/mainnet/index.cjs.map +1 -1
- package/dist/mainnet/index.js +65 -63
- package/dist/mainnet/index.js.map +1 -1
- package/dist/mainnet/worker.js +65 -63
- package/dist/mainnet/worker.js.map +1 -1
- package/dist/testnet/aleo_wasm.d.ts +26 -24
- package/dist/testnet/aleo_wasm.wasm +0 -0
- package/dist/testnet/index.cjs +97 -95
- package/dist/testnet/index.cjs.map +1 -1
- package/dist/testnet/index.js +97 -95
- package/dist/testnet/index.js.map +1 -1
- package/dist/testnet/worker.js +97 -95
- package/dist/testnet/worker.js.map +1 -1
- package/package.json +1 -1
package/dist/testnet/worker.js
CHANGED
|
@@ -286,16 +286,6 @@ function runRayonThread(receiver) {
|
|
|
286
286
|
wasm.runRayonThread(receiver);
|
|
287
287
|
}
|
|
288
288
|
|
|
289
|
-
/**
|
|
290
|
-
* @param {URL} url
|
|
291
|
-
* @param {number} num_threads
|
|
292
|
-
* @returns {Promise<void>}
|
|
293
|
-
*/
|
|
294
|
-
function initThreadPool(url, num_threads) {
|
|
295
|
-
const ret = wasm.initThreadPool(addHeapObject(url), num_threads);
|
|
296
|
-
return takeObject(ret);
|
|
297
|
-
}
|
|
298
|
-
|
|
299
289
|
/**
|
|
300
290
|
* Set the WASM log level from JS. Called automatically by the SDK's
|
|
301
291
|
* `setLogLevel(level)` to keep TS and WASM logging in sync.
|
|
@@ -307,6 +297,16 @@ function setWasmLogLevel(level) {
|
|
|
307
297
|
wasm.setWasmLogLevel(level);
|
|
308
298
|
}
|
|
309
299
|
|
|
300
|
+
/**
|
|
301
|
+
* @param {URL} url
|
|
302
|
+
* @param {number} num_threads
|
|
303
|
+
* @returns {Promise<void>}
|
|
304
|
+
*/
|
|
305
|
+
function initThreadPool(url, num_threads) {
|
|
306
|
+
const ret = wasm.initThreadPool(addHeapObject(url), num_threads);
|
|
307
|
+
return takeObject(ret);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
310
|
let stack_pointer = 128;
|
|
311
311
|
|
|
312
312
|
function addBorrowedObject(obj) {
|
|
@@ -314,38 +314,6 @@ function addBorrowedObject(obj) {
|
|
|
314
314
|
heap[--stack_pointer] = obj;
|
|
315
315
|
return stack_pointer;
|
|
316
316
|
}
|
|
317
|
-
/**
|
|
318
|
-
* Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
|
|
319
|
-
*
|
|
320
|
-
* This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
|
|
321
|
-
* Each verifying key is paired with one or more sets of public inputs (instances).
|
|
322
|
-
*
|
|
323
|
-
* @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
|
|
324
|
-
* @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
|
|
325
|
-
* @param {Proof} proof The batch proof to verify
|
|
326
|
-
* @returns {boolean} True if the batch proof is valid, false otherwise
|
|
327
|
-
* @param {Array<any>} verifying_keys
|
|
328
|
-
* @param {Array<any>} inputs
|
|
329
|
-
* @param {Proof} proof
|
|
330
|
-
* @returns {boolean}
|
|
331
|
-
*/
|
|
332
|
-
function snarkVerifyBatch(verifying_keys, inputs, proof) {
|
|
333
|
-
try {
|
|
334
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
335
|
-
_assertClass(proof, Proof);
|
|
336
|
-
wasm.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
|
|
337
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
338
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
339
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
340
|
-
if (r2) {
|
|
341
|
-
throw takeObject(r1);
|
|
342
|
-
}
|
|
343
|
-
return r0 !== 0;
|
|
344
|
-
} finally {
|
|
345
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
|
|
349
317
|
/**
|
|
350
318
|
* Verify an execution. Executions with multiple transitions must have the program source code and
|
|
351
319
|
* verifying keys of imported functions supplied from outside to correctly verify. Also, this does
|
|
@@ -398,7 +366,9 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
|
|
|
398
366
|
* Verify a SNARK proof against a verifying key and public inputs.
|
|
399
367
|
*
|
|
400
368
|
* This function verifies a proof produced by an Aleo program that may not be deployed on chain.
|
|
401
|
-
* It directly invokes the Varuna proof verification from snarkVM
|
|
369
|
+
* It directly invokes the Varuna proof verification from snarkVM, using the Varuna version required
|
|
370
|
+
* by the latest consensus version (Varuna V3 as of `ConsensusVersion::V21`). Proofs generated with
|
|
371
|
+
* an older Varuna version will fail verification.
|
|
402
372
|
*
|
|
403
373
|
* @param {VerifyingKey} verifying_key The verifying key for the circuit
|
|
404
374
|
* @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
|
|
@@ -428,20 +398,57 @@ function snarkVerify(verifying_key, inputs, proof) {
|
|
|
428
398
|
}
|
|
429
399
|
|
|
430
400
|
/**
|
|
431
|
-
*
|
|
432
|
-
* snarkVM network implementation this SDK was built against.
|
|
433
|
-
*
|
|
434
|
-
* @returns {number} The maximum number of program imports.
|
|
401
|
+
* Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
|
|
435
402
|
*
|
|
436
|
-
*
|
|
437
|
-
*
|
|
403
|
+
* This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
|
|
404
|
+
* Each verifying key is paired with one or more sets of public inputs (instances).
|
|
438
405
|
*
|
|
439
|
-
*
|
|
440
|
-
* @
|
|
406
|
+
* @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
|
|
407
|
+
* @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
|
|
408
|
+
* @param {Proof} proof The batch proof to verify
|
|
409
|
+
* @returns {boolean} True if the batch proof is valid, false otherwise
|
|
410
|
+
* @param {Array<any>} verifying_keys
|
|
411
|
+
* @param {Array<any>} inputs
|
|
412
|
+
* @param {Proof} proof
|
|
413
|
+
* @returns {boolean}
|
|
441
414
|
*/
|
|
442
|
-
function
|
|
443
|
-
|
|
444
|
-
|
|
415
|
+
function snarkVerifyBatch(verifying_keys, inputs, proof) {
|
|
416
|
+
try {
|
|
417
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
418
|
+
_assertClass(proof, Proof);
|
|
419
|
+
wasm.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
|
|
420
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
421
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
422
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
423
|
+
if (r2) {
|
|
424
|
+
throw takeObject(r1);
|
|
425
|
+
}
|
|
426
|
+
return r0 !== 0;
|
|
427
|
+
} finally {
|
|
428
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* @param {string} string
|
|
434
|
+
* @returns {Field}
|
|
435
|
+
*/
|
|
436
|
+
function stringToField(string) {
|
|
437
|
+
try {
|
|
438
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
439
|
+
const ptr0 = passStringToWasm0(string, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
440
|
+
const len0 = WASM_VECTOR_LEN;
|
|
441
|
+
wasm.stringToField(retptr, ptr0, len0);
|
|
442
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
443
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
444
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
445
|
+
if (r2) {
|
|
446
|
+
throw takeObject(r1);
|
|
447
|
+
}
|
|
448
|
+
return Field.__wrap(r0);
|
|
449
|
+
} finally {
|
|
450
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
451
|
+
}
|
|
445
452
|
}
|
|
446
453
|
|
|
447
454
|
/**
|
|
@@ -453,7 +460,7 @@ function getMaxProgramImports() {
|
|
|
453
460
|
* import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
|
|
454
461
|
*
|
|
455
462
|
* Set the consensus version heights.
|
|
456
|
-
* getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20");
|
|
463
|
+
* getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21");
|
|
457
464
|
* @param {string | null} [heights]
|
|
458
465
|
* @returns {Array<any>}
|
|
459
466
|
*/
|
|
@@ -465,25 +472,20 @@ function getOrInitConsensusVersionTestHeights(heights) {
|
|
|
465
472
|
}
|
|
466
473
|
|
|
467
474
|
/**
|
|
468
|
-
*
|
|
469
|
-
*
|
|
475
|
+
* Returns the maximum number of imports allowed in a program by the
|
|
476
|
+
* snarkVM network implementation this SDK was built against.
|
|
477
|
+
*
|
|
478
|
+
* @returns {number} The maximum number of program imports.
|
|
479
|
+
*
|
|
480
|
+
* @example
|
|
481
|
+
* import { getMaxProgramImports } from '@provablehq/sdk';
|
|
482
|
+
*
|
|
483
|
+
* const maxImports = getMaxProgramImports();
|
|
484
|
+
* @returns {number}
|
|
470
485
|
*/
|
|
471
|
-
function
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
const ptr0 = passStringToWasm0(string, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
475
|
-
const len0 = WASM_VECTOR_LEN;
|
|
476
|
-
wasm.stringToField(retptr, ptr0, len0);
|
|
477
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
478
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
479
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
480
|
-
if (r2) {
|
|
481
|
-
throw takeObject(r1);
|
|
482
|
-
}
|
|
483
|
-
return Field.__wrap(r0);
|
|
484
|
-
} finally {
|
|
485
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
486
|
-
}
|
|
486
|
+
function getMaxProgramImports() {
|
|
487
|
+
const ret = wasm.getMaxProgramImports();
|
|
488
|
+
return ret >>> 0;
|
|
487
489
|
}
|
|
488
490
|
|
|
489
491
|
function passArrayJsValueToWasm0(array, malloc) {
|
|
@@ -505,16 +507,16 @@ function getArrayJsValueFromWasm0(ptr, len) {
|
|
|
505
507
|
}
|
|
506
508
|
return result;
|
|
507
509
|
}
|
|
508
|
-
function
|
|
509
|
-
wasm.
|
|
510
|
+
function __wasm_bindgen_func_elem_9005(arg0, arg1, arg2) {
|
|
511
|
+
wasm.__wasm_bindgen_func_elem_9005(arg0, arg1, addHeapObject(arg2));
|
|
510
512
|
}
|
|
511
513
|
|
|
512
|
-
function
|
|
513
|
-
wasm.
|
|
514
|
+
function __wasm_bindgen_func_elem_7563(arg0, arg1) {
|
|
515
|
+
wasm.__wasm_bindgen_func_elem_7563(arg0, arg1);
|
|
514
516
|
}
|
|
515
517
|
|
|
516
|
-
function
|
|
517
|
-
wasm.
|
|
518
|
+
function __wasm_bindgen_func_elem_7835(arg0, arg1, arg2, arg3) {
|
|
519
|
+
wasm.__wasm_bindgen_func_elem_7835(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
518
520
|
}
|
|
519
521
|
|
|
520
522
|
const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
|
|
@@ -19319,7 +19321,7 @@ function __wbg_get_imports(memory) {
|
|
|
19319
19321
|
const ret = getObject(arg0).length;
|
|
19320
19322
|
return ret;
|
|
19321
19323
|
};
|
|
19322
|
-
imports.wbg.
|
|
19324
|
+
imports.wbg.__wbg_log_c2eca570a6157825 = function(arg0, arg1) {
|
|
19323
19325
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
19324
19326
|
};
|
|
19325
19327
|
imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
|
|
@@ -19337,7 +19339,7 @@ function __wbg_get_imports(memory) {
|
|
|
19337
19339
|
const a = state0.a;
|
|
19338
19340
|
state0.a = 0;
|
|
19339
19341
|
try {
|
|
19340
|
-
return
|
|
19342
|
+
return __wasm_bindgen_func_elem_7835(a, state0.b, arg0, arg1);
|
|
19341
19343
|
} finally {
|
|
19342
19344
|
state0.a = a;
|
|
19343
19345
|
}
|
|
@@ -19509,7 +19511,7 @@ function __wbg_get_imports(memory) {
|
|
|
19509
19511
|
const ret = Signature.__wrap(arg0);
|
|
19510
19512
|
return addHeapObject(ret);
|
|
19511
19513
|
};
|
|
19512
|
-
imports.wbg.
|
|
19514
|
+
imports.wbg.__wbg_spawnWorker_0d7c58b5ba9ab046 = function(arg0, arg1, arg2, arg3) {
|
|
19513
19515
|
const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
|
|
19514
19516
|
return addHeapObject(ret);
|
|
19515
19517
|
};
|
|
@@ -19591,11 +19593,6 @@ function __wbg_get_imports(memory) {
|
|
|
19591
19593
|
const ret = Atomics.waitAsync(getObject(arg0), arg1 >>> 0, arg2);
|
|
19592
19594
|
return addHeapObject(ret);
|
|
19593
19595
|
};
|
|
19594
|
-
imports.wbg.__wbindgen_cast_19cdf6e41653eb6c = function(arg0, arg1) {
|
|
19595
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 397, function: Function { arguments: [Externref], shim_idx: 398, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19596
|
-
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7555, __wasm_bindgen_func_elem_8995);
|
|
19597
|
-
return addHeapObject(ret);
|
|
19598
|
-
};
|
|
19599
19596
|
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
19600
19597
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
19601
19598
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
@@ -19611,6 +19608,16 @@ function __wbg_get_imports(memory) {
|
|
|
19611
19608
|
const ret = BigInt.asUintN(64, arg0);
|
|
19612
19609
|
return addHeapObject(ret);
|
|
19613
19610
|
};
|
|
19611
|
+
imports.wbg.__wbindgen_cast_4a4bdde4030a89e7 = function(arg0, arg1) {
|
|
19612
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 398, function: Function { arguments: [], shim_idx: 533, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19613
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7562, __wasm_bindgen_func_elem_7563);
|
|
19614
|
+
return addHeapObject(ret);
|
|
19615
|
+
};
|
|
19616
|
+
imports.wbg.__wbindgen_cast_994af091adc907b6 = function(arg0, arg1) {
|
|
19617
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 398, function: Function { arguments: [Externref], shim_idx: 399, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19618
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7562, __wasm_bindgen_func_elem_9005);
|
|
19619
|
+
return addHeapObject(ret);
|
|
19620
|
+
};
|
|
19614
19621
|
imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
|
|
19615
19622
|
// Cast intrinsic for `I64 -> Externref`.
|
|
19616
19623
|
const ret = arg0;
|
|
@@ -19621,19 +19628,14 @@ function __wbg_get_imports(memory) {
|
|
|
19621
19628
|
const ret = arg0;
|
|
19622
19629
|
return addHeapObject(ret);
|
|
19623
19630
|
};
|
|
19624
|
-
imports.wbg.__wbindgen_cast_dc45e30c78fa2793 = function(arg0, arg1) {
|
|
19625
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 397, function: Function { arguments: [], shim_idx: 533, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19626
|
-
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7555, __wasm_bindgen_func_elem_7556);
|
|
19627
|
-
return addHeapObject(ret);
|
|
19628
|
-
};
|
|
19629
19631
|
imports.wbg.__wbindgen_cast_e7b45dd881f38ce3 = function(arg0, arg1) {
|
|
19630
19632
|
// Cast intrinsic for `U128 -> Externref`.
|
|
19631
19633
|
const ret = (BigInt.asUintN(64, arg0) | (BigInt.asUintN(64, arg1) << BigInt(64)));
|
|
19632
19634
|
return addHeapObject(ret);
|
|
19633
19635
|
};
|
|
19634
|
-
imports.wbg.
|
|
19635
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
19636
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
19636
|
+
imports.wbg.__wbindgen_cast_ffe78050edfd1435 = function(arg0, arg1) {
|
|
19637
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 398, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 399, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19638
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7562, __wasm_bindgen_func_elem_9005);
|
|
19637
19639
|
return addHeapObject(ret);
|
|
19638
19640
|
};
|
|
19639
19641
|
imports.wbg.__wbindgen_link_b9f45ffe079ef2c1 = function(arg0) {
|