Fix big proof generation

This commit is contained in:
Jordi Baylina 2020-10-22 16:39:51 +02:00
parent ca6b8f3eea
commit 5f0158dbed
No known key found for this signature in database
GPG Key ID: 7480C80C1BE43112
5 changed files with 18 additions and 14 deletions

@ -6107,6 +6107,7 @@ async function groth16Prove(zkeyFileName, witnessFileName, logger) {
if (logger) logger.debug("Reading H Points");
const buffBasesH = await readSection$1(fdZKey, sectionsZKey, 9);
if (logger) logger.debug("Building ABC");
const [buffA_T, buffB_T, buffC_T] = await buldABC(curve, zkey, buffWitness, buffCoeffs);
const inc = power == Fr.s ? curve.Fr.shift : curve.Fr.w[power+1];
@ -6241,9 +6242,9 @@ async function buldABC(curve, zkey, witness, coeffs) {
const result = await Promise.all(promises);
const outBuffA = new Uint8Array(zkey.domainSize * curve.Fr.n8);
const outBuffB = new Uint8Array(zkey.domainSize * curve.Fr.n8);
const outBuffC = new Uint8Array(zkey.domainSize * curve.Fr.n8);
const outBuffA = new ffjavascript.BigBuffer(zkey.domainSize * curve.Fr.n8);
const outBuffB = new ffjavascript.BigBuffer(zkey.domainSize * curve.Fr.n8);
const outBuffC = new ffjavascript.BigBuffer(zkey.domainSize * curve.Fr.n8);
let p=0;
for (let i=0; i<result.length; i++) {
outBuffA.set(result[i][0], p);

@ -1595,6 +1595,7 @@ async function groth16Prove(zkeyFileName, witnessFileName, logger) {
if (logger) logger.debug("Reading H Points");
const buffBasesH = await readSection(fdZKey, sectionsZKey, 9);
if (logger) logger.debug("Building ABC");
const [buffA_T, buffB_T, buffC_T] = await buldABC(curve, zkey, buffWitness, buffCoeffs);
const inc = power == Fr.s ? curve.Fr.shift : curve.Fr.w[power+1];
@ -1729,9 +1730,9 @@ async function buldABC(curve, zkey, witness, coeffs) {
const result = await Promise.all(promises);
const outBuffA = new Uint8Array(zkey.domainSize * curve.Fr.n8);
const outBuffB = new Uint8Array(zkey.domainSize * curve.Fr.n8);
const outBuffC = new Uint8Array(zkey.domainSize * curve.Fr.n8);
const outBuffA = new ffjavascript.BigBuffer(zkey.domainSize * curve.Fr.n8);
const outBuffB = new ffjavascript.BigBuffer(zkey.domainSize * curve.Fr.n8);
const outBuffC = new ffjavascript.BigBuffer(zkey.domainSize * curve.Fr.n8);
let p=0;
for (let i=0; i<result.length; i++) {
outBuffA.set(result[i][0], p);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -45,6 +45,7 @@ export default async function groth16Prove(zkeyFileName, witnessFileName, logger
if (logger) logger.debug("Reading H Points");
const buffBasesH = await binFileUtils.readSection(fdZKey, sectionsZKey, 9);
if (logger) logger.debug("Building ABC");
const [buffA_T, buffB_T, buffC_T] = await buldABC(curve, zkey, buffWitness, buffCoeffs);
const inc = power == Fr.s ? curve.Fr.shift : curve.Fr.w[power+1];
@ -179,9 +180,9 @@ async function buldABC(curve, zkey, witness, coeffs) {
const result = await Promise.all(promises);
const outBuffA = new Uint8Array(zkey.domainSize * curve.Fr.n8);
const outBuffB = new Uint8Array(zkey.domainSize * curve.Fr.n8);
const outBuffC = new Uint8Array(zkey.domainSize * curve.Fr.n8);
const outBuffA = new BigBuffer(zkey.domainSize * curve.Fr.n8);
const outBuffB = new BigBuffer(zkey.domainSize * curve.Fr.n8);
const outBuffC = new BigBuffer(zkey.domainSize * curve.Fr.n8);
let p=0;
for (let i=0; i<result.length; i++) {
outBuffA.set(result[i][0], p);