From b8a81b5dcb9e33d68aad8cf07345099a56b28e24 Mon Sep 17 00:00:00 2001 From: Kobi Gurkan Date: Thu, 16 Jan 2020 19:39:49 +0200 Subject: [PATCH] r1cs-std: makes extension field to_bits create namespaces for the individual elements --- r1cs-std/src/fields/fp12.rs | 8 ++++---- r1cs-std/src/fields/fp2.rs | 8 ++++---- r1cs-std/src/fields/fp6_3over2.rs | 12 ++++++------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/r1cs-std/src/fields/fp12.rs b/r1cs-std/src/fields/fp12.rs index 944c0f8..22f5be8 100644 --- a/r1cs-std/src/fields/fp12.rs +++ b/r1cs-std/src/fields/fp12.rs @@ -725,8 +725,8 @@ where &self, mut cs: CS, ) -> Result, SynthesisError> { - let mut c0 = self.c0.to_bits(&mut cs)?; - let mut c1 = self.c1.to_bits(cs)?; + let mut c0 = self.c0.to_bits(cs.ns(|| "c0"))?; + let mut c1 = self.c1.to_bits(cs.ns(|| "c1"))?; c0.append(&mut c1); Ok(c0) } @@ -735,8 +735,8 @@ where &self, mut cs: CS, ) -> Result, SynthesisError> { - let mut c0 = self.c0.to_bits_strict(&mut cs)?; - let mut c1 = self.c1.to_bits_strict(cs)?; + let mut c0 = self.c0.to_bits_strict(cs.ns(|| "c0"))?; + let mut c1 = self.c1.to_bits_strict(cs.ns(|| "c1"))?; c0.append(&mut c1); Ok(c0) } diff --git a/r1cs-std/src/fields/fp2.rs b/r1cs-std/src/fields/fp2.rs index 618f566..a5154d7 100644 --- a/r1cs-std/src/fields/fp2.rs +++ b/r1cs-std/src/fields/fp2.rs @@ -524,8 +524,8 @@ impl, ConstraintF: PrimeField> ToBitsGadget Result, SynthesisError> { - let mut c0 = self.c0.to_bits(&mut cs)?; - let mut c1 = self.c1.to_bits(cs)?; + let mut c0 = self.c0.to_bits(cs.ns(|| "c0"))?; + let mut c1 = self.c1.to_bits(cs.ns(|| "c1"))?; c0.append(&mut c1); Ok(c0) } @@ -534,8 +534,8 @@ impl, ConstraintF: PrimeField> ToBitsGadget Result, SynthesisError> { - let mut c0 = self.c0.to_bits_strict(&mut cs)?; - let mut c1 = self.c1.to_bits_strict(cs)?; + let mut c0 = self.c0.to_bits_strict(cs.ns(|| "c0"))?; + let mut c1 = self.c1.to_bits_strict(cs.ns(|| "c1"))?; c0.append(&mut c1); Ok(c0) } diff --git a/r1cs-std/src/fields/fp6_3over2.rs b/r1cs-std/src/fields/fp6_3over2.rs index 07a5120..722a806 100644 --- a/r1cs-std/src/fields/fp6_3over2.rs +++ b/r1cs-std/src/fields/fp6_3over2.rs @@ -790,9 +790,9 @@ where &self, mut cs: CS, ) -> Result, SynthesisError> { - let mut c0 = self.c0.to_bits(&mut cs)?; - let mut c1 = self.c1.to_bits(&mut cs)?; - let mut c2 = self.c2.to_bits(cs)?; + let mut c0 = self.c0.to_bits(cs.ns(|| "c0"))?; + let mut c1 = self.c1.to_bits(cs.ns(|| "c1"))?; + let mut c2 = self.c2.to_bits(cs.ns(|| "c2"))?; c0.append(&mut c1); c0.append(&mut c2); @@ -804,9 +804,9 @@ where &self, mut cs: CS, ) -> Result, SynthesisError> { - let mut c0 = self.c0.to_bits_strict(&mut cs)?; - let mut c1 = self.c1.to_bits_strict(&mut cs)?; - let mut c2 = self.c2.to_bits_strict(cs)?; + let mut c0 = self.c0.to_bits_strict(cs.ns(|| "c0"))?; + let mut c1 = self.c1.to_bits_strict(cs.ns(|| "c1"))?; + let mut c2 = self.c2.to_bits_strict(cs.ns(|| "c2"))?; c0.append(&mut c1); c0.append(&mut c2);