From 0f8c16301e0930a6dce74ed6ac6ff993d75bbfb2 Mon Sep 17 00:00:00 2001 From: Xavier Pinsach <10213118+xavi-pinsach@users.noreply.github.com> Date: Mon, 28 Oct 2024 11:15:27 +0100 Subject: [PATCH] fix-sctx (#89) --- .../std/rs/src/range_check/specified_ranges.rs | 6 +++--- .../std/rs/src/range_check/std_range_check.rs | 2 +- .../lib/std/rs/src/range_check/u16air.rs | 8 ++++---- .../lib/std/rs/src/range_check/u8air.rs | 6 +++--- proofman/src/witness_manager.rs | 18 +++--------------- 5 files changed, 14 insertions(+), 26 deletions(-) diff --git a/pil2-components/lib/std/rs/src/range_check/specified_ranges.rs b/pil2-components/lib/std/rs/src/range_check/specified_ranges.rs index ab6132d0..48d47c99 100644 --- a/pil2-components/lib/std/rs/src/range_check/specified_ranges.rs +++ b/pil2-components/lib/std/rs/src/range_check/specified_ranges.rs @@ -34,8 +34,8 @@ impl SpecifiedRanges { const MY_NAME: &'static str = "SpecRang"; pub fn new(wcm: Arc>) -> Arc { - let pctx = wcm.get_arc_pctx(); - let sctx = wcm.get_arc_sctx(); + let pctx = wcm.get_pctx(); + let sctx = wcm.get_sctx(); // Scan global hints to get the airgroup_id and air_id let hint_global = get_hint_ids_by_name(sctx.get_global_bin(), "specified_ranges"); @@ -109,7 +109,7 @@ impl SpecifiedRanges { let mul_columns = &*self.mul_columns.lock().unwrap(); for (index, hint) in hints[1..].iter().enumerate() { - set_hint_field(self.wcm.get_sctx(), air_instance, *hint, "reference", &mul_columns[index]); + set_hint_field(&self.wcm.get_sctx(), air_instance, *hint, "reference", &mul_columns[index]); } log::trace!("{}: ··· Drained inputs for AIR '{}'", Self::MY_NAME, "SpecifiedRanges"); diff --git a/pil2-components/lib/std/rs/src/range_check/std_range_check.rs b/pil2-components/lib/std/rs/src/range_check/std_range_check.rs index fcb167fa..015a29bf 100644 --- a/pil2-components/lib/std/rs/src/range_check/std_range_check.rs +++ b/pil2-components/lib/std/rs/src/range_check/std_range_check.rs @@ -73,7 +73,7 @@ impl StdRangeCheck { const _MY_NAME: &'static str = "STD Range Check"; pub fn new(mode: StdMode, wcm: Arc>) -> Arc { - let sctx = wcm.get_arc_sctx(); + let sctx = wcm.get_sctx(); // Scan global hints to know which airs are associated with the range check let u8air_hint = get_hint_ids_by_name(sctx.get_global_bin(), "u8air"); diff --git a/pil2-components/lib/std/rs/src/range_check/u16air.rs b/pil2-components/lib/std/rs/src/range_check/u16air.rs index 0473cc3b..a8622173 100644 --- a/pil2-components/lib/std/rs/src/range_check/u16air.rs +++ b/pil2-components/lib/std/rs/src/range_check/u16air.rs @@ -29,8 +29,8 @@ impl U16Air { const MY_NAME: &'static str = "U16Air "; pub fn new(wcm: Arc>) -> Arc { - let pctx = wcm.get_arc_pctx(); - let sctx = wcm.get_arc_sctx(); + let pctx = wcm.get_pctx(); + let sctx = wcm.get_sctx(); // Scan global hints to get the airgroup_id and air_id let hint_global = get_hint_ids_by_name(sctx.get_global_bin(), "u16air"); @@ -98,7 +98,7 @@ impl U16Air { let air_instance = &mut air_instance_rw[air_instance_id]; let mul_column = &*self.mul_column.lock().unwrap(); - set_hint_field(self.wcm.get_sctx(), air_instance, self.hint.load(Ordering::Acquire), "reference", mul_column); + set_hint_field(&self.wcm.get_sctx(), air_instance, self.hint.load(Ordering::Acquire), "reference", mul_column); log::trace!("{}: ··· Drained inputs for AIR '{}'", Self::MY_NAME, "U16Air"); } @@ -137,7 +137,7 @@ impl WitnessComponent for U16Air { let mut air_instance = AirInstance::new(sctx.clone(), self.airgroup_id, self.air_id, None, buffer); *self.mul_column.lock().unwrap() = get_hint_field::( - self.wcm.get_sctx(), + &self.wcm.get_sctx(), &pctx, &mut air_instance, u16air_hints[0] as usize, diff --git a/pil2-components/lib/std/rs/src/range_check/u8air.rs b/pil2-components/lib/std/rs/src/range_check/u8air.rs index 867ddf1f..ab49dbe6 100644 --- a/pil2-components/lib/std/rs/src/range_check/u8air.rs +++ b/pil2-components/lib/std/rs/src/range_check/u8air.rs @@ -28,8 +28,8 @@ impl U8Air { const MY_NAME: &'static str = "U8Air "; pub fn new(wcm: Arc>) -> Arc { - let pctx = wcm.get_arc_pctx(); - let sctx = wcm.get_arc_sctx(); + let pctx = wcm.get_pctx(); + let sctx = wcm.get_sctx(); // Scan global hints to get the airgroup_id and air_id let hint_global = get_hint_ids_by_name(sctx.get_global_bin(), "u8air"); @@ -97,7 +97,7 @@ impl U8Air { let air_instance = &mut air_instance_rw[air_instance_id]; let mul_column = &*self.mul_column.lock().unwrap(); - set_hint_field(self.wcm.get_sctx(), air_instance, self.hint.load(Ordering::Acquire), "reference", mul_column); + set_hint_field(&self.wcm.get_sctx(), air_instance, self.hint.load(Ordering::Acquire), "reference", mul_column); log::trace!("{}: ··· Drained inputs for AIR '{}'", Self::MY_NAME, "U8Air"); } diff --git a/proofman/src/witness_manager.rs b/proofman/src/witness_manager.rs index 1f555d35..f28ccf81 100644 --- a/proofman/src/witness_manager.rs +++ b/proofman/src/witness_manager.rs @@ -112,27 +112,15 @@ impl WitnessManager { timer_stop_and_log_debug!(CALCULATING_WITNESS); } - pub fn get_pctx(&self) -> &ProofCtx { - self.pctx.as_ref() - } - - pub fn get_ectx(&self) -> &ExecutionCtx { - self.ectx.as_ref() - } - - pub fn get_sctx(&self) -> &SetupCtx { - self.sctx.as_ref() - } - - pub fn get_arc_pctx(&self) -> Arc> { + pub fn get_pctx(&self) -> Arc> { self.pctx.clone() } - pub fn get_arc_ectx(&self) -> Arc { + pub fn get_ectx(&self) -> Arc { self.ectx.clone() } - pub fn get_arc_sctx(&self) -> Arc { + pub fn get_sctx(&self) -> Arc { self.sctx.clone() } }