From 5231fbce8999b20a864ce14bef5c35758fa6ebc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Garillot?= Date: Thu, 4 Jan 2024 15:59:49 -0500 Subject: [PATCH] fix: rename CircuitShape -> R1CSWithArity --- src/lib.rs | 16 ++++++++-------- src/supernova/mod.rs | 24 ++++++++++++------------ 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 7bc24fdf..9054c332 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -55,14 +55,14 @@ use traits::{ /// A type that holds parameters for the primary and secondary circuits of Nova and SuperNova #[derive(Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(bound = "")] -pub struct CircuitShape { +pub struct R1CSWithArity { F_arity: usize, r1cs_shape: R1CSShape, } -impl SimpleDigestible for CircuitShape {} +impl SimpleDigestible for R1CSWithArity {} -impl CircuitShape { +impl R1CSWithArity { /// Create a new `CircuitShape` pub fn new(r1cs_shape: R1CSShape, F_arity: usize) -> Self { Self { @@ -73,7 +73,7 @@ impl CircuitShape { /// Return the [CircuitShape]' digest. pub fn digest(&self) -> E::Scalar { - let dc: DigestComputer<'_, ::Scalar, CircuitShape> = DigestComputer::new(self); + let dc: DigestComputer<'_, ::Scalar, R1CSWithArity> = DigestComputer::new(self); dc.digest().expect("Failure in computing digest") } } @@ -93,11 +93,11 @@ where ro_consts_primary: ROConstants, ro_consts_circuit_primary: ROConstantsCircuit, ck_primary: CommitmentKey, - circuit_shape_primary: CircuitShape, + circuit_shape_primary: R1CSWithArity, ro_consts_secondary: ROConstants, ro_consts_circuit_secondary: ROConstantsCircuit, ck_secondary: CommitmentKey, - circuit_shape_secondary: CircuitShape, + circuit_shape_secondary: R1CSWithArity, augmented_circuit_params_primary: NovaAugmentedCircuitParams, augmented_circuit_params_secondary: NovaAugmentedCircuitParams, #[serde(skip, default = "OnceCell::new")] @@ -211,8 +211,8 @@ where return Err(NovaError::InvalidStepCircuitIO); } - let circuit_shape_primary = CircuitShape::new(r1cs_shape_primary, F_arity_primary); - let circuit_shape_secondary = CircuitShape::new(r1cs_shape_secondary, F_arity_secondary); + let circuit_shape_primary = R1CSWithArity::new(r1cs_shape_primary, F_arity_primary); + let circuit_shape_secondary = R1CSWithArity::new(r1cs_shape_secondary, F_arity_secondary); let pp = PublicParams { F_arity_primary, diff --git a/src/supernova/mod.rs b/src/supernova/mod.rs index 59252716..383546d6 100644 --- a/src/supernova/mod.rs +++ b/src/supernova/mod.rs @@ -18,7 +18,7 @@ use crate::{ commitment::{CommitmentEngineTrait, CommitmentTrait}, AbsorbInROTrait, Engine, ROConstants, ROConstantsCircuit, ROTrait, }, - CircuitShape, Commitment, CommitmentKey, + R1CSWithArity, Commitment, CommitmentKey, }; use ff::Field; use itertools::Itertools as _; @@ -83,7 +83,7 @@ where C2: StepCircuit, { /// The internal circuit shapes - pub circuit_shapes: Vec>, + pub circuit_shapes: Vec>, ro_consts_primary: ROConstants, ro_consts_circuit_primary: ROConstantsCircuit, @@ -93,7 +93,7 @@ where ro_consts_secondary: ROConstants, ro_consts_circuit_secondary: ROConstantsCircuit, ck_secondary: CommitmentKey, - circuit_shape_secondary: CircuitShape, + circuit_shape_secondary: R1CSWithArity, augmented_circuit_params_secondary: SuperNovaAugmentedCircuitParams, /// Digest constructed from this `PublicParams`' parameters @@ -120,7 +120,7 @@ where ro_consts_secondary: ROConstants, ro_consts_circuit_secondary: ROConstantsCircuit, ck_secondary: CommitmentKey, - circuit_shape_secondary: CircuitShape, + circuit_shape_secondary: R1CSWithArity, augmented_circuit_params_secondary: SuperNovaAugmentedCircuitParams, digest: E1::Scalar, @@ -133,7 +133,7 @@ where C1: StepCircuit, C2: StepCircuit, { - type Output = CircuitShape; + type Output = R1CSWithArity; fn index(&self, index: usize) -> &Self::Output { &self.circuit_shapes[index] @@ -206,7 +206,7 @@ where // We use the largest commitment_key for all instances let r1cs_shape_primary = cs.r1cs_shape(); - CircuitShape::new(r1cs_shape_primary, F_arity) + R1CSWithArity::new(r1cs_shape_primary, F_arity) }) .collect::>(); @@ -231,7 +231,7 @@ where .synthesize(&mut cs) .expect("circuit synthesis failed"); let (r1cs_shape_secondary, ck_secondary) = cs.r1cs_shape_and_key(ck_hint2); - let circuit_shape_secondary = CircuitShape::new(r1cs_shape_secondary, F_arity_secondary); + let circuit_shape_secondary = R1CSWithArity::new(r1cs_shape_secondary, F_arity_secondary); let pp = PublicParams { circuit_shapes, @@ -255,7 +255,7 @@ where } /// Breaks down an instance of [PublicParams] into the circuit params and auxiliary params. - pub fn into_parts(self) -> (Vec>, AuxParams) { + pub fn into_parts(self) -> (Vec>, AuxParams) { let digest = self.digest(); let PublicParams { @@ -290,7 +290,7 @@ where } /// Create a [PublicParams] from a vector of raw [CircuitShape] and auxiliary params. - pub fn from_parts(circuit_shapes: Vec>, aux_params: AuxParams) -> Self { + pub fn from_parts(circuit_shapes: Vec>, aux_params: AuxParams) -> Self { let pp = PublicParams { circuit_shapes, ro_consts_primary: aux_params.ro_consts_primary, @@ -316,7 +316,7 @@ where /// Create a [PublicParams] from a vector of raw [CircuitShape] and auxiliary params. /// We don't check that the `aux_params.digest` is a valid digest for the created params. pub fn from_parts_unchecked( - circuit_shapes: Vec>, + circuit_shapes: Vec>, aux_params: AuxParams, ) -> Self { PublicParams { @@ -338,7 +338,7 @@ where /// Compute primary and secondary commitment keys sized to handle the largest of the circuits in the provided /// `CircuitShape`. fn compute_primary_ck( - circuit_params: &[CircuitShape], + circuit_params: &[R1CSWithArity], ck_hint1: &CommitmentKeyHint, ) -> CommitmentKey { let size_primary = circuit_params @@ -1059,7 +1059,7 @@ pub fn circuit_digest< let _ = augmented_circuit.synthesize(&mut cs); let F_arity = circuit.arity(); - let circuit_params = CircuitShape::new(cs.r1cs_shape(), F_arity); + let circuit_params = R1CSWithArity::new(cs.r1cs_shape(), F_arity); circuit_params.digest() }