diff --git a/src/circuit/gadget/ecc.rs b/src/circuit/gadget/ecc.rs index a84dbf9e..55293a9b 100644 --- a/src/circuit/gadget/ecc.rs +++ b/src/circuit/gadget/ecc.rs @@ -9,12 +9,12 @@ use halo2::{ plonk::Error, }; -use crate::circuit::gadget::utilities::CellValue; +use crate::circuit::gadget::utilities::UtilitiesInstructions; pub mod chip; /// The set of circuit instructions required to use the ECC gadgets. -pub trait EccInstructions: Chip { +pub trait EccInstructions: Chip + UtilitiesInstructions { /// Variable representing an element of the elliptic curve's base field, that /// is used as a scalar in variable-base scalar mul. /// @@ -137,7 +137,7 @@ pub trait EccInstructions: Chip { fn mul_fixed_base_field_elem( &self, layouter: &mut impl Layouter, - base_field_elem: CellValue, + base_field_elem: Self::Var, base: &Self::FixedPoints, ) -> Result; } @@ -369,7 +369,7 @@ where pub fn mul_base_field_elem( &self, mut layouter: impl Layouter, - by: CellValue, + by: EccChip::Var, ) -> Result, Error> { self.chip .mul_fixed_base_field_elem(&mut layouter, by, &self.inner) diff --git a/src/circuit/gadget/ecc/chip.rs b/src/circuit/gadget/ecc/chip.rs index 7ce4453b..5dde03d6 100644 --- a/src/circuit/gadget/ecc/chip.rs +++ b/src/circuit/gadget/ecc/chip.rs @@ -2,7 +2,7 @@ use super::EccInstructions; use crate::{ circuit::gadget::utilities::{ copy, decompose_running_sum::RunningSumConfig, lookup_range_check::LookupRangeCheckConfig, - CellValue, Var, + CellValue, UtilitiesInstructions, Var, }, constants::{self, OrchardFixedBasesFull, ValueCommitV}, primitives::sinsemilla, @@ -159,6 +159,10 @@ impl Chip for EccChip { } } +impl UtilitiesInstructions for EccChip { + type Var = CellValue; +} + impl EccChip { pub fn construct(config: >::Config) -> Self { Self { config } diff --git a/src/circuit/gadget/ecc/chip/mul_fixed/base_field_elem.rs b/src/circuit/gadget/ecc/chip/mul_fixed/base_field_elem.rs index 1e366ee5..55846070 100644 --- a/src/circuit/gadget/ecc/chip/mul_fixed/base_field_elem.rs +++ b/src/circuit/gadget/ecc/chip/mul_fixed/base_field_elem.rs @@ -426,7 +426,7 @@ pub mod tests { chip::{EccChip, OrchardFixedBasesFull}, FixedPoint, Point, }, - utilities::{CellValue, UtilitiesInstructions}, + utilities::UtilitiesInstructions, }; use crate::constants; @@ -434,10 +434,6 @@ pub mod tests { chip: EccChip, mut layouter: impl Layouter, ) -> Result<(), Error> { - impl UtilitiesInstructions for EccChip { - type Var = CellValue; - } - // commit_ivk_r let commit_ivk_r = OrchardFixedBasesFull::CommitIvkR; test_single_base(