Fix big proof verify

This commit is contained in:
Jordi Baylina 2020-10-29 06:56:31 +01:00
parent 32a08552ab
commit 1516767cdf
No known key found for this signature in database
GPG Key ID: 7480C80C1BE43112
5 changed files with 14 additions and 14 deletions

@ -5281,12 +5281,12 @@ async function phase2verify(r1csFileName, pTauFileName, zkeyFileName, logger) {
return false; return false;
} }
if (!curve.G1.eq(zkey.vk_delta_1, curDelta)) { if (!curve.G1.eq(zkey.vk_delta_1, curDelta)) {
if (logger) logger.error("INVALID: Invalud delta1"); if (logger) logger.error("INVALID: Invalid delta1");
return false; return false;
} }
sr = await sameRatio$2(curve, curve.G1.g, curDelta, curve.G2.g, zkey.vk_delta_2); sr = await sameRatio$2(curve, curve.G1.g, curDelta, curve.G2.g, zkey.vk_delta_2);
if (sr !== true) { if (sr !== true) {
if (logger) logger.error("INVALID: Invalud delta2"); if (logger) logger.error("INVALID: Invalid delta2");
return false; return false;
} }
@ -5478,7 +5478,7 @@ async function phase2verify(r1csFileName, pTauFileName, zkeyFileName, logger) {
const n = Math.min(zkey.domainSize - i, MAX_CHUNK_SIZE); const n = Math.min(zkey.domainSize - i, MAX_CHUNK_SIZE);
const buff = await fd.read(sG*n); const buff = await fd.read(sG*n);
const buffS = buff_r.slice((i*MAX_CHUNK_SIZE)*zkey.n8r, (i*MAX_CHUNK_SIZE+n)*zkey.n8r); const buffS = buff_r.slice(i*zkey.n8r, (i+n)*zkey.n8r);
const r = await G.multiExpAffine(buff, buffS); const r = await G.multiExpAffine(buff, buffS);
R2 = G.add(R2, r); R2 = G.add(R2, r);

@ -5493,12 +5493,12 @@ async function phase2verify(r1csFileName, pTauFileName, zkeyFileName, logger) {
return false; return false;
} }
if (!curve.G1.eq(zkey.vk_delta_1, curDelta)) { if (!curve.G1.eq(zkey.vk_delta_1, curDelta)) {
if (logger) logger.error("INVALID: Invalud delta1"); if (logger) logger.error("INVALID: Invalid delta1");
return false; return false;
} }
sr = await sameRatio$2(curve, curve.G1.g, curDelta, curve.G2.g, zkey.vk_delta_2); sr = await sameRatio$2(curve, curve.G1.g, curDelta, curve.G2.g, zkey.vk_delta_2);
if (sr !== true) { if (sr !== true) {
if (logger) logger.error("INVALID: Invalud delta2"); if (logger) logger.error("INVALID: Invalid delta2");
return false; return false;
} }
@ -5690,7 +5690,7 @@ async function phase2verify(r1csFileName, pTauFileName, zkeyFileName, logger) {
const n = Math.min(zkey.domainSize - i, MAX_CHUNK_SIZE); const n = Math.min(zkey.domainSize - i, MAX_CHUNK_SIZE);
const buff = await fd.read(sG*n); const buff = await fd.read(sG*n);
const buffS = buff_r.slice((i*MAX_CHUNK_SIZE)*zkey.n8r, (i*MAX_CHUNK_SIZE+n)*zkey.n8r); const buffS = buff_r.slice(i*zkey.n8r, (i+n)*zkey.n8r);
const r = await G.multiExpAffine(buff, buffS); const r = await G.multiExpAffine(buff, buffS);
R2 = G.add(R2, r); R2 = G.add(R2, r);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -123,12 +123,12 @@ export default async function phase2verify(r1csFileName, pTauFileName, zkeyFileN
return false; return false;
} }
if (!curve.G1.eq(zkey.vk_delta_1, curDelta)) { if (!curve.G1.eq(zkey.vk_delta_1, curDelta)) {
if (logger) logger.error("INVALID: Invalud delta1"); if (logger) logger.error("INVALID: Invalid delta1");
return false; return false;
} }
sr = await sameRatio(curve, curve.G1.g, curDelta, curve.G2.g, zkey.vk_delta_2); sr = await sameRatio(curve, curve.G1.g, curDelta, curve.G2.g, zkey.vk_delta_2);
if (sr !== true) { if (sr !== true) {
if (logger) logger.error("INVALID: Invalud delta2"); if (logger) logger.error("INVALID: Invalid delta2");
return false; return false;
} }
@ -320,7 +320,7 @@ export default async function phase2verify(r1csFileName, pTauFileName, zkeyFileN
const n = Math.min(zkey.domainSize - i, MAX_CHUNK_SIZE); const n = Math.min(zkey.domainSize - i, MAX_CHUNK_SIZE);
const buff = await fd.read(sG*n); const buff = await fd.read(sG*n);
const buffS = buff_r.slice((i*MAX_CHUNK_SIZE)*zkey.n8r, (i*MAX_CHUNK_SIZE+n)*zkey.n8r); const buffS = buff_r.slice(i*zkey.n8r, (i+n)*zkey.n8r);
const r = await G.multiExpAffine(buff, buffS); const r = await G.multiExpAffine(buff, buffS);
R2 = G.add(R2, r); R2 = G.add(R2, r);