[][src]Trait snarkos_models::gadgets::curves::group::GroupGadget

pub trait GroupGadget<G: Group, F: Field>: Sized + ToBytesGadget<F> + NEqGadget<F> + EqGadget<F> + ToBitsGadget<F> + CondSelectGadget<F> + AllocGadget<G, F> + Clone + Debug {
    type Value: Debug;
    type Variable;
    fn get_value(&self) -> Option<Self::Value>;
fn get_variable(&self) -> Self::Variable;
fn zero<CS: ConstraintSystem<F>>(cs: CS) -> Result<Self, SynthesisError>;
fn add<CS: ConstraintSystem<F>>(
        &self,
        cs: CS,
        other: &Self
    ) -> Result<Self, SynthesisError>;
fn add_constant<CS: ConstraintSystem<F>>(
        &self,
        cs: CS,
        other: &G
    ) -> Result<Self, SynthesisError>;
fn double_in_place<CS: ConstraintSystem<F>>(
        &mut self,
        cs: CS
    ) -> Result<(), SynthesisError>;
fn negate<CS: ConstraintSystem<F>>(
        &self,
        cs: CS
    ) -> Result<Self, SynthesisError>;
fn cost_of_add() -> usize;
fn cost_of_double() -> usize; fn sub<CS: ConstraintSystem<F>>(
        &self,
        cs: CS,
        other: &Self
    ) -> Result<Self, SynthesisError> { ... }
fn sub_constant<CS: ConstraintSystem<F>>(
        &self,
        cs: CS,
        other: &G
    ) -> Result<Self, SynthesisError> { ... }
fn mul_bits<'a, CS: ConstraintSystem<F>>(
        &self,
        cs: CS,
        result: &Self,
        bits: impl Iterator<Item = &'a Boolean>
    ) -> Result<Self, SynthesisError> { ... }
fn precomputed_base_scalar_mul<'a, CS, I, B>(
        &mut self,
        cs: CS,
        scalar_bits_with_base_powers: I
    ) -> Result<(), SynthesisError>
    where
        CS: ConstraintSystem<F>,
        I: Iterator<Item = (B, &'a G)>,
        B: Borrow<Boolean>,
        G: 'a
, { ... }
fn precomputed_base_symmetric_scalar_mul<'a, CS, I, B>(
        &mut self,
        cs: CS,
        scalar_bits_with_base_powers: I
    ) -> Result<(), SynthesisError>
    where
        CS: ConstraintSystem<F>,
        I: Iterator<Item = (B, &'a G)>,
        B: Borrow<Boolean>,
        G: 'a
, { ... }
fn precomputed_base_scalar_mul_masked<'a, CS, I, B>(
        &mut self,
        _: CS,
        _: I,
        _: I
    ) -> Result<(), SynthesisError>
    where
        CS: ConstraintSystem<F>,
        I: Iterator<Item = (B, &'a G)>,
        B: Borrow<Boolean>,
        G: 'a
, { ... }
fn precomputed_base_3_bit_signed_digit_scalar_mul<'a, CS, I, J, B>(
        _: CS,
        _: &[B],
        _: &[J]
    ) -> Result<Self, SynthesisError>
    where
        CS: ConstraintSystem<F>,
        I: Borrow<[Boolean]>,
        J: Borrow<[I]>,
        B: Borrow<[G]>
, { ... }
fn precomputed_base_multiscalar_mul<'a, CS, T: ?Sized, I, B>(
        cs: CS,
        bases: &[B],
        scalars: I
    ) -> Result<Self, SynthesisError>
    where
        CS: ConstraintSystem<F>,
        T: 'a + ToBitsGadget<F>,
        I: Iterator<Item = &'a T>,
        B: Borrow<[G]>
, { ... }
fn precomputed_base_symmetric_multiscalar_mul<'a, CS, T: ?Sized, I, B>(
        cs: CS,
        bases: &[B],
        scalars: I
    ) -> Result<Self, SynthesisError>
    where
        CS: ConstraintSystem<F>,
        T: 'a + ToBitsGadget<F>,
        I: Iterator<Item = &'a T>,
        B: Borrow<[G]>
, { ... }
fn precomputed_base_multiscalar_mul_masked<'a, CS, T: ?Sized, I, B>(
        cs: CS,
        bases: &[B],
        scalars: I,
        mask_bases: &[B],
        masks: I
    ) -> Result<Self, SynthesisError>
    where
        CS: ConstraintSystem<F>,
        T: 'a + ToBitsGadget<F>,
        I: Iterator<Item = &'a T>,
        B: Borrow<[G]>
