@noir-lang/noir_js 0.22.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,6 +4,13 @@ exports.generateWitness = void 0;
|
|
|
4
4
|
const noirc_abi_1 = require("@noir-lang/noirc_abi");
|
|
5
5
|
const base64_decode_js_1 = require("./base64_decode.cjs");
|
|
6
6
|
const acvm_js_1 = require("@noir-lang/acvm_js");
|
|
7
|
+
let solver;
|
|
8
|
+
const getSolver = () => {
|
|
9
|
+
if (!solver) {
|
|
10
|
+
solver = (0, acvm_js_1.createBlackBoxSolver)();
|
|
11
|
+
}
|
|
12
|
+
return solver;
|
|
13
|
+
};
|
|
7
14
|
const defaultForeignCallHandler = async (name, args) => {
|
|
8
15
|
if (name == 'print') {
|
|
9
16
|
// By default we do not print anything for `print` foreign calls due to a need for formatting,
|
|
@@ -21,7 +28,7 @@ async function generateWitness(compiledProgram, inputs, foreignCallHandler = def
|
|
|
21
28
|
// Execute the circuit to generate the rest of the witnesses and serialize
|
|
22
29
|
// them into a Uint8Array.
|
|
23
30
|
try {
|
|
24
|
-
const solvedWitness = await (0, acvm_js_1.
|
|
31
|
+
const solvedWitness = await (0, acvm_js_1.executeCircuitWithBlackBoxSolver)(await getSolver(), (0, base64_decode_js_1.base64Decode)(compiledProgram.bytecode), witnessMap, foreignCallHandler);
|
|
25
32
|
return solvedWitness;
|
|
26
33
|
}
|
|
27
34
|
catch (err) {
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { abiEncode } from '@noir-lang/noirc_abi';
|
|
2
2
|
import { base64Decode } from "./base64_decode.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { createBlackBoxSolver, executeCircuitWithBlackBoxSolver, } from '@noir-lang/acvm_js';
|
|
4
|
+
let solver;
|
|
5
|
+
const getSolver = () => {
|
|
6
|
+
if (!solver) {
|
|
7
|
+
solver = createBlackBoxSolver();
|
|
8
|
+
}
|
|
9
|
+
return solver;
|
|
10
|
+
};
|
|
4
11
|
const defaultForeignCallHandler = async (name, args) => {
|
|
5
12
|
if (name == 'print') {
|
|
6
13
|
// By default we do not print anything for `print` foreign calls due to a need for formatting,
|
|
@@ -18,7 +25,7 @@ export async function generateWitness(compiledProgram, inputs, foreignCallHandle
|
|
|
18
25
|
// Execute the circuit to generate the rest of the witnesses and serialize
|
|
19
26
|
// them into a Uint8Array.
|
|
20
27
|
try {
|
|
21
|
-
const solvedWitness = await
|
|
28
|
+
const solvedWitness = await executeCircuitWithBlackBoxSolver(await getSolver(), base64Decode(compiledProgram.bytecode), witnessMap, foreignCallHandler);
|
|
22
29
|
return solvedWitness;
|
|
23
30
|
}
|
|
24
31
|
catch (err) {
|
package/package.json
CHANGED
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noir-lang/noir_js",
|
|
3
|
-
"
|
|
3
|
+
"contributors": [
|
|
4
4
|
"The Noir Team <team@noir-lang.org>"
|
|
5
5
|
],
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.23.0",
|
|
7
7
|
"packageManager": "yarn@3.5.1",
|
|
8
8
|
"license": "(MIT OR Apache-2.0)",
|
|
9
9
|
"type": "module",
|
|
10
|
+
"homepage": "https://noir-lang.org/",
|
|
11
|
+
"repository": {
|
|
12
|
+
"url": "https://github.com/noir-lang/noir.git",
|
|
13
|
+
"directory": "tooling/noir_js",
|
|
14
|
+
"type": "git"
|
|
15
|
+
},
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/noir-lang/noir/issues"
|
|
18
|
+
},
|
|
10
19
|
"dependencies": {
|
|
11
|
-
"@noir-lang/acvm_js": "0.
|
|
12
|
-
"@noir-lang/noirc_abi": "0.
|
|
13
|
-
"@noir-lang/types": "0.
|
|
20
|
+
"@noir-lang/acvm_js": "0.39.0",
|
|
21
|
+
"@noir-lang/noirc_abi": "0.23.0",
|
|
22
|
+
"@noir-lang/types": "0.23.0"
|
|
14
23
|
},
|
|
15
24
|
"files": [
|
|
16
25
|
"lib",
|