Skip to content

Commit

Permalink
fix-sctx
Browse files Browse the repository at this point in the history
  • Loading branch information
xavi-pinsach committed Oct 28, 2024
1 parent d9c07ae commit aae3b6a
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ impl<F: PrimeField> SpecifiedRanges<F> {
const MY_NAME: &'static str = "SpecRang";

pub fn new(wcm: Arc<WitnessManager<F>>) -> Arc<Self> {
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");
Expand Down Expand Up @@ -109,7 +109,7 @@ impl<F: PrimeField> SpecifiedRanges<F> {
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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl<F: PrimeField> StdRangeCheck<F> {
const _MY_NAME: &'static str = "STD Range Check";

pub fn new(mode: StdMode, wcm: Arc<WitnessManager<F>>) -> Arc<Self> {
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");
Expand Down
8 changes: 4 additions & 4 deletions pil2-components/lib/std/rs/src/range_check/u16air.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ impl<F: PrimeField> U16Air<F> {
const MY_NAME: &'static str = "U16Air ";

pub fn new(wcm: Arc<WitnessManager<F>>) -> Arc<Self> {
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");
Expand Down Expand Up @@ -98,7 +98,7 @@ impl<F: PrimeField> U16Air<F> {
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");
}
Expand Down Expand Up @@ -137,7 +137,7 @@ impl<F: PrimeField> WitnessComponent<F> for U16Air<F> {
let mut air_instance = AirInstance::new(sctx.clone(), self.airgroup_id, self.air_id, None, buffer);

*self.mul_column.lock().unwrap() = get_hint_field::<F>(
self.wcm.get_sctx(),
&self.wcm.get_sctx(),
&pctx,
&mut air_instance,
u16air_hints[0] as usize,
Expand Down
6 changes: 3 additions & 3 deletions pil2-components/lib/std/rs/src/range_check/u8air.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ impl<F: PrimeField> U8Air<F> {
const MY_NAME: &'static str = "U8Air ";

pub fn new(wcm: Arc<WitnessManager<F>>) -> Arc<Self> {
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");
Expand Down Expand Up @@ -97,7 +97,7 @@ impl<F: PrimeField> U8Air<F> {
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");
}
Expand Down
18 changes: 3 additions & 15 deletions proofman/src/witness_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,27 +112,15 @@ impl<F> WitnessManager<F> {
timer_stop_and_log_debug!(CALCULATING_WITNESS);
}

pub fn get_pctx(&self) -> &ProofCtx<F> {
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<ProofCtx<F>> {
pub fn get_pctx(&self) -> Arc<ProofCtx<F>> {
self.pctx.clone()
}

pub fn get_arc_ectx(&self) -> Arc<ExecutionCtx> {
pub fn get_ectx(&self) -> Arc<ExecutionCtx> {
self.ectx.clone()
}

pub fn get_arc_sctx(&self) -> Arc<SetupCtx> {
pub fn get_sctx(&self) -> Arc<SetupCtx> {
self.sctx.clone()
}
}

0 comments on commit aae3b6a

Please sign in to comment.