Fix min power2 for circuit
This commit is contained in:
parent
7b521405c2
commit
e6a13b6d27
@ -3653,8 +3653,8 @@ async function newZKey(r1csName, ptauName, zkeyName, logger) {
|
||||
|
||||
const cirPower = log2(r1cs.nConstraints + r1cs.nPubInputs + r1cs.nOutputs +1 -1) +1;
|
||||
|
||||
if (cirPower > power) {
|
||||
if (logger) logger.error(`circuit too big for this power of tau ceremony. ${r1cs.nConstraints} > 2**${power}`);
|
||||
if (cirPower > power+1) {
|
||||
if (logger) logger.error(`circuit too big for this power of tau ceremony. ${r1cs.nConstraints}*2 > 2**${power}`);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -4667,6 +4667,7 @@ async function phase2importMPCParams(zkeyNameOld, mpcparamsName, zkeyNameNew, na
|
||||
const buffTauLEM = await curve.G1.batchUtoLEM(buffTauU);
|
||||
buffH = new Uint8Array(zkeyHeader.domainSize*sG1);
|
||||
buffH.set(buffTauLEM); // Let the last one to zero.
|
||||
curve.G1.toRprLEM(buffH, sG1*(zkeyHeader.domainSize-1), curve.G1.zeroAffine);
|
||||
const n2Inv = curve.Fr.neg(curve.Fr.inv(curve.Fr.e(2)));
|
||||
const wInv = curve.Fr.inv(curve.Fr.w[zkeyHeader.power+1]);
|
||||
buffH = await curve.G1.batchApplyKey(buffH, n2Inv, wInv, "affine", "jacobian", logger);
|
||||
@ -5012,6 +5013,7 @@ async function phase2verify(r1csFileName, pTauFileName, zkeyFileName, logger) {
|
||||
const e = curve.Fr.fromRng(rng);
|
||||
curve.Fr.toRprLE(buff_r, i*zkey.n8r, e);
|
||||
}
|
||||
curve.Fr.toRprLE(buff_r, (zkey.domainSize-1)*zkey.n8r, curve.Fr.zero);
|
||||
|
||||
let R1 = G.zero;
|
||||
for (let i=0; i<zkey.domainSize; i += MAX_CHUNK_SIZE) {
|
||||
|
@ -4225,8 +4225,8 @@ async function newZKey(r1csName, ptauName, zkeyName, logger) {
|
||||
|
||||
const cirPower = log2(r1cs.nConstraints + r1cs.nPubInputs + r1cs.nOutputs +1 -1) +1;
|
||||
|
||||
if (cirPower > power) {
|
||||
if (logger) logger.error(`circuit too big for this power of tau ceremony. ${r1cs.nConstraints} > 2**${power}`);
|
||||
if (cirPower > power+1) {
|
||||
if (logger) logger.error(`circuit too big for this power of tau ceremony. ${r1cs.nConstraints}*2 > 2**${power}`);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -4909,6 +4909,7 @@ async function phase2importMPCParams(zkeyNameOld, mpcparamsName, zkeyNameNew, na
|
||||
const buffTauLEM = await curve.G1.batchUtoLEM(buffTauU);
|
||||
buffH = new Uint8Array(zkeyHeader.domainSize*sG1);
|
||||
buffH.set(buffTauLEM); // Let the last one to zero.
|
||||
curve.G1.toRprLEM(buffH, sG1*(zkeyHeader.domainSize-1), curve.G1.zeroAffine);
|
||||
const n2Inv = curve.Fr.neg(curve.Fr.inv(curve.Fr.e(2)));
|
||||
const wInv = curve.Fr.inv(curve.Fr.w[zkeyHeader.power+1]);
|
||||
buffH = await curve.G1.batchApplyKey(buffH, n2Inv, wInv, "affine", "jacobian", logger);
|
||||
@ -5254,6 +5255,7 @@ async function phase2verify(r1csFileName, pTauFileName, zkeyFileName, logger) {
|
||||
const e = curve.Fr.fromRng(rng);
|
||||
curve.Fr.toRprLE(buff_r, i*zkey.n8r, e);
|
||||
}
|
||||
curve.Fr.toRprLE(buff_r, (zkey.domainSize-1)*zkey.n8r, curve.Fr.zero);
|
||||
|
||||
let R1 = G.zero;
|
||||
for (let i=0; i<zkey.domainSize; i += MAX_CHUNK_SIZE) {
|
||||
|
9273
build/snarkjs.js
9273
build/snarkjs.js
File diff suppressed because one or more lines are too long
2
build/snarkjs.min.js
vendored
2
build/snarkjs.min.js
vendored
File diff suppressed because one or more lines are too long
844
package-lock.json
generated
844
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -41,7 +41,7 @@
|
||||
"blake2b-wasm": "https://github.com/jbaylina/blake2b-wasm.git",
|
||||
"circom_runtime": "0.0.9",
|
||||
"fastfile": "0.0.12",
|
||||
"ffjavascript": "0.2.4",
|
||||
"ffjavascript": "0.2.5",
|
||||
"logplease": "^1.2.15",
|
||||
"r1csfile": "0.0.12"
|
||||
},
|
||||
|
@ -113,6 +113,7 @@ export default async function phase2importMPCParams(zkeyNameOld, mpcparamsName,
|
||||
const buffTauLEM = await curve.G1.batchUtoLEM(buffTauU);
|
||||
buffH = new Uint8Array(zkeyHeader.domainSize*sG1);
|
||||
buffH.set(buffTauLEM); // Let the last one to zero.
|
||||
curve.G1.toRprLEM(buffH, sG1*(zkeyHeader.domainSize-1), curve.G1.zeroAffine);
|
||||
const n2Inv = curve.Fr.neg(curve.Fr.inv(curve.Fr.e(2)));
|
||||
const wInv = curve.Fr.inv(curve.Fr.w[zkeyHeader.power+1]);
|
||||
buffH = await curve.G1.batchApplyKey(buffH, n2Inv, wInv, "affine", "jacobian", logger);
|
||||
|
@ -29,8 +29,8 @@ export default async function newZKey(r1csName, ptauName, zkeyName, logger) {
|
||||
|
||||
const cirPower = log2(r1cs.nConstraints + r1cs.nPubInputs + r1cs.nOutputs +1 -1) +1;
|
||||
|
||||
if (cirPower > power) {
|
||||
if (logger) logger.error(`circuit too big for this power of tau ceremony. ${r1cs.nConstraints} > 2**${power}`);
|
||||
if (cirPower > power+1) {
|
||||
if (logger) logger.error(`circuit too big for this power of tau ceremony. ${r1cs.nConstraints}*2 > 2**${power}`);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -270,6 +270,7 @@ export default async function phase2verify(r1csFileName, pTauFileName, zkeyFileN
|
||||
const e = curve.Fr.fromRng(rng);
|
||||
curve.Fr.toRprLE(buff_r, i*zkey.n8r, e);
|
||||
}
|
||||
curve.Fr.toRprLE(buff_r, (zkey.domainSize-1)*zkey.n8r, curve.Fr.zero);
|
||||
|
||||
let R1 = G.zero;
|
||||
for (let i=0; i<zkey.domainSize; i += MAX_CHUNK_SIZE) {
|
||||
|
Loading…
Reference in New Issue
Block a user