@@ -419,12 +419,22 @@ impl<E: ExtensionField> ConstraintSystem<E> {
419419 record : Vec < Expression < E > > ,
420420 ) -> Result < ( ) , CircuitBuilderError > {
421421 let rlc_record = self . rlc_chip_record ( record. clone ( ) ) ;
422+ self . read_rlc_record ( name_fn, ( ram_type as u64 ) . into ( ) , record, rlc_record)
423+ }
424+
425+ pub fn read_rlc_record < NR : Into < String > , N : FnOnce ( ) -> NR > (
426+ & mut self ,
427+ name_fn : N ,
428+ ram_type : Expression < E > ,
429+ record : Vec < Expression < E > > ,
430+ rlc_record : Expression < E > ,
431+ ) -> Result < ( ) , CircuitBuilderError > {
422432 self . r_expressions . push ( rlc_record) ;
423433 let path = self . ns . compute_path ( name_fn ( ) . into ( ) ) ;
424434 self . r_expressions_namespace_map . push ( path) ;
425435 // Since r_expression is RLC(record) and when we're debugging
426436 // it's helpful to recover the value of record itself.
427- self . r_ram_types . push ( ( ( ram_type as u64 ) . into ( ) , record) ) ;
437+ self . r_ram_types . push ( ( ram_type, record) ) ;
428438 Ok ( ( ) )
429439 }
430440
@@ -435,10 +445,22 @@ impl<E: ExtensionField> ConstraintSystem<E> {
435445 record : Vec < Expression < E > > ,
436446 ) -> Result < ( ) , CircuitBuilderError > {
437447 let rlc_record = self . rlc_chip_record ( record. clone ( ) ) ;
448+ self . write_rlc_record ( name_fn, ( ram_type as u64 ) . into ( ) , record, rlc_record)
449+ }
450+
451+ pub fn write_rlc_record < NR : Into < String > , N : FnOnce ( ) -> NR > (
452+ & mut self ,
453+ name_fn : N ,
454+ ram_type : Expression < E > ,
455+ record : Vec < Expression < E > > ,
456+ rlc_record : Expression < E > ,
457+ ) -> Result < ( ) , CircuitBuilderError > {
438458 self . w_expressions . push ( rlc_record) ;
439459 let path = self . ns . compute_path ( name_fn ( ) . into ( ) ) ;
440460 self . w_expressions_namespace_map . push ( path) ;
441- self . w_ram_types . push ( ( ( ram_type as u64 ) . into ( ) , record) ) ;
461+ // Since w_expression is RLC(record) and when we're debugging
462+ // it's helpful to recover the value of record itself.
463+ self . w_ram_types . push ( ( ram_type, record) ) ;
442464 Ok ( ( ) )
443465 }
444466
@@ -696,6 +718,21 @@ impl<'a, E: ExtensionField> CircuitBuilder<'a, E> {
696718 self . cs . read_record ( name_fn, ram_type, record)
697719 }
698720
721+ pub fn read_rlc_record < NR , N > (
722+ & mut self ,
723+ name_fn : N ,
724+ ram_type : Expression < E > ,
725+ record : Vec < Expression < E > > ,
726+ rlc_record : Expression < E > ,
727+ ) -> Result < ( ) , CircuitBuilderError >
728+ where
729+ NR : Into < String > ,
730+ N : FnOnce ( ) -> NR ,
731+ {
732+ self . cs
733+ . read_rlc_record ( name_fn, ram_type, record, rlc_record)
734+ }
735+
699736 pub fn write_record < NR , N > (
700737 & mut self ,
701738 name_fn : N ,
@@ -709,6 +746,21 @@ impl<'a, E: ExtensionField> CircuitBuilder<'a, E> {
709746 self . cs . write_record ( name_fn, ram_type, record)
710747 }
711748
749+ pub fn write_rlc_record < NR , N > (
750+ & mut self ,
751+ name_fn : N ,
752+ ram_type : Expression < E > ,
753+ record : Vec < Expression < E > > ,
754+ rlc_record : Expression < E > ,
755+ ) -> Result < ( ) , CircuitBuilderError >
756+ where
757+ NR : Into < String > ,
758+ N : FnOnce ( ) -> NR ,
759+ {
760+ self . cs
761+ . write_rlc_record ( name_fn, ram_type, record, rlc_record)
762+ }
763+
712764 pub fn rlc_chip_record ( & self , records : Vec < Expression < E > > ) -> Expression < E > {
713765 self . cs . rlc_chip_record ( records)
714766 }
0 commit comments