Skip to content

Commit

Permalink
Merge pull request #785 from dusk-network/jubjub-malformed-error-784
Browse files Browse the repository at this point in the history
Add JubJubScalarMalformed error
  • Loading branch information
HDauven authored Oct 27, 2023
2 parents e8960ba + cf21a19 commit 7b22063
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
9 changes: 9 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ coverage:
precision: 2
round: down
range: "70...100"
status:
project:
default:
target: 85%
threshold: 15%
patch:
default:
target: 70%
threshold: 100%

parsers:
gcov:
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Add `JubJubScalarMalformed` error [#784]
- Add blinding factors to the quotient polynomial [#773]

### Changed
Expand Down Expand Up @@ -522,6 +523,7 @@ is necessary since `rkyv/validation` was required as a bound.
- Proof system module.

<!-- ISSUES -->
[#784]: https://github.com/dusk-network/plonk/issues/784
[#773]: https://github.com/dusk-network/plonk/issues/773
[#774]: https://github.com/dusk-network/plonk/issues/774
[#763]: https://github.com/dusk-network/plonk/issues/763
Expand Down
5 changes: 3 additions & 2 deletions src/composer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ pub trait Composer: Sized + Index<Witness, Output = BlsScalar> {
///
/// `generator` will be appended to the circuit description as constant
///
/// Will error if `jubjub` doesn't fit `Fr`
/// Will error with a `JubJubScalarMalformed` error if `jubjub` doesn't fit
/// `Fr`
fn component_mul_generator<P: Into<JubJubExtended>>(
&mut self,
jubjub: Witness,
Expand Down Expand Up @@ -278,7 +279,7 @@ pub trait Composer: Sized + Index<Witness, Output = BlsScalar> {
let scalar: JubJubScalar =
match JubJubScalar::from_bytes(&self[jubjub].to_bytes()).into() {
Some(s) => s,
None => return Err(Error::BlsScalarMalformed),
None => return Err(Error::JubJubScalarMalformed),
};

let width = 2;
Expand Down
4 changes: 4 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ pub enum Error {
/// This error occurs when a malformed BLS scalar is decoded from a byte
/// array.
BlsScalarMalformed,
/// This error occurs when a malformed JubJub scalar is decoded from a byte
/// array.
JubJubScalarMalformed,
/// WNAF2k should be in `[-1, 0, 1]`
UnsupportedWNAF2k,
/// The provided public inputs doesn't match the circuit definition
Expand Down Expand Up @@ -148,6 +151,7 @@ impl std::fmt::Display for Error {
Self::NotEnoughBytes => write!(f, "not enough bytes left to read"),
Self::PointMalformed => write!(f, "BLS point bytes malformed"),
Self::BlsScalarMalformed => write!(f, "BLS scalar bytes malformed"),
Self::JubJubScalarMalformed => write!(f, "JubJub scalar bytes malformed"),
Self::BytesError(err) => write!(f, "{:?}", err),
Self::UnsupportedWNAF2k => write!(
f,
Expand Down

0 comments on commit 7b22063

Please sign in to comment.