mirror of
https://github.com/CryptKeeperZK/snarkjs.git
synced 2026-01-10 07:48:03 -05:00
This PR includes all the FFLONK implementation * baby plonk added * wip * commands added * fix babyplonk command calls * refactor cmd calls * WIP * Add header babyplonk to zkey utils * wip * Wip baby plonk verifier * Add baby plonk test * babyplonk export verification keu aded * wip * refactor polynomial & add some tests * refactor setup, extract a new class to process r1cs constraints * improve polynomial.4T * fix * refactor setup * refactor * massive update * Add comments to round1 and 2 * organize fflonk prover * organize fflonk verifier * Change format add a section for each sigma * read sigma from each section * add T0 polynomial computation * mul_z transformed to a class * add C1 polynomial computation * add function to X^n to Polynomial class * Add C2 polynomial computation * typos * added computeZ * Add T1 polynomial computation * T2 polynomial computation added * Compute h1, h2, h3 and xi * polynomial F added (wip) * Improve comments in fflonk prover * typo * fix comments * compute F(X) and L(X) polynomials added * fflonk verifier added * Remove QL, QR, QM, QO, QC, S1, S2 and S3 commitments in verification key and zkey because they are not used on either the verifier or the prover * remove unused variables * Fix in final pairing * Add omega 3 and omega 4 in setup process and export vk process * Add omega3 and omega4 to the prover&verifier * omega3 and omega4 comments * change folder name to fflonk * fix proof messages * change polynomial length getter to function * change evalutions length getter to function * dev * fix error on sigma computings & increase ptau buffer * fflonk setup memory improvements * fflonk prover & verifier refactor * wip fflonk exportcalldata & export solidity done, refactor fflonk prove and verifier * wip * fix r1(x) & r2(x) and refactor h1w3, h2w3 & h3w3 converted to arrays * improve comments * improve lagrange4 * refactoring polynomial lagrange4 * Add Lagrange polynomials interpolation methods (optimized and non optimized) * Added polynomials methods: fromCoefficientsArray, divBy === eucledian division and changed method name fromBuffer to fromEvaluations * Refactor polynomial.js to take in account when use BigBuffer or Uint8Array * Add div by ZT's * massive updates * add polynomial zerofier test * massive updates * Move computation of 3th root of omega to fflonk_setup to setup * fix: L polynomial computation * fix: remove default parameter in evaluations * Add logger to export verification key * fix: several improvements * Change evaluations.getEvaluation(i) from byte-based i parameter to index-based * fix: first proof verified * dev * solidity verifier added and working with r1(y) and r2(y) inside the proof * fflonk verifier in Solidity working * Added zero knowledge and degree checking * fix typo * fix: save & load the exact SRS length string * prover improvement * fix: add zero knowledge * Improve add batch inverse in lagrange polynomials computation * wip develop part of the verifier developed in Solidity in Javascript to check if could work * added beta version of the first fflonk verifier smart contract * remove babyplonk references * fix: Check if Ptau is big enough for the circuit * remove polynomials and evakuations from memory when not used * add fflonk tests suite * Add fflonk full prove command * Add readme documentation for fflonk * fix typos * fix: force to clean memory with globalThis.gc() * fix: extract constant multiplication part outside of the loop for better performance * perfomance: removed all the divisions in smart contract by sending a single evaluation from the prover and the rebuild the onverses using the Montgomery batched algorithm * smart contract updated * Refactor fflonk smart contract * improve comments in smart contract * Refactor lagrange interpolation. Specific lagrange from 4 and 6 points removed * improve prover performance * improve performance of the prover * resolve conflict * improve performance of the prover * write fflonk tests into github action workflow tutorial.yml * comment previous fflonk workflow * Fix: load constraints dinamically * fix dev * add more comments in fflonk setup * improve comments * improve comments * improve comments * improve comments in setup process * improve prompt comments in setup process * dev * change divZh() arguments, added domainSize * dev * fix coef.length by coef.byteLength * fix dev * dev * fix dev * add more messages * Improve comments & add a new parameter in Evaluation::fromPolynomial to choose the extension size * dev * fflonk security issue fixed * Add comments in fflonk_proer and fast divison and new method "fromPolynomial" to create a new Polynomial * add w16 to setup and remove w3, w4 and w8 * CPolynomial added * fix dev * use CPolynomial class in setup and us multiexp from polynomial * fix computeT1 * improve round 5 * fix r1cs processor * fix r1cs process constraints * adapt solidity verifier to new implementation * remove unnecessary debug functions * fix typo * refactor computeF and computeL * fix * refactor computeF * update package-lock.json
21 lines
474 B
JavaScript
21 lines
474 B
JavaScript
export function getRandomValue(higher = 10) {
|
|
return Math.floor((Math.random() * higher) + 1);
|
|
}
|
|
|
|
export function getRandomBuffer(length, Fr) {
|
|
let buffer = new Uint8Array(length * Fr.n8);
|
|
for (let i = 0; i < length; i++) {
|
|
buffer.set(Fr.random(), i * Fr.n8);
|
|
}
|
|
return buffer;
|
|
}
|
|
|
|
export function getRandomArray(length, Fr) {
|
|
let buffer = [];
|
|
for (let i = 0; i < length; i++) {
|
|
buffer[i] = Fr.random();
|
|
}
|
|
return buffer;
|
|
}
|
|
|