Skip to content
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

refactor: move the halo2_common::arithmetic to halo2_backend(post fe-be split) #281

Merged
merged 16 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
//! This module provides common utilities, traits and structures for group,
//! field and polynomial arithmetic.

use super::multicore;
use group::{
ff::{BatchInvert, PrimeField},
Curve, Group, GroupOpsOwned, ScalarMulOwned,
};
use halo2_common::multicore;
pub use halo2_middleware::ff::Field;

pub use halo2curves::{CurveAffine, CurveExt};
Expand Down Expand Up @@ -89,7 +89,7 @@ fn multiexp_serial<C: CurveAffine>(coeffs: &[C::Scalar], bases: &[C], acc: &mut
other += a;
other
}
Bucket::Projective(a) => other + &a,
Bucket::Projective(a) => other + a,
}
}
}
Expand Down Expand Up @@ -531,7 +531,7 @@ pub fn powers<F: Field>(base: F) -> impl Iterator<Item = F> {
use rand_core::OsRng;

#[cfg(test)]
use crate::halo2curves::pasta::Fp;
use halo2curves::pasta::Fp;

#[test]
fn test_lagrange_interpolate() {
Expand Down
2 changes: 1 addition & 1 deletion halo2_backend/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
pub mod arithmetic;
mod helpers;
pub mod plonk;
pub mod poly;

// Internal re-exports
pub use halo2_common::arithmetic;
pub use halo2_common::circuit;
pub use halo2_common::multicore;
pub use halo2_common::transcript;
Expand Down
2 changes: 1 addition & 1 deletion halo2_backend/src/plonk.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use blake2b_simd::Params as Blake2bParams;
use group::ff::{Field, FromUniformBytes, PrimeField};

use crate::arithmetic::CurveAffine;
use crate::helpers::{
self, polynomial_slice_byte_length, read_polynomial_vec, write_polynomial_slice,
SerdeCurveAffine, SerdePrimeField,
Expand All @@ -10,7 +11,6 @@ use crate::poly::{
Polynomial,
};
use evaluation::Evaluator;
use halo2_common::arithmetic::CurveAffine;
use halo2_common::plonk::{Circuit, ConstraintSystem, PinnedConstraintSystem};
use halo2_common::transcript::{EncodedChallenge, Transcript};
use halo2_common::SerdeFormat;
Expand Down
6 changes: 3 additions & 3 deletions halo2_backend/src/plonk/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use rand_core::RngCore;
use std::collections::{BTreeSet, HashSet};
use std::{collections::HashMap, iter};

use crate::arithmetic::{eval_polynomial, CurveAffine};
use crate::plonk::lookup::prover::lookup_commit_permuted;
use crate::plonk::permutation::prover::permutation_commit;
use crate::plonk::shuffle::prover::shuffle_commit_product;
Expand All @@ -12,12 +13,11 @@ use crate::poly::{
commitment::{Blind, CommitmentScheme, Params, Prover},
Basis, Coeff, LagrangeCoeff, Polynomial, ProverQuery,
};

use group::prime::PrimeCurveAffine;
use halo2_common::plonk::{
circuit::sealed, ChallengeBeta, ChallengeGamma, ChallengeTheta, ChallengeX, ChallengeY, Error,
};

use group::prime::PrimeCurveAffine;
use halo2_common::arithmetic::{eval_polynomial, CurveAffine};
use halo2_common::transcript::{EncodedChallenge, TranscriptWrite};

/// Collection of instance data used during proving for a single circuit proof.
Expand Down
1 change: 0 additions & 1 deletion halo2_common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#![deny(rustdoc::broken_intra_doc_links)]
#![deny(unsafe_code)]

pub mod arithmetic;
pub mod circuit;
pub use halo2curves;
pub mod multicore;
Expand Down
2 changes: 1 addition & 1 deletion halo2_proofs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub mod circuit {
///! This module provides common utilities, traits and structures for group,
///! field and polynomial arithmetic.
pub mod arithmetic {
pub use halo2_common::arithmetic::{
pub use halo2_backend::arithmetic::{
best_fft, parallelize, small_multiexp, CurveAffine, CurveExt, Field,
};
}
Expand Down
Loading