@@ -16,7 +16,7 @@ use std::marker::PhantomData;
1616use ff:: Field ;
1717use group:: { Group , GroupEncoding } ;
1818
19- use crate :: codec:: ShakeCodec ;
19+ use crate :: codec:: Shake128DuplexSponge ;
2020use crate :: errors:: Error ;
2121use crate :: schnorr_protocol:: SchnorrProof ;
2222use crate :: Nizk ;
@@ -224,7 +224,7 @@ impl<G: Group> FromIterator<(GroupVar<G>, G)> for GroupMap<G> {
224224#[ derive( Clone , Default , Debug ) ]
225225pub struct LinearMap < G : Group > {
226226 /// The set of linear combination constraints (equations).
227- pub constraints : Vec < LinearCombination < G > > ,
227+ pub linear_combinations : Vec < LinearCombination < G > > ,
228228 /// The list of group elements referenced in the linear map.
229229 ///
230230 /// Uninitialized group elements are presented with `None`.
@@ -263,7 +263,7 @@ impl<G: Group> LinearMap<G> {
263263 /// and zero allocated scalars and elements.
264264 pub fn new ( ) -> Self {
265265 Self {
266- constraints : Vec :: new ( ) ,
266+ linear_combinations : Vec :: new ( ) ,
267267 group_elements : GroupMap :: default ( ) ,
268268 num_scalars : 0 ,
269269 num_elements : 0 ,
@@ -272,15 +272,15 @@ impl<G: Group> LinearMap<G> {
272272
273273 /// Returns the number of constraints (equations) in this linear map.
274274 pub fn num_constraints ( & self ) -> usize {
275- self . constraints . len ( )
275+ self . linear_combinations . len ( )
276276 }
277277
278278 /// Adds a new linear combination constraint to the linear map.
279279 ///
280280 /// # Parameters
281281 /// - `lc`: The [`LinearCombination`] to add.
282282 pub fn append ( & mut self , lc : LinearCombination < G > ) {
283- self . constraints . push ( lc) ;
283+ self . linear_combinations . push ( lc) ;
284284 }
285285
286286 /// Evaluates all linear combinations in the linear map with the provided scalars.
@@ -292,7 +292,7 @@ impl<G: Group> LinearMap<G> {
292292 ///
293293 /// A vector of group elements, each being the result of evaluating one linear combination with the scalars.
294294 pub fn evaluate ( & self , scalars : & [ <G as Group >:: Scalar ] ) -> Result < Vec < G > , Error > {
295- self . constraints
295+ self . linear_combinations
296296 . iter ( )
297297 . map ( |lc| {
298298 // TODO: The multiplication by the (public) weight is potentially wasteful in the
@@ -343,7 +343,7 @@ pub struct CanonicalLinearRelation<G: Group + GroupEncoding> {
343343 pub image : Vec < G > ,
344344 /// The constraints, where each constraint is a vector of (scalar_var, group_var) pairs
345345 /// representing the right-hand side of the equation
346- pub constraints : Vec < Vec < ( ScalarVar < G > , GroupVar < G > ) > > ,
346+ pub linear_combinations : Vec < Vec < ( ScalarVar < G > , GroupVar < G > ) > > ,
347347 /// The group elements map
348348 pub group_elements : GroupMap < G > ,
349349 /// Number of scalar variables
@@ -355,7 +355,7 @@ impl<G: Group + GroupEncoding> CanonicalLinearRelation<G> {
355355 pub fn new ( ) -> Self {
356356 Self {
357357 image : Vec :: new ( ) ,
358- constraints : Vec :: new ( ) ,
358+ linear_combinations : Vec :: new ( ) ,
359359 group_elements : GroupMap :: default ( ) ,
360360 num_scalars : 0 ,
361361 }
@@ -435,7 +435,7 @@ impl<G: Group + GroupEncoding> CanonicalLinearRelation<G> {
435435
436436 // Only include constraints that are non-trivial (not zero constraints)
437437 self . image . push ( canonical_image) ;
438- self . constraints . push ( rhs_terms) ;
438+ self . linear_combinations . push ( rhs_terms) ;
439439
440440 Ok ( ( ) )
441441 }
@@ -471,7 +471,7 @@ impl<G: Group + GroupEncoding> CanonicalLinearRelation<G> {
471471 // Build constraint data in the same order as original
472472 let mut constraint_data = Vec :: new ( ) ;
473473
474- for ( image_elem, constraint_terms) in iter:: zip ( & self . image , & self . constraints ) {
474+ for ( image_elem, constraint_terms) in iter:: zip ( & self . image , & self . linear_combinations ) {
475475 // First, add the left-hand side (image) element
476476 let lhs_index = repr_index ( image_elem. to_bytes ( ) ) ;
477477
@@ -520,7 +520,7 @@ impl<G: Group + GroupEncoding> TryFrom<LinearRelation<G>> for CanonicalLinearRel
520520 fn try_from ( relation : LinearRelation < G > ) -> Result < Self , Self :: Error > {
521521 assert_eq ! (
522522 relation. image. len( ) ,
523- relation. linear_map. constraints . len( ) ,
523+ relation. linear_map. linear_combinations . len( ) ,
524524 "Number of equations and image variables must match"
525525 ) ;
526526
@@ -532,7 +532,7 @@ impl<G: Group + GroupEncoding> TryFrom<LinearRelation<G>> for CanonicalLinearRel
532532 HashMap :: new ( ) ;
533533
534534 // Process each constraint using the modular helper method
535- for ( image_var, equation) in iter:: zip ( & relation. image , & relation. linear_map . constraints ) {
535+ for ( image_var, equation) in iter:: zip ( & relation. image , & relation. linear_map . linear_combinations ) {
536536 canonical. process_constraint (
537537 * image_var,
538538 equation,
@@ -683,7 +683,7 @@ where
683683 }
684684
685685 for ( lc, lhs) in iter:: zip (
686- self . linear_map . constraints . as_slice ( ) ,
686+ self . linear_map . linear_combinations . as_slice ( ) ,
687687 self . image . as_slice ( ) ,
688688 ) {
689689 // TODO: The multiplication by the (public) weight is potentially wasteful in the
@@ -761,7 +761,7 @@ where
761761 /// let proof = nizk.prove_batchable(&vec![x], &mut OsRng).unwrap();
762762 /// assert!(nizk.verify_batchable(&proof).is_ok());
763763 /// ```
764- pub fn into_nizk ( self , session_identifier : & [ u8 ] ) -> Nizk < SchnorrProof < G > , ShakeCodec < G > >
764+ pub fn into_nizk ( self , session_identifier : & [ u8 ] ) -> Nizk < SchnorrProof < G > , Shake128DuplexSponge < G > >
765765 where
766766 G : group:: GroupEncoding ,
767767 {
0 commit comments