, { ... } }

Associated Types

type Value: Debug

type Variable

Loading content...

Required methods

fn get_value(&self) -> Option<Self::Value>

fn get_variable(&self) -> Self::Variable

fn zero<CS: ConstraintSystem<F>>(cs: CS) -> Result<Self, SynthesisError>

fn add<CS: ConstraintSystem<F>>(
    &self,
    cs: CS,
    other: &Self
) -> Result<Self, SynthesisError>

fn add_constant<CS: ConstraintSystem<F>>(
    &self,
    cs: CS,
    other: &G
) -> Result<Self, SynthesisError>

fn double_in_place<CS: ConstraintSystem<F>>(
    &mut self,
    cs: CS
) -> Result<(), SynthesisError>

fn negate<CS: ConstraintSystem<F>>(
    &self,
    cs: CS
) -> Result<Self, SynthesisError>

fn cost_of_add() -> usize

fn cost_of_double() -> usize

Loading content...

Provided methods

fn sub<CS: ConstraintSystem<F>>(
    &self,
    cs: CS,
    other: &Self
) -> Result<Self, SynthesisError>

fn sub_constant<CS: ConstraintSystem<F>>(
    &self,
    cs: CS,
    other: &G
) -> Result<Self, SynthesisError>

fn mul_bits<'a, CS: ConstraintSystem<F>>(
    &self,
    cs: CS,
    result: &Self,
    bits: impl Iterator<Item = &'a Boolean>
) -> Result<Self, SynthesisError>

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 precomputed_base_scalar_mul<'a, CS, I, B>(
    &mut self,
    cs: CS,
    scalar_bits_with_base_powers: I
) -> Result<(), SynthesisError> where
    CS: ConstraintSystem<F>,
    I: Iterator<Item = (B, &'a G)>,
    B: Borrow<Boolean>,
    G: 'a, 

fn precomputed_base_symmetric_scalar_mul<'a, CS, I, B>(
    &mut self,
    cs: CS,
    scalar_bits_with_base_powers: I
) -> Result<(), SynthesisError> where
    CS: ConstraintSystem<F>,
    I: Iterator<Item = (B, &'a G)>,
    B: Borrow<Boolean>,
    G: 'a, 

fn precomputed_base_scalar_mul_masked<'a, CS, I, B>(
    &mut self,
    _: CS,
    _: I,
    _: I
) -> Result<(), SynthesisError> where
    CS: ConstraintSystem<F>,
    I: Iterator<Item = (B, &'a G)>,
    B: Borrow<Boolean>,
    G: 'a, 

fn precomputed_base_3_bit_signed_digit_scalar_mul<'a, CS, I, J, B>(
    _: CS,
    _: &[B],
    _: &[J]
) -> Result<Self, SynthesisError> where
    CS: ConstraintSystem<F>,
    I: Borrow<[Boolean]>,
    J: Borrow<[I]>,
    B: Borrow<[G]>, 

fn precomputed_base_multiscalar_mul<'a, CS, T: ?Sized, I, B>(
    cs: CS,
    bases: &[B],
    scalars: I
) -> Result<Self, SynthesisError> where
    CS: ConstraintSystem<F>,
    T: 'a + ToBitsGadget<F>,
    I: Iterator<Item = &'a T>,
    B: Borrow<[G]>, 

fn precomputed_base_symmetric_multiscalar_mul<'a, CS, T: ?Sized, I, B>(
    cs: CS,
    bases: &[B],
    scalars: I
) -> Result<Self, SynthesisError> where
    CS: ConstraintSystem<F>,
    T: 'a + ToBitsGadget<F>,
    I: Iterator<Item = &'a T>,
    B: Borrow<[G]>, 

fn precomputed_base_multiscalar_mul_masked<'a, CS, T: ?Sized, I, B>(
    cs: CS,
    bases: &[B],
    scalars: I,
    mask_bases: &[B],
    masks: I
) -> Result<Self, SynthesisError> where
    CS: ConstraintSystem<F>,
    T: 'a + ToBitsGadget<F>,
    I: Iterator<Item = &'a T>,
    B: Borrow<[G]>, 

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.

Loading content...

Implementors

Loading content...