@provablehq/wasm 0.11.7 → 0.11.9
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 +20 -20
- package/dist/mainnet/aleo_wasm.wasm +0 -0
- package/dist/mainnet/index.cjs +56 -56
- package/dist/mainnet/index.cjs.map +1 -1
- package/dist/mainnet/index.js +56 -56
- package/dist/mainnet/index.js.map +1 -1
- package/dist/mainnet/worker.js +56 -56
- package/dist/mainnet/worker.js.map +1 -1
- package/dist/testnet/aleo_wasm.d.ts +23 -23
- package/dist/testnet/aleo_wasm.wasm +0 -0
- package/dist/testnet/index.cjs +75 -75
- package/dist/testnet/index.cjs.map +1 -1
- package/dist/testnet/index.js +75 -75
- package/dist/testnet/index.js.map +1 -1
- package/dist/testnet/worker.js +75 -75
- package/dist/testnet/worker.js.map +1 -1
- package/package.json +1 -1
package/dist/testnet/index.js
CHANGED
|
@@ -314,6 +314,54 @@ function addBorrowedObject(obj) {
|
|
|
314
314
|
heap[--stack_pointer] = obj;
|
|
315
315
|
return stack_pointer;
|
|
316
316
|
}
|
|
317
|
+
/**
|
|
318
|
+
* Verify an execution. Executions with multiple transitions must have the program source code and
|
|
319
|
+
* verifying keys of imported functions supplied from outside to correctly verify. Also, this does
|
|
320
|
+
* not verify that the state root of the execution is included in the Aleo Network ledger.
|
|
321
|
+
*
|
|
322
|
+
* @param {Execution} execution The function execution to verify
|
|
323
|
+
* @param {VerifyingKey} verifying_key The verifying key for the function
|
|
324
|
+
* @param {Program} program The program that the function execution belongs to
|
|
325
|
+
* @param {String} function_id The name of the function that was executed
|
|
326
|
+
* @param {Object} imports The imports for the program in the form of { "program_id.aleo":"source code", ... }
|
|
327
|
+
* @param {Object} import_verifying_keys The verifying keys for the imports in the form of { "program_id.aleo": [["function, "verifying_key"], ...], ...}
|
|
328
|
+
* @returns {boolean} True if the execution is valid, false otherwise
|
|
329
|
+
* @param {Execution} execution
|
|
330
|
+
* @param {VerifyingKey} verifying_key
|
|
331
|
+
* @param {Program} program
|
|
332
|
+
* @param {string} function_id
|
|
333
|
+
* @param {object | null | undefined} imports
|
|
334
|
+
* @param {object | null | undefined} imported_verifying_keys
|
|
335
|
+
* @param {number} block_height
|
|
336
|
+
* @param {ProgramImports | null} [program_imports]
|
|
337
|
+
* @returns {boolean}
|
|
338
|
+
*/
|
|
339
|
+
function verifyFunctionExecution(execution, verifying_key, program, function_id, imports, imported_verifying_keys, block_height, program_imports) {
|
|
340
|
+
try {
|
|
341
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
342
|
+
_assertClass(execution, Execution);
|
|
343
|
+
_assertClass(verifying_key, VerifyingKey);
|
|
344
|
+
_assertClass(program, Program);
|
|
345
|
+
const ptr0 = passStringToWasm0(function_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
346
|
+
const len0 = WASM_VECTOR_LEN;
|
|
347
|
+
let ptr1 = 0;
|
|
348
|
+
if (!isLikeNone(program_imports)) {
|
|
349
|
+
_assertClass(program_imports, ProgramImports);
|
|
350
|
+
ptr1 = program_imports.__destroy_into_raw();
|
|
351
|
+
}
|
|
352
|
+
wasm.verifyFunctionExecution(retptr, execution.__wbg_ptr, verifying_key.__wbg_ptr, program.__wbg_ptr, ptr0, len0, isLikeNone(imports) ? 0 : addHeapObject(imports), isLikeNone(imported_verifying_keys) ? 0 : addHeapObject(imported_verifying_keys), block_height, ptr1);
|
|
353
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
354
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
355
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
356
|
+
if (r2) {
|
|
357
|
+
throw takeObject(r1);
|
|
358
|
+
}
|
|
359
|
+
return r0 !== 0;
|
|
360
|
+
} finally {
|
|
361
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
317
365
|
/**
|
|
318
366
|
* Verify a SNARK proof against a verifying key and public inputs.
|
|
319
367
|
*
|
|
@@ -380,51 +428,23 @@ function snarkVerifyBatch(verifying_keys, inputs, proof) {
|
|
|
380
428
|
}
|
|
381
429
|
|
|
382
430
|
/**
|
|
383
|
-
*
|
|
384
|
-
* verifying keys of imported functions supplied from outside to correctly verify. Also, this does
|
|
385
|
-
* not verify that the state root of the execution is included in the Aleo Network ledger.
|
|
431
|
+
* Set test consensus version heights for testing.
|
|
386
432
|
*
|
|
387
|
-
* @param {
|
|
388
|
-
*
|
|
389
|
-
* @
|
|
390
|
-
*
|
|
391
|
-
*
|
|
392
|
-
*
|
|
393
|
-
*
|
|
394
|
-
* @param {
|
|
395
|
-
* @
|
|
396
|
-
* @param {Program} program
|
|
397
|
-
* @param {string} function_id
|
|
398
|
-
* @param {object | null | undefined} imports
|
|
399
|
-
* @param {object | null | undefined} imported_verifying_keys
|
|
400
|
-
* @param {number} block_height
|
|
401
|
-
* @param {ProgramImports | null} [program_imports]
|
|
402
|
-
* @returns {boolean}
|
|
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,15,16,17,18");
|
|
440
|
+
* @param {string | null} [heights]
|
|
441
|
+
* @returns {Array<any>}
|
|
403
442
|
*/
|
|
404
|
-
function
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
_assertClass(program, Program);
|
|
410
|
-
const ptr0 = passStringToWasm0(function_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
411
|
-
const len0 = WASM_VECTOR_LEN;
|
|
412
|
-
let ptr1 = 0;
|
|
413
|
-
if (!isLikeNone(program_imports)) {
|
|
414
|
-
_assertClass(program_imports, ProgramImports);
|
|
415
|
-
ptr1 = program_imports.__destroy_into_raw();
|
|
416
|
-
}
|
|
417
|
-
wasm.verifyFunctionExecution(retptr, execution.__wbg_ptr, verifying_key.__wbg_ptr, program.__wbg_ptr, ptr0, len0, isLikeNone(imports) ? 0 : addHeapObject(imports), isLikeNone(imported_verifying_keys) ? 0 : addHeapObject(imported_verifying_keys), block_height, ptr1);
|
|
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
|
/**
|
|
@@ -466,26 +486,6 @@ function getMaxProgramImports() {
|
|
|
466
486
|
return ret >>> 0;
|
|
467
487
|
}
|
|
468
488
|
|
|
469
|
-
/**
|
|
470
|
-
* Set test consensus version heights for testing.
|
|
471
|
-
*
|
|
472
|
-
* @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.
|
|
473
|
-
*
|
|
474
|
-
* @example
|
|
475
|
-
* import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
|
|
476
|
-
*
|
|
477
|
-
* Set the consensus version heights.
|
|
478
|
-
* getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18");
|
|
479
|
-
* @param {string | null} [heights]
|
|
480
|
-
* @returns {Array<any>}
|
|
481
|
-
*/
|
|
482
|
-
function getOrInitConsensusVersionTestHeights(heights) {
|
|
483
|
-
var ptr0 = isLikeNone(heights) ? 0 : passStringToWasm0(heights, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
484
|
-
var len0 = WASM_VECTOR_LEN;
|
|
485
|
-
const ret = wasm.getOrInitConsensusVersionTestHeights(ptr0, len0);
|
|
486
|
-
return takeObject(ret);
|
|
487
|
-
}
|
|
488
|
-
|
|
489
489
|
function passArrayJsValueToWasm0(array, malloc) {
|
|
490
490
|
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
491
491
|
const mem = getDataViewMemory0();
|
|
@@ -505,16 +505,16 @@ function getArrayJsValueFromWasm0(ptr, len) {
|
|
|
505
505
|
}
|
|
506
506
|
return result;
|
|
507
507
|
}
|
|
508
|
-
function
|
|
509
|
-
wasm.
|
|
508
|
+
function __wasm_bindgen_func_elem_7509(arg0, arg1) {
|
|
509
|
+
wasm.__wasm_bindgen_func_elem_7509(arg0, arg1);
|
|
510
510
|
}
|
|
511
511
|
|
|
512
|
-
function
|
|
513
|
-
wasm.
|
|
512
|
+
function __wasm_bindgen_func_elem_8948(arg0, arg1, arg2) {
|
|
513
|
+
wasm.__wasm_bindgen_func_elem_8948(arg0, arg1, addHeapObject(arg2));
|
|
514
514
|
}
|
|
515
515
|
|
|
516
|
-
function
|
|
517
|
-
wasm.
|
|
516
|
+
function __wasm_bindgen_func_elem_7781(arg0, arg1, arg2, arg3) {
|
|
517
|
+
wasm.__wasm_bindgen_func_elem_7781(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
518
518
|
}
|
|
519
519
|
|
|
520
520
|
const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
|
|
@@ -19319,7 +19319,7 @@ function __wbg_get_imports(memory) {
|
|
|
19319
19319
|
const ret = getObject(arg0).length;
|
|
19320
19320
|
return ret;
|
|
19321
19321
|
};
|
|
19322
|
-
imports.wbg.
|
|
19322
|
+
imports.wbg.__wbg_log_94d1dab6039baf0d = function(arg0, arg1) {
|
|
19323
19323
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
19324
19324
|
};
|
|
19325
19325
|
imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
|
|
@@ -19337,7 +19337,7 @@ function __wbg_get_imports(memory) {
|
|
|
19337
19337
|
const a = state0.a;
|
|
19338
19338
|
state0.a = 0;
|
|
19339
19339
|
try {
|
|
19340
|
-
return
|
|
19340
|
+
return __wasm_bindgen_func_elem_7781(a, state0.b, arg0, arg1);
|
|
19341
19341
|
} finally {
|
|
19342
19342
|
state0.a = a;
|
|
19343
19343
|
}
|
|
@@ -19509,7 +19509,7 @@ function __wbg_get_imports(memory) {
|
|
|
19509
19509
|
const ret = Signature.__wrap(arg0);
|
|
19510
19510
|
return addHeapObject(ret);
|
|
19511
19511
|
};
|
|
19512
|
-
imports.wbg.
|
|
19512
|
+
imports.wbg.__wbg_spawnWorker_755c8ce6e1ead587 = function(arg0, arg1, arg2, arg3) {
|
|
19513
19513
|
const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
|
|
19514
19514
|
return addHeapObject(ret);
|
|
19515
19515
|
};
|
|
@@ -19593,7 +19593,7 @@ function __wbg_get_imports(memory) {
|
|
|
19593
19593
|
};
|
|
19594
19594
|
imports.wbg.__wbindgen_cast_19cdf6e41653eb6c = function(arg0, arg1) {
|
|
19595
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.
|
|
19596
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7508, __wasm_bindgen_func_elem_8948);
|
|
19597
19597
|
return addHeapObject(ret);
|
|
19598
19598
|
};
|
|
19599
19599
|
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
@@ -19613,7 +19613,7 @@ function __wbg_get_imports(memory) {
|
|
|
19613
19613
|
};
|
|
19614
19614
|
imports.wbg.__wbindgen_cast_601de75c058a35e1 = function(arg0, arg1) {
|
|
19615
19615
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 397, function: Function { arguments: [], shim_idx: 528, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19616
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
19616
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7508, __wasm_bindgen_func_elem_7509);
|
|
19617
19617
|
return addHeapObject(ret);
|
|
19618
19618
|
};
|
|
19619
19619
|
imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
|
|
@@ -19633,7 +19633,7 @@ function __wbg_get_imports(memory) {
|
|
|
19633
19633
|
};
|
|
19634
19634
|
imports.wbg.__wbindgen_cast_eb522c22a7f98ff2 = function(arg0, arg1) {
|
|
19635
19635
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 397, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 398, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19636
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
19636
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7508, __wasm_bindgen_func_elem_8948);
|
|
19637
19637
|
return addHeapObject(ret);
|
|
19638
19638
|
};
|
|
19639
19639
|
imports.wbg.__wbindgen_link_b9f45ffe079ef2c1 = function(arg0) {
|