Add labels

This commit is contained in:
Jordi Baylina 2020-12-16 11:18:14 +01:00
parent 36b426626b
commit b2cb681c3f
No known key found for this signature in database
GPG Key ID: 7480C80C1BE43112
6 changed files with 19 additions and 10 deletions

@ -5438,8 +5438,8 @@ async function phase2verify(r1csFileName, pTauFileName, zkeyFileName, logger) {
if (logger) logger.debug(`H Verificaition(tau): ${i}/${zkey.domainSize}`);
const n = Math.min(zkey.domainSize - i, MAX_CHUNK_SIZE);
const buff1 = await fdPTau.read(sG*n, sectionsPTau[2][0].p + zkey.domainSize*sG + i*MAX_CHUNK_SIZE*sG);
const buff2 = await fdPTau.read(sG*n, sectionsPTau[2][0].p + i*MAX_CHUNK_SIZE*sG);
const buff1 = await fdPTau.read(sG*n, sectionsPTau[2][0].p + zkey.domainSize*sG + i*sG);
const buff2 = await fdPTau.read(sG*n, sectionsPTau[2][0].p + i*sG);
const buffB = await batchSubstract(buff1, buff2);
const buffS = buff_r.slice(i*zkey.n8r, (i+n)*zkey.n8r);

@ -5650,8 +5650,8 @@ async function phase2verify(r1csFileName, pTauFileName, zkeyFileName, logger) {
if (logger) logger.debug(`H Verificaition(tau): ${i}/${zkey.domainSize}`);
const n = Math.min(zkey.domainSize - i, MAX_CHUNK_SIZE);
const buff1 = await fdPTau.read(sG*n, sectionsPTau[2][0].p + zkey.domainSize*sG + i*MAX_CHUNK_SIZE*sG);
const buff2 = await fdPTau.read(sG*n, sectionsPTau[2][0].p + i*MAX_CHUNK_SIZE*sG);
const buff1 = await fdPTau.read(sG*n, sectionsPTau[2][0].p + zkey.domainSize*sG + i*sG);
const buff2 = await fdPTau.read(sG*n, sectionsPTau[2][0].p + i*sG);
const buffB = await batchSubstract(buff1, buff2);
const buffS = buff_r.slice(i*zkey.n8r, (i+n)*zkey.n8r);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -41,8 +41,12 @@ export default async function groth16Prove(zkeyFileName, witnessFileName, logger
const inc = power == Fr.s ? curve.Fr.shift : curve.Fr.w[power+1];
const buffA = await Fr.ifft(buffA_T, "", "", logger, "IFFT_A");
console.log(curve.Fr.toString(buffA.slice(0, 32)));
console.log(curve.Fr.toString(buffA.slice(32, 64)));
const buffAodd = await Fr.batchApplyKey(buffA, Fr.e(1), inc);
const buffAodd_T = await Fr.fft(buffAodd, "", "", logger, "FFT_A");
console.log(curve.Fr.toString(buffAodd_T.slice(0, 32)));
console.log(curve.Fr.toString(buffAodd_T.slice(32, 64)));
const buffB = await Fr.ifft(buffB_T, "", "", logger, "IFFT_B");
const buffBodd = await Fr.batchApplyKey(buffB, Fr.e(1), inc);
@ -77,8 +81,12 @@ export default async function groth16Prove(zkeyFileName, witnessFileName, logger
const buffBasesH = await binFileUtils.readSection(fdZKey, sectionsZKey, 9);
const resH = await curve.G1.multiExpAffine(buffBasesH, buffPodd_T, logger, "multiexp H");
const r = curve.Fr.random();
const s = curve.Fr.random();
console.log(curve.G1.toString(curve.G1.toAffine(resH)));
// const r = curve.Fr.random();
// const s = curve.Fr.random();
const r = curve.Fr.zero;
const s = curve.Fr.zero;
proof.pi_a = G1.add( proof.pi_a, zkey.vk_alpha_1 );
proof.pi_a = G1.add( proof.pi_a, G1.timesFr( zkey.vk_delta_1, r ));

@ -19,6 +19,7 @@ export default async function r1csInfo(r1csName, logger) {
if (logger) logger.info(`# of Constraints: ${cir.nConstraints}`);
if (logger) logger.info(`# of Private Inputs: ${cir.nPrvInputs}`);
if (logger) logger.info(`# of Public Inputs: ${cir.nPubInputs}`);
if (logger) logger.info(`# of Labels: ${cir.nLabels}`);
if (logger) logger.info(`# of Outputs: ${cir.nOutputs}`);
return cir;