@provablehq/wasm 0.11.1 → 0.11.3
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 +14 -14
- package/dist/mainnet/aleo_wasm.wasm +0 -0
- package/dist/mainnet/index.cjs +69 -69
- package/dist/mainnet/index.cjs.map +1 -1
- package/dist/mainnet/index.js +69 -69
- package/dist/mainnet/index.js.map +1 -1
- package/dist/mainnet/worker.js +69 -69
- package/dist/mainnet/worker.js.map +1 -1
- package/dist/testnet/aleo_wasm.d.ts +12 -12
- package/dist/testnet/aleo_wasm.wasm +0 -0
- package/dist/testnet/index.cjs +33 -33
- package/dist/testnet/index.cjs.map +1 -1
- package/dist/testnet/index.js +33 -33
- package/dist/testnet/index.js.map +1 -1
- package/dist/testnet/worker.js +33 -33
- package/dist/testnet/worker.js.map +1 -1
- package/package.json +1 -1
package/dist/mainnet/worker.js
CHANGED
|
@@ -286,6 +286,16 @@ 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
|
+
|
|
289
299
|
/**
|
|
290
300
|
* Set the WASM log level from JS. Called automatically by the SDK's
|
|
291
301
|
* `setLogLevel(level)` to keep TS and WASM logging in sync.
|
|
@@ -297,16 +307,6 @@ function setWasmLogLevel(level) {
|
|
|
297
307
|
wasm.setWasmLogLevel(level);
|
|
298
308
|
}
|
|
299
309
|
|
|
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,6 +314,39 @@ function addBorrowedObject(obj) {
|
|
|
314
314
|
heap[--stack_pointer] = obj;
|
|
315
315
|
return stack_pointer;
|
|
316
316
|
}
|
|
317
|
+
/**
|
|
318
|
+
* Verify a SNARK proof against a verifying key and public inputs.
|
|
319
|
+
*
|
|
320
|
+
* This function verifies a proof produced by an Aleo program that may not be deployed on chain.
|
|
321
|
+
* It directly invokes the Varuna proof verification from snarkVM.
|
|
322
|
+
*
|
|
323
|
+
* @param {VerifyingKey} verifying_key The verifying key for the circuit
|
|
324
|
+
* @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
|
|
325
|
+
* @param {Proof} proof The proof to verify
|
|
326
|
+
* @returns {boolean} True if the proof is valid, false otherwise
|
|
327
|
+
* @param {VerifyingKey} verifying_key
|
|
328
|
+
* @param {Array<any>} inputs
|
|
329
|
+
* @param {Proof} proof
|
|
330
|
+
* @returns {boolean}
|
|
331
|
+
*/
|
|
332
|
+
function snarkVerify(verifying_key, inputs, proof) {
|
|
333
|
+
try {
|
|
334
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
335
|
+
_assertClass(verifying_key, VerifyingKey);
|
|
336
|
+
_assertClass(proof, Proof);
|
|
337
|
+
wasm.snarkVerify(retptr, verifying_key.__wbg_ptr, addHeapObject(inputs), proof.__wbg_ptr);
|
|
338
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
339
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
340
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
341
|
+
if (r2) {
|
|
342
|
+
throw takeObject(r1);
|
|
343
|
+
}
|
|
344
|
+
return r0 !== 0;
|
|
345
|
+
} finally {
|
|
346
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
317
350
|
/**
|
|
318
351
|
* Verify an execution. Executions with multiple transitions must have the program source code and
|
|
319
352
|
* verifying keys of imported functions supplied from outside to correctly verify. Also, this does
|
|
@@ -395,36 +428,23 @@ function snarkVerifyBatch(verifying_keys, inputs, proof) {
|
|
|
395
428
|
}
|
|
396
429
|
|
|
397
430
|
/**
|
|
398
|
-
*
|
|
431
|
+
* Set test consensus version heights for testing.
|
|
399
432
|
*
|
|
400
|
-
* This
|
|
401
|
-
* It directly invokes the Varuna proof verification from snarkVM.
|
|
433
|
+
* @param {string | undefined} heights The block heights at which each consensus version applies. This input should be a simple csv list of block heights and there should be one number for each consensus version. If left undefined, the default test heights will be applied.
|
|
402
434
|
*
|
|
403
|
-
* @
|
|
404
|
-
*
|
|
405
|
-
*
|
|
406
|
-
*
|
|
407
|
-
*
|
|
408
|
-
* @param {
|
|
409
|
-
* @
|
|
410
|
-
* @returns {boolean}
|
|
435
|
+
* @example
|
|
436
|
+
* import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
|
|
437
|
+
*
|
|
438
|
+
* Set the consensus version heights.
|
|
439
|
+
* getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14");
|
|
440
|
+
* @param {string | null} [heights]
|
|
441
|
+
* @returns {Array<any>}
|
|
411
442
|
*/
|
|
412
|
-
function
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
wasm.snarkVerify(retptr, verifying_key.__wbg_ptr, addHeapObject(inputs), proof.__wbg_ptr);
|
|
418
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
419
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
420
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
421
|
-
if (r2) {
|
|
422
|
-
throw takeObject(r1);
|
|
423
|
-
}
|
|
424
|
-
return r0 !== 0;
|
|
425
|
-
} finally {
|
|
426
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
427
|
-
}
|
|
443
|
+
function getOrInitConsensusVersionTestHeights(heights) {
|
|
444
|
+
var ptr0 = isLikeNone(heights) ? 0 : passStringToWasm0(heights, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
445
|
+
var len0 = WASM_VECTOR_LEN;
|
|
446
|
+
const ret = wasm.getOrInitConsensusVersionTestHeights(ptr0, len0);
|
|
447
|
+
return takeObject(ret);
|
|
428
448
|
}
|
|
429
449
|
|
|
430
450
|
/**
|
|
@@ -449,26 +469,6 @@ function stringToField(string) {
|
|
|
449
469
|
}
|
|
450
470
|
}
|
|
451
471
|
|
|
452
|
-
/**
|
|
453
|
-
* Set test consensus version heights for testing.
|
|
454
|
-
*
|
|
455
|
-
* @param {string | undefined} heights The block heights at which each consensus version applies. This input should be a simple csv list of block heights and there should be one number for each consensus version. If left undefined, the default test heights will be applied.
|
|
456
|
-
*
|
|
457
|
-
* @example
|
|
458
|
-
* import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
|
|
459
|
-
*
|
|
460
|
-
* Set the consensus version heights.
|
|
461
|
-
* getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14");
|
|
462
|
-
* @param {string | null} [heights]
|
|
463
|
-
* @returns {Array<any>}
|
|
464
|
-
*/
|
|
465
|
-
function getOrInitConsensusVersionTestHeights(heights) {
|
|
466
|
-
var ptr0 = isLikeNone(heights) ? 0 : passStringToWasm0(heights, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
467
|
-
var len0 = WASM_VECTOR_LEN;
|
|
468
|
-
const ret = wasm.getOrInitConsensusVersionTestHeights(ptr0, len0);
|
|
469
|
-
return takeObject(ret);
|
|
470
|
-
}
|
|
471
|
-
|
|
472
472
|
function passArrayJsValueToWasm0(array, malloc) {
|
|
473
473
|
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
474
474
|
const mem = getDataViewMemory0();
|
|
@@ -488,16 +488,16 @@ function getArrayJsValueFromWasm0(ptr, len) {
|
|
|
488
488
|
}
|
|
489
489
|
return result;
|
|
490
490
|
}
|
|
491
|
-
function
|
|
492
|
-
wasm.
|
|
491
|
+
function __wasm_bindgen_func_elem_7387(arg0, arg1) {
|
|
492
|
+
wasm.__wasm_bindgen_func_elem_7387(arg0, arg1);
|
|
493
493
|
}
|
|
494
494
|
|
|
495
|
-
function
|
|
496
|
-
wasm.
|
|
495
|
+
function __wasm_bindgen_func_elem_8758(arg0, arg1, arg2) {
|
|
496
|
+
wasm.__wasm_bindgen_func_elem_8758(arg0, arg1, addHeapObject(arg2));
|
|
497
497
|
}
|
|
498
498
|
|
|
499
|
-
function
|
|
500
|
-
wasm.
|
|
499
|
+
function __wasm_bindgen_func_elem_7660(arg0, arg1, arg2, arg3) {
|
|
500
|
+
wasm.__wasm_bindgen_func_elem_7660(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
501
501
|
}
|
|
502
502
|
|
|
503
503
|
const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
|
|
@@ -19232,7 +19232,7 @@ function __wbg_get_imports(memory) {
|
|
|
19232
19232
|
const ret = getObject(arg0).length;
|
|
19233
19233
|
return ret;
|
|
19234
19234
|
};
|
|
19235
|
-
imports.wbg.
|
|
19235
|
+
imports.wbg.__wbg_log_0eaae399732a802e = function(arg0, arg1) {
|
|
19236
19236
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
19237
19237
|
};
|
|
19238
19238
|
imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
|
|
@@ -19250,7 +19250,7 @@ function __wbg_get_imports(memory) {
|
|
|
19250
19250
|
const a = state0.a;
|
|
19251
19251
|
state0.a = 0;
|
|
19252
19252
|
try {
|
|
19253
|
-
return
|
|
19253
|
+
return __wasm_bindgen_func_elem_7660(a, state0.b, arg0, arg1);
|
|
19254
19254
|
} finally {
|
|
19255
19255
|
state0.a = a;
|
|
19256
19256
|
}
|
|
@@ -19422,7 +19422,7 @@ function __wbg_get_imports(memory) {
|
|
|
19422
19422
|
const ret = Signature.__wrap(arg0);
|
|
19423
19423
|
return addHeapObject(ret);
|
|
19424
19424
|
};
|
|
19425
|
-
imports.wbg.
|
|
19425
|
+
imports.wbg.__wbg_spawnWorker_3f95ae6c0630b765 = function(arg0, arg1, arg2, arg3) {
|
|
19426
19426
|
const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
|
|
19427
19427
|
return addHeapObject(ret);
|
|
19428
19428
|
};
|
|
@@ -19521,12 +19521,12 @@ function __wbg_get_imports(memory) {
|
|
|
19521
19521
|
};
|
|
19522
19522
|
imports.wbg.__wbindgen_cast_4a64cbb5b17898c9 = function(arg0, arg1) {
|
|
19523
19523
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 358, function: Function { arguments: [Externref], shim_idx: 359, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19524
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
19524
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7386, __wasm_bindgen_func_elem_8758);
|
|
19525
19525
|
return addHeapObject(ret);
|
|
19526
19526
|
};
|
|
19527
19527
|
imports.wbg.__wbindgen_cast_65bbaf572cb463ed = function(arg0, arg1) {
|
|
19528
19528
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 358, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 359, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19529
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
19529
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7386, __wasm_bindgen_func_elem_8758);
|
|
19530
19530
|
return addHeapObject(ret);
|
|
19531
19531
|
};
|
|
19532
19532
|
imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
|
|
@@ -19536,7 +19536,7 @@ function __wbg_get_imports(memory) {
|
|
|
19536
19536
|
};
|
|
19537
19537
|
imports.wbg.__wbindgen_cast_aca65e91b5ef2a91 = function(arg0, arg1) {
|
|
19538
19538
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 358, function: Function { arguments: [], shim_idx: 467, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19539
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
19539
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7386, __wasm_bindgen_func_elem_7387);
|
|
19540
19540
|
return addHeapObject(ret);
|
|
19541
19541
|
};
|
|
19542
19542
|
imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
|