[Zenith] 2 Incorrect random number generation in Testing#59
Open
manishbista28 wants to merge 2 commits intomainfrom
Open
[Zenith] 2 Incorrect random number generation in Testing#59manishbista28 wants to merge 2 commits intomainfrom
manishbista28 wants to merge 2 commits intomainfrom
Conversation
Contributor
Author
|
removed g2 msm code because it is not used. |
AaronFeickert
requested changes
Jan 5, 2026
g16ckt/src/gadgets/bn254/g1.rs
Outdated
|
|
||
| pub fn rnd_g1(rng: &mut impl Rng) -> ark_bn254::G1Projective { | ||
| ark_bn254::G1Projective::default() * rnd_fr(rng) | ||
| ark_bn254::G1Projective::rand(rng) * rnd_fr(rng) |
Contributor
There was a problem hiding this comment.
This works, but is overkill for test purposes. A simpler approach is either:
- Generate a random point using
G1Projective::randand return it directly - Multiply the default
G1Projectivegenerator by a random scalar produced usingrand_frand return the result
Note that the former is (likely) secure even outside of a test environment. The latter is not.
g16ckt/src/gadgets/bn254/g2.rs
Outdated
|
|
||
| pub fn rnd_g2(rng: &mut impl Rng) -> ark_bn254::G2Projective { | ||
| ark_bn254::G2Projective::default() * rnd_fr(rng) | ||
| ark_bn254::G2Projective::rand(rng) * rnd_fr(rng) |
Contributor
There was a problem hiding this comment.
See the corresponding comment for rnd_g1, which applies here as well.
This file contains hidden or 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
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.
Fixes #19