-
Notifications
You must be signed in to change notification settings - Fork 31
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
Coconut Proof allows empty blinding messages #21
Merged
lovesh
merged 6 commits into
docknetwork:main
from
grandchildrice:0xvon/ps-allow-empty-blinding
Nov 6, 2023
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
976ff0e
allow empty messages on coconut UnpackedBlindedMessages
grandchildrice 884a3d6
use j instead of i
grandchildrice 913658e
chal_bytes is used for both prover and verifier
grandchildrice 6171d07
pass empty blinded_messages
grandchildrice 9074118
commit 05f02df
grandchildrice 0b8b49a
fmt
grandchildrice File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -178,7 +178,7 @@ impl<'pair, Pair, F: PrimeField> UnpackedBlindedMessages<'pair, Pair, F> { | |
let (paired, (msgs, blindings)): (Vec<_>, _) = | ||
process_results(paired, |iter| iter.unzip())?; | ||
if paired.is_empty() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can remove this |
||
Err(MessageUnpackingError::NoMessagesProvided) | ||
Ok(Self(paired, msgs, blindings)) | ||
} else if pair_with.len() != total_count { | ||
Err(MessageUnpackingError::LessMessagesThanExpected { | ||
provided: total_count, | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -347,12 +347,20 @@ mod tests { | |
|
||
let sig = Signature::new(&mut rng, messages.as_slice(), &sk, ¶ms).unwrap(); | ||
|
||
assert_eq!( | ||
SignaturePoKGenerator::init(&mut rng, &[], &sig, &pk, ¶ms), | ||
Err(SignaturePoKError::MessageInputError( | ||
MessageUnpackingError::NoMessagesProvided | ||
)) | ||
); | ||
let pok = SignaturePoKGenerator::init(&mut rng, &[], &sig, &pk, ¶ms).unwrap(); | ||
|
||
let mut chal_bytes_prover = vec![]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar comment as above on naming. |
||
pok.challenge_contribution(&mut chal_bytes_prover, &pk, ¶ms) | ||
.unwrap(); | ||
let challenge_prover = | ||
compute_random_oracle_challenge::<Fr, Blake2b512>(&chal_bytes_prover); | ||
|
||
let proof = pok.clone().gen_proof(&challenge_prover).unwrap(); | ||
let revealed = messages.iter().enumerate().into_iter().rev(); | ||
|
||
assert!(proof | ||
.verify(&challenge_prover, revealed.clone(), &pk, ¶ms) | ||
.is_ok()); | ||
} | ||
|
||
#[test] | ||
|
Oops, something went wrong.
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.
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.
As you are using the same variables for prover's and verifier's challenge, they should not have suffix
_prover
,chal_bytes
is good.