diff --git a/Cargo.toml b/Cargo.toml index 458f57fbe9..39b4e8c24b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,3 +7,4 @@ members = [ "halo2_backend", "halo2_common", ] +resolver = "2" \ No newline at end of file diff --git a/halo2_backend/Cargo.toml b/halo2_backend/Cargo.toml index 807436a131..e443c953dc 100644 --- a/halo2_backend/Cargo.toml +++ b/halo2_backend/Cargo.toml @@ -48,7 +48,7 @@ proptest = "1" rand_core = { version = "0.6", default-features = false, features = ["getrandom"] } serde_json = "1" -[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dev-dependencies] +[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies] getrandom = { version = "0.2", features = ["js"] } [features] diff --git a/halo2_common/src/arithmetic.rs b/halo2_backend/src/arithmetic.rs similarity index 99% rename from halo2_common/src/arithmetic.rs rename to halo2_backend/src/arithmetic.rs index d6b546e852..876856c05c 100644 --- a/halo2_common/src/arithmetic.rs +++ b/halo2_backend/src/arithmetic.rs @@ -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}; @@ -89,7 +89,7 @@ fn multiexp_serial(coeffs: &[C::Scalar], bases: &[C], acc: &mut other += a; other } - Bucket::Projective(a) => other + &a, + Bucket::Projective(a) => other + a, } } } @@ -531,7 +531,7 @@ pub fn powers(base: F) -> impl Iterator { use rand_core::OsRng; #[cfg(test)] -use crate::halo2curves::pasta::Fp; +use halo2curves::pasta::Fp; #[test] fn test_lagrange_interpolate() { diff --git a/halo2_backend/src/lib.rs b/halo2_backend/src/lib.rs index 4183e6425b..6a60c32919 100644 --- a/halo2_backend/src/lib.rs +++ b/halo2_backend/src/lib.rs @@ -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; diff --git a/halo2_backend/src/plonk.rs b/halo2_backend/src/plonk.rs index 9a170834cd..a88c8763a3 100644 --- a/halo2_backend/src/plonk.rs +++ b/halo2_backend/src/plonk.rs @@ -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, @@ -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; diff --git a/halo2_backend/src/plonk/prover.rs b/halo2_backend/src/plonk/prover.rs index f6c3cc695d..82ad9cdc47 100644 --- a/halo2_backend/src/plonk/prover.rs +++ b/halo2_backend/src/plonk/prover.rs @@ -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; @@ -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. diff --git a/halo2_common/Cargo.toml b/halo2_common/Cargo.toml index 4f60dbfa11..a4442a6423 100644 --- a/halo2_common/Cargo.toml +++ b/halo2_common/Cargo.toml @@ -44,7 +44,7 @@ proptest = "1" rand_core = { version = "0.6", default-features = false, features = ["getrandom"] } serde_json = "1" -[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dev-dependencies] +[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies] getrandom = { version = "0.2", features = ["js"] } [features] diff --git a/halo2_common/src/lib.rs b/halo2_common/src/lib.rs index 8bd60e0f49..6e0a149bef 100644 --- a/halo2_common/src/lib.rs +++ b/halo2_common/src/lib.rs @@ -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; diff --git a/halo2_common/src/plonk.rs b/halo2_common/src/plonk.rs index e58952346a..01f9177203 100644 --- a/halo2_common/src/plonk.rs +++ b/halo2_common/src/plonk.rs @@ -5,7 +5,6 @@ //! [halo]: https://eprint.iacr.org/2019/1021 //! [plonk]: https://eprint.iacr.org/2019/953 -use crate::plonk::circuit::Column; use crate::transcript::ChallengeScalar; use halo2_middleware::circuit::{Advice, Fixed, Instance}; use halo2_middleware::ff::Field; diff --git a/halo2_frontend/Cargo.toml b/halo2_frontend/Cargo.toml index 6a35d66652..9924479feb 100644 --- a/halo2_frontend/Cargo.toml +++ b/halo2_frontend/Cargo.toml @@ -45,7 +45,7 @@ proptest = "1" rand_core = { version = "0.6", default-features = false, features = ["getrandom"] } serde_json = "1" -[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dev-dependencies] +[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies] getrandom = { version = "0.2", features = ["js"] } [features] diff --git a/halo2_frontend/src/circuit.rs b/halo2_frontend/src/circuit.rs index 18a8f917a7..03c5d56697 100644 --- a/halo2_frontend/src/circuit.rs +++ b/halo2_frontend/src/circuit.rs @@ -76,7 +76,7 @@ pub fn compile_circuit>( let selectors = std::mem::take(&mut assembly.selectors); cs.directly_convert_selectors_to_fixed(selectors) }; - fixed.extend(selector_polys.into_iter()); + fixed.extend(selector_polys); let preprocessing = PreprocessingV2 { permutation: halo2_middleware::permutation::AssemblyMid { diff --git a/halo2_frontend/src/circuit/floor_planner.rs b/halo2_frontend/src/circuit/floor_planner.rs index cd63de8a67..9ad3df1a15 100644 --- a/halo2_frontend/src/circuit/floor_planner.rs +++ b/halo2_frontend/src/circuit/floor_planner.rs @@ -1,4 +1,4 @@ -mod single_pass; -mod v1; +pub mod single_pass; +pub mod v1; pub use halo2_common::circuit::floor_planner::*; diff --git a/halo2_middleware/Cargo.toml b/halo2_middleware/Cargo.toml index 66ec0b5105..575c25dc8a 100644 --- a/halo2_middleware/Cargo.toml +++ b/halo2_middleware/Cargo.toml @@ -35,7 +35,7 @@ proptest = "1" group = "0.13" halo2curves = { version = "0.6.0", default-features = false } -[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dev-dependencies] +[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies] getrandom = { version = "0.2", features = ["js"] } [lib] diff --git a/halo2_proofs/Cargo.toml b/halo2_proofs/Cargo.toml index 8bf059790b..4df38b4187 100644 --- a/halo2_proofs/Cargo.toml +++ b/halo2_proofs/Cargo.toml @@ -70,7 +70,7 @@ proptest = "1" dhat = "0.3.2" serde_json = "1" -[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dev-dependencies] +[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies] getrandom = { version = "0.2", features = ["js"] } [features] diff --git a/halo2_proofs/src/lib.rs b/halo2_proofs/src/lib.rs index dbe5899cc2..4f72856a10 100644 --- a/halo2_proofs/src/lib.rs +++ b/halo2_proofs/src/lib.rs @@ -20,10 +20,10 @@ pub mod circuit { AssignedCell, Cell, Chip, Layouter, Region, SimpleFloorPlanner, Value, }; } -///! This module provides common utilities, traits and structures for group, -///! field and polynomial arithmetic. +/// 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, }; } diff --git a/halo2_proofs/tests/plonk_api.rs b/halo2_proofs/tests/plonk_api.rs index ef595811f9..c3e21112aa 100644 --- a/halo2_proofs/tests/plonk_api.rs +++ b/halo2_proofs/tests/plonk_api.rs @@ -622,7 +622,7 @@ fn plonk_api() { //panic!("{:#?}", pk.get_vk().pinned()); assert_eq!( format!("{:#?}", pk.get_vk().pinned()), - r#####"PinnedVerificationKey { + r#"PinnedVerificationKey { base_modulus: "0x40000000000000000000000000000000224698fc0994a8dd8c46eb2100000001", scalar_modulus: "0x40000000000000000000000000000000224698fc094cf91b992d30ed00000001", domain: PinnedEvaluationDomain { @@ -1015,7 +1015,7 @@ fn plonk_api() { (0x3d907e0591343bd285c2c846f3e871a6ac70d80ec29e9500b8cb57f544e60202, 0x1034e48df35830244cabea076be8a16d67d7896e27c6ac22b285d017105da9c3), ], }, -}"##### +}"# ); } } diff --git a/rust-toolchain b/rust-toolchain index 65ee095984..5e3a425662 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.67.0 +1.73.0