fix template dir

This commit is contained in:
Jordi Baylina 2020-07-13 08:47:02 +02:00
parent 0eac6e98f2
commit 7df37c1592
No known key found for this signature in database
GPG Key ID: 7480C80C1BE43112
5 changed files with 13 additions and 14 deletions

View File

@ -11,7 +11,6 @@ var readline = _interopDefault(require('readline'));
var crypto = _interopDefault(require('crypto')); var crypto = _interopDefault(require('crypto'));
var circomRuntime = _interopDefault(require('circom_runtime')); var circomRuntime = _interopDefault(require('circom_runtime'));
var path = _interopDefault(require('path')); var path = _interopDefault(require('path'));
var appRoot = _interopDefault(require('app-root-path'));
var Logger = _interopDefault(require('logplease')); var Logger = _interopDefault(require('logplease'));
async function open(fileName, openFlags, cacheSize) { async function open(fileName, openFlags, cacheSize) {
@ -740,7 +739,7 @@ async function r1csExportJson(r1csFileName, logger) {
var name = "snarkjs"; var name = "snarkjs";
var type = "module"; var type = "module";
var version = "0.3.1"; var version = "0.3.2";
var description = "zkSNARKs implementation in JavaScript"; var description = "zkSNARKs implementation in JavaScript";
var main = "./build/main.cjs"; var main = "./build/main.cjs";
var module$1 = "./main.js"; var module$1 = "./main.js";
@ -777,7 +776,6 @@ var repository = {
url: "https://github.com/iden3/snarkjs.git" url: "https://github.com/iden3/snarkjs.git"
}; };
var dependencies = { var dependencies = {
"app-root-path": "^3.0.0",
"blake2b-wasm": "https://github.com/jbaylina/blake2b-wasm.git", "blake2b-wasm": "https://github.com/jbaylina/blake2b-wasm.git",
circom_runtime: "0.0.9", circom_runtime: "0.0.9",
fastfile: "0.0.6", fastfile: "0.0.6",
@ -6109,7 +6107,12 @@ async function zkeyExportSolidityVerifier(params, options) {
if (options.verbose) Logger.setLogLevel("DEBUG"); if (options.verbose) Logger.setLogLevel("DEBUG");
const templateName = path.join( appRoot.path, "templates", "verifier_groth16.sol"); let templateName;
if (path.existsSync(path.join( __dirname, "templates", "verifier_groth16.sol"))) {
templateName = path.join( __dirname, "templates", "verifier_groth16.sol");
} else {
templateName = path.join( __dirname, "..", "templates", "verifier_groth16.sol");
}
const verifierCode = await exportSolidityVerifier(zkeyName, templateName); const verifierCode = await exportSolidityVerifier(zkeyName, templateName);

8
cli.js
View File

@ -38,7 +38,6 @@ import * as groth16 from "./src/groth16.js";
import * as wtns from "./src/wtns.js"; import * as wtns from "./src/wtns.js";
import * as curves from "./src/curves.js"; import * as curves from "./src/curves.js";
import path from "path"; import path from "path";
import appRoot from "app-root-path";
import Logger from "logplease"; import Logger from "logplease";
const logger = Logger.create("snarkJS", {showTimestamp:false}); const logger = Logger.create("snarkJS", {showTimestamp:false});
@ -520,7 +519,12 @@ async function zkeyExportSolidityVerifier(params, options) {
if (options.verbose) Logger.setLogLevel("DEBUG"); if (options.verbose) Logger.setLogLevel("DEBUG");
const templateName = path.join( appRoot.path, "templates", "verifier_groth16.sol"); let templateName;
if (path.existsSync(path.join( __dirname, "templates", "verifier_groth16.sol"))) {
templateName = path.join( __dirname, "templates", "verifier_groth16.sol");
} else {
templateName = path.join( __dirname, "..", "templates", "verifier_groth16.sol");
}
const verifierCode = await zkey.exportSolidityVerifier(zkeyName, templateName, logger); const verifierCode = await zkey.exportSolidityVerifier(zkeyName, templateName, logger);

View File

@ -25,8 +25,6 @@ export default {
"keccak", "keccak",
"yargs", "yargs",
"logplease", "logplease",
"app-root-path"
], ],
plugins: [ plugins: [
resolve({ resolve({

5
package-lock.json generated
View File

@ -128,11 +128,6 @@
"picomatch": "^2.0.4" "picomatch": "^2.0.4"
} }
}, },
"app-root-path": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/app-root-path/-/app-root-path-3.0.0.tgz",
"integrity": "sha512-qMcx+Gy2UZynHjOHOIXPNvpf+9cjvk3cWrBBK7zg4gH9+clobJRb9NGzcT7mQTcV/6Gm/1WelUtqxVXnNlrwcw=="
},
"argparse": { "argparse": {
"version": "1.0.10", "version": "1.0.10",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",

View File

@ -38,7 +38,6 @@
"url": "https://github.com/iden3/snarkjs.git" "url": "https://github.com/iden3/snarkjs.git"
}, },
"dependencies": { "dependencies": {
"app-root-path": "^3.0.0",
"blake2b-wasm": "https://github.com/jbaylina/blake2b-wasm.git", "blake2b-wasm": "https://github.com/jbaylina/blake2b-wasm.git",
"circom_runtime": "0.0.9", "circom_runtime": "0.0.9",
"fastfile": "0.0.6", "fastfile": "0.0.6",