Skip to content

Commit

Permalink
Better comments for emulated operations.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrain committed Jun 15, 2023
1 parent b99daea commit 9345eea
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions relation/src/gadgets/emulated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ impl<F: PrimeField> PlonkCircuit<F> {

/// Constrain that a*b=c in the emulated field.
/// Checking that a * b - k * E::MODULUS = c.
/// This function doesn't perform emulated variable validaty check on the
/// input a, b and c. We assume that they are already performed elsewhere.
pub fn emulated_mul_gate<E: EmulationConfig<F>>(
&mut self,
a: &EmulatedVariable<E>,
Expand Down Expand Up @@ -292,6 +294,8 @@ impl<F: PrimeField> PlonkCircuit<F> {
}

/// Constrain that a*b=c in the emulated field for a constant b.
/// This function doesn't perform emulated variable validaty check on the
/// input a and c. We assume that they are already performed elsewhere.
pub fn emulated_mul_constant_gate<E: EmulationConfig<F>>(
&mut self,
a: &EmulatedVariable<E>,
Expand Down Expand Up @@ -408,6 +412,8 @@ impl<F: PrimeField> PlonkCircuit<F> {

/// Constrain that a+b=c in the emulated field.
/// Checking whether a + b = k * E::MODULUS + c
/// This function doesn't perform emulated variable validaty check on the
/// input a, b and c. We assume that they are already performed elsewhere.
pub fn emulated_add_gate<E: EmulationConfig<F>>(
&mut self,
a: &EmulatedVariable<E>,
Expand Down Expand Up @@ -477,6 +483,8 @@ impl<F: PrimeField> PlonkCircuit<F> {
}

/// Constrain that a+b=c in the emulated field.
/// This function doesn't perform emulated variable validaty check on the
/// input a and c. We assume that they are already performed elsewhere.
pub fn emulated_add_constant_gate<E: EmulationConfig<F>>(
&mut self,
a: &EmulatedVariable<E>,
Expand Down

0 comments on commit 9345eea

Please sign in to comment.