diff --git a/plonky2/examples/square_root.rs b/plonky2/examples/square_root.rs index d8b3bd69..98ddc4e9 100644 --- a/plonky2/examples/square_root.rs +++ b/plonky2/examples/square_root.rs @@ -11,6 +11,8 @@ use plonky2::plonk::circuit_data::CircuitConfig; use plonky2::plonk::config::{GenericConfig, PoseidonGoldilocksConfig}; use plonky2_field::extension::Extendable; +/// A generator used by the prover to calculate the square root (`x`) of a given value +/// (`x_squared`), outside of the circuit, in order to supply it as an additional public input. #[derive(Debug)] struct SquareRootGenerator, const D: usize> { x: Target, @@ -56,6 +58,7 @@ fn main() -> Result<()> { _phantom: PhantomData, }); + // Randomly generate the value of x^2: any quadratic residue in the field works. let x_squared_value = { let mut val = F::rand(); while !val.is_quadratic_residue() {