66 Commits

Author SHA1 Message Date
0xmad
3a6b571e76 fix: cli templates 2023-10-19 13:58:51 -05:00
isk
303a92f6b4 fix: convert to @cryptkeeperzk/ejs 2023-10-19 13:58:08 -05:00
isk
41f5895ef0 fix: replacing ffjavascript with forked @cryptkeeperzk/ffjavascript package 2023-10-19 13:57:31 -05:00
Blaine Bublitz
f5bc353115 fix: Return 0 exit code when import succeeds (#391)
chore: Rebuild cli
2023-08-06 12:57:06 -07:00
Blaine Bublitz
2f9def43f7 fix(cli): Correctly return status codes instead of values (#369) 2023-05-17 20:53:11 -07:00
Blaine Bublitz
570cb07805 fix: Remove bfj & fs calls from core logic (#356) 2023-05-06 16:02:26 -07:00
Xavier Pinsach
7164ec8779 Witness check cmd (#337)
* add wtns check tool

* add more info when checking

* remove false test

* add + detailed messages

* add check witness test & tutorial test workflow

* remove witness in tutorial.yml
2023-03-21 00:04:43 +01:00
Xavier Pinsach
6555d901a7 Fflonk (#305)
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
2023-02-10 17:12:08 +01:00
Kasper Ziemianek
c9f7771cdc fix: Ensure power is number in powersoftau new command (#291) 2022-12-22 09:38:13 -07:00
Xavi Pinsach
b607029566 feat: Add "file info" command to CLI (#202) 2022-07-29 13:28:44 -07:00
Blaine Bublitz
f3f10ab596 fix: Use bfj library to stringify JSON in CLI commands 2022-07-16 14:20:23 -04:00
Blaine Bublitz
e70413b162 fix: Ensure powersoftau export json works (#171)
chore: Add powersoftau export json test
fix: Use noCheck like ptau verify
fix: Ensure powersoftau export json uses stringify from field
chore: Build bundles
2022-06-22 14:39:43 -07:00
Blaine Bublitz
318234b3a9 fix: Ensure zkey export json command works (#168)
chore: Add failing test to CI
fix: Delete the field on the zkey
fix: Also delete the curve property
chore: Build bundles
chore!: Move stringifyBigInt into zkeyExportJson
2022-06-17 13:50:18 -07:00
Blaine Bublitz
e090cbecfe fix: Ensure zkey import bellman command exits with correct code 2022-06-08 16:42:09 -07:00
bajpai244
e378a1e6c9 refactor(scope): move unstringification of BigInts to Library from client
The CLI uses the `unstringifyBigInts` utility on Objects and then passes
it to the library functions. When working on a webclient or using the library
without the cli this leads to production of errors, one example is
generating callData for Solidity Verifier, since unstringification of
BigBigInts haven’t happened, the callData generated is corrupt, anyone
who wants to fix this would have to read the cli to figure out what is
going wrong.

Two files: `plonk_verify.js` & `groth16_verify.js` are doing this
unstringification in themselves already, and the CLI is doing it again
making the unstringification reduntant.

This PR moves the unstringification of BigInts to library files, which saves the
effort for anyone consuming the library to dig deep in the CLI and then
figure our what is going wrong, it also solves the reduntancy mentioned
in the section above.

The PR also includes the updated builds and has also passed all
described library tests.
2022-05-16 10:24:55 +05:30
Oleg Poludnenko
8a7286207a Fix for Windows https://nodejs.org/api/url.html#urlfileurltopathurl 2022-03-30 18:50:27 +03:00
Oleg Poludnenko
7703b2b4da Fix for Windows https://nodejs.org/api/url.html#urlfileurltopathurl 2022-03-22 10:21:14 +02:00
Jordi Baylina
8368c53976 Fix tutorial test and templates relative path 2021-05-31 20:41:10 +02:00
Jordi Baylina
577b3f3580 Plonk finished 2021-05-31 13:21:07 +02:00
Jordi Baylina
7ed350002d Plonk working 2021-05-18 22:26:22 +02:00
Jordi Baylina
621a31c8e9 fix verifyFromInit cli param 2020-12-20 10:25:38 +01:00
Jordi Baylina
9f7f26c49c Added zKey verify from init file 2020-12-18 15:38:31 +01:00
Jordi Baylina
769210b91e Merge pull request #62 from weijiekoh/fix/zk_vk_export
Fixes the zkey export verificationkey command to allow the user to specify the output path of the verification key
2020-12-01 17:39:02 +01:00
Jordi Baylina
1bbb46a322 deps 2020-10-09 06:19:20 +02:00
Jordi Baylina
9a1509d849 Fix r1cs json export 2020-10-08 16:06:48 +02:00
Jordi Baylina
86ee180a81 deps 2020-10-08 11:43:05 +02:00
Koh Wei Jie
08c460764a fixed params index in zkeyExportVKey to allow the user to specify the vk output path 2020-09-20 11:51:26 +08:00
Jordi Baylina
1fafad70ee Add lagrange op power plus one 2020-09-02 12:06:20 +02:00
Jordi Baylina
97ac985a1b Big ptau verification 2020-08-29 14:12:24 +02:00
Kevin Mai-Husan Chia
6d7e2a6f8d Fix: typo "llallange" to "challenge" 2020-07-22 16:39:18 +08:00
Jordi Baylina
12ec77e9c3 Fixes in Readme and challenge word fix 2020-07-14 11:55:12 +02:00
Jordi Baylina
59d948eb45 fix solidity template dir 2020-07-13 08:54:48 +02:00
Jordi Baylina
7df37c1592 fix template dir 2020-07-13 08:47:02 +02:00
Jordi Baylina
b3ec4930ea solidity template dir 2020-07-13 08:37:21 +02:00
Jordi Baylina
4fcc0a3398 tutorial and many fixes 2020-07-13 07:21:03 +02:00
Jordi Baylina
9b418568f6 api and tutorial start 2020-07-11 10:31:52 +02:00
Jordi Baylina
1d3ad357c1 bls12-381 all working 2020-06-30 21:39:25 +02:00
Jordi Baylina
6b08298526 bls12-381 working 2020-06-30 15:45:21 +02:00
Jordi Baylina
b45eb248e2 beacon phase2, verification and challange contribution 2020-06-18 19:14:06 +02:00
Jordi Baylina
3ba1341404 Contribution phase2 2020-06-16 16:45:32 +02:00
Jordi Baylina
a4da81f0a7 phase2 verification done 2020-06-14 17:37:22 +02:00
Jordi Baylina
bfd7489cc3 fast proof 2020-06-08 11:03:36 +02:00
Jordi Baylina
b948a0d0d1 First try phase2 2020-05-31 00:46:49 +02:00
Jordi Baylina
f916a58ef8 limit to 2 to 28 2020-05-27 07:03:44 +02:00
Jordi Baylina
f587735530 more advances in powers of taw cermony 2020-05-26 18:45:49 +02:00
Jordi Baylina
4c7a37c274 contribution generated in wasm 2020-05-15 21:30:37 +02:00
Jordi Baylina
9f72725b3d powers of tau validated 2020-05-11 20:23:04 +02:00
Jordi Baylina
6598f9df4a powersof taw new export and contribute 2020-05-09 15:05:45 +02:00
Jordi Baylina
7b099d2843 Use native big int 2020-04-18 20:21:16 +02:00
Jordi Baylina
235bd14de9 verbose in setup added 2020-04-06 21:38:08 +02:00