Trait snarkvm_wasm::GroupGadget [−][src]
pub trait GroupGadget<G, F>: ToBytesGadget<F> + NEqGadget<F> + EqGadget<F> + ToBitsBEGadget<F> + CondSelectGadget<F> + AllocGadget<G, F> + Clone + Debug where
G: Group,
F: Field, { type Value: Debug; type Variable;}Show methods
fn get_value(&self) -> Option<Self::Value>; fn get_variable(&self) -> Self::Variable; fn zero<CS>(cs: CS) -> Result<Self, SynthesisError>
where
CS: ConstraintSystem<F>; fn add<CS>(&self, cs: CS, other: &Self) -> Result<Self, SynthesisError>
where
CS: ConstraintSystem<F>; fn add_constant<CS>(
&self,
cs: CS,
other: &G
) -> Result<Self, SynthesisError>
where
CS: ConstraintSystem<F>; fn double_in_place<CS>(&mut self, cs: CS) -> Result<(), SynthesisError>
where
CS: ConstraintSystem<F>; fn negate<CS>(&self, cs: CS) -> Result<Self, SynthesisError>
where
CS: ConstraintSystem<F>; fn cost_of_add() -> usize; fn cost_of_double() -> usize; fn sub<CS>(&self, cs: CS, other: &Self) -> Result<Self, SynthesisError>
where
CS: ConstraintSystem<F>, { ... } fn sub_constant<CS>(
&self,
cs: CS,
other: &G
) -> Result<Self, SynthesisError>
where
CS: ConstraintSystem<F>, { ... } fn mul_bits<CS>(
&self,
cs: CS,
result: &Self,
bits: impl Iterator<Item = Boolean>
) -> Result<Self, SynthesisError>
where
CS: ConstraintSystem<F>, { ... } fn scalar_multiplication<'a, CS, I, B>(
&mut self,
cs: CS,
scalar_bits_with_base_powers: I
) -> Result<(), SynthesisError>
where
CS: ConstraintSystem<F>,
B: Borrow<Boolean>,
G: 'a,
I: Iterator<Item = (B, &'a G)>, { ... } fn symmetric_scalar_multiplication<'a, CS, I, B>(
&mut self,
cs: CS,
scalar_bits_with_base_powers: I
) -> Result<(), SynthesisError>
where
CS: ConstraintSystem<F>,
B: Borrow<Boolean>,
G: 'a,
I: Iterator<Item = (B, &'a G)>, { ... } fn masked_scalar_multiplication<'a, CS, I, B>(
&mut self,
CS,
I,
I
) -> Result<(), SynthesisError>
where
CS: ConstraintSystem<F>,
B: Borrow<Boolean>,
G: 'a,
I: Iterator<Item = (B, &'a G)>, { ... } fn three_bit_signed_digit_scalar_multiplication<CS, I, J, K, B>(
CS,
&[B],
K
) -> Result<Self, SynthesisError>
where
CS: ConstraintSystem<F>,
B: Borrow<[G]>,
I: Borrow<[Boolean]>,
J: Iterator<Item = I>,
K: Iterator<Item = J>, { ... } fn multi_scalar_multiplication<'a, CS, T, I, B>(
cs: CS,
bases: &[B],
scalars: I
) -> Result<Self, SynthesisError>
where
CS: ConstraintSystem<F>,
B: Borrow<[G]>,
T: 'a + ToBitsBEGadget<F> + ?Sized,
I: Iterator<Item = &'a T>, { ... } fn symmetric_multi_scalar_multiplication<'a, CS, T, I, B>(
cs: CS,
bases: &[B],
scalars: I
) -> Result<Self, SynthesisError>
where
CS: ConstraintSystem<F>,
B: Borrow<[G]>,
T: 'a + ToBitsBEGadget<F> + ?Sized,
I: Iterator<Item = &'a T>, { ... } fn masked_multi_scalar_multiplication<'a, CS, T, I, B>(
cs: CS,
bases: &[B],
scalars: I,
mask_bases: &[B],
masks: I
) -> Result<Self, SynthesisError>
where
CS: ConstraintSystem<F>,
B: Borrow<[G]>,
T: 'a + ToBitsBEGadget<F> + ?Sized,
I: Iterator<Item = &'a T>, { ... }
Associated Types
Required methods
fn get_variable(&self) -> Self::Variable[src]fn zero<CS>(cs: CS) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>, [src]fn add<CS>(&self, cs: CS, other: &Self) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>, [src]fn add_constant<CS>(&self, cs: CS, other: &G) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>, [src]fn double_in_place<CS>(&mut self, cs: CS) -> Result<(), SynthesisError> where
CS: ConstraintSystem<F>, [src]fn negate<CS>(&self, cs: CS) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>, [src]fn cost_of_add() -> usize[src]fn cost_of_double() -> usize[src]Provided methods
fn sub<CS>(&self, cs: CS, other: &Self) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>, [src]fn sub_constant<CS>(&self, cs: CS, other: &G) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>, [src]fn mul_bits<CS>(
&self,
cs: CS,
result: &Self,
bits: impl Iterator<Item = Boolean>
) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>, [src]
fn mul_bits<CS>(
&self,
cs: CS,
result: &Self,
bits: impl Iterator<Item = Boolean>
) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>, [src]Inputs must be specified in little-endian form.
If the addition law is incomplete for the identity element,
result must not be the identity element.
fn scalar_multiplication<'a, CS, I, B>(
&mut self,
cs: CS,
scalar_bits_with_base_powers: I
) -> Result<(), SynthesisError> where
CS: ConstraintSystem<F>,
B: Borrow<Boolean>,
G: 'a,
I: Iterator<Item = (B, &'a G)>, [src]fn symmetric_scalar_multiplication<'a, CS, I, B>(
&mut self,
cs: CS,
scalar_bits_with_base_powers: I
) -> Result<(), SynthesisError> where
CS: ConstraintSystem<F>,
B: Borrow<Boolean>,
G: 'a,
I: Iterator<Item = (B, &'a G)>, [src]fn masked_scalar_multiplication<'a, CS, I, B>(
&mut self,
CS,
I,
I
) -> Result<(), SynthesisError> where
CS: ConstraintSystem<F>,
B: Borrow<Boolean>,
G: 'a,
I: Iterator<Item = (B, &'a G)>, [src]fn three_bit_signed_digit_scalar_multiplication<CS, I, J, K, B>(
CS,
&[B],
K
) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
B: Borrow<[G]>,
I: Borrow<[Boolean]>,
J: Iterator<Item = I>,
K: Iterator<Item = J>, [src]fn multi_scalar_multiplication<'a, CS, T, I, B>(
cs: CS,
bases: &[B],
scalars: I
) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
B: Borrow<[G]>,
T: 'a + ToBitsBEGadget<F> + ?Sized,
I: Iterator<Item = &'a T>, [src]
fn multi_scalar_multiplication<'a, CS, T, I, B>(
cs: CS,
bases: &[B],
scalars: I
) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
B: Borrow<[G]>,
T: 'a + ToBitsBEGadget<F> + ?Sized,
I: Iterator<Item = &'a T>, [src]Computes Σⱼ(scalarⱼ * baseⱼ) for all j,
where scalarⱼ is a Boolean representation of the j-th scalar.
fn symmetric_multi_scalar_multiplication<'a, CS, T, I, B>(
cs: CS,
bases: &[B],
scalars: I
) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
B: Borrow<[G]>,
T: 'a + ToBitsBEGadget<F> + ?Sized,
I: Iterator<Item = &'a T>, [src]fn masked_multi_scalar_multiplication<'a, CS, T, I, B>(
cs: CS,
bases: &[B],
scalars: I,
mask_bases: &[B],
masks: I
) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
B: Borrow<[G]>,
T: 'a + ToBitsBEGadget<F> + ?Sized,
I: Iterator<Item = &'a T>, [src]
fn masked_multi_scalar_multiplication<'a, CS, T, I, B>(
cs: CS,
bases: &[B],
scalars: I,
mask_bases: &[B],
masks: I
) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
B: Borrow<[G]>,
T: 'a + ToBitsBEGadget<F> + ?Sized,
I: Iterator<Item = &'a T>, [src]Compute ∏((h_i^{-1} * 1[p_i = 0] + h_i * 1[p_i = 1])^{1 - m_i \xor p_i})((g_i h_i^{-1} * 1[p_i = 0] + g_i^{-1} h_i * 1[p_i = 1])^{m_i \xor p_i}) for all i, m_i being the scalars, p_i being the masks, h_i being the symmetric Pedersen bases and g_i the Pedersen bases.
Implementors
impl<P, F, FG> GroupGadget<GroupProjective<P>, F> for snarkvm_wasm::curves::templates::bls12::AffineGadget<P, F, FG> where
P: SWModelParameters,
F: PrimeField,
FG: FieldGadget<<P as ModelParameters>::BaseField, F>, [src]
impl<P, F, FG> GroupGadget<GroupProjective<P>, F> for snarkvm_wasm::curves::templates::bls12::AffineGadget<P, F, FG> where
P: SWModelParameters,
F: PrimeField,
FG: FieldGadget<<P as ModelParameters>::BaseField, F>, [src]pub fn add<CS>(
&self,
cs: CS,
other: &AffineGadget<P, F, FG>
) -> Result<AffineGadget<P, F, FG>, SynthesisError> where
CS: ConstraintSystem<F>, [src]
pub fn add<CS>(
&self,
cs: CS,
other: &AffineGadget<P, F, FG>
) -> Result<AffineGadget<P, F, FG>, SynthesisError> where
CS: ConstraintSystem<F>, [src]Incomplete addition: neither self nor other can be the neutral
element.
pub fn add_constant<CS>(
&self,
cs: CS,
other: &GroupProjective<P>
) -> Result<AffineGadget<P, F, FG>, SynthesisError> where
CS: ConstraintSystem<F>, [src]
pub fn add_constant<CS>(
&self,
cs: CS,
other: &GroupProjective<P>
) -> Result<AffineGadget<P, F, FG>, SynthesisError> where
CS: ConstraintSystem<F>, [src]Incomplete addition: neither self nor other can be the neutral
element.
type Value = GroupProjective<P>type Variable = (<FG as FieldGadget<<P as ModelParameters>::BaseField, F>>::Variable, <FG as FieldGadget<<P as ModelParameters>::BaseField, F>>::Variable)pub fn get_value(
&self
) -> Option<<AffineGadget<P, F, FG> as GroupGadget<GroupProjective<P>, F>>::Value>[src]pub fn get_variable(
&self
) -> <AffineGadget<P, F, FG> as GroupGadget<GroupProjective<P>, F>>::Variable[src]pub fn zero<CS>(cs: CS) -> Result<AffineGadget<P, F, FG>, SynthesisError> where
CS: ConstraintSystem<F>, [src]pub fn double_in_place<CS>(&mut self, cs: CS) -> Result<(), SynthesisError> where
CS: ConstraintSystem<F>, [src]pub fn negate<CS>(
&self,
cs: CS
) -> Result<AffineGadget<P, F, FG>, SynthesisError> where
CS: ConstraintSystem<F>, [src]impl<P, F, FG> GroupGadget<GroupAffine<P>, F> for snarkvm_wasm::curves::templates::twisted_edwards::AffineGadget<P, F, FG> where
P: TEModelParameters,
F: Field,
FG: FieldGadget<<P as ModelParameters>::BaseField, F>, [src]
impl<P, F, FG> GroupGadget<GroupAffine<P>, F> for snarkvm_wasm::curves::templates::twisted_edwards::AffineGadget<P, F, FG> where
P: TEModelParameters,
F: Field,
FG: FieldGadget<<P as ModelParameters>::BaseField, F>, [src]pub fn add<CS>(
&self,
cs: CS,
other: &AffineGadget<P, F, FG>
) -> Result<AffineGadget<P, F, FG>, SynthesisError> where
CS: ConstraintSystem<F>, [src]
pub fn add<CS>(
&self,
cs: CS,
other: &AffineGadget<P, F, FG>
) -> Result<AffineGadget<P, F, FG>, SynthesisError> where
CS: ConstraintSystem<F>, [src]Optimized constraints for checking Edwards point addition from ZCash developers Daira Hopwood and Sean Bowe. Requires only 6 constraints compared to 7 for the straightforward version we had earlier.
type Value = GroupAffine<P>type Variable = (<FG as FieldGadget<<P as ModelParameters>::BaseField, F>>::Variable, <FG as FieldGadget<<P as ModelParameters>::BaseField, F>>::Variable)pub fn get_value(
&self
) -> Option<<AffineGadget<P, F, FG> as GroupGadget<GroupAffine<P>, F>>::Value>[src]pub fn get_variable(
&self
) -> <AffineGadget<P, F, FG> as GroupGadget<GroupAffine<P>, F>>::Variable[src]pub fn zero<CS>(cs: CS) -> Result<AffineGadget<P, F, FG>, SynthesisError> where
CS: ConstraintSystem<F>, [src]pub fn add_constant<CS>(
&self,
cs: CS,
other: &GroupAffine<P>
) -> Result<AffineGadget<P, F, FG>, SynthesisError> where
CS: ConstraintSystem<F>, [src]pub fn double_in_place<CS>(&mut self, cs: CS) -> Result<(), SynthesisError> where
CS: ConstraintSystem<F>, [src]pub fn negate<CS>(
&self,
cs: CS
) -> Result<AffineGadget<P, F, FG>, SynthesisError> where
CS: ConstraintSystem<F>, [src]impl<P, F, FG> GroupGadget<GroupProjective<P>, F> for snarkvm_wasm::curves::templates::twisted_edwards::AffineGadget<P, F, FG> where
P: TEModelParameters,
F: Field,
FG: FieldGadget<<P as ModelParameters>::BaseField, F>, [src]
impl<P, F, FG> GroupGadget<GroupProjective<P>, F> for snarkvm_wasm::curves::templates::twisted_edwards::AffineGadget<P, F, FG> where
P: TEModelParameters,
F: Field,
FG: FieldGadget<<P as ModelParameters>::BaseField, F>, [src]pub fn add<CS>(
&self,
cs: CS,
other: &AffineGadget<P, F, FG>
) -> Result<AffineGadget<P, F, FG>, SynthesisError> where
CS: ConstraintSystem<F>, [src]
pub fn add<CS>(
&self,
cs: CS,
other: &AffineGadget<P, F, FG>
) -> Result<AffineGadget<P, F, FG>, SynthesisError> where
CS: ConstraintSystem<F>, [src]Optimized constraints for checking Edwards point addition from ZCash developers Daira Hopwood and Sean Bowe. Requires only 6 constraints compared to 7 for the straightforward version we had earlier.
type Value = GroupProjective<P>type Variable = (<FG as FieldGadget<<P as ModelParameters>::BaseField, F>>::Variable, <FG as FieldGadget<<P as ModelParameters>::BaseField, F>>::Variable)pub fn get_value(
&self
) -> Option<<AffineGadget<P, F, FG> as GroupGadget<GroupProjective<P>, F>>::Value>[src]pub fn get_variable(
&self
) -> <AffineGadget<P, F, FG> as GroupGadget<GroupProjective<P>, F>>::Variable[src]pub fn zero<CS>(cs: CS) -> Result<AffineGadget<P, F, FG>, SynthesisError> where
CS: ConstraintSystem<F>, [src]pub fn add_constant<CS>(
&self,
cs: CS,
other: &GroupProjective<P>
) -> Result<AffineGadget<P, F, FG>, SynthesisError> where
CS: ConstraintSystem<F>, [src]pub fn double_in_place<CS>(&mut self, cs: CS) -> Result<(), SynthesisError> where
CS: ConstraintSystem<F>, [src]pub fn negate<CS>(
&self,
cs: CS
) -> Result<AffineGadget<P, F, FG>, SynthesisError> where
CS: ConstraintSystem<F>, [src]pub fn scalar_multiplication<'a, CS, I, B>(
&mut self,
cs: CS,
scalar_bits_with_base_powers: I
) -> Result<(), SynthesisError> where
CS: ConstraintSystem<F>,
B: Borrow<Boolean>,
I: Iterator<Item = (B, &'a GroupProjective<P>)>, [src]pub fn symmetric_scalar_multiplication<'a, CS, I, B>(
&mut self,
cs: CS,
scalar_bits_with_base_powers: I
) -> Result<(), SynthesisError> where
CS: ConstraintSystem<F>,
B: Borrow<Boolean>,
I: Iterator<Item = (B, &'a GroupProjective<P>)>, [src]pub fn masked_scalar_multiplication<'a, CS, I, B>(
&mut self,
cs: CS,
scalar_bits_with_base_powers: I,
mask_bits_with_mask_powers: I
) -> Result<(), SynthesisError> where
CS: ConstraintSystem<F>,
B: Borrow<Boolean>,
I: Iterator<Item = (B, &'a GroupProjective<P>)>, [src]pub fn three_bit_signed_digit_scalar_multiplication<CS, I, J, K, B>(
cs: CS,
bases: &[B],
scalars: K
) -> Result<AffineGadget<P, F, FG>, SynthesisError> where
CS: ConstraintSystem<F>,
B: Borrow<[GroupProjective<P>]>,
I: Borrow<[Boolean]>,
J: Iterator<Item = I>,
K: Iterator<Item = J>, [src]