-
Notifications
You must be signed in to change notification settings - Fork 8
Code review and minor corrections #52
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
Conversation
…ar decoding failure Reverted the `verifier_challenge` method to its previous implementation because the optimized version failed to produce a valid scalar in some edge cases. The issue arose when attempting to convert a reduced BigUint to a field scalar via its byte representation (`from_repr`), which panicked when the representation was out of bounds or invalid for the underlying field. This ensures compatibility and correctness when deriving challenges from squeezed bytes.
| .collect(); | ||
| let prover_state = (nonces.clone(), witness.clone()); | ||
| let commitment = self.0.linear_map.evaluate(&nonces)?; | ||
| let prover_state = (nonces, witness.clone()); |
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.
Computing commitment before prover state saves cloning of the nonces vector
| Ok(ProtocolCommitment::And(commitments)) | ||
| } | ||
| Protocol::Or(ps) => { | ||
| Protocol::And(ps) | Protocol::Or(ps) => { |
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.
The calculation is done in the same way in the cases And and Or
src/errors.rs
Outdated
| /// Indicates a mismatch in parameter sizes during batch verification. | ||
| #[error("Mismatched parameter sizes for batch verification.")] | ||
|
|
||
| /// The sizes of input parameters (e.g., witnesses, commitments) do not match expected values. |
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.
This error can occur in different contexts (always being due to a size problem)
| pub struct LinearMap<G: Group> { | ||
| /// The set of linear combination constraints (equations). | ||
| pub constraints: Vec<LinearCombination<G>>, | ||
| // TODO: Update the usage of the word "morphism" |
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.
The name "morphism" has been changed to "linear map"
| /// - `simulate_transcript` | ||
| #[allow(clippy::type_complexity)] | ||
| pub trait SigmaProtocolSimulator: SigmaProtocol { | ||
| /// Simulates a protocol transcript given a challenge. |
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.
This function does not take challenge as an argument
- No need to define type aliases
| pedersen_commitment_dleq, | ||
| }; | ||
|
|
||
| type Codec = ByteSchnorrCodec<G, KeccakDuplexSponge>; |
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.
Such an alias is already defined in the codec module
Signed-off-by: Michele Orrù <[email protected]>
Co-authored-by: Michele Orrù <[email protected]>
No description provided.