INNER CODE UNIT · Rust
new_variable
arkworks-rs/groth16 · src/constraints.rs:371
fn new_variable<T: Borrow<VerifyingKey<E>>>(
cs: impl Into<Namespace<BasePrimeField<E>>>,
f: impl FnOnce() -> Result<T, SynthesisError>,
mode: AllocationMode,
) -> Result<Self, SynthesisError> {
let ns = cs.into();
let cs = ns.cs();
f().and_then(|vk| {
let VerifyingKey {
alpha_g1,
beta_g2,
gamma_g2,
delta_g2,
gamma_abc_g1,
} = vk.borrow().clone();
let alpha_g1 =
P::G1Var::new_variable(ark_relations::ns!(cs, "alpha_g1"), || Ok(alpha_g1), mode)?;