o1js
Version:
TypeScript framework for zk-SNARKs and zkApps
1,645 lines (1,518 loc) • 277 kB
JavaScript
let imports = {};
imports['__wbindgen_placeholder__'] = module.exports;
let { isMainThread, workerData } = require('worker_threads');
let env = {};
if (isMainThread) {
env.memory = new WebAssembly.Memory({
initial: 20,
maximum: 65536,
shared: true,
});
} else {
env.memory = workerData.memory;
}
imports['env'] = env;
let wasm;
const { TextDecoder, TextEncoder } = require(`util`);
const heap = new Array(128).fill(undefined);
heap.push(undefined, null, true, false);
function getObject(idx) { return heap[idx]; }
let heap_next = heap.length;
function dropObject(idx) {
if (idx < 132) return;
heap[idx] = heap_next;
heap_next = idx;
}
function takeObject(idx) {
const ret = getObject(idx);
dropObject(idx);
return ret;
}
function addHeapObject(obj) {
if (heap_next === heap.length) heap.push(heap.length + 1);
const idx = heap_next;
heap_next = heap[idx];
heap[idx] = obj;
return idx;
}
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
cachedTextDecoder.decode();
let cachedUint8Memory0 = null;
function getUint8Memory0() {
if (cachedUint8Memory0 === null || cachedUint8Memory0.buffer !== wasm.memory.buffer) {
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
}
return cachedUint8Memory0;
}
function getStringFromWasm0(ptr, len) {
ptr = ptr >>> 0;
return cachedTextDecoder.decode(getUint8Memory0().slice(ptr, ptr + len));
}
function debugString(val) {
// primitive types
const type = typeof val;
if (type == 'number' || type == 'boolean' || val == null) {
return `${val}`;
}
if (type == 'string') {
return `"${val}"`;
}
if (type == 'symbol') {
const description = val.description;
if (description == null) {
return 'Symbol';
} else {
return `Symbol(${description})`;
}
}
if (type == 'function') {
const name = val.name;
if (typeof name == 'string' && name.length > 0) {
return `Function(${name})`;
} else {
return 'Function';
}
}
// objects
if (Array.isArray(val)) {
const length = val.length;
let debug = '[';
if (length > 0) {
debug += debugString(val[0]);
}
for(let i = 1; i < length; i++) {
debug += ', ' + debugString(val[i]);
}
debug += ']';
return debug;
}
// Test for built-in
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
let className;
if (builtInMatches.length > 1) {
className = builtInMatches[1];
} else {
// Failed to match the standard '[object ClassName]'
return toString.call(val);
}
if (className == 'Object') {
// we're a user defined class or Object
// JSON.stringify avoids problems with cycles, and is generally much
// easier than looping through ownProperties of `val`.
try {
return 'Object(' + JSON.stringify(val) + ')';
} catch (_) {
return 'Object';
}
}
// errors
if (val instanceof Error) {
return `${val.name}: ${val.message}\n${val.stack}`;
}
// TODO we could test for more things here, like `Set`s and `Map`s.
return className;
}
let WASM_VECTOR_LEN = 0;
let cachedTextEncoder = new TextEncoder('utf-8');
const encodeString = function (arg, view) {
const buf = cachedTextEncoder.encode(arg);
view.set(buf);
return {
read: arg.length,
written: buf.length
};
};
function passStringToWasm0(arg, malloc, realloc) {
if (realloc === undefined) {
const buf = cachedTextEncoder.encode(arg);
const ptr = malloc(buf.length, 1) >>> 0;
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
WASM_VECTOR_LEN = buf.length;
return ptr;
}
let len = arg.length;
let ptr = malloc(len, 1) >>> 0;
const mem = getUint8Memory0();
let offset = 0;
for (; offset < len; offset++) {
const code = arg.charCodeAt(offset);
if (code > 0x7F) break;
mem[ptr + offset] = code;
}
if (offset !== len) {
if (offset !== 0) {
arg = arg.slice(offset);
}
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
const ret = encodeString(arg, view);
offset += ret.written;
}
WASM_VECTOR_LEN = offset;
return ptr;
}
let cachedInt32Memory0 = null;
function getInt32Memory0() {
if (cachedInt32Memory0 === null || cachedInt32Memory0.buffer !== wasm.memory.buffer) {
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
}
return cachedInt32Memory0;
}
/**
* @param {number} num_threads
* @param {string} worker_source
* @returns {Promise<any>}
*/
module.exports.initThreadPool = function(num_threads, worker_source) {
const ret = wasm.initThreadPool(num_threads, addHeapObject(worker_source));
return takeObject(ret);
};
/**
* @returns {Promise<any>}
*/
module.exports.exitThreadPool = function() {
const ret = wasm.exitThreadPool();
return takeObject(ret);
};
/**
* @param {number} receiver
*/
module.exports.wbg_rayon_start_worker = function(receiver) {
wasm.wbg_rayon_start_worker(receiver);
};
/**
* @param {number} depth
* @returns {WasmFqSrs}
*/
module.exports.caml_fq_srs_create = function(depth) {
const ret = wasm.caml_fq_srs_create(depth);
return WasmFqSrs.__wrap(ret);
};
function _assertClass(instance, klass) {
if (!(instance instanceof klass)) {
throw new Error(`expected instance of ${klass.name}`);
}
return instance.ptr;
}
/**
* @param {WasmFqSrs} srs
* @param {number} log2_size
*/
module.exports.caml_fq_srs_add_lagrange_basis = function(srs, log2_size) {
_assertClass(srs, WasmFqSrs);
wasm.caml_fq_srs_add_lagrange_basis(srs.__wbg_ptr, log2_size);
};
function isLikeNone(x) {
return x === undefined || x === null;
}
/**
* @param {boolean | undefined} append
* @param {WasmFqSrs} srs
* @param {string} path
*/
module.exports.caml_fq_srs_write = function(append, srs, path) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(srs, WasmFqSrs);
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.caml_fq_srs_write(retptr, isLikeNone(append) ? 0xFFFFFF : append ? 1 : 0, srs.__wbg_ptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
if (r1) {
throw takeObject(r0);
}
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @param {number | undefined} offset
* @param {string} path
* @returns {WasmFqSrs | undefined}
*/
module.exports.caml_fq_srs_read = function(offset, path) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.caml_fp_srs_read(retptr, !isLikeNone(offset), isLikeNone(offset) ? 0 : offset, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return r0 === 0 ? undefined : WasmFqSrs.__wrap(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @param {WasmFqSrs} srs
* @param {number} domain_size
* @returns {number}
*/
module.exports.caml_fq_srs_lagrange_commitments_whole_domain_ptr = function(srs, domain_size) {
_assertClass(srs, WasmFqSrs);
const ret = wasm.caml_fq_srs_lagrange_commitments_whole_domain_ptr(srs.__wbg_ptr, domain_size);
return ret >>> 0;
};
let cachedUint32Memory0 = null;
function getUint32Memory0() {
if (cachedUint32Memory0 === null || cachedUint32Memory0.buffer !== wasm.memory.buffer) {
cachedUint32Memory0 = new Uint32Array(wasm.memory.buffer);
}
return cachedUint32Memory0;
}
function getArrayU32FromWasm0(ptr, len) {
ptr = ptr >>> 0;
return getUint32Memory0().subarray(ptr / 4, ptr / 4 + len);
}
/**
* Reads the lagrange commitments from a raw pointer.
*
* # Safety
*
* This function is unsafe because it might dereference a
* raw pointer.
* @param {number} ptr
* @returns {Uint32Array}
*/
module.exports.caml_fq_srs_lagrange_commitments_whole_domain_read_from_ptr = function(ptr) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.caml_fq_srs_lagrange_commitments_whole_domain_read_from_ptr(retptr, ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v1 = getArrayU32FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 4, 4);
return v1;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @param {WasmFqSrs} srs
* @param {number} domain_size
* @param {number} i
* @returns {WasmFqPolyComm}
*/
module.exports.caml_fq_srs_lagrange_commitment = function(srs, domain_size, i) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(srs, WasmFqSrs);
wasm.caml_fq_srs_lagrange_commitment(retptr, srs.__wbg_ptr, domain_size, i);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return WasmFqPolyComm.__wrap(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
function passArray8ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 1, 1) >>> 0;
getUint8Memory0().set(arg, ptr / 1);
WASM_VECTOR_LEN = arg.length;
return ptr;
}
/**
* @param {WasmFqSrs} srs
* @param {number} domain_size
* @param {Uint8Array} evals
* @returns {WasmFqPolyComm}
*/
module.exports.caml_fq_srs_commit_evaluations = function(srs, domain_size, evals) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(srs, WasmFqSrs);
const ptr0 = passArray8ToWasm0(evals, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.caml_fq_srs_commit_evaluations(retptr, srs.__wbg_ptr, domain_size, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return WasmFqPolyComm.__wrap(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @param {WasmFqSrs} srs
* @param {Uint8Array} chals
* @returns {WasmFqPolyComm}
*/
module.exports.caml_fq_srs_b_poly_commitment = function(srs, chals) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(srs, WasmFqSrs);
const ptr0 = passArray8ToWasm0(chals, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.caml_fq_srs_b_poly_commitment(retptr, srs.__wbg_ptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return WasmFqPolyComm.__wrap(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
function passArray32ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 4, 4) >>> 0;
getUint32Memory0().set(arg, ptr / 4);
WASM_VECTOR_LEN = arg.length;
return ptr;
}
/**
* @param {WasmFqSrs} srs
* @param {Uint32Array} comms
* @param {Uint8Array} chals
* @returns {boolean}
*/
module.exports.caml_fq_srs_batch_accumulator_check = function(srs, comms, chals) {
_assertClass(srs, WasmFqSrs);
const ptr0 = passArray32ToWasm0(comms, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ptr1 = passArray8ToWasm0(chals, wasm.__wbindgen_malloc);
const len1 = WASM_VECTOR_LEN;
const ret = wasm.caml_fq_srs_batch_accumulator_check(srs.__wbg_ptr, ptr0, len0, ptr1, len1);
return ret !== 0;
};
/**
* @param {WasmFqSrs} srs
* @param {number} comms
* @param {Uint8Array} chals
* @returns {Uint32Array}
*/
module.exports.caml_fq_srs_batch_accumulator_generate = function(srs, comms, chals) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(srs, WasmFqSrs);
const ptr0 = passArray8ToWasm0(chals, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.caml_fq_srs_batch_accumulator_generate(retptr, srs.__wbg_ptr, comms, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v2 = getArrayU32FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 4, 4);
return v2;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @param {WasmFqSrs} srs
* @returns {WasmGPallas}
*/
module.exports.caml_fq_srs_h = function(srs) {
_assertClass(srs, WasmFqSrs);
const ret = wasm.caml_fq_srs_h(srs.__wbg_ptr);
return WasmGPallas.__wrap(ret);
};
/**
* @param {number} depth
* @returns {WasmFqSrs}
*/
module.exports.caml_fq_srs_create_parallel = function(depth) {
const ret = wasm.caml_fq_srs_create_parallel(depth);
return WasmFqSrs.__wrap(ret);
};
/**
* @param {WasmFqSrs} srs
* @returns {Uint32Array}
*/
module.exports.caml_fq_srs_get = function(srs) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(srs, WasmFqSrs);
wasm.caml_fq_srs_get(retptr, srs.__wbg_ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v1 = getArrayU32FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 4, 4);
return v1;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @param {Uint32Array} h_and_gs
* @returns {WasmFqSrs}
*/
module.exports.caml_fq_srs_set = function(h_and_gs) {
const ptr0 = passArray32ToWasm0(h_and_gs, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.caml_fq_srs_set(ptr0, len0);
return WasmFqSrs.__wrap(ret);
};
/**
* @param {WasmFqSrs} srs
* @param {number} domain_size
* @param {number} i
* @returns {WasmFqPolyComm | undefined}
*/
module.exports.caml_fq_srs_maybe_lagrange_commitment = function(srs, domain_size, i) {
_assertClass(srs, WasmFqSrs);
const ret = wasm.caml_fq_srs_maybe_lagrange_commitment(srs.__wbg_ptr, domain_size, i);
return ret === 0 ? undefined : WasmFqPolyComm.__wrap(ret);
};
/**
* @param {WasmFqSrs} srs
* @param {number} domain_size
* @param {Uint32Array} input_bases
*/
module.exports.caml_fq_srs_set_lagrange_basis = function(srs, domain_size, input_bases) {
_assertClass(srs, WasmFqSrs);
const ptr0 = passArray32ToWasm0(input_bases, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.caml_fq_srs_set_lagrange_basis(srs.__wbg_ptr, domain_size, ptr0, len0);
};
/**
* @param {WasmFqSrs} srs
* @param {number} domain_size
* @returns {Uint32Array}
*/
module.exports.caml_fq_srs_get_lagrange_basis = function(srs, domain_size) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(srs, WasmFqSrs);
wasm.caml_fq_srs_get_lagrange_basis(retptr, srs.__wbg_ptr, domain_size);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v1 = getArrayU32FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 4, 4);
return v1;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
function getArrayU8FromWasm0(ptr, len) {
ptr = ptr >>> 0;
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
}
/**
* @param {Uint8Array} state
* @returns {Uint8Array}
*/
module.exports.caml_pasta_fp_poseidon_block_cipher = function(state) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(state, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.caml_pasta_fp_poseidon_block_cipher(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v2 = getArrayU8FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1, 1);
return v2;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @param {Uint8Array} state
* @returns {Uint8Array}
*/
module.exports.caml_pasta_fq_poseidon_block_cipher = function(state) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(state, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.caml_pasta_fq_poseidon_block_cipher(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v2 = getArrayU8FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1, 1);
return v2;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @param {string} s
* @param {number} _len
* @param {number} base
* @returns {Uint8Array}
*/
module.exports.caml_bigint_256_of_numeral = function(s, _len, base) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.caml_bigint_256_of_numeral(retptr, ptr0, len0, _len, base);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v2 = getArrayU8FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1, 1);
return v2;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @param {string} s
* @returns {Uint8Array}
*/
module.exports.caml_bigint_256_of_decimal_string = function(s) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.caml_bigint_256_of_decimal_string(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v2 = getArrayU8FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1, 1);
return v2;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @returns {number}
*/
module.exports.caml_bigint_256_num_limbs = function() {
const ret = wasm.caml_bigint_256_num_limbs();
return ret;
};
/**
* @returns {number}
*/
module.exports.caml_bigint_256_bytes_per_limb = function() {
const ret = wasm.caml_bigint_256_bytes_per_limb();
return ret;
};
/**
* @param {Uint8Array} x
* @param {Uint8Array} y
* @returns {Uint8Array}
*/
module.exports.caml_bigint_256_div = function(x, y) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(x, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ptr1 = passArray8ToWasm0(y, wasm.__wbindgen_malloc);
const len1 = WASM_VECTOR_LEN;
wasm.caml_bigint_256_div(retptr, ptr0, len0, ptr1, len1);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v3 = getArrayU8FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1, 1);
return v3;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @param {Uint8Array} x
* @param {Uint8Array} y
* @returns {number}
*/
module.exports.caml_bigint_256_compare = function(x, y) {
const ptr0 = passArray8ToWasm0(x, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ptr1 = passArray8ToWasm0(y, wasm.__wbindgen_malloc);
const len1 = WASM_VECTOR_LEN;
const ret = wasm.caml_bigint_256_compare(ptr0, len0, ptr1, len1);
return ret;
};
/**
* @param {Uint8Array} x
* @param {number} i
* @returns {boolean}
*/
module.exports.caml_bigint_256_test_bit = function(x, i) {
const ptr0 = passArray8ToWasm0(x, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.caml_bigint_256_test_bit(ptr0, len0, i);
return ret !== 0;
};
/**
* @param {Uint8Array} x
* @returns {Uint8Array}
*/
module.exports.caml_bigint_256_to_bytes = function(x) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(x, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.caml_bigint_256_to_bytes(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v2 = getArrayU8FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1, 1);
return v2;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @param {Uint8Array} x
* @returns {Uint8Array}
*/
module.exports.caml_bigint_256_of_bytes = function(x) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(x, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.caml_bigint_256_of_bytes(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v2 = getArrayU8FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1, 1);
return v2;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @param {Uint8Array} x
* @returns {Uint8Array}
*/
module.exports.caml_bigint_256_deep_copy = function(x) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(x, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.caml_bigint_256_deep_copy(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v2 = getArrayU8FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1, 1);
return v2;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @returns {WasmGPallas}
*/
module.exports.caml_pallas_affine_one = function() {
const ret = wasm.caml_pallas_affine_one();
return WasmGPallas.__wrap(ret);
};
/**
* @returns {WasmGVesta}
*/
module.exports.caml_vesta_affine_one = function() {
const ret = wasm.caml_vesta_affine_one();
return WasmGVesta.__wrap(ret);
};
function handleError(f, args) {
try {
return f.apply(this, args);
} catch (e) {
wasm.__wbindgen_exn_store(addHeapObject(e));
}
}
/**
* @param {string} s
*/
module.exports.console_log = function(s) {
const ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.console_log(ptr0, len0);
};
/**
* @returns {number}
*/
module.exports.create_zero_u32_ptr = function() {
const ret = wasm.create_zero_u32_ptr();
return ret >>> 0;
};
/**
* Free a pointer. This method is exported in the WebAssembly module to be used
* on the JavaScript side, see `web-backend.js`.
*
* # Safety
*
* See
* `<https://rust-lang.github.io/rust-clippy/master/index.html#not_unsafe_ptr_arg_deref>`
* @param {number} ptr
*/
module.exports.free_u32_ptr = function(ptr) {
wasm.free_u32_ptr(ptr);
};
/**
* Set the value of a pointer. This method is exported in the WebAssembly
* module to be used on the JavaScript side, see `web-backend.js`.
*
* # Safety
*
* See
* `<https://rust-lang.github.io/rust-clippy/master/index.html#not_unsafe_ptr_arg_deref>`
* @param {number} ptr
* @param {number} arg
*/
module.exports.set_u32_ptr = function(ptr, arg) {
wasm.set_u32_ptr(ptr, arg);
};
/**
* This method is exported in the WebAssembly to be used on the JavaScript
* side, see `web-backend.js`.
*
* # Safety
*
* See
* `<https://rust-lang.github.io/rust-clippy/master/index.html#not_unsafe_ptr_arg_deref>`
* @param {number} ptr
* @returns {number}
*/
module.exports.wait_until_non_zero = function(ptr) {
const ret = wasm.wait_until_non_zero(ptr);
return ret >>> 0;
};
/**
* This method is exported in the WebAssembly to check the memory used on the
* JavaScript
* @returns {any}
*/
module.exports.get_memory = function() {
const ret = wasm.get_memory();
return takeObject(ret);
};
/**
* Returns the number of bytes used by the WebAssembly memory.
* @returns {number}
*/
module.exports.get_memory_byte_length = function() {
const ret = wasm.get_memory_byte_length();
return ret >>> 0;
};
/**
* @returns {WasmPallasGProjective}
*/
module.exports.caml_pallas_one = function() {
const ret = wasm.caml_pallas_one();
return WasmPallasGProjective.__wrap(ret);
};
/**
* @param {WasmPallasGProjective} x
* @param {WasmPallasGProjective} y
* @returns {WasmPallasGProjective}
*/
module.exports.caml_pallas_add = function(x, y) {
_assertClass(x, WasmPallasGProjective);
_assertClass(y, WasmPallasGProjective);
const ret = wasm.caml_pallas_add(x.__wbg_ptr, y.__wbg_ptr);
return WasmPallasGProjective.__wrap(ret);
};
/**
* @param {WasmPallasGProjective} x
* @param {WasmPallasGProjective} y
* @returns {WasmPallasGProjective}
*/
module.exports.caml_pallas_sub = function(x, y) {
_assertClass(x, WasmPallasGProjective);
_assertClass(y, WasmPallasGProjective);
const ret = wasm.caml_pallas_sub(x.__wbg_ptr, y.__wbg_ptr);
return WasmPallasGProjective.__wrap(ret);
};
/**
* @param {WasmPallasGProjective} x
* @returns {WasmPallasGProjective}
*/
module.exports.caml_pallas_negate = function(x) {
_assertClass(x, WasmPallasGProjective);
const ret = wasm.caml_pallas_negate(x.__wbg_ptr);
return WasmPallasGProjective.__wrap(ret);
};
/**
* @param {WasmPallasGProjective} x
* @returns {WasmPallasGProjective}
*/
module.exports.caml_pallas_double = function(x) {
_assertClass(x, WasmPallasGProjective);
const ret = wasm.caml_pallas_double(x.__wbg_ptr);
return WasmPallasGProjective.__wrap(ret);
};
/**
* @param {WasmPallasGProjective} x
* @param {Uint8Array} y
* @returns {WasmPallasGProjective}
*/
module.exports.caml_pallas_scale = function(x, y) {
_assertClass(x, WasmPallasGProjective);
const ptr0 = passArray8ToWasm0(y, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.caml_pallas_scale(x.__wbg_ptr, ptr0, len0);
return WasmPallasGProjective.__wrap(ret);
};
/**
* @returns {WasmPallasGProjective}
*/
module.exports.caml_pallas_random = function() {
const ret = wasm.caml_pallas_random();
return WasmPallasGProjective.__wrap(ret);
};
/**
* @param {number} i
* @returns {WasmPallasGProjective}
*/
module.exports.caml_pallas_rng = function(i) {
const ret = wasm.caml_pallas_rng(i);
return WasmPallasGProjective.__wrap(ret);
};
/**
* @returns {Uint8Array}
*/
module.exports.caml_pallas_endo_base = function() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.caml_pallas_endo_base(retptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v1 = getArrayU8FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1, 1);
return v1;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @returns {Uint8Array}
*/
module.exports.caml_pallas_endo_scalar = function() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.caml_pallas_endo_scalar(retptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v1 = getArrayU8FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1, 1);
return v1;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @param {WasmPallasGProjective} x
* @returns {WasmGPallas}
*/
module.exports.caml_pallas_to_affine = function(x) {
_assertClass(x, WasmPallasGProjective);
const ret = wasm.caml_pallas_to_affine(x.__wbg_ptr);
return WasmGPallas.__wrap(ret);
};
/**
* @param {WasmGPallas} x
* @returns {WasmPallasGProjective}
*/
module.exports.caml_pallas_of_affine = function(x) {
_assertClass(x, WasmGPallas);
var ptr0 = x.__destroy_into_raw();
const ret = wasm.caml_pallas_of_affine(ptr0);
return WasmPallasGProjective.__wrap(ret);
};
/**
* @param {Uint8Array} x
* @param {Uint8Array} y
* @returns {WasmPallasGProjective}
*/
module.exports.caml_pallas_of_affine_coordinates = function(x, y) {
const ptr0 = passArray8ToWasm0(x, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ptr1 = passArray8ToWasm0(y, wasm.__wbindgen_malloc);
const len1 = WASM_VECTOR_LEN;
const ret = wasm.caml_pallas_of_affine_coordinates(ptr0, len0, ptr1, len1);
return WasmPallasGProjective.__wrap(ret);
};
/**
* @param {WasmGPallas} x
* @returns {WasmGPallas}
*/
module.exports.caml_pallas_affine_deep_copy = function(x) {
_assertClass(x, WasmGPallas);
var ptr0 = x.__destroy_into_raw();
const ret = wasm.caml_pallas_affine_deep_copy(ptr0);
return WasmGPallas.__wrap(ret);
};
/**
* @param {number | undefined} offset
* @param {WasmFpSrs} srs
* @param {string} path
* @returns {WasmFpPlonkVerifierIndex}
*/
module.exports.caml_pasta_fp_plonk_verifier_index_read = function(offset, srs, path) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(srs, WasmFpSrs);
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.caml_pasta_fp_plonk_verifier_index_read(retptr, !isLikeNone(offset), isLikeNone(offset) ? 0 : offset, srs.__wbg_ptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return WasmFpPlonkVerifierIndex.__wrap(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @param {boolean | undefined} append
* @param {WasmFpPlonkVerifierIndex} index
* @param {string} path
*/
module.exports.caml_pasta_fp_plonk_verifier_index_write = function(append, index, path) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(index, WasmFpPlonkVerifierIndex);
var ptr0 = index.__destroy_into_raw();
const ptr1 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len1 = WASM_VECTOR_LEN;
wasm.caml_pasta_fp_plonk_verifier_index_write(retptr, isLikeNone(append) ? 0xFFFFFF : append ? 1 : 0, ptr0, ptr1, len1);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
if (r1) {
throw takeObject(r0);
}
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @param {WasmFpPlonkVerifierIndex} index
* @returns {string}
*/
module.exports.caml_pasta_fp_plonk_verifier_index_serialize = function(index) {
let deferred2_0;
let deferred2_1;
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(index, WasmFpPlonkVerifierIndex);
var ptr0 = index.__destroy_into_raw();
wasm.caml_pasta_fp_plonk_verifier_index_serialize(retptr, ptr0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
deferred2_0 = r0;
deferred2_1 = r1;
return getStringFromWasm0(r0, r1);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
}
};
/**
* @param {WasmFpSrs} srs
* @param {string} index
* @returns {WasmFpPlonkVerifierIndex}
*/
module.exports.caml_pasta_fp_plonk_verifier_index_deserialize = function(srs, index) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(srs, WasmFpSrs);
const ptr0 = passStringToWasm0(index, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.caml_pasta_fp_plonk_verifier_index_deserialize(retptr, srs.__wbg_ptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return WasmFpPlonkVerifierIndex.__wrap(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @param {WasmPastaFpPlonkIndex} index
* @returns {WasmFpPlonkVerifierIndex}
*/
module.exports.caml_pasta_fp_plonk_verifier_index_create = function(index) {
_assertClass(index, WasmPastaFpPlonkIndex);
const ret = wasm.caml_pasta_fp_plonk_verifier_index_create(index.__wbg_ptr);
return WasmFpPlonkVerifierIndex.__wrap(ret);
};
/**
* @param {number} log2_size
* @returns {WasmFpShifts}
*/
module.exports.caml_pasta_fp_plonk_verifier_index_shifts = function(log2_size) {
const ret = wasm.caml_pasta_fp_plonk_verifier_index_shifts(log2_size);
return WasmFpShifts.__wrap(ret);
};
/**
* @returns {WasmFpPlonkVerifierIndex}
*/
module.exports.caml_pasta_fp_plonk_verifier_index_dummy = function() {
const ret = wasm.caml_pasta_fp_plonk_verifier_index_dummy();
return WasmFpPlonkVerifierIndex.__wrap(ret);
};
/**
* @param {WasmFpPlonkVerifierIndex} x
* @returns {WasmFpPlonkVerifierIndex}
*/
module.exports.caml_pasta_fp_plonk_verifier_index_deep_copy = function(x) {
_assertClass(x, WasmFpPlonkVerifierIndex);
const ret = wasm.caml_pasta_fp_plonk_verifier_index_deep_copy(x.__wbg_ptr);
return WasmFpPlonkVerifierIndex.__wrap(ret);
};
/**
* @param {Uint32Array} lgr_comm
* @param {WasmFpPlonkVerifierIndex} index
* @param {WasmFpProverProof} proof
* @returns {WasmFpOracles}
*/
module.exports.fp_oracles_create = function(lgr_comm, index, proof) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray32ToWasm0(lgr_comm, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
_assertClass(index, WasmFpPlonkVerifierIndex);
var ptr1 = index.__destroy_into_raw();
_assertClass(proof, WasmFpProverProof);
var ptr2 = proof.__destroy_into_raw();
wasm.fp_oracles_create(retptr, ptr0, len0, ptr1, ptr2);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return WasmFpOracles.__wrap(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @returns {WasmFpOracles}
*/
module.exports.fp_oracles_dummy = function() {
const ret = wasm.fp_oracles_dummy();
return WasmFpOracles.__wrap(ret);
};
/**
* @param {WasmFpProverProof} x
* @returns {WasmFpProverProof}
*/
module.exports.fp_oracles_deep_copy = function(x) {
_assertClass(x, WasmFpProverProof);
var ptr0 = x.__destroy_into_raw();
const ret = wasm.fp_oracles_deep_copy(ptr0);
return WasmFpProverProof.__wrap(ret);
};
/**
* @param {number} depth
* @returns {WasmFpSrs}
*/
module.exports.caml_fp_srs_create = function(depth) {
const ret = wasm.caml_fp_srs_create(depth);
return WasmFpSrs.__wrap(ret);
};
/**
* @param {WasmFpSrs} srs
* @param {number} log2_size
*/
module.exports.caml_fp_srs_add_lagrange_basis = function(srs, log2_size) {
_assertClass(srs, WasmFpSrs);
wasm.caml_fp_srs_add_lagrange_basis(srs.__wbg_ptr, log2_size);
};
/**
* @param {boolean | undefined} append
* @param {WasmFpSrs} srs
* @param {string} path
*/
module.exports.caml_fp_srs_write = function(append, srs, path) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(srs, WasmFpSrs);
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.caml_fp_srs_write(retptr, isLikeNone(append) ? 0xFFFFFF : append ? 1 : 0, srs.__wbg_ptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
if (r1) {
throw takeObject(r0);
}
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @param {number | undefined} offset
* @param {string} path
* @returns {WasmFpSrs | undefined}
*/
module.exports.caml_fp_srs_read = function(offset, path) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.caml_fp_srs_read(retptr, !isLikeNone(offset), isLikeNone(offset) ? 0 : offset, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return r0 === 0 ? undefined : WasmFpSrs.__wrap(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @param {WasmFpSrs} srs
* @param {number} domain_size
* @returns {number}
*/
module.exports.caml_fp_srs_lagrange_commitments_whole_domain_ptr = function(srs, domain_size) {
_assertClass(srs, WasmFpSrs);
const ret = wasm.caml_fp_srs_lagrange_commitments_whole_domain_ptr(srs.__wbg_ptr, domain_size);
return ret >>> 0;
};
/**
* Reads the lagrange commitments from a raw pointer.
*
* # Safety
*
* This function is unsafe because it might dereference a
* raw pointer.
* @param {number} ptr
* @returns {Uint32Array}
*/
module.exports.caml_fp_srs_lagrange_commitments_whole_domain_read_from_ptr = function(ptr) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.caml_fp_srs_lagrange_commitments_whole_domain_read_from_ptr(retptr, ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v1 = getArrayU32FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 4, 4);
return v1;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @param {WasmFpSrs} srs
* @param {number} domain_size
* @param {number} i
* @returns {WasmFpPolyComm}
*/
module.exports.caml_fp_srs_lagrange_commitment = function(srs, domain_size, i) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(srs, WasmFpSrs);
wasm.caml_fp_srs_lagrange_commitment(retptr, srs.__wbg_ptr, domain_size, i);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return WasmFpPolyComm.__wrap(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @param {WasmFpSrs} srs
* @param {number} domain_size
* @param {Uint8Array} evals
* @returns {WasmFpPolyComm}
*/
module.exports.caml_fp_srs_commit_evaluations = function(srs, domain_size, evals) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(srs, WasmFpSrs);
const ptr0 = passArray8ToWasm0(evals, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.caml_fp_srs_commit_evaluations(retptr, srs.__wbg_ptr, domain_size, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return WasmFpPolyComm.__wrap(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @param {WasmFpSrs} srs
* @param {Uint8Array} chals
* @returns {WasmFpPolyComm}
*/
module.exports.caml_fp_srs_b_poly_commitment = function(srs, chals) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(srs, WasmFpSrs);
const ptr0 = passArray8ToWasm0(chals, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.caml_fp_srs_b_poly_commitment(retptr, srs.__wbg_ptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return WasmFpPolyComm.__wrap(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @param {WasmFpSrs} srs
* @param {Uint32Array} comms
* @param {Uint8Array} chals
* @returns {boolean}
*/
module.exports.caml_fp_srs_batch_accumulator_check = function(srs, comms, chals) {
_assertClass(srs, WasmFpSrs);
const ptr0 = passArray32ToWasm0(comms, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ptr1 = passArray8ToWasm0(chals, wasm.__wbindgen_malloc);
const len1 = WASM_VECTOR_LEN;
const ret = wasm.caml_fp_srs_batch_accumulator_check(srs.__wbg_ptr, ptr0, len0, ptr1, len1);
return ret !== 0;
};
/**
* @param {WasmFpSrs} srs
* @param {number} comms
* @param {Uint8Array} chals
* @returns {Uint32Array}
*/
module.exports.caml_fp_srs_batch_accumulator_generate = function(srs, comms, chals) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(srs, WasmFpSrs);
const ptr0 = passArray8ToWasm0(chals, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.caml_fp_srs_batch_accumulator_generate(retptr, srs.__wbg_ptr, comms, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v2 = getArrayU32FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 4, 4);
return v2;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @param {WasmFpSrs} srs
* @returns {WasmGVesta}
*/
module.exports.caml_fp_srs_h = function(srs) {
_assertClass(srs, WasmFpSrs);
const ret = wasm.caml_fp_srs_h(srs.__wbg_ptr);
return WasmGVesta.__wrap(ret);
};
/**
* @param {number} depth
* @returns {WasmFpSrs}
*/
module.exports.caml_fp_srs_create_parallel = function(depth) {
const ret = wasm.caml_fp_srs_create_parallel(depth);
return WasmFpSrs.__wrap(ret);
};
/**
* @param {WasmFpSrs} srs
* @returns {Uint32Array}
*/
module.exports.caml_fp_srs_get = function(srs) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(srs, WasmFpSrs);
wasm.caml_fp_srs_get(retptr, srs.__wbg_ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v1 = getArrayU32FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 4, 4);
return v1;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @param {Uint32Array} h_and_gs
* @returns {WasmFpSrs}
*/
module.exports.caml_fp_srs_set = function(h_and_gs) {
const ptr0 = passArray32ToWasm0(h_and_gs, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ret = wasm.caml_fp_srs_set(ptr0, len0);
return WasmFpSrs.__wrap(ret);
};
/**
* @param {WasmFpSrs} srs
* @param {number} domain_size
* @param {number} i
* @returns {WasmFpPolyComm | undefined}
*/
module.exports.caml_fp_srs_maybe_lagrange_commitment = function(srs, domain_size, i) {
_assertClass(srs, WasmFpSrs);
const ret = wasm.caml_fp_srs_maybe_lagrange_commitment(srs.__wbg_ptr, domain_size, i);
return ret === 0 ? undefined : WasmFpPolyComm.__wrap(ret);
};
/**
* @param {WasmFpSrs} srs
* @param {number} domain_size
* @param {Uint32Array} input_bases
*/
module.exports.caml_fp_srs_set_lagrange_basis = function(srs, domain_size, input_bases) {
_assertClass(srs, WasmFpSrs);
const ptr0 = passArray32ToWasm0(input_bases, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.caml_fp_srs_set_lagrange_basis(srs.__wbg_ptr, domain_size, ptr0, len0);
};
/**
* @param {WasmFpSrs} srs
* @param {number} domain_size
* @returns {Uint32Array}
*/
module.exports.caml_fp_srs_get_lagrange_basis = function(srs, domain_size) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(srs, WasmFpSrs);
wasm.caml_fp_srs_get_lagrange_basis(retptr, srs.__wbg_ptr, domain_size);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v1 = getArrayU32FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 4, 4);
return v1;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @param {WasmFpGateVector} gates
* @param {number} public_
* @param {Uint32Array} lookup_tables
* @param {Uint32Array} runtime_table_cfgs
* @param {number} prev_challenges
* @param {WasmFpSrs} srs
* @param {boolean} lazy_mode
* @returns {WasmPastaFpPlonkIndex}
*/
module.exports.caml_pasta_fp_plonk_index_create = function(gates, public_, lookup_tables, runtime_table_cfgs, prev_challenges, srs, lazy_mode) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(gates, WasmFpGateVector);
const ptr0 = passArray32ToWasm0(lookup_tables, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
const ptr1 = passArray32ToWasm0(runtime_table_cfgs, wasm.__wbindgen_malloc);
const len1 = WASM_VECTOR_LEN;
_assertClass(srs, WasmFpSrs);
wasm.caml_pasta_fp_plonk_index_create(retptr, gates.__wbg_ptr, public_, ptr0, len0, ptr1, len1, prev_challenges, srs.__wbg_ptr, lazy_mode);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return WasmPastaFpPlonkIndex.__wrap(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @param {WasmPastaFpPlonkIndex} index
* @returns {number}
*/
module.exports.caml_pasta_fp_plonk_index_max_degree = function(index) {
_assertClass(index, WasmPastaFpPlonkIndex);
const ret = wasm.caml_pasta_fp_plonk_index_max_degree(index.__wbg_ptr);
return ret;
};
/**
* @param {WasmPastaFpPlonkIndex} index
* @returns {number}
*/
module.exports.caml_pasta_fp_plonk_index_public_inputs = function(index) {
_assertClass(index, WasmPastaFpPlonkIndex);
const ret = wasm.caml_pasta_fp_plonk_index_public_inputs(index.__wbg_ptr);
return ret;
};
/**
* @param {WasmPastaFpPlonkIndex} index
* @returns {number}
*/
module.exports.caml_pasta_fp_plonk_index_domain_d1_size = function(index) {
_assertClass(index, WasmPastaFpPlonkIndex);
const ret = wasm.caml_pasta_fp_plonk_index_domain_d1_size(index.__wbg_ptr);
return ret;
};
/**
* @param {WasmPastaFpPlonkIndex} index
* @returns {number}
*/
module.exports.caml_pasta_fp_plonk_index_domain_d4_size = function(index) {
_assertClass(index, WasmPastaFpPlonkIndex);
const ret = wasm.caml_pasta_fp_plonk_index_domain_d4_size(index.__wbg_ptr);
return ret;
};
/**
* @param {WasmPastaFpPlonkIndex} index
* @returns {number}
*/
module.exports.caml_pasta_fp_plonk_index_domain_d8_size = function(index) {
_assertClass(index, WasmPastaFpPlonkIndex);
const ret = wasm.caml_pasta_fp_plonk_index_domain_d8_size(index.__wbg_ptr);
return ret;
};
/**
* @param {Uint8Array} bytes
* @param {WasmFpSrs} srs
* @returns {WasmPastaFpPlonkIndex}
*/
module.exports.caml_pasta_fp_plonk_index_decode = function(bytes, srs) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
_assertClass(srs, WasmFpSrs);
wasm.caml_pasta_fp_plonk_index_decode(retptr, ptr0, len0, srs.__wbg_ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
if (r2) {
throw takeObject(r1);
}
return WasmPastaFpPlonkIndex.__wrap(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @param {WasmPastaFpPlonkIndex} index
* @returns {Uint8Array}
*/
module.exports.caml_pasta_fp_plonk_index_encode = function(index) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(index, WasmPastaFpPlonkIndex);
wasm.caml_pasta_fp_plonk_index_encode(retptr, index.__wbg_ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
var r3 = getInt32Memory0()[retptr / 4 + 3];
if (r3) {
throw takeObject(r2);
}
var v1 = getArrayU8FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1, 1);
return v1;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @param {number | undefined} offset
* @param {WasmFpSrs} srs
* @param {st