This commit is contained in:
Jordi Baylina 2020-10-09 06:29:55 +02:00
parent 1bbb46a322
commit 0029b2f1a7
No known key found for this signature in database
GPG Key ID: 7480C80C1BE43112
7 changed files with 26 additions and 26 deletions

@ -961,7 +961,7 @@ async function readBigInt(fd, n8, pos) {
return ffjavascript.Scalar.fromRprLE(buff, 0, n8);
}
async function readR1csHeader(fd,sections) {
async function readR1csHeader(fd,sections,singleThread) {
const res = {};
@ -970,7 +970,7 @@ async function readR1csHeader(fd,sections) {
res.n8 = await fd.readULE32();
res.prime = await readBigInt(fd, res.n8);
res.curve = await ffjavascript.getCurveFromR(res.prime, true);
res.curve = await ffjavascript.getCurveFromR(res.prime, singleThread);
res.nVars = await fd.readULE32();
res.nOutputs = await fd.readULE32();
@ -983,10 +983,10 @@ async function readR1csHeader(fd,sections) {
return res;
}
async function readR1cs(fileName, loadConstraints, loadMap, logger, loggerCtx) {
async function readR1cs(fileName, loadConstraints, loadMap, singleThread, logger, loggerCtx) {
const {fd, sections} = await readBinFile(fileName, "r1cs", 1, 1<<22, 1<<25);
const res = await readR1csHeader(fd, sections);
const res = await readR1csHeader(fd, sections, singleThread);
if (loadConstraints) {
@ -1154,7 +1154,7 @@ function stringifyBigInts(Fr, o) {
async function r1csExportJson(r1csFileName, logger) {
const cir = await readR1cs(r1csFileName, true, true, true);
const cir = await readR1cs(r1csFileName, true, true, true, logger);
const Fr=cir.curve.Fr;
delete cir.curve;
@ -3898,7 +3898,7 @@ async function newZKey(r1csName, ptauName, zkeyName, logger) {
const csHasher = Blake2b(64);
const {fd: fdR1cs, sections: sectionsR1cs} = await readBinFile$1(r1csName, "r1cs", 1);
const r1cs = await readR1csHeader(fdR1cs, sectionsR1cs);
const r1cs = await readR1csHeader(fdR1cs, sectionsR1cs, false);
const {fd: fdPTau, sections: sectionsPTau} = await readBinFile$1(ptauName, "ptau", 1);
const {curve, power} = await readPTauHeader(fdPTau, sectionsPTau);
@ -6672,7 +6672,7 @@ async function r1csExportJSON(params, options) {
if (options.verbose) Logger.setLogLevel("DEBUG");
const r1csObj = await r1csExportJson(r1csName);
const r1csObj = await r1csExportJson(r1csName, logger);
const S = JSON.stringify(r1csObj, null, 1);
await fs.promises.writeFile(jsonName, S);

@ -4140,7 +4140,7 @@ async function readBigInt$1(fd, n8, pos) {
return ffjavascript.Scalar.fromRprLE(buff, 0, n8);
}
async function readR1csHeader(fd,sections) {
async function readR1csHeader(fd,sections,singleThread) {
const res = {};
@ -4149,7 +4149,7 @@ async function readR1csHeader(fd,sections) {
res.n8 = await fd.readULE32();
res.prime = await readBigInt$1(fd, res.n8);
res.curve = await ffjavascript.getCurveFromR(res.prime, true);
res.curve = await ffjavascript.getCurveFromR(res.prime, singleThread);
res.nVars = await fd.readULE32();
res.nOutputs = await fd.readULE32();
@ -4162,10 +4162,10 @@ async function readR1csHeader(fd,sections) {
return res;
}
async function readR1cs(fileName, loadConstraints, loadMap, logger, loggerCtx) {
async function readR1cs(fileName, loadConstraints, loadMap, singleThread, logger, loggerCtx) {
const {fd, sections} = await readBinFile$1(fileName, "r1cs", 1, 1<<22, 1<<25);
const res = await readR1csHeader(fd, sections);
const res = await readR1csHeader(fd, sections, singleThread);
if (loadConstraints) {
@ -4271,7 +4271,7 @@ function stringifyBigInts$1(Fr, o) {
async function r1csExportJson(r1csFileName, logger) {
const cir = await readR1cs(r1csFileName, true, true, true);
const cir = await readR1cs(r1csFileName, true, true, true, logger);
const Fr=cir.curve.Fr;
delete cir.curve;
@ -4464,7 +4464,7 @@ async function newZKey(r1csName, ptauName, zkeyName, logger) {
const csHasher = Blake2b(64);
const {fd: fdR1cs, sections: sectionsR1cs} = await readBinFile(r1csName, "r1cs", 1);
const r1cs = await readR1csHeader(fdR1cs, sectionsR1cs);
const r1cs = await readR1csHeader(fdR1cs, sectionsR1cs, false);
const {fd: fdPTau, sections: sectionsPTau} = await readBinFile(ptauName, "ptau", 1);
const {curve, power} = await readPTauHeader(fdPTau, sectionsPTau);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

6
package-lock.json generated

@ -1528,9 +1528,9 @@
"dev": true
},
"r1csfile": {
"version": "0.0.18",
"resolved": "https://registry.npmjs.org/r1csfile/-/r1csfile-0.0.18.tgz",
"integrity": "sha512-RSbyKXzn2sKCCm6i+xeYrkVGKbFKOTeC7sjyzYovJllYhS8r9zfyPRQRpx0u6knPQfHdiDEW0BA9rBTGJG9Wyw==",
"version": "0.0.19",
"resolved": "https://registry.npmjs.org/r1csfile/-/r1csfile-0.0.19.tgz",
"integrity": "sha512-Wes7idDuX05S4B1vxWYuwlFdzIqK8cCkfy4Yn6lCCc25dAWzy5lxQFMYrXfrxDtyLMs4anC71n87fy3KUM2h9w==",
"requires": {
"@iden3/bigarray": "0.0.2",
"@iden3/binfileutils": "0.0.2",

@ -43,7 +43,7 @@
"fastfile": "0.0.18",
"ffjavascript": "0.2.24",
"logplease": "^1.2.15",
"r1csfile": "0.0.18"
"r1csfile": "0.0.19"
},
"devDependencies": {
"chai": "^4.2.0",

@ -22,7 +22,7 @@ export function stringifyBigInts(Fr, o) {
export default async function r1csExportJson(r1csFileName, logger) {
const cir = await readR1cs(r1csFileName, true, true, true);
const cir = await readR1cs(r1csFileName, true, true, true, logger);
const Fr=cir.curve.Fr;
delete cir.curve;