@provablehq/wasm 0.11.2 → 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 +17 -17
- package/dist/mainnet/aleo_wasm.wasm +0 -0
- package/dist/mainnet/index.cjs +53 -53
- package/dist/mainnet/index.cjs.map +1 -1
- package/dist/mainnet/index.js +53 -53
- package/dist/mainnet/index.js.map +1 -1
- package/dist/mainnet/worker.js +53 -53
- package/dist/mainnet/worker.js.map +1 -1
- package/dist/testnet/aleo_wasm.d.ts +13 -13
- package/dist/testnet/aleo_wasm.wasm +0 -0
- package/dist/testnet/index.cjs +51 -51
- package/dist/testnet/index.cjs.map +1 -1
- package/dist/testnet/index.js +51 -51
- package/dist/testnet/index.js.map +1 -1
- package/dist/testnet/worker.js +51 -51
- package/dist/testnet/worker.js.map +1 -1
- package/package.json +1 -1
package/dist/testnet/worker.js
CHANGED
|
@@ -315,25 +315,26 @@ function addBorrowedObject(obj) {
|
|
|
315
315
|
return stack_pointer;
|
|
316
316
|
}
|
|
317
317
|
/**
|
|
318
|
-
* Verify a
|
|
318
|
+
* Verify a SNARK proof against a verifying key and public inputs.
|
|
319
319
|
*
|
|
320
|
-
* This function verifies a
|
|
321
|
-
*
|
|
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
322
|
*
|
|
323
|
-
* @param {
|
|
324
|
-
* @param {Array<
|
|
325
|
-
* @param {Proof} proof The
|
|
326
|
-
* @returns {boolean} True if the
|
|
327
|
-
* @param {
|
|
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
328
|
* @param {Array<any>} inputs
|
|
329
329
|
* @param {Proof} proof
|
|
330
330
|
* @returns {boolean}
|
|
331
331
|
*/
|
|
332
|
-
function
|
|
332
|
+
function snarkVerify(verifying_key, inputs, proof) {
|
|
333
333
|
try {
|
|
334
334
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
335
|
+
_assertClass(verifying_key, VerifyingKey);
|
|
335
336
|
_assertClass(proof, Proof);
|
|
336
|
-
wasm.
|
|
337
|
+
wasm.snarkVerify(retptr, verifying_key.__wbg_ptr, addHeapObject(inputs), proof.__wbg_ptr);
|
|
337
338
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
338
339
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
339
340
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -347,26 +348,25 @@ function snarkVerifyBatch(verifying_keys, inputs, proof) {
|
|
|
347
348
|
}
|
|
348
349
|
|
|
349
350
|
/**
|
|
350
|
-
* Verify a SNARK proof against
|
|
351
|
+
* Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
|
|
351
352
|
*
|
|
352
|
-
* This function verifies a proof produced by
|
|
353
|
-
*
|
|
353
|
+
* This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
|
|
354
|
+
* Each verifying key is paired with one or more sets of public inputs (instances).
|
|
354
355
|
*
|
|
355
|
-
* @param {
|
|
356
|
-
* @param {Array<string
|
|
357
|
-
* @param {Proof} proof The proof to verify
|
|
358
|
-
* @returns {boolean} True if the proof is valid, false otherwise
|
|
359
|
-
* @param {
|
|
356
|
+
* @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
|
|
357
|
+
* @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
|
|
358
|
+
* @param {Proof} proof The batch proof to verify
|
|
359
|
+
* @returns {boolean} True if the batch proof is valid, false otherwise
|
|
360
|
+
* @param {Array<any>} verifying_keys
|
|
360
361
|
* @param {Array<any>} inputs
|
|
361
362
|
* @param {Proof} proof
|
|
362
363
|
* @returns {boolean}
|
|
363
364
|
*/
|
|
364
|
-
function
|
|
365
|
+
function snarkVerifyBatch(verifying_keys, inputs, proof) {
|
|
365
366
|
try {
|
|
366
367
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
367
|
-
_assertClass(verifying_key, VerifyingKey);
|
|
368
368
|
_assertClass(proof, Proof);
|
|
369
|
-
wasm.
|
|
369
|
+
wasm.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
|
|
370
370
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
371
371
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
372
372
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -427,6 +427,26 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
|
|
|
427
427
|
}
|
|
428
428
|
}
|
|
429
429
|
|
|
430
|
+
/**
|
|
431
|
+
* Set test consensus version heights for testing.
|
|
432
|
+
*
|
|
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.
|
|
434
|
+
*
|
|
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>}
|
|
442
|
+
*/
|
|
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);
|
|
448
|
+
}
|
|
449
|
+
|
|
430
450
|
/**
|
|
431
451
|
* @param {string} string
|
|
432
452
|
* @returns {Field}
|
|
@@ -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_7384(arg0, arg1) {
|
|
492
|
+
wasm.__wasm_bindgen_func_elem_7384(arg0, arg1);
|
|
493
493
|
}
|
|
494
494
|
|
|
495
495
|
function __wasm_bindgen_func_elem_8758(arg0, arg1, arg2) {
|
|
496
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_7657(arg0, arg1, arg2, arg3) {
|
|
500
|
+
wasm.__wasm_bindgen_func_elem_7657(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_7657(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
|
};
|
|
@@ -19506,7 +19506,7 @@ function __wbg_get_imports(memory) {
|
|
|
19506
19506
|
};
|
|
19507
19507
|
imports.wbg.__wbindgen_cast_073ddd2b87fab8ab = function(arg0, arg1) {
|
|
19508
19508
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 360, function: Function { arguments: [], shim_idx: 467, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19509
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
19509
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7383, __wasm_bindgen_func_elem_7384);
|
|
19510
19510
|
return addHeapObject(ret);
|
|
19511
19511
|
};
|
|
19512
19512
|
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
@@ -19516,7 +19516,7 @@ function __wbg_get_imports(memory) {
|
|
|
19516
19516
|
};
|
|
19517
19517
|
imports.wbg.__wbindgen_cast_263b62405be3c669 = function(arg0, arg1) {
|
|
19518
19518
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 360, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 361, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19519
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
19519
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7383, __wasm_bindgen_func_elem_8758);
|
|
19520
19520
|
return addHeapObject(ret);
|
|
19521
19521
|
};
|
|
19522
19522
|
imports.wbg.__wbindgen_cast_2ddd8a25ff58642a = function(arg0, arg1) {
|
|
@@ -19531,7 +19531,7 @@ function __wbg_get_imports(memory) {
|
|
|
19531
19531
|
};
|
|
19532
19532
|
imports.wbg.__wbindgen_cast_5cd376b701f56c0e = function(arg0, arg1) {
|
|
19533
19533
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 360, function: Function { arguments: [Externref], shim_idx: 361, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19534
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
19534
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7383, __wasm_bindgen_func_elem_8758);
|
|
19535
19535
|
return addHeapObject(ret);
|
|
19536
19536
|
};
|
|
19537
19537
|
imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
|