pub struct EccChip<FixedPoints: FixedPoints<Affine>> { /* private fields */ }
Expand description
An EccInstructions
chip that uses 10 advice columns.
Implementations
sourceimpl<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
sourceimpl<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>,
sourceimpl<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
. Read more
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. Read more
sourceimpl<FixedPoints: Clone + FixedPoints<Affine>> Clone for EccChip<FixedPoints>
impl<FixedPoints: Clone + FixedPoints<Affine>> Clone for EccChip<FixedPoints>
sourceimpl<FixedPoints: Debug + FixedPoints<Affine>> Debug for EccChip<FixedPoints>
impl<FixedPoints: Debug + FixedPoints<Affine>> Debug for EccChip<FixedPoints>
sourceimpl<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. Read more
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. Read more
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. Read more
sourcefn 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
.
sourcefn 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. Read more
sourcefn 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. Read more
sourcefn 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.
sourcefn 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.
sourcefn 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. Read more
sourcefn 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.
sourcefn 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 more
sourcefn 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
.
sourcefn 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
.
sourcefn 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
.
sourcefn 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
. Read more
sourcefn 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. Read more
sourceimpl<FixedPoints: PartialEq + FixedPoints<Affine>> PartialEq<EccChip<FixedPoints>> for EccChip<FixedPoints>
impl<FixedPoints: PartialEq + FixedPoints<Affine>> PartialEq<EccChip<FixedPoints>> for EccChip<FixedPoints>
sourceimpl<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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
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. Read more
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. Read more
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. Read more
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. Read more
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. Read more
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. Read more
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. Read more
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. Read more
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
impl<T> Pipe for T where
T: ?Sized,
impl<T> Pipe for T where
T: ?Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
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) -> R where
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R where
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) -> R where
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R where
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) -> R where
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R where
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
Borrows self
, then passes self.borrow()
into the pipe function. Read more
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> R where
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
) -> R where
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
Mutably borrows self
, then passes self.borrow_mut()
into the pipe
function. Read more
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R where
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R where
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) -> R where
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) -> R where
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
Mutably borrows self
, then passes self.as_mut()
into the pipe
function. Read more
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
Borrows self
, then passes self.deref()
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)) -> Self where
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self where
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)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self where
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)) -> Self where
Self: AsRef<R>,
R: ?Sized,
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self where
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)) -> Self where
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self where
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)) -> Self where
Self: Deref<Target = T>,
T: ?Sized,
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self where
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)) -> Self where
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self where
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. Read more
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
Calls .tap_borrow()
only in debug builds, and is erased in release
builds. Read more
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
Calls .tap_borrow_mut()
only in debug builds, and is erased in release
builds. Read more
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self where
Self: AsRef<R>,
R: ?Sized,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self where
Self: AsRef<R>,
R: ?Sized,
Calls .tap_ref()
only in debug builds, and is erased in release
builds. Read more
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
Calls .tap_ref_mut()
only in debug builds, and is erased in release
builds. Read more