-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
[zk-token-sdk] replace hard-coded constants with constant variables #32274
Merged
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
samkim-crypto
force-pushed
the
zk-token-sdk/constant-variables
branch
from
June 26, 2023 02:43
8b83ce1
to
a967163
Compare
Codecov Report
@@ Coverage Diff @@
## master #32274 +/- ##
=======================================
Coverage 82.0% 82.0%
=======================================
Files 773 773
Lines 209616 209603 -13
=======================================
+ Hits 172038 172083 +45
+ Misses 37578 37520 -58 |
samkim-crypto
force-pushed
the
zk-token-sdk/constant-variables
branch
3 times, most recently
from
June 27, 2023 06:55
6af03dc
to
e1a63d0
Compare
samkim-crypto
added
v1.16
PRs that should be backported to v1.16
and removed
work in progress
This isn't quite right yet
labels
Jun 27, 2023
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.
Generally in favor :)
Just a couple suggestions, plus a few comments that need updating.
zk-token-sdk/src/sigma_proofs/ciphertext_ciphertext_equality_proof.rs
Outdated
Show resolved
Hide resolved
zk-token-sdk/src/sigma_proofs/ciphertext_commitment_equality_proof.rs
Outdated
Show resolved
Hide resolved
zk-token-sdk/src/sigma_proofs/grouped_ciphertext_validity_proof.rs
Outdated
Show resolved
Hide resolved
samkim-crypto
force-pushed
the
zk-token-sdk/constant-variables
branch
from
June 28, 2023 01:39
9488552
to
29bc565
Compare
Co-authored-by: Tyera <[email protected]>
Co-authored-by: Tyera <[email protected]>
samkim-crypto
force-pushed
the
zk-token-sdk/constant-variables
branch
from
June 28, 2023 06:52
c65cb3d
to
c2b0bff
Compare
CriesofCarrots
approved these changes
Jun 28, 2023
mergify bot
pushed a commit
that referenced
this pull request
Jun 28, 2023
…32274) * add ristretto and scalar byte length constants * add serialization and deserialization helper functions * remove hard-coded constants in the `sigma` module * remove hard-coded constants in the `encryption` module * remove hard-coded constants in the `zk-token-elgamal` module * Apply suggestions from code review Co-authored-by: Tyera <[email protected]> * fix docs for range proof constants * Apply suggestions from code review Co-authored-by: Tyera <[email protected]> * clippy --------- Co-authored-by: Tyera <[email protected]> (cherry picked from commit 91186d3)
samkim-crypto
added a commit
that referenced
this pull request
Jun 29, 2023
…ables (backport of #32274) (#32322) [zk-token-sdk] replace hard-coded constants with constant variables (#32274) * add ristretto and scalar byte length constants * add serialization and deserialization helper functions * remove hard-coded constants in the `sigma` module * remove hard-coded constants in the `encryption` module * remove hard-coded constants in the `zk-token-elgamal` module * Apply suggestions from code review Co-authored-by: Tyera <[email protected]> * fix docs for range proof constants * Apply suggestions from code review Co-authored-by: Tyera <[email protected]> * clippy --------- Co-authored-by: Tyera <[email protected]> (cherry picked from commit 91186d3) Co-authored-by: samkim-crypto <[email protected]>
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.
Problem
Throughout zk-token-sdk, there are many hard-coded constants, which make the code harder to read and maintain.
Summary of Changes
Use constant variables to replace hard-coded constants.
In the process, I updated/simplified the way serialization is done in the sigma module. Previously, direct indexing was used to update slices. Now, chunks iterator is used to update the slices.
The hard-coded constants in the
range_proof
module will be updated in a separate PR.Fixes #