documentation

This commit is contained in:
Nicholas Ward 2022-09-26 15:58:28 -07:00
parent 33d97eff1c
commit 20053ac4c7

View File

@ -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<F: RichField + Extendable<D>, 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() {