@noir-lang/acvm_js
Advanced tools
Comparing version 0.30.0 to 0.31.0-3107159.nightly
/* tslint:disable */ | ||
/* eslint-disable */ | ||
export const memory: WebAssembly.Memory; | ||
export function decompressWitness(a: number, b: number, c: number): void; | ||
export function compressWitness(a: number, b: number): void; | ||
export function getPublicWitness(a: number, b: number, c: number, d: number): void; | ||
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void; | ||
export function getReturnWitness(a: number, b: number, c: number, d: number): void; | ||
export function executeCircuitWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number; | ||
export function executeCircuit(a: number, b: number, c: number, d: number): number; | ||
export function createBlackBoxSolver(): number; | ||
export function __wbg_wasmblackboxfunctionsolver_free(a: number): void; | ||
export function initLogLevel(a: number): void; | ||
export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number; | ||
@@ -13,11 +19,5 @@ export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number; | ||
export function and(a: number, b: number): number; | ||
export function decompressWitness(a: number, b: number, c: number): void; | ||
export function compressWitness(a: number, b: number): void; | ||
export function buildInfo(): number; | ||
export function executeCircuitWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number; | ||
export function executeCircuit(a: number, b: number, c: number, d: number): number; | ||
export function createBlackBoxSolver(): number; | ||
export function __wbg_wasmblackboxfunctionsolver_free(a: number): void; | ||
export function initLogLevel(a: number): void; | ||
export function getPublicWitness(a: number, b: number, c: number, d: number): void; | ||
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void; | ||
export function getReturnWitness(a: number, b: number, c: number, d: number): void; | ||
export function __wbg_trap_free(a: number): void; | ||
@@ -28,6 +28,6 @@ export function trap___wbgd_downcast_token(): number; | ||
export const __wbindgen_export_2: WebAssembly.Table; | ||
export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__heb1f60a5b015b6c5(a: number, b: number, c: number): void; | ||
export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h3d2354449e918783(a: number, b: number, c: number): void; | ||
export function __wbindgen_add_to_stack_pointer(a: number): number; | ||
export function __wbindgen_free(a: number, b: number): void; | ||
export function __wbindgen_exn_store(a: number): void; | ||
export function wasm_bindgen__convert__closures__invoke2_mut__h72933b4dbc34aade(a: number, b: number, c: number, d: number): void; | ||
export function wasm_bindgen__convert__closures__invoke2_mut__ha676a05262f43687(a: number, b: number, c: number, d: number): void; |
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`. | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs. | ||
* | ||
* @param {Uint8Array} compressed_witness - A compressed witness. | ||
* @returns {WitnessMap} The decompressed witness map. | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's public inputs. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} solved_witness | ||
* @returns {WitnessMap} | ||
*/ | ||
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap; | ||
export function getPublicWitness(circuit: Uint8Array, solved_witness: WitnessMap): WitnessMap; | ||
/** | ||
* Compresses a `WitnessMap` into the binary format outputted by Nargo. | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters. | ||
* | ||
* @param {Uint8Array} compressed_witness - A witness map. | ||
* @returns {WitnessMap} A compressed witness map | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's public parameters. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} solved_witness | ||
* @returns {WitnessMap} | ||
*/ | ||
export function compressWitness(witness_map: WitnessMap): Uint8Array; | ||
export function getPublicParametersWitness(circuit: Uint8Array, solved_witness: WitnessMap): WitnessMap; | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's return values. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} witness_map | ||
* @returns {WitnessMap} | ||
*/ | ||
export function getReturnWitness(circuit: Uint8Array, witness_map: WitnessMap): WitnessMap; | ||
/** | ||
* Executes an ACIR circuit to generate the solved witness from the initial witness. | ||
* | ||
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver. | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit. | ||
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs. | ||
*/ | ||
export function executeCircuitWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, circuit: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>; | ||
/** | ||
* Executes an ACIR circuit to generate the solved witness from the initial witness. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit. | ||
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs. | ||
*/ | ||
export function executeCircuit(circuit: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>; | ||
/** | ||
* @returns {Promise<WasmBlackBoxFunctionSolver>} | ||
*/ | ||
export function createBlackBoxSolver(): Promise<WasmBlackBoxFunctionSolver>; | ||
/** | ||
* Sets the package's logging level. | ||
* | ||
* @param {LogLevel} level - The maximum level of logging to be emitted. | ||
*/ | ||
export function initLogLevel(level: LogLevel): void; | ||
/** | ||
* Verifies a ECDSA signature over the secp256r1 curve. | ||
@@ -69,68 +117,20 @@ * @param {Uint8Array} hashed_msg | ||
/** | ||
* Returns the `BuildInfo` object containing information about how the installed package was built. | ||
* @returns {BuildInfo} - Information on how the installed package was built. | ||
*/ | ||
export function buildInfo(): BuildInfo; | ||
/** | ||
* Executes an ACIR circuit to generate the solved witness from the initial witness. | ||
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`. | ||
* | ||
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver. | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit. | ||
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs. | ||
* @param {Uint8Array} compressed_witness - A compressed witness. | ||
* @returns {WitnessMap} The decompressed witness map. | ||
*/ | ||
export function executeCircuitWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, circuit: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>; | ||
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap; | ||
/** | ||
* Executes an ACIR circuit to generate the solved witness from the initial witness. | ||
* Compresses a `WitnessMap` into the binary format outputted by Nargo. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit. | ||
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs. | ||
* @param {Uint8Array} compressed_witness - A witness map. | ||
* @returns {WitnessMap} A compressed witness map | ||
*/ | ||
export function executeCircuit(circuit: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>; | ||
export function compressWitness(witness_map: WitnessMap): Uint8Array; | ||
/** | ||
* @returns {Promise<WasmBlackBoxFunctionSolver>} | ||
* Returns the `BuildInfo` object containing information about how the installed package was built. | ||
* @returns {BuildInfo} - Information on how the installed package was built. | ||
*/ | ||
export function createBlackBoxSolver(): Promise<WasmBlackBoxFunctionSolver>; | ||
/** | ||
* Sets the package's logging level. | ||
* | ||
* @param {LogLevel} level - The maximum level of logging to be emitted. | ||
*/ | ||
export function initLogLevel(level: LogLevel): void; | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's public inputs. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} solved_witness | ||
* @returns {WitnessMap} | ||
*/ | ||
export function getPublicWitness(circuit: Uint8Array, solved_witness: WitnessMap): WitnessMap; | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's public parameters. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} solved_witness | ||
* @returns {WitnessMap} | ||
*/ | ||
export function getPublicParametersWitness(circuit: Uint8Array, solved_witness: WitnessMap): WitnessMap; | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's return values. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} witness_map | ||
* @returns {WitnessMap} | ||
*/ | ||
export function getReturnWitness(circuit: Uint8Array, witness_map: WitnessMap): WitnessMap; | ||
export function buildInfo(): BuildInfo; | ||
@@ -151,17 +151,8 @@ export type ForeignCallInput = string[] | ||
/** | ||
* @typedef {Object} BuildInfo - Information about how the installed package was built | ||
* @property {string} gitHash - The hash of the git commit from which the package was built. | ||
* @property {string} version - The version of the package at the built git commit. | ||
* @property {boolean} dirty - Whether the package contained uncommitted changes when built. | ||
*/ | ||
export type BuildInfo = { | ||
gitHash: string; | ||
version: string; | ||
dirty: string; | ||
} | ||
export type LogLevel = "OFF" | "ERROR" | "WARN" | "INFO" | "DEBUG" | "TRACE"; | ||
export type LogLevel = "OFF" | "ERROR" | "WARN" | "INFO" | "DEBUG" | "TRACE"; | ||
// Map from witness index to hex string value of witness. | ||
export type WitnessMap = Map<number, string>; | ||
@@ -176,4 +167,13 @@ | ||
// Map from witness index to hex string value of witness. | ||
export type WitnessMap = Map<number, string>; | ||
/** | ||
* @typedef {Object} BuildInfo - Information about how the installed package was built | ||
* @property {string} gitHash - The hash of the git commit from which the package was built. | ||
* @property {string} version - The version of the package at the built git commit. | ||
* @property {boolean} dirty - Whether the package contained uncommitted changes when built. | ||
*/ | ||
export type BuildInfo = { | ||
gitHash: string; | ||
version: string; | ||
dirty: string; | ||
} | ||
@@ -180,0 +180,0 @@ |
let imports = {}; | ||
imports['__wbindgen_placeholder__'] = module.exports; | ||
let wasm; | ||
const { TextDecoder, TextEncoder } = require(`util`); | ||
const { TextEncoder, TextDecoder } = require(`util`); | ||
@@ -26,6 +26,4 @@ const heap = new Array(128).fill(undefined); | ||
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); | ||
let WASM_VECTOR_LEN = 0; | ||
cachedTextDecoder.decode(); | ||
let cachedUint8Memory0 = null; | ||
@@ -40,40 +38,2 @@ | ||
function getStringFromWasm0(ptr, len) { | ||
ptr = ptr >>> 0; | ||
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); | ||
} | ||
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; | ||
} | ||
function isLikeNone(x) { | ||
return x === undefined || x === null; | ||
} | ||
let cachedFloat64Memory0 = null; | ||
function getFloat64Memory0() { | ||
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) { | ||
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer); | ||
} | ||
return cachedFloat64Memory0; | ||
} | ||
let cachedInt32Memory0 = null; | ||
function getInt32Memory0() { | ||
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) { | ||
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); | ||
} | ||
return cachedInt32Memory0; | ||
} | ||
let WASM_VECTOR_LEN = 0; | ||
let cachedTextEncoder = new TextEncoder('utf-8'); | ||
@@ -132,2 +92,42 @@ | ||
function isLikeNone(x) { | ||
return x === undefined || x === null; | ||
} | ||
let cachedInt32Memory0 = null; | ||
function getInt32Memory0() { | ||
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) { | ||
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); | ||
} | ||
return cachedInt32Memory0; | ||
} | ||
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 cachedFloat64Memory0 = null; | ||
function getFloat64Memory0() { | ||
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) { | ||
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer); | ||
} | ||
return cachedFloat64Memory0; | ||
} | ||
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); | ||
cachedTextDecoder.decode(); | ||
function getStringFromWasm0(ptr, len) { | ||
ptr = ptr >>> 0; | ||
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); | ||
} | ||
let cachedBigInt64Memory0 = null; | ||
@@ -232,3 +232,3 @@ | ||
function __wbg_adapter_54(arg0, arg1, arg2) { | ||
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__heb1f60a5b015b6c5(arg0, arg1, addHeapObject(arg2)); | ||
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h3d2354449e918783(arg0, arg1, addHeapObject(arg2)); | ||
} | ||
@@ -243,13 +243,17 @@ | ||
/** | ||
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`. | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs. | ||
* | ||
* @param {Uint8Array} compressed_witness - A compressed witness. | ||
* @returns {WitnessMap} The decompressed witness map. | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's public inputs. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} solved_witness | ||
* @returns {WitnessMap} | ||
*/ | ||
module.exports.decompressWitness = function(compressed_witness) { | ||
module.exports.getPublicWitness = function(circuit, solved_witness) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc); | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.decompressWitness(retptr, ptr0, len0); | ||
wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
@@ -267,26 +271,25 @@ var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
function getArrayU8FromWasm0(ptr, len) { | ||
ptr = ptr >>> 0; | ||
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len); | ||
} | ||
/** | ||
* Compresses a `WitnessMap` into the binary format outputted by Nargo. | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters. | ||
* | ||
* @param {Uint8Array} compressed_witness - A witness map. | ||
* @returns {WitnessMap} A compressed witness map | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's public parameters. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} solved_witness | ||
* @returns {WitnessMap} | ||
*/ | ||
module.exports.compressWitness = function(witness_map) { | ||
module.exports.getPublicParametersWitness = function(circuit, solved_witness) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.compressWitness(retptr, addHeapObject(witness_map)); | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness)); | ||
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); | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
var v1 = getArrayU8FromWasm0(r0, r1).slice(); | ||
wasm.__wbindgen_free(r0, r1 * 1); | ||
return v1; | ||
return takeObject(r0); | ||
} finally { | ||
@@ -298,2 +301,85 @@ wasm.__wbindgen_add_to_stack_pointer(16); | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's return values. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} witness_map | ||
* @returns {WitnessMap} | ||
*/ | ||
module.exports.getReturnWitness = function(circuit, witness_map) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
return takeObject(r0); | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
} | ||
}; | ||
function _assertClass(instance, klass) { | ||
if (!(instance instanceof klass)) { | ||
throw new Error(`expected instance of ${klass.name}`); | ||
} | ||
return instance.ptr; | ||
} | ||
/** | ||
* Executes an ACIR circuit to generate the solved witness from the initial witness. | ||
* | ||
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver. | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit. | ||
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs. | ||
*/ | ||
module.exports.executeCircuitWithBlackBoxSolver = function(solver, circuit, initial_witness, foreign_call_handler) { | ||
_assertClass(solver, WasmBlackBoxFunctionSolver); | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ret = wasm.executeCircuitWithBlackBoxSolver(solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler)); | ||
return takeObject(ret); | ||
}; | ||
/** | ||
* Executes an ACIR circuit to generate the solved witness from the initial witness. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit. | ||
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs. | ||
*/ | ||
module.exports.executeCircuit = function(circuit, initial_witness, foreign_call_handler) { | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler)); | ||
return takeObject(ret); | ||
}; | ||
/** | ||
* @returns {Promise<WasmBlackBoxFunctionSolver>} | ||
*/ | ||
module.exports.createBlackBoxSolver = function() { | ||
const ret = wasm.createBlackBoxSolver(); | ||
return takeObject(ret); | ||
}; | ||
/** | ||
* Sets the package's logging level. | ||
* | ||
* @param {LogLevel} level - The maximum level of logging to be emitted. | ||
*/ | ||
module.exports.initLogLevel = function(level) { | ||
wasm.initLogLevel(addHeapObject(level)); | ||
}; | ||
/** | ||
* Verifies a ECDSA signature over the secp256r1 curve. | ||
@@ -341,2 +427,6 @@ * @param {Uint8Array} hashed_msg | ||
function getArrayU8FromWasm0(ptr, len) { | ||
ptr = ptr >>> 0; | ||
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len); | ||
} | ||
/** | ||
@@ -428,81 +518,13 @@ * Calculates the Keccak256 hash of the input bytes | ||
/** | ||
* Returns the `BuildInfo` object containing information about how the installed package was built. | ||
* @returns {BuildInfo} - Information on how the installed package was built. | ||
*/ | ||
module.exports.buildInfo = function() { | ||
const ret = wasm.buildInfo(); | ||
return takeObject(ret); | ||
}; | ||
function _assertClass(instance, klass) { | ||
if (!(instance instanceof klass)) { | ||
throw new Error(`expected instance of ${klass.name}`); | ||
} | ||
return instance.ptr; | ||
} | ||
/** | ||
* Executes an ACIR circuit to generate the solved witness from the initial witness. | ||
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`. | ||
* | ||
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver. | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit. | ||
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs. | ||
* @param {Uint8Array} compressed_witness - A compressed witness. | ||
* @returns {WitnessMap} The decompressed witness map. | ||
*/ | ||
module.exports.executeCircuitWithBlackBoxSolver = function(solver, circuit, initial_witness, foreign_call_handler) { | ||
_assertClass(solver, WasmBlackBoxFunctionSolver); | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ret = wasm.executeCircuitWithBlackBoxSolver(solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler)); | ||
return takeObject(ret); | ||
}; | ||
/** | ||
* Executes an ACIR circuit to generate the solved witness from the initial witness. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit. | ||
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs. | ||
*/ | ||
module.exports.executeCircuit = function(circuit, initial_witness, foreign_call_handler) { | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler)); | ||
return takeObject(ret); | ||
}; | ||
/** | ||
* @returns {Promise<WasmBlackBoxFunctionSolver>} | ||
*/ | ||
module.exports.createBlackBoxSolver = function() { | ||
const ret = wasm.createBlackBoxSolver(); | ||
return takeObject(ret); | ||
}; | ||
/** | ||
* Sets the package's logging level. | ||
* | ||
* @param {LogLevel} level - The maximum level of logging to be emitted. | ||
*/ | ||
module.exports.initLogLevel = function(level) { | ||
wasm.initLogLevel(addHeapObject(level)); | ||
}; | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's public inputs. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} solved_witness | ||
* @returns {WitnessMap} | ||
*/ | ||
module.exports.getPublicWitness = function(circuit, solved_witness) { | ||
module.exports.decompressWitness = function(compressed_witness) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness)); | ||
wasm.decompressWitness(retptr, ptr0, len0); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
@@ -521,24 +543,21 @@ var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters. | ||
* Compresses a `WitnessMap` into the binary format outputted by Nargo. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's public parameters. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} solved_witness | ||
* @returns {WitnessMap} | ||
* @param {Uint8Array} compressed_witness - A witness map. | ||
* @returns {WitnessMap} A compressed witness map | ||
*/ | ||
module.exports.getPublicParametersWitness = function(circuit, solved_witness) { | ||
module.exports.compressWitness = function(witness_map) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness)); | ||
wasm.compressWitness(retptr, addHeapObject(witness_map)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
var r3 = getInt32Memory0()[retptr / 4 + 3]; | ||
if (r3) { | ||
throw takeObject(r2); | ||
} | ||
return takeObject(r0); | ||
var v1 = getArrayU8FromWasm0(r0, r1).slice(); | ||
wasm.__wbindgen_free(r0, r1 * 1); | ||
return v1; | ||
} finally { | ||
@@ -550,27 +569,8 @@ wasm.__wbindgen_add_to_stack_pointer(16); | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's return values. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} witness_map | ||
* @returns {WitnessMap} | ||
* Returns the `BuildInfo` object containing information about how the installed package was built. | ||
* @returns {BuildInfo} - Information on how the installed package was built. | ||
*/ | ||
module.exports.getReturnWitness = function(circuit, witness_map) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
return takeObject(r0); | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
} | ||
module.exports.buildInfo = function() { | ||
const ret = wasm.buildInfo(); | ||
return takeObject(ret); | ||
}; | ||
@@ -586,3 +586,3 @@ | ||
function __wbg_adapter_155(arg0, arg1, arg2, arg3) { | ||
wasm.wasm_bindgen__convert__closures__invoke2_mut__h72933b4dbc34aade(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3)); | ||
wasm.wasm_bindgen__convert__closures__invoke2_mut__ha676a05262f43687(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3)); | ||
} | ||
@@ -645,12 +645,21 @@ | ||
module.exports.__wbindgen_error_new = function(arg0, arg1) { | ||
const ret = new Error(getStringFromWasm0(arg0, arg1)); | ||
module.exports.__wbg_wasmblackboxfunctionsolver_new = function(arg0) { | ||
const ret = WasmBlackBoxFunctionSolver.__wrap(arg0); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbindgen_object_clone_ref = function(arg0) { | ||
const ret = getObject(arg0); | ||
return addHeapObject(ret); | ||
module.exports.__wbindgen_is_array = function(arg0) { | ||
const ret = Array.isArray(getObject(arg0)); | ||
return ret; | ||
}; | ||
module.exports.__wbindgen_string_get = function(arg0, arg1) { | ||
const obj = getObject(arg1); | ||
const ret = typeof(obj) === 'string' ? obj : undefined; | ||
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
var len1 = WASM_VECTOR_LEN; | ||
getInt32Memory0()[arg0 / 4 + 1] = len1; | ||
getInt32Memory0()[arg0 / 4 + 0] = ptr1; | ||
}; | ||
module.exports.__wbindgen_is_string = function(arg0) { | ||
@@ -661,14 +670,9 @@ const ret = typeof(getObject(arg0)) === 'string'; | ||
module.exports.__wbindgen_is_array = function(arg0) { | ||
const ret = Array.isArray(getObject(arg0)); | ||
return ret; | ||
}; | ||
module.exports.__wbindgen_string_new = function(arg0, arg1) { | ||
const ret = getStringFromWasm0(arg0, arg1); | ||
module.exports.__wbg_new_3a350aed96e43abb = function() { | ||
const ret = new Map(); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbg_wasmblackboxfunctionsolver_new = function(arg0) { | ||
const ret = WasmBlackBoxFunctionSolver.__wrap(arg0); | ||
module.exports.__wbindgen_number_new = function(arg0) { | ||
const ret = arg0; | ||
return addHeapObject(ret); | ||
@@ -684,16 +688,22 @@ }; | ||
module.exports.__wbindgen_is_undefined = function(arg0) { | ||
const ret = getObject(arg0) === undefined; | ||
return ret; | ||
module.exports.__wbindgen_error_new = function(arg0, arg1) { | ||
const ret = new Error(getStringFromWasm0(arg0, arg1)); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbindgen_string_get = function(arg0, arg1) { | ||
const obj = getObject(arg1); | ||
const ret = typeof(obj) === 'string' ? obj : undefined; | ||
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
var len1 = WASM_VECTOR_LEN; | ||
getInt32Memory0()[arg0 / 4 + 1] = len1; | ||
getInt32Memory0()[arg0 / 4 + 0] = ptr1; | ||
module.exports.__wbindgen_object_clone_ref = function(arg0) { | ||
const ret = getObject(arg0); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbg_constructor_e2f72a91b4e3ce37 = function(arg0) { | ||
const ret = new Error(takeObject(arg0)); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbindgen_string_new = function(arg0, arg1) { | ||
const ret = getStringFromWasm0(arg0, arg1); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbindgen_cb_drop = function(arg0) { | ||
@@ -709,17 +719,7 @@ const obj = takeObject(arg0).original; | ||
module.exports.__wbg_new_e290c3c041336f87 = function() { | ||
const ret = new Map(); | ||
return addHeapObject(ret); | ||
module.exports.__wbindgen_is_undefined = function(arg0) { | ||
const ret = getObject(arg0) === undefined; | ||
return ret; | ||
}; | ||
module.exports.__wbindgen_number_new = function(arg0) { | ||
const ret = arg0; | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbg_constructor_6e18ba778d67e20b = function(arg0) { | ||
const ret = new Error(takeObject(arg0)); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbg_new_abda76e883ba8a5f = function() { | ||
@@ -765,12 +765,2 @@ const ret = new Error(); | ||
module.exports.__wbindgen_is_bigint = function(arg0) { | ||
const ret = typeof(getObject(arg0)) === 'bigint'; | ||
return ret; | ||
}; | ||
module.exports.__wbindgen_jsval_eq = function(arg0, arg1) { | ||
const ret = getObject(arg0) === getObject(arg1); | ||
return ret; | ||
}; | ||
module.exports.__wbindgen_bigint_from_u64 = function(arg0) { | ||
@@ -786,8 +776,12 @@ const ret = BigInt.asUintN(64, arg0); | ||
module.exports.__wbindgen_is_object = function(arg0) { | ||
const val = getObject(arg0); | ||
const ret = typeof(val) === 'object' && val !== null; | ||
module.exports.__wbindgen_jsval_eq = function(arg0, arg1) { | ||
const ret = getObject(arg0) === getObject(arg1); | ||
return ret; | ||
}; | ||
module.exports.__wbindgen_is_bigint = function(arg0) { | ||
const ret = typeof(getObject(arg0)) === 'bigint'; | ||
return ret; | ||
}; | ||
module.exports.__wbindgen_is_function = function(arg0) { | ||
@@ -798,3 +792,3 @@ const ret = typeof(getObject(arg0)) === 'function'; | ||
module.exports.__wbg_instanceof_Global_68951a6a6244ac6e = function(arg0) { | ||
module.exports.__wbg_instanceof_Global_f190e0e5a44a62df = function(arg0) { | ||
let result; | ||
@@ -810,2 +804,8 @@ try { | ||
module.exports.__wbindgen_is_object = function(arg0) { | ||
const val = getObject(arg0); | ||
const ret = typeof(val) === 'object' && val !== null; | ||
return ret; | ||
}; | ||
module.exports.__wbg_static_accessor_SYMBOL_45d4d15e3c4aeb33 = function() { | ||
@@ -821,10 +821,2 @@ const ret = Symbol; | ||
module.exports.__wbg_getRandomValues_37fa2ca9e4e07fab = function() { return handleError(function (arg0, arg1) { | ||
getObject(arg0).getRandomValues(getObject(arg1)); | ||
}, arguments) }; | ||
module.exports.__wbg_randomFillSync_dc1e9a60c158336d = function() { return handleError(function (arg0, arg1) { | ||
getObject(arg0).randomFillSync(takeObject(arg1)); | ||
}, arguments) }; | ||
module.exports.__wbg_crypto_c48a774b022d20ac = function(arg0) { | ||
@@ -860,2 +852,10 @@ const ret = getObject(arg0).crypto; | ||
module.exports.__wbg_getRandomValues_37fa2ca9e4e07fab = function() { return handleError(function (arg0, arg1) { | ||
getObject(arg0).getRandomValues(getObject(arg1)); | ||
}, arguments) }; | ||
module.exports.__wbg_randomFillSync_dc1e9a60c158336d = function() { return handleError(function (arg0, arg1) { | ||
getObject(arg0).randomFillSync(takeObject(arg1)); | ||
}, arguments) }; | ||
module.exports.__wbg_debug_efabe4eb183aa5d4 = function(arg0, arg1, arg2, arg3) { | ||
@@ -1214,4 +1214,4 @@ console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3)); | ||
module.exports.__wbindgen_closure_wrapper631 = function(arg0, arg1, arg2) { | ||
const ret = makeMutClosure(arg0, arg1, 201, __wbg_adapter_54); | ||
module.exports.__wbindgen_closure_wrapper503 = function(arg0, arg1, arg2) { | ||
const ret = makeMutClosure(arg0, arg1, 160, __wbg_adapter_54); | ||
return addHeapObject(ret); | ||
@@ -1218,0 +1218,0 @@ }; |
{ | ||
"name": "@noir-lang/acvm_js", | ||
"version": "0.30.0", | ||
"version": "0.31.0-3107159.nightly", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "type": "git", |
/* tslint:disable */ | ||
/* eslint-disable */ | ||
export const memory: WebAssembly.Memory; | ||
export function decompressWitness(a: number, b: number, c: number): void; | ||
export function compressWitness(a: number, b: number): void; | ||
export function getPublicWitness(a: number, b: number, c: number, d: number): void; | ||
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void; | ||
export function getReturnWitness(a: number, b: number, c: number, d: number): void; | ||
export function executeCircuitWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number; | ||
export function executeCircuit(a: number, b: number, c: number, d: number): number; | ||
export function createBlackBoxSolver(): number; | ||
export function __wbg_wasmblackboxfunctionsolver_free(a: number): void; | ||
export function initLogLevel(a: number): void; | ||
export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number; | ||
@@ -13,11 +19,5 @@ export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number; | ||
export function and(a: number, b: number): number; | ||
export function decompressWitness(a: number, b: number, c: number): void; | ||
export function compressWitness(a: number, b: number): void; | ||
export function buildInfo(): number; | ||
export function executeCircuitWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number; | ||
export function executeCircuit(a: number, b: number, c: number, d: number): number; | ||
export function createBlackBoxSolver(): number; | ||
export function __wbg_wasmblackboxfunctionsolver_free(a: number): void; | ||
export function initLogLevel(a: number): void; | ||
export function getPublicWitness(a: number, b: number, c: number, d: number): void; | ||
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void; | ||
export function getReturnWitness(a: number, b: number, c: number, d: number): void; | ||
export function __wbg_trap_free(a: number): void; | ||
@@ -28,6 +28,6 @@ export function trap___wbgd_downcast_token(): number; | ||
export const __wbindgen_export_2: WebAssembly.Table; | ||
export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__heb1f60a5b015b6c5(a: number, b: number, c: number): void; | ||
export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h3d2354449e918783(a: number, b: number, c: number): void; | ||
export function __wbindgen_add_to_stack_pointer(a: number): number; | ||
export function __wbindgen_free(a: number, b: number): void; | ||
export function __wbindgen_exn_store(a: number): void; | ||
export function wasm_bindgen__convert__closures__invoke2_mut__h72933b4dbc34aade(a: number, b: number, c: number, d: number): void; | ||
export function wasm_bindgen__convert__closures__invoke2_mut__ha676a05262f43687(a: number, b: number, c: number, d: number): void; |
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`. | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs. | ||
* | ||
* @param {Uint8Array} compressed_witness - A compressed witness. | ||
* @returns {WitnessMap} The decompressed witness map. | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's public inputs. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} solved_witness | ||
* @returns {WitnessMap} | ||
*/ | ||
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap; | ||
export function getPublicWitness(circuit: Uint8Array, solved_witness: WitnessMap): WitnessMap; | ||
/** | ||
* Compresses a `WitnessMap` into the binary format outputted by Nargo. | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters. | ||
* | ||
* @param {Uint8Array} compressed_witness - A witness map. | ||
* @returns {WitnessMap} A compressed witness map | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's public parameters. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} solved_witness | ||
* @returns {WitnessMap} | ||
*/ | ||
export function compressWitness(witness_map: WitnessMap): Uint8Array; | ||
export function getPublicParametersWitness(circuit: Uint8Array, solved_witness: WitnessMap): WitnessMap; | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's return values. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} witness_map | ||
* @returns {WitnessMap} | ||
*/ | ||
export function getReturnWitness(circuit: Uint8Array, witness_map: WitnessMap): WitnessMap; | ||
/** | ||
* Executes an ACIR circuit to generate the solved witness from the initial witness. | ||
* | ||
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver. | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit. | ||
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs. | ||
*/ | ||
export function executeCircuitWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, circuit: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>; | ||
/** | ||
* Executes an ACIR circuit to generate the solved witness from the initial witness. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit. | ||
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs. | ||
*/ | ||
export function executeCircuit(circuit: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>; | ||
/** | ||
* @returns {Promise<WasmBlackBoxFunctionSolver>} | ||
*/ | ||
export function createBlackBoxSolver(): Promise<WasmBlackBoxFunctionSolver>; | ||
/** | ||
* Sets the package's logging level. | ||
* | ||
* @param {LogLevel} level - The maximum level of logging to be emitted. | ||
*/ | ||
export function initLogLevel(level: LogLevel): void; | ||
/** | ||
* Verifies a ECDSA signature over the secp256r1 curve. | ||
@@ -69,68 +117,20 @@ * @param {Uint8Array} hashed_msg | ||
/** | ||
* Returns the `BuildInfo` object containing information about how the installed package was built. | ||
* @returns {BuildInfo} - Information on how the installed package was built. | ||
*/ | ||
export function buildInfo(): BuildInfo; | ||
/** | ||
* Executes an ACIR circuit to generate the solved witness from the initial witness. | ||
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`. | ||
* | ||
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver. | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit. | ||
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs. | ||
* @param {Uint8Array} compressed_witness - A compressed witness. | ||
* @returns {WitnessMap} The decompressed witness map. | ||
*/ | ||
export function executeCircuitWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, circuit: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>; | ||
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap; | ||
/** | ||
* Executes an ACIR circuit to generate the solved witness from the initial witness. | ||
* Compresses a `WitnessMap` into the binary format outputted by Nargo. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit. | ||
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs. | ||
* @param {Uint8Array} compressed_witness - A witness map. | ||
* @returns {WitnessMap} A compressed witness map | ||
*/ | ||
export function executeCircuit(circuit: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>; | ||
export function compressWitness(witness_map: WitnessMap): Uint8Array; | ||
/** | ||
* @returns {Promise<WasmBlackBoxFunctionSolver>} | ||
* Returns the `BuildInfo` object containing information about how the installed package was built. | ||
* @returns {BuildInfo} - Information on how the installed package was built. | ||
*/ | ||
export function createBlackBoxSolver(): Promise<WasmBlackBoxFunctionSolver>; | ||
/** | ||
* Sets the package's logging level. | ||
* | ||
* @param {LogLevel} level - The maximum level of logging to be emitted. | ||
*/ | ||
export function initLogLevel(level: LogLevel): void; | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's public inputs. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} solved_witness | ||
* @returns {WitnessMap} | ||
*/ | ||
export function getPublicWitness(circuit: Uint8Array, solved_witness: WitnessMap): WitnessMap; | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's public parameters. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} solved_witness | ||
* @returns {WitnessMap} | ||
*/ | ||
export function getPublicParametersWitness(circuit: Uint8Array, solved_witness: WitnessMap): WitnessMap; | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's return values. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} witness_map | ||
* @returns {WitnessMap} | ||
*/ | ||
export function getReturnWitness(circuit: Uint8Array, witness_map: WitnessMap): WitnessMap; | ||
export function buildInfo(): BuildInfo; | ||
@@ -151,17 +151,8 @@ export type ForeignCallInput = string[] | ||
/** | ||
* @typedef {Object} BuildInfo - Information about how the installed package was built | ||
* @property {string} gitHash - The hash of the git commit from which the package was built. | ||
* @property {string} version - The version of the package at the built git commit. | ||
* @property {boolean} dirty - Whether the package contained uncommitted changes when built. | ||
*/ | ||
export type BuildInfo = { | ||
gitHash: string; | ||
version: string; | ||
dirty: string; | ||
} | ||
export type LogLevel = "OFF" | "ERROR" | "WARN" | "INFO" | "DEBUG" | "TRACE"; | ||
export type LogLevel = "OFF" | "ERROR" | "WARN" | "INFO" | "DEBUG" | "TRACE"; | ||
// Map from witness index to hex string value of witness. | ||
export type WitnessMap = Map<number, string>; | ||
@@ -176,4 +167,13 @@ | ||
// Map from witness index to hex string value of witness. | ||
export type WitnessMap = Map<number, string>; | ||
/** | ||
* @typedef {Object} BuildInfo - Information about how the installed package was built | ||
* @property {string} gitHash - The hash of the git commit from which the package was built. | ||
* @property {string} version - The version of the package at the built git commit. | ||
* @property {boolean} dirty - Whether the package contained uncommitted changes when built. | ||
*/ | ||
export type BuildInfo = { | ||
gitHash: string; | ||
version: string; | ||
dirty: string; | ||
} | ||
@@ -201,4 +201,10 @@ | ||
readonly memory: WebAssembly.Memory; | ||
readonly decompressWitness: (a: number, b: number, c: number) => void; | ||
readonly compressWitness: (a: number, b: number) => void; | ||
readonly getPublicWitness: (a: number, b: number, c: number, d: number) => void; | ||
readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void; | ||
readonly getReturnWitness: (a: number, b: number, c: number, d: number) => void; | ||
readonly executeCircuitWithBlackBoxSolver: (a: number, b: number, c: number, d: number, e: number) => number; | ||
readonly executeCircuit: (a: number, b: number, c: number, d: number) => number; | ||
readonly createBlackBoxSolver: () => number; | ||
readonly __wbg_wasmblackboxfunctionsolver_free: (a: number) => void; | ||
readonly initLogLevel: (a: number) => void; | ||
readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number; | ||
@@ -211,11 +217,5 @@ readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number; | ||
readonly and: (a: number, b: number) => number; | ||
readonly decompressWitness: (a: number, b: number, c: number) => void; | ||
readonly compressWitness: (a: number, b: number) => void; | ||
readonly buildInfo: () => number; | ||
readonly executeCircuitWithBlackBoxSolver: (a: number, b: number, c: number, d: number, e: number) => number; | ||
readonly executeCircuit: (a: number, b: number, c: number, d: number) => number; | ||
readonly createBlackBoxSolver: () => number; | ||
readonly __wbg_wasmblackboxfunctionsolver_free: (a: number) => void; | ||
readonly initLogLevel: (a: number) => void; | ||
readonly getPublicWitness: (a: number, b: number, c: number, d: number) => void; | ||
readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void; | ||
readonly getReturnWitness: (a: number, b: number, c: number, d: number) => void; | ||
readonly __wbg_trap_free: (a: number) => void; | ||
@@ -226,7 +226,7 @@ readonly trap___wbgd_downcast_token: () => number; | ||
readonly __wbindgen_export_2: WebAssembly.Table; | ||
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__heb1f60a5b015b6c5: (a: number, b: number, c: number) => void; | ||
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h3d2354449e918783: (a: number, b: number, c: number) => void; | ||
readonly __wbindgen_add_to_stack_pointer: (a: number) => number; | ||
readonly __wbindgen_free: (a: number, b: number) => void; | ||
readonly __wbindgen_exn_store: (a: number) => void; | ||
readonly wasm_bindgen__convert__closures__invoke2_mut__h72933b4dbc34aade: (a: number, b: number, c: number, d: number) => void; | ||
readonly wasm_bindgen__convert__closures__invoke2_mut__ha676a05262f43687: (a: number, b: number, c: number, d: number) => void; | ||
} | ||
@@ -233,0 +233,0 @@ |
@@ -23,6 +23,4 @@ let wasm; | ||
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); | ||
let WASM_VECTOR_LEN = 0; | ||
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; | ||
let cachedUint8Memory0 = null; | ||
@@ -37,40 +35,2 @@ | ||
function getStringFromWasm0(ptr, len) { | ||
ptr = ptr >>> 0; | ||
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); | ||
} | ||
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; | ||
} | ||
function isLikeNone(x) { | ||
return x === undefined || x === null; | ||
} | ||
let cachedFloat64Memory0 = null; | ||
function getFloat64Memory0() { | ||
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) { | ||
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer); | ||
} | ||
return cachedFloat64Memory0; | ||
} | ||
let cachedInt32Memory0 = null; | ||
function getInt32Memory0() { | ||
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) { | ||
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); | ||
} | ||
return cachedInt32Memory0; | ||
} | ||
let WASM_VECTOR_LEN = 0; | ||
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } ); | ||
@@ -129,2 +89,42 @@ | ||
function isLikeNone(x) { | ||
return x === undefined || x === null; | ||
} | ||
let cachedInt32Memory0 = null; | ||
function getInt32Memory0() { | ||
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) { | ||
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); | ||
} | ||
return cachedInt32Memory0; | ||
} | ||
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 cachedFloat64Memory0 = null; | ||
function getFloat64Memory0() { | ||
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) { | ||
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer); | ||
} | ||
return cachedFloat64Memory0; | ||
} | ||
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); | ||
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; | ||
function getStringFromWasm0(ptr, len) { | ||
ptr = ptr >>> 0; | ||
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); | ||
} | ||
let cachedBigInt64Memory0 = null; | ||
@@ -229,3 +229,3 @@ | ||
function __wbg_adapter_54(arg0, arg1, arg2) { | ||
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__heb1f60a5b015b6c5(arg0, arg1, addHeapObject(arg2)); | ||
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h3d2354449e918783(arg0, arg1, addHeapObject(arg2)); | ||
} | ||
@@ -240,13 +240,17 @@ | ||
/** | ||
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`. | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs. | ||
* | ||
* @param {Uint8Array} compressed_witness - A compressed witness. | ||
* @returns {WitnessMap} The decompressed witness map. | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's public inputs. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} solved_witness | ||
* @returns {WitnessMap} | ||
*/ | ||
export function decompressWitness(compressed_witness) { | ||
export function getPublicWitness(circuit, solved_witness) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc); | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.decompressWitness(retptr, ptr0, len0); | ||
wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
@@ -264,26 +268,53 @@ var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
function getArrayU8FromWasm0(ptr, len) { | ||
ptr = ptr >>> 0; | ||
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len); | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's public parameters. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} solved_witness | ||
* @returns {WitnessMap} | ||
*/ | ||
export function getPublicParametersWitness(circuit, solved_witness) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
return takeObject(r0); | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
} | ||
} | ||
/** | ||
* Compresses a `WitnessMap` into the binary format outputted by Nargo. | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values. | ||
* | ||
* @param {Uint8Array} compressed_witness - A witness map. | ||
* @returns {WitnessMap} A compressed witness map | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's return values. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} witness_map | ||
* @returns {WitnessMap} | ||
*/ | ||
export function compressWitness(witness_map) { | ||
export function getReturnWitness(circuit, witness_map) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.compressWitness(retptr, addHeapObject(witness_map)); | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map)); | ||
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); | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
var v1 = getArrayU8FromWasm0(r0, r1).slice(); | ||
wasm.__wbindgen_free(r0, r1 * 1); | ||
return v1; | ||
return takeObject(r0); | ||
} finally { | ||
@@ -294,3 +325,58 @@ wasm.__wbindgen_add_to_stack_pointer(16); | ||
function _assertClass(instance, klass) { | ||
if (!(instance instanceof klass)) { | ||
throw new Error(`expected instance of ${klass.name}`); | ||
} | ||
return instance.ptr; | ||
} | ||
/** | ||
* Executes an ACIR circuit to generate the solved witness from the initial witness. | ||
* | ||
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver. | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit. | ||
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs. | ||
*/ | ||
export function executeCircuitWithBlackBoxSolver(solver, circuit, initial_witness, foreign_call_handler) { | ||
_assertClass(solver, WasmBlackBoxFunctionSolver); | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ret = wasm.executeCircuitWithBlackBoxSolver(solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler)); | ||
return takeObject(ret); | ||
} | ||
/** | ||
* Executes an ACIR circuit to generate the solved witness from the initial witness. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit. | ||
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs. | ||
*/ | ||
export function executeCircuit(circuit, initial_witness, foreign_call_handler) { | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler)); | ||
return takeObject(ret); | ||
} | ||
/** | ||
* @returns {Promise<WasmBlackBoxFunctionSolver>} | ||
*/ | ||
export function createBlackBoxSolver() { | ||
const ret = wasm.createBlackBoxSolver(); | ||
return takeObject(ret); | ||
} | ||
/** | ||
* Sets the package's logging level. | ||
* | ||
* @param {LogLevel} level - The maximum level of logging to be emitted. | ||
*/ | ||
export function initLogLevel(level) { | ||
wasm.initLogLevel(addHeapObject(level)); | ||
} | ||
/** | ||
* Verifies a ECDSA signature over the secp256r1 curve. | ||
@@ -338,2 +424,6 @@ * @param {Uint8Array} hashed_msg | ||
function getArrayU8FromWasm0(ptr, len) { | ||
ptr = ptr >>> 0; | ||
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len); | ||
} | ||
/** | ||
@@ -425,81 +515,13 @@ * Calculates the Keccak256 hash of the input bytes | ||
/** | ||
* Returns the `BuildInfo` object containing information about how the installed package was built. | ||
* @returns {BuildInfo} - Information on how the installed package was built. | ||
*/ | ||
export function buildInfo() { | ||
const ret = wasm.buildInfo(); | ||
return takeObject(ret); | ||
} | ||
function _assertClass(instance, klass) { | ||
if (!(instance instanceof klass)) { | ||
throw new Error(`expected instance of ${klass.name}`); | ||
} | ||
return instance.ptr; | ||
} | ||
/** | ||
* Executes an ACIR circuit to generate the solved witness from the initial witness. | ||
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`. | ||
* | ||
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver. | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit. | ||
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs. | ||
* @param {Uint8Array} compressed_witness - A compressed witness. | ||
* @returns {WitnessMap} The decompressed witness map. | ||
*/ | ||
export function executeCircuitWithBlackBoxSolver(solver, circuit, initial_witness, foreign_call_handler) { | ||
_assertClass(solver, WasmBlackBoxFunctionSolver); | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ret = wasm.executeCircuitWithBlackBoxSolver(solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler)); | ||
return takeObject(ret); | ||
} | ||
/** | ||
* Executes an ACIR circuit to generate the solved witness from the initial witness. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit. | ||
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs. | ||
*/ | ||
export function executeCircuit(circuit, initial_witness, foreign_call_handler) { | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler)); | ||
return takeObject(ret); | ||
} | ||
/** | ||
* @returns {Promise<WasmBlackBoxFunctionSolver>} | ||
*/ | ||
export function createBlackBoxSolver() { | ||
const ret = wasm.createBlackBoxSolver(); | ||
return takeObject(ret); | ||
} | ||
/** | ||
* Sets the package's logging level. | ||
* | ||
* @param {LogLevel} level - The maximum level of logging to be emitted. | ||
*/ | ||
export function initLogLevel(level) { | ||
wasm.initLogLevel(addHeapObject(level)); | ||
} | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's public inputs. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} solved_witness | ||
* @returns {WitnessMap} | ||
*/ | ||
export function getPublicWitness(circuit, solved_witness) { | ||
export function decompressWitness(compressed_witness) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness)); | ||
wasm.decompressWitness(retptr, ptr0, len0); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
@@ -518,24 +540,21 @@ var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters. | ||
* Compresses a `WitnessMap` into the binary format outputted by Nargo. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's public parameters. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} solved_witness | ||
* @returns {WitnessMap} | ||
* @param {Uint8Array} compressed_witness - A witness map. | ||
* @returns {WitnessMap} A compressed witness map | ||
*/ | ||
export function getPublicParametersWitness(circuit, solved_witness) { | ||
export function compressWitness(witness_map) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness)); | ||
wasm.compressWitness(retptr, addHeapObject(witness_map)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
var r3 = getInt32Memory0()[retptr / 4 + 3]; | ||
if (r3) { | ||
throw takeObject(r2); | ||
} | ||
return takeObject(r0); | ||
var v1 = getArrayU8FromWasm0(r0, r1).slice(); | ||
wasm.__wbindgen_free(r0, r1 * 1); | ||
return v1; | ||
} finally { | ||
@@ -547,27 +566,8 @@ wasm.__wbindgen_add_to_stack_pointer(16); | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's return values. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} witness_map | ||
* @returns {WitnessMap} | ||
* Returns the `BuildInfo` object containing information about how the installed package was built. | ||
* @returns {BuildInfo} - Information on how the installed package was built. | ||
*/ | ||
export function getReturnWitness(circuit, witness_map) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
return takeObject(r0); | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
} | ||
export function buildInfo() { | ||
const ret = wasm.buildInfo(); | ||
return takeObject(ret); | ||
} | ||
@@ -583,3 +583,3 @@ | ||
function __wbg_adapter_155(arg0, arg1, arg2, arg3) { | ||
wasm.wasm_bindgen__convert__closures__invoke2_mut__h72933b4dbc34aade(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3)); | ||
wasm.wasm_bindgen__convert__closures__invoke2_mut__ha676a05262f43687(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3)); | ||
} | ||
@@ -673,10 +673,18 @@ | ||
}; | ||
imports.wbg.__wbindgen_error_new = function(arg0, arg1) { | ||
const ret = new Error(getStringFromWasm0(arg0, arg1)); | ||
imports.wbg.__wbg_wasmblackboxfunctionsolver_new = function(arg0) { | ||
const ret = WasmBlackBoxFunctionSolver.__wrap(arg0); | ||
return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbindgen_object_clone_ref = function(arg0) { | ||
const ret = getObject(arg0); | ||
return addHeapObject(ret); | ||
imports.wbg.__wbindgen_is_array = function(arg0) { | ||
const ret = Array.isArray(getObject(arg0)); | ||
return ret; | ||
}; | ||
imports.wbg.__wbindgen_string_get = function(arg0, arg1) { | ||
const obj = getObject(arg1); | ||
const ret = typeof(obj) === 'string' ? obj : undefined; | ||
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
var len1 = WASM_VECTOR_LEN; | ||
getInt32Memory0()[arg0 / 4 + 1] = len1; | ||
getInt32Memory0()[arg0 / 4 + 0] = ptr1; | ||
}; | ||
imports.wbg.__wbindgen_is_string = function(arg0) { | ||
@@ -686,12 +694,8 @@ const ret = typeof(getObject(arg0)) === 'string'; | ||
}; | ||
imports.wbg.__wbindgen_is_array = function(arg0) { | ||
const ret = Array.isArray(getObject(arg0)); | ||
return ret; | ||
}; | ||
imports.wbg.__wbindgen_string_new = function(arg0, arg1) { | ||
const ret = getStringFromWasm0(arg0, arg1); | ||
imports.wbg.__wbg_new_3a350aed96e43abb = function() { | ||
const ret = new Map(); | ||
return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbg_wasmblackboxfunctionsolver_new = function(arg0) { | ||
const ret = WasmBlackBoxFunctionSolver.__wrap(arg0); | ||
imports.wbg.__wbindgen_number_new = function(arg0) { | ||
const ret = arg0; | ||
return addHeapObject(ret); | ||
@@ -705,14 +709,18 @@ }; | ||
}; | ||
imports.wbg.__wbindgen_is_undefined = function(arg0) { | ||
const ret = getObject(arg0) === undefined; | ||
return ret; | ||
imports.wbg.__wbindgen_error_new = function(arg0, arg1) { | ||
const ret = new Error(getStringFromWasm0(arg0, arg1)); | ||
return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbindgen_string_get = function(arg0, arg1) { | ||
const obj = getObject(arg1); | ||
const ret = typeof(obj) === 'string' ? obj : undefined; | ||
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
var len1 = WASM_VECTOR_LEN; | ||
getInt32Memory0()[arg0 / 4 + 1] = len1; | ||
getInt32Memory0()[arg0 / 4 + 0] = ptr1; | ||
imports.wbg.__wbindgen_object_clone_ref = function(arg0) { | ||
const ret = getObject(arg0); | ||
return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbg_constructor_e2f72a91b4e3ce37 = function(arg0) { | ||
const ret = new Error(takeObject(arg0)); | ||
return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbindgen_string_new = function(arg0, arg1) { | ||
const ret = getStringFromWasm0(arg0, arg1); | ||
return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbindgen_cb_drop = function(arg0) { | ||
@@ -727,14 +735,6 @@ const obj = takeObject(arg0).original; | ||
}; | ||
imports.wbg.__wbg_new_e290c3c041336f87 = function() { | ||
const ret = new Map(); | ||
return addHeapObject(ret); | ||
imports.wbg.__wbindgen_is_undefined = function(arg0) { | ||
const ret = getObject(arg0) === undefined; | ||
return ret; | ||
}; | ||
imports.wbg.__wbindgen_number_new = function(arg0) { | ||
const ret = arg0; | ||
return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbg_constructor_6e18ba778d67e20b = function(arg0) { | ||
const ret = new Error(takeObject(arg0)); | ||
return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbg_new_abda76e883ba8a5f = function() { | ||
@@ -774,10 +774,2 @@ const ret = new Error(); | ||
}; | ||
imports.wbg.__wbindgen_is_bigint = function(arg0) { | ||
const ret = typeof(getObject(arg0)) === 'bigint'; | ||
return ret; | ||
}; | ||
imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) { | ||
const ret = getObject(arg0) === getObject(arg1); | ||
return ret; | ||
}; | ||
imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) { | ||
@@ -791,7 +783,10 @@ const ret = BigInt.asUintN(64, arg0); | ||
}; | ||
imports.wbg.__wbindgen_is_object = function(arg0) { | ||
const val = getObject(arg0); | ||
const ret = typeof(val) === 'object' && val !== null; | ||
imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) { | ||
const ret = getObject(arg0) === getObject(arg1); | ||
return ret; | ||
}; | ||
imports.wbg.__wbindgen_is_bigint = function(arg0) { | ||
const ret = typeof(getObject(arg0)) === 'bigint'; | ||
return ret; | ||
}; | ||
imports.wbg.__wbindgen_is_function = function(arg0) { | ||
@@ -801,3 +796,3 @@ const ret = typeof(getObject(arg0)) === 'function'; | ||
}; | ||
imports.wbg.__wbg_instanceof_Global_68951a6a6244ac6e = function(arg0) { | ||
imports.wbg.__wbg_instanceof_Global_f190e0e5a44a62df = function(arg0) { | ||
let result; | ||
@@ -812,2 +807,7 @@ try { | ||
}; | ||
imports.wbg.__wbindgen_is_object = function(arg0) { | ||
const val = getObject(arg0); | ||
const ret = typeof(val) === 'object' && val !== null; | ||
return ret; | ||
}; | ||
imports.wbg.__wbg_static_accessor_SYMBOL_45d4d15e3c4aeb33 = function() { | ||
@@ -821,8 +821,2 @@ const ret = Symbol; | ||
}; | ||
imports.wbg.__wbg_getRandomValues_37fa2ca9e4e07fab = function() { return handleError(function (arg0, arg1) { | ||
getObject(arg0).getRandomValues(getObject(arg1)); | ||
}, arguments) }; | ||
imports.wbg.__wbg_randomFillSync_dc1e9a60c158336d = function() { return handleError(function (arg0, arg1) { | ||
getObject(arg0).randomFillSync(takeObject(arg1)); | ||
}, arguments) }; | ||
imports.wbg.__wbg_crypto_c48a774b022d20ac = function(arg0) { | ||
@@ -852,2 +846,8 @@ const ret = getObject(arg0).crypto; | ||
}, arguments) }; | ||
imports.wbg.__wbg_getRandomValues_37fa2ca9e4e07fab = function() { return handleError(function (arg0, arg1) { | ||
getObject(arg0).getRandomValues(getObject(arg1)); | ||
}, arguments) }; | ||
imports.wbg.__wbg_randomFillSync_dc1e9a60c158336d = function() { return handleError(function (arg0, arg1) { | ||
getObject(arg0).randomFillSync(takeObject(arg1)); | ||
}, arguments) }; | ||
imports.wbg.__wbg_debug_efabe4eb183aa5d4 = function(arg0, arg1, arg2, arg3) { | ||
@@ -1144,4 +1144,4 @@ console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3)); | ||
}; | ||
imports.wbg.__wbindgen_closure_wrapper631 = function(arg0, arg1, arg2) { | ||
const ret = makeMutClosure(arg0, arg1, 201, __wbg_adapter_54); | ||
imports.wbg.__wbindgen_closure_wrapper503 = function(arg0, arg1, arg2) { | ||
const ret = makeMutClosure(arg0, arg1, 160, __wbg_adapter_54); | ||
return addHeapObject(ret); | ||
@@ -1148,0 +1148,0 @@ }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3393059