-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
improve challenge generation #1829
Merged
Merged
+62
−45
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alxiong
requested review from
nomaxg,
philippecamacho,
ImJeremyHe,
sveitser,
jbearer and
tbro
as code owners
August 7, 2024 04:15
philippecamacho
approved these changes
Aug 7, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A question regarding the documentation. Otherwise LGTM. Great assembly trick that yielded some nice gas savings!
philippecamacho
added a commit
that referenced
this pull request
Sep 4, 2024
* 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 <alex.xiong.tech@gmail.com> --------- Co-authored-by: Alex Xiong <alex.xiong.tech@gmail.com> * 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 <alex.xiong.tech@gmail.com> * Gas optimization for evaluatePiPoly (#1822) * Gas optimization for evaluatePiPoly * add credit --------- Co-authored-by: Alex Xiong <alex.xiong.tech@gmail.com> * 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 <alex.xiong.tech@gmail.com> * 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 <alex.xiong.tech@gmail.com> * 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 <alex.xiong.tech@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #1735,
Correspond to EspressoSystems/jellyfish#648
This PR:
Not exactly implementing the suggestion from L03,
state
(but properly this time where transcript is emptied each time a challenge is squeezed), see longer explanation in L03: Challenge generation logic deviates from the protocol specification #1735 (comment)This PR partially reverts some changes made in #1801 by introducing back the
state
, but this time, the transcript is no longer an ever-growing append-only bytes.Additionally, given the design, I optimized the
genChallenge()
logic and bring down gas cost by another 36k 🥂