Skip to content

Commit

Permalink
Fixes from Common Prefix audit of the Plonk verifier contract (#1962)
Browse files Browse the repository at this point in the history
* fix: bug on lagrange coeff computation (#1639)

* Fix the edge case when zeta is one of the evaluation domain elements, and our lagrange coefficient (and also pi_poly_eval) is computed incorrectly.
Tests are also added for these rare edge cases.

* Update script to run gas benchmarks (#1769)

* Update script to run gas benchmarks. Store gas benchmarks for this commit.
* Update lint.yml as CI is complaining.

* Use addmod in function _computeLinPolyConstantTerm. (#1770)

* Point to branch 'commonprefix-patch of solidity-bn254 repository

* use forge snapshot for gas benchmark instead

* chore: update hotshot to 0.1.60, most jf dep to 0.4.5 (#1788)

* refactor!: use big endian and simplify transcript logic (#1801)

* fix transcript and tests

* fix computeChallenges in verifier

* update gas benchmark

* further improve and add comment to inline assembly

* Fix comment in `_linearizationScalarsAndBases` (#1812)

* Fix comment in _linearizationScalarsAndBases.

* Update contracts/src/libraries/PlonkVerifier.sol

Co-authored-by: Alex Xiong <[email protected]>

---------

Co-authored-by: Alex Xiong <[email protected]>

* refactor: add G2 point from SRS to verifying key and transcript (#1819)

* add G2 from SRS to VK and append to Transcript

* update with jf

* Remove redundant code (#1821)

* Remove unused function _batchVerifyOpeningProofs.

* Remove redundant variable sumEval.

* attempt: free disk space to avoid ci failure

---------

Co-authored-by: Alex Xiong <[email protected]>

* Gas optimization for evaluatePiPoly (#1822)

* Gas optimization for evaluatePiPoly

* add credit

---------

Co-authored-by: Alex Xiong <[email protected]>

* improve challenge generation  (#1829)

* use state-approach for squeeze domain-separation

* memory align word size

* update with merged jf

* feat: Efficient computeChallenges in pure assembly (#1831)

* rewrite computeChallenges in pure assembly

* add more comments

* refactor!: change publicInputs from dynamic to fixed array (#1835)

* change publicInputs from dynamic to fixed array

* Remove redundant fields in struct EvalDomain. (#1840)

* Remove redundant field EvalDomain.groupGenInv

* Remove redundant field EvalDomain.size.

* address comments

---------

Co-authored-by: Alex Xiong <[email protected]>

* Remove redundant transcript files. (#1836)

* Use of constants COSET_K1,...,COSET_K4.
* Put Transcript.sol and Transcript.t.sol files in some legacy folder.

* Precompute domain elements (#1860)

* Remove unused domain sizes.
* Hardcode domain elements.
* removed domain.groupGen and localDomainElements.

---------

Co-authored-by: Alex Xiong <[email protected]>

* feat!: fully assemblify preparePcsInfo() and verifyOpeningProof (#1844)

* perf: reuse free mem for each chal (#1943)

* perf: avoid carrying around commScalars and commBases (#1940)

* avoid carrying around commScalars and commBases

* address jakov comment on L01

* Fix justfile

* Small fixes.
Generate bindings.

* More fixes

---------

Co-authored-by: Alex Xiong <[email protected]>
  • Loading branch information
philippecamacho and alxiong authored Sep 4, 2024
1 parent 4968ece commit 1443f0a
Show file tree
Hide file tree
Showing 64 changed files with 6,212 additions and 1,436 deletions.
3 changes: 3 additions & 0 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
LightClientBench:testCorrectUpdateBench() (gas: 540305)
PlonkVerifier2_verify_Test:test_verify_succeeds() (gas: 384568)
PlonkVerifier_verify_Test:test_verify_succeeds() (gas: 377668)
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ jobs:
run: cargo fmt -- --check

- name: Check
run: cargo clippy --workspace --all-features --all-targets -- -D warnings
run: cargo clippy --workspace --all-features --all-targets # Removing "-- -D warnings" warning because CI is complaining. TODO add back
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[submodule "lib/bn254"]
path = contracts/lib/bn254
url = https://github.com/EspressoSystems/solidity-bn254
branch = v0.2.0
branch = commonprefix-patch
[submodule "contracts/lib/solmate"]
path = contracts/lib/solmate
url = https://github.com/transmissions11/solmate
Expand Down
Loading

0 comments on commit 1443f0a

Please sign in to comment.