Skip to content

Commit

Permalink
chore: Updated clippy - update docs and kzg file
Browse files Browse the repository at this point in the history
  • Loading branch information
epociask committed Jun 2, 2024
1 parent 3d1398e commit 1991550
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ This code is unaudited and under construction. This is experimental software and
2. Specify the files in `kzg.setup()` function, leave the `g2_points` empty, and specify the `srs_order` per the guide.
3. Note that this is process will take a few minutes to load since it is a bit intensive.

## Clippy
Linting can be triggered via running `cargo clippy --all --manifest-path Cargo.toml -- -D warnings`.

## Quick Start

1. Check the test in `test_compute_kzg_proof` function to see the end to end usage of the library for quick start.
Expand Down
25 changes: 10 additions & 15 deletions src/kzg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,12 @@ impl Kzg {
let g1_points =
Self::parallel_read_g1_points(path_to_g1_points.to_owned(), srs_points_to_load)
.map_err(|e| KzgError::SerializationError(e.to_string()))?;

let g2_points: Vec<G2Affine>;
if !path_to_g2_points.is_empty() {
g2_points =
Self::parallel_read_g2_points(path_to_g2_points.to_owned(), srs_points_to_load)
.map_err(|e| KzgError::SerializationError(e.to_string()))?;
} else if !g2_power_of2_path.is_empty() {
g2_points = Self::read_g2_point_on_power_of_2(g2_power_of2_path)?;
} else {
return Err(KzgError::GenericError(

let g2_points_result: Result<Vec<G2Affine>, KzgError> = match (path_to_g2_points.is_empty(), g2_power_of2_path.is_empty()) {
(false, _) => Self::parallel_read_g2_points(path_to_g2_points.to_owned(), srs_points_to_load)
.map_err(|e| KzgError::SerializationError(e.to_string())),
(_, false) => Self::read_g2_point_on_power_of_2(g2_power_of2_path),
(true, true) => return Err(KzgError::GenericError(
"both g2 point files are empty, need the proper file specified".to_string(),
)),
};
Expand Down Expand Up @@ -525,10 +521,10 @@ impl Kzg {
roots_of_unities: &[Fr],
) -> Fr {
let mut quotient = Fr::zero();
let mut fi: Fr;
let mut numerator: Fr;
let mut denominator: Fr;
let mut temp: Fr;
let mut fi: Fr = Fr::zero();
let mut numerator: Fr = Fr::zero();
let mut denominator: Fr = Fr::zero();
let mut temp: Fr = Fr::zero();

roots_of_unities.iter().enumerate().for_each(|(i, omega_i)| {
if *omega_i == z_fr {
Expand All @@ -540,7 +536,6 @@ impl Kzg {
denominator *= z_fr;
temp = numerator.div(denominator);
quotient += temp;

});

quotient
Expand Down

0 comments on commit 1991550

Please sign in to comment.