From 285ff6c6da5132e5c6e0a99fd4145577c4543028 Mon Sep 17 00:00:00 2001 From: sashass1315 Date: Fri, 10 Oct 2025 13:06:50 +0300 Subject: [PATCH] Ensure explicit R1CS presence checks in SR1CS adapter --- relations/src/sr1cs/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/relations/src/sr1cs/mod.rs b/relations/src/sr1cs/mod.rs index 9261d8133..1909d5af1 100644 --- a/relations/src/sr1cs/mod.rs +++ b/relations/src/sr1cs/mod.rs @@ -125,6 +125,7 @@ impl Sr1csAdapter { cs: &ConstraintSystemRef, ) -> Result, SynthesisError> { assert_eq!(cs.num_predicates(), 1); + assert!(cs.has_predicate(R1CS_PREDICATE_LABEL)); let matrices = &cs.to_matrices().unwrap()[R1CS_PREDICATE_LABEL]; let mut public_variables = BTreeMap::new(); let mut witness_variables = BTreeMap::new(); @@ -187,10 +188,11 @@ impl Sr1csAdapter { /// /// # Panics /// - /// Panics is the constraint system does not have the R1CS predicate registered. + /// Panics if the constraint system does not have the R1CS predicate registered. pub fn r1cs_to_sr1cs_with_assignment( cs: &mut ConstraintSystem, ) -> Result, SynthesisError> { + assert!(cs.has_predicate(R1CS_PREDICATE_LABEL)); let matrices = &cs.to_matrices().unwrap()[R1CS_PREDICATE_LABEL]; let mut public_variables = BTreeMap::new(); let mut witness_variables = BTreeMap::new();