diff --git a/halo2_gadgets/src/ecc.rs b/halo2_gadgets/src/ecc.rs index 8cb9ce4d57..2e16b3d1a6 100644 --- a/halo2_gadgets/src/ecc.rs +++ b/halo2_gadgets/src/ecc.rs @@ -231,7 +231,7 @@ impl> ScalarFixed { #[derive(Debug)] pub struct ScalarFixedShort> { chip: EccChip, - pub(crate) inner: EccChip::ScalarFixedShort, + inner: EccChip::ScalarFixedShort, } impl> ScalarFixedShort { @@ -375,8 +375,8 @@ impl + Clone + Debug + Eq> /// A point on a specific elliptic curve. #[derive(Copy, Clone, Debug)] pub struct Point + Clone + Debug + Eq> { - pub(crate) chip: EccChip, - pub(crate) inner: EccChip::Point, + chip: EccChip, + inner: EccChip::Point, } impl + Clone + Debug + Eq> Point { diff --git a/halo2_gadgets/src/ecc/chip.rs b/halo2_gadgets/src/ecc/chip.rs index c27a34ca6b..7133bdfd78 100644 --- a/halo2_gadgets/src/ecc/chip.rs +++ b/halo2_gadgets/src/ecc/chip.rs @@ -14,12 +14,12 @@ use pasta_curves::{arithmetic::CurveAffine, pallas}; use std::convert::TryInto; -pub(crate) mod add; -pub(crate) mod add_incomplete; +pub(super) mod add; +pub(super) mod add_incomplete; pub mod constants; -pub(crate) mod mul; -pub(crate) mod mul_fixed; -pub(crate) mod witness_point; +pub(super) mod mul; +pub(super) mod mul_fixed; +pub(super) mod witness_point; pub use constants::*; @@ -34,11 +34,11 @@ pub struct EccPoint { /// x-coordinate /// /// Stored as an `Assigned` to enable batching inversions. - pub(crate) x: AssignedCell, pallas::Base>, + x: AssignedCell, pallas::Base>, /// y-coordinate /// /// Stored as an `Assigned` to enable batching inversions. - pub(crate) y: AssignedCell, pallas::Base>, + y: AssignedCell, pallas::Base>, } impl EccPoint { @@ -153,12 +153,12 @@ pub struct EccConfig< /// Fixed-base full-width scalar multiplication mul_fixed_full: mul_fixed::full_width::Config, /// Fixed-base signed short scalar multiplication - pub(crate) mul_fixed_short: mul_fixed::short::Config, + mul_fixed_short: mul_fixed::short::Config, /// Fixed-base mul using a base field element as a scalar mul_fixed_base_field: mul_fixed::base_field_elem::Config, /// Witness point - pub(crate) witness_point: witness_point::Config, + witness_point: witness_point::Config, /// Lookup range check using 10-bit lookup table pub lookup_config: Lookup, @@ -345,7 +345,7 @@ pub struct EccScalarFixed { type MagnitudeCell = AssignedCell; // TODO: Make V an enum Sign { Positive, Negative } type SignCell = AssignedCell; -pub(crate) type MagnitudeSign = (MagnitudeCell, SignCell); +type MagnitudeSign = (MagnitudeCell, SignCell); /// A signed short scalar used for fixed-base scalar multiplication. /// A short scalar must have magnitude in the range [0..2^64), with diff --git a/halo2_gadgets/src/ecc/chip/mul.rs b/halo2_gadgets/src/ecc/chip/mul.rs index a67b77b0e8..02d2e2d805 100644 --- a/halo2_gadgets/src/ecc/chip/mul.rs +++ b/halo2_gadgets/src/ecc/chip/mul.rs @@ -62,7 +62,7 @@ pub struct Config { } impl Config { - pub(crate) fn configure( + pub(super) fn configure( meta: &mut ConstraintSystem, add_config: add::Config, lookup_config: Lookup, @@ -460,6 +460,7 @@ pub mod tests { ff::{Field, PrimeField}, Curve, }; + use halo2_proofs::circuit::Chip; use halo2_proofs::{ circuit::{Layouter, Value}, plonk::Error, @@ -483,7 +484,7 @@ pub mod tests { p: &NonIdentityPoint>, p_val: pallas::Affine, ) -> Result<(), Error> { - let column = chip.config.advices[0]; + let column = chip.config().advices[0]; fn constrain_equal_non_id< EccChip: EccInstructions + Clone + Eq + std::fmt::Debug, diff --git a/halo2_gadgets/src/ecc/chip/mul_fixed.rs b/halo2_gadgets/src/ecc/chip/mul_fixed.rs index 686cb6203e..d0781056b8 100644 --- a/halo2_gadgets/src/ecc/chip/mul_fixed.rs +++ b/halo2_gadgets/src/ecc/chip/mul_fixed.rs @@ -41,11 +41,11 @@ pub struct Config> { fixed_z: Column, // Decomposition of an `n-1`-bit scalar into `k`-bit windows: // a = a_0 + 2^k(a_1) + 2^{2k}(a_2) + ... + 2^{(n-1)k}(a_{n-1}) - pub(crate) window: Column, + window: Column, // y-coordinate of accumulator (only used in the final row). - pub(crate) u: Column, + u: Column, // Configuration for `add` - pub(crate) add_config: add::Config, + add_config: add::Config, // Configuration for `add_incomplete` add_incomplete_config: add_incomplete::Config, _marker: PhantomData, diff --git a/halo2_gadgets/src/ecc/chip/mul_fixed/short.rs b/halo2_gadgets/src/ecc/chip/mul_fixed/short.rs index 48a1cbf88a..acbba7cc3a 100644 --- a/halo2_gadgets/src/ecc/chip/mul_fixed/short.rs +++ b/halo2_gadgets/src/ecc/chip/mul_fixed/short.rs @@ -13,8 +13,8 @@ use pasta_curves::pallas; #[derive(Clone, Debug, Eq, PartialEq)] pub struct Config> { // Selector used for fixed-base scalar mul with short signed exponent. - pub(crate) q_mul_fixed_short: Selector, - pub(crate) super_config: super::Config, + q_mul_fixed_short: Selector, + super_config: super::Config, } impl> Config { @@ -401,8 +401,6 @@ pub mod tests { Ok(()) } - // todo: fixit - #[test] fn invalid_magnitude_sign() { use crate::{ diff --git a/halo2_gadgets/src/ecc/chip/witness_point.rs b/halo2_gadgets/src/ecc/chip/witness_point.rs index 580a07ca1d..7cba8d6f87 100644 --- a/halo2_gadgets/src/ecc/chip/witness_point.rs +++ b/halo2_gadgets/src/ecc/chip/witness_point.rs @@ -12,14 +12,14 @@ use halo2_proofs::{ }; use pasta_curves::{arithmetic::CurveAffine, pallas}; -pub(crate) type Coordinates = ( +type Coordinates = ( AssignedCell, pallas::Base>, AssignedCell, pallas::Base>, ); #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub struct Config { - pub(crate) q_point: Selector, + q_point: Selector, q_point_non_id: Selector, // x-coordinate pub x: Column,