Struct halo2_gadgets::ecc::chip::EccChip
source · pub struct EccChip<FixedPoints: FixedPoints<Affine>> { /* private fields */ }
Expand description
An EccInstructions
chip that uses 10 advice columns.
Implementations§
source§impl<FixedPoints: FixedPoints<Affine>> EccChip<FixedPoints>
impl<FixedPoints: FixedPoints<Affine>> EccChip<FixedPoints>
sourcepub fn construct(config: <Self as Chip<Base>>::Config) -> Self
pub fn construct(config: <Self as Chip<Base>>::Config) -> Self
Reconstructs this chip from the given config.
sourcepub fn configure(
meta: &mut ConstraintSystem<Base>,
advices: [Column<Advice>; 10],
lagrange_coeffs: [Column<Fixed>; 8],
range_check: LookupRangeCheckConfig<Base, { sinsemilla::K }>
) -> <Self as Chip<Base>>::Config
pub fn configure( meta: &mut ConstraintSystem<Base>, advices: [Column<Advice>; 10], lagrange_coeffs: [Column<Fixed>; 8], range_check: LookupRangeCheckConfig<Base, { sinsemilla::K }> ) -> <Self as Chip<Base>>::Config
Side effects
All columns in advices
will be equality-enabled.
Trait Implementations§
source§impl<Fixed: FixedPoints<Affine>> BaseFitsInScalarInstructions<EpAffine> for EccChip<Fixed>where
<Fixed as FixedPoints<Affine>>::Base: FixedPoint<Affine, FixedScalarKind = BaseFieldElem>,
<Fixed as FixedPoints<Affine>>::FullScalar: FixedPoint<Affine, FixedScalarKind = FullScalar>,
<Fixed as FixedPoints<Affine>>::ShortScalar: FixedPoint<Affine, FixedScalarKind = ShortScalar>,
impl<Fixed: FixedPoints<Affine>> BaseFitsInScalarInstructions<EpAffine> for EccChip<Fixed>where <Fixed as FixedPoints<Affine>>::Base: FixedPoint<Affine, FixedScalarKind = BaseFieldElem>, <Fixed as FixedPoints<Affine>>::FullScalar: FixedPoint<Affine, FixedScalarKind = FullScalar>, <Fixed as FixedPoints<Affine>>::ShortScalar: FixedPoint<Affine, FixedScalarKind = ShortScalar>,
source§impl<FixedPoints: FixedPoints<Affine>> Chip<Fp> for EccChip<FixedPoints>
impl<FixedPoints: FixedPoints<Affine>> Chip<Fp> for EccChip<FixedPoints>
§type Config = EccConfig<FixedPoints>
type Config = EccConfig<FixedPoints>
A type that holds the configuration for this chip, and any other state it may need
during circuit synthesis, that can be derived during
Circuit::configure
.§type Loaded = ()
type Loaded = ()
A type that holds any general chip state that needs to be loaded at the start of
Circuit::synthesize
. This might simply be ()
for some chips.source§impl<Fixed: FixedPoints<Affine>> EccInstructions<EpAffine> for EccChip<Fixed>where
<Fixed as FixedPoints<Affine>>::Base: FixedPoint<Affine, FixedScalarKind = BaseFieldElem>,
<Fixed as FixedPoints<Affine>>::FullScalar: FixedPoint<Affine, FixedScalarKind = FullScalar>,
<Fixed as FixedPoints<Affine>>::ShortScalar: FixedPoint<Affine, FixedScalarKind = ShortScalar>,
impl<Fixed: FixedPoints<Affine>> EccInstructions<EpAffine> for EccChip<Fixed>where <Fixed as FixedPoints<Affine>>::Base: FixedPoint<Affine, FixedScalarKind = BaseFieldElem>, <Fixed as FixedPoints<Affine>>::FullScalar: FixedPoint<Affine, FixedScalarKind = FullScalar>, <Fixed as FixedPoints<Affine>>::ShortScalar: FixedPoint<Affine, FixedScalarKind = ShortScalar>,
§type ScalarFixed = EccScalarFixed
type ScalarFixed = EccScalarFixed
Variable representing a full-width element of the elliptic curve’s
scalar field, to be used for fixed-base scalar mul.
§type ScalarFixedShort = EccScalarFixedShort
type ScalarFixedShort = EccScalarFixedShort
Variable representing a signed short element of the elliptic curve’s
scalar field, to be used for fixed-base scalar mul. Read more
§type ScalarVar = ScalarVar
type ScalarVar = ScalarVar
Variable representing a scalar used in variable-base scalar mul. Read more
§type NonIdentityPoint = NonIdentityEccPoint
type NonIdentityPoint = NonIdentityEccPoint
Variable representing a non-identity elliptic curve point.
§type X = AssignedCell<Fp, Fp>
type X = AssignedCell<Fp, Fp>
Variable representing the affine short Weierstrass x-coordinate of an
elliptic curve point.
§type FixedPoints = Fixed
type FixedPoints = Fixed
Enumeration of the set of fixed bases to be used in scalar mul.
TODO: When associated consts can be used as const generics, introduce
Self::NUM_WINDOWS
, Self::NUM_WINDOWS_BASE_FIELD
, Self::NUM_WINDOWS_SHORT
and use them to differentiate FixedPoints
types.source§fn constrain_equal(
&self,
layouter: &mut impl Layouter<Base>,
a: &Self::Point,
b: &Self::Point
) -> Result<(), Error>
fn constrain_equal( &self, layouter: &mut impl Layouter<Base>, a: &Self::Point, b: &Self::Point ) -> Result<(), Error>
Constrains point
a
to be equal in value to point b
.source§fn witness_point(
&self,
layouter: &mut impl Layouter<Base>,
value: Value<Affine>
) -> Result<Self::Point, Error>
fn witness_point( &self, layouter: &mut impl Layouter<Base>, value: Value<Affine> ) -> Result<Self::Point, Error>
Witnesses the given point as a private input to the circuit.
This allows the point to be the identity, mapped to (0, 0) in
affine coordinates.
source§fn witness_point_non_id(
&self,
layouter: &mut impl Layouter<Base>,
value: Value<Affine>
) -> Result<Self::NonIdentityPoint, Error>
fn witness_point_non_id( &self, layouter: &mut impl Layouter<Base>, value: Value<Affine> ) -> Result<Self::NonIdentityPoint, Error>
Witnesses the given point as a private input to the circuit.
This returns an error if the point is the identity.
source§fn witness_scalar_var(
&self,
_layouter: &mut impl Layouter<Base>,
_value: Value<Scalar>
) -> Result<Self::ScalarVar, Error>
fn witness_scalar_var( &self, _layouter: &mut impl Layouter<Base>, _value: Value<Scalar> ) -> Result<Self::ScalarVar, Error>
Witnesses a full-width scalar to be used in variable-base multiplication.
source§fn witness_scalar_fixed(
&self,
_layouter: &mut impl Layouter<Base>,
value: Value<Scalar>
) -> Result<Self::ScalarFixed, Error>
fn witness_scalar_fixed( &self, _layouter: &mut impl Layouter<Base>, value: Value<Scalar> ) -> Result<Self::ScalarFixed, Error>
Witnesses a full-width scalar to be used in fixed-base multiplication.
source§fn scalar_fixed_from_signed_short(
&self,
_layouter: &mut impl Layouter<Base>,
(magnitude, sign): (AssignedCell<Base, Base>, AssignedCell<Base, Base>)
) -> Result<Self::ScalarFixedShort, Error>
fn scalar_fixed_from_signed_short( &self, _layouter: &mut impl Layouter<Base>, (magnitude, sign): (AssignedCell<Base, Base>, AssignedCell<Base, Base>) ) -> Result<Self::ScalarFixedShort, Error>
Converts a magnitude and sign that exists as variables in the circuit into a
signed short scalar to be used in fixed-base scalar multiplication.
source§fn extract_p<Point: Into<Self::Point> + Clone>(point: &Point) -> Self::X
fn extract_p<Point: Into<Self::Point> + Clone>(point: &Point) -> Self::X
Extracts the x-coordinate of a point.
source§fn add_incomplete(
&self,
layouter: &mut impl Layouter<Base>,
a: &Self::NonIdentityPoint,
b: &Self::NonIdentityPoint
) -> Result<Self::NonIdentityPoint, Error>
fn add_incomplete( &self, layouter: &mut impl Layouter<Base>, a: &Self::NonIdentityPoint, b: &Self::NonIdentityPoint ) -> Result<Self::NonIdentityPoint, Error>
Performs incomplete point addition, returning
a + b
. Read moresource§fn add<A: Into<Self::Point> + Clone, B: Into<Self::Point> + Clone>(
&self,
layouter: &mut impl Layouter<Base>,
a: &A,
b: &B
) -> Result<Self::Point, Error>
fn add<A: Into<Self::Point> + Clone, B: Into<Self::Point> + Clone>( &self, layouter: &mut impl Layouter<Base>, a: &A, b: &B ) -> Result<Self::Point, Error>
Performs complete point addition, returning
a + b
.source§fn mul(
&self,
layouter: &mut impl Layouter<Base>,
scalar: &Self::ScalarVar,
base: &Self::NonIdentityPoint
) -> Result<(Self::Point, Self::ScalarVar), Error>
fn mul( &self, layouter: &mut impl Layouter<Base>, scalar: &Self::ScalarVar, base: &Self::NonIdentityPoint ) -> Result<(Self::Point, Self::ScalarVar), Error>
Performs variable-base scalar multiplication, returning
[scalar] base
.source§fn mul_fixed(
&self,
layouter: &mut impl Layouter<Base>,
scalar: &Self::ScalarFixed,
base: &<Self::FixedPoints as FixedPoints<Affine>>::FullScalar
) -> Result<(Self::Point, Self::ScalarFixed), Error>
fn mul_fixed( &self, layouter: &mut impl Layouter<Base>, scalar: &Self::ScalarFixed, base: &<Self::FixedPoints as FixedPoints<Affine>>::FullScalar ) -> Result<(Self::Point, Self::ScalarFixed), Error>
Performs fixed-base scalar multiplication using a full-width scalar, returning
[scalar] base
.source§fn mul_fixed_short(
&self,
layouter: &mut impl Layouter<Base>,
scalar: &Self::ScalarFixedShort,
base: &<Self::FixedPoints as FixedPoints<Affine>>::ShortScalar
) -> Result<(Self::Point, Self::ScalarFixedShort), Error>
fn mul_fixed_short( &self, layouter: &mut impl Layouter<Base>, scalar: &Self::ScalarFixedShort, base: &<Self::FixedPoints as FixedPoints<Affine>>::ShortScalar ) -> Result<(Self::Point, Self::ScalarFixedShort), Error>
Performs fixed-base scalar multiplication using a short signed scalar, returning
[scalar] base
.source§fn mul_fixed_base_field_elem(
&self,
layouter: &mut impl Layouter<Base>,
base_field_elem: AssignedCell<Base, Base>,
base: &<Self::FixedPoints as FixedPoints<Affine>>::Base
) -> Result<Self::Point, Error>
fn mul_fixed_base_field_elem( &self, layouter: &mut impl Layouter<Base>, base_field_elem: AssignedCell<Base, Base>, base: &<Self::FixedPoints as FixedPoints<Affine>>::Base ) -> Result<Self::Point, Error>
Performs fixed-base scalar multiplication using a base field element as the scalar.
In the current implementation, this base field element must be output from another
instruction.
source§impl<FixedPoints: PartialEq + FixedPoints<Affine>> PartialEq<EccChip<FixedPoints>> for EccChip<FixedPoints>
impl<FixedPoints: PartialEq + FixedPoints<Affine>> PartialEq<EccChip<FixedPoints>> for EccChip<FixedPoints>
source§impl<Fixed: FixedPoints<Affine>> UtilitiesInstructions<Fp> for EccChip<Fixed>
impl<Fixed: FixedPoints<Affine>> UtilitiesInstructions<Fp> for EccChip<Fixed>
impl<FixedPoints: Eq + FixedPoints<Affine>> Eq for EccChip<FixedPoints>
impl<FixedPoints: FixedPoints<Affine>> StructuralEq for EccChip<FixedPoints>
impl<FixedPoints: FixedPoints<Affine>> StructuralPartialEq for EccChip<FixedPoints>
Auto Trait Implementations§
impl<FixedPoints> RefUnwindSafe for EccChip<FixedPoints>where FixedPoints: RefUnwindSafe,
impl<FixedPoints> Send for EccChip<FixedPoints>where FixedPoints: Send,
impl<FixedPoints> Sync for EccChip<FixedPoints>where FixedPoints: Sync,
impl<FixedPoints> Unpin for EccChip<FixedPoints>where FixedPoints: Unpin,
impl<FixedPoints> UnwindSafe for EccChip<FixedPoints>where FixedPoints: UnwindSafe,
Blanket Implementations§
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where Self: Binary,
Causes
self
to use its Binary
implementation when Debug
-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where Self: Display,
Causes
self
to use its Display
implementation when
Debug
-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where Self: LowerExp,
Causes
self
to use its LowerExp
implementation when
Debug
-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where Self: LowerHex,
Causes
self
to use its LowerHex
implementation when
Debug
-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where Self: Octal,
Causes
self
to use its Octal
implementation when Debug
-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where Self: Pointer,
Causes
self
to use its Pointer
implementation when
Debug
-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where Self: UpperExp,
Causes
self
to use its UpperExp
implementation when
Debug
-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where Self: UpperHex,
Causes
self
to use its UpperHex
implementation when
Debug
-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where &'a Self: for<'a> IntoIterator,
Formats each item in a sequence. Read more
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere R: 'a,
Borrows
self
and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere R: 'a,
Mutably borrows
self
and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere Self: Borrow<B>, B: 'a + ?Sized, R: 'a,
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R ) -> Rwhere Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere Self: AsRef<U>, U: 'a + ?Sized, R: 'a,
Borrows
self
, then passes self.as_ref()
into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere Self: AsMut<U>, U: 'a + ?Sized, R: 'a,
Mutably borrows
self
, then passes self.as_mut()
into the pipe
function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere Self: Borrow<B>, B: ?Sized,
Immutable access to the
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere Self: BorrowMut<B>, B: ?Sized,
Mutable access to the
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere Self: AsRef<R>, R: ?Sized,
Immutable access to the
AsRef<R>
view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere Self: AsMut<R>, R: ?Sized,
Mutable access to the
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere Self: Deref<Target = T>, T: ?Sized,
Immutable access to the
Deref::Target
of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere Self: DerefMut<Target = T> + Deref, T: ?Sized,
Mutable access to the
Deref::Target
of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap()
only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut()
only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere Self: Borrow<B>, B: ?Sized,
Calls
.tap_borrow()
only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere Self: BorrowMut<B>, B: ?Sized,
Calls
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere Self: AsRef<R>, R: ?Sized,
Calls
.tap_ref()
only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere Self: AsMut<R>, R: ?Sized,
Calls
.tap_ref_mut()
only in debug builds, and is erased in release
builds.