Skip to content

Commit

Permalink
various minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonio95 committed Jun 6, 2024
1 parent ac4a14c commit f3495d0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
6 changes: 2 additions & 4 deletions poly-commit/src/hyrax/data_structures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,8 @@ impl<G: AffineRepr> PCCommitment for HyraxCommitment<G> {

pub(crate) type HyraxRandomness<F> = Vec<F>;

/// Hyrax Commitment State blah blah blah blah
/// blah blah blah blah
/// blah blah blah blah
/// blah blah blah blah
/// Hyrax Commitment state: matrix of polynomial coefficients and list of random
/// scalars used in each of the row-wise Pedersen commitments
#[derive(Derivative, CanonicalSerialize, CanonicalDeserialize)]
#[derivative(Default(bound = ""), Clone(bound = ""), Debug(bound = ""))]
pub struct HyraxCommitmentState<F>
Expand Down
2 changes: 1 addition & 1 deletion poly-commit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ pub trait PolynomialCommitment<F: PrimeField, P: Polynomial<F>, S: Cryptographic
// order to gather (i.e. batch) all polynomials that should be queried at
// the same point, then opening their commitments simultaneously with a
// single call to `open` (per point)
let rng = &mut crate::optional_rng::OptionalRng(rng);
let rng = &mut optional_rng::OptionalRng(rng);
let poly_st_comm: BTreeMap<_, _> = labeled_polynomials
.into_iter()
.zip(states)
Expand Down
8 changes: 3 additions & 5 deletions poly-commit/src/optional_rng.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use ark_std::rand::RngCore;
use ark_std::rand::{Error, RngCore};
use core::num::NonZeroU32;

/// `OptionalRng` is a hack that is necessary because `Option<&mut R>` is not implicitly reborrowed
Expand Down Expand Up @@ -35,12 +35,10 @@ impl<R: RngCore> RngCore for OptionalRng<R> {
}

#[inline]
fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), ark_std::rand::Error> {
fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> {
match &mut self.0 {
Some(r) => r.try_fill_bytes(dest),
None => Err(NonZeroU32::new(ark_std::rand::Error::CUSTOM_START)
.unwrap()
.into()),
None => Err(NonZeroU32::new(Error::CUSTOM_START).unwrap().into()),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion poly-commit/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl<F: Field> Matrix<F> {
.map(|col| {
inner_product(
v,
&cfg_into_iter!(0..self.m)
&cfg_into_iter!(0..self.n)
.map(|row| self.entries[row][col])
.collect::<Vec<F>>(),
)
Expand Down

0 comments on commit f3495d0

Please sign in to comment.