diff --git a/src/lem/circuit.rs b/src/lem/circuit.rs index 37889003d6..0d29ffbb54 100644 --- a/src/lem/circuit.rs +++ b/src/lem/circuit.rs @@ -1333,7 +1333,7 @@ impl Func { )?; } else { assert!(!cs.is_witness_generator()); - let slots_allocations = build_slots_allocations(cs, store, frame, &self.slot)?; + let slots_allocations = build_slots_allocations(cs, store, frame, &self.slots_count)?; let hash4_slots = &slots_allocations.hash4.iter().collect::>(); let hash6_slots = &slots_allocations.hash6.iter().collect::>(); let hash8_slots = &slots_allocations.hash8.iter().collect::>(); @@ -1549,11 +1549,11 @@ impl Func { }; // fixed cost for each slot - let slot_constraints = 289 * self.slot.hash4 - + 337 * self.slot.hash6 - + 388 * self.slot.hash8 - + 265 * self.slot.commitment - + bit_decomp_cost * self.slot.bit_decomp; + let slot_constraints = 289 * self.slots_count.hash4 + + 337 * self.slots_count.hash6 + + 388 * self.slots_count.hash8 + + 265 * self.slots_count.commitment + + bit_decomp_cost * self.slots_count.bit_decomp; let num_constraints = recurse(&self.body, globals, store, false); slot_constraints + num_constraints + globals.len() } diff --git a/src/lem/eval.rs b/src/lem/eval.rs index 1b4d72b52b..795322ba1a 100644 --- a/src/lem/eval.rs +++ b/src/lem/eval.rs @@ -1785,7 +1785,7 @@ mod tests { let mut cs = TestConstraintSystem::::new(); let lang: Lang> = Lang::new(); let _ = func.synthesize_frame_aux(&mut cs, &store, &frame, &lang); - assert_eq!(func.slot, NUM_SLOTS); + assert_eq!(func.slots_count, NUM_SLOTS); assert_eq!(cs.num_inputs(), NUM_INPUTS); assert_eq!( (cs.aux().len(), cs.num_constraints()), diff --git a/src/lem/interpreter.rs b/src/lem/interpreter.rs index a04cda2518..a8cd726436 100644 --- a/src/lem/interpreter.rs +++ b/src/lem/interpreter.rs @@ -66,7 +66,7 @@ pub struct Hints { impl Hints { pub fn new_from_func(func: &Func) -> Hints { - let slot = func.slot; + let slot = func.slots_count; let hash4 = Vec::with_capacity(slot.hash4); let hash6 = Vec::with_capacity(slot.hash6); let hash8 = Vec::with_capacity(slot.hash8); @@ -86,7 +86,7 @@ impl Hints { } pub fn blank(func: &Func) -> Hints { - let slot = func.slot; + let slot = func.slots_count; let hash4 = vec![None; slot.hash4]; let hash6 = vec![None; slot.hash6]; let hash8 = vec![None; slot.hash8]; @@ -530,19 +530,19 @@ impl Func { let commitment_used = hints.commitment.len() - commitment_init; let bit_decomp_used = hints.bit_decomp.len() - bit_decomp_init; - for _ in hash4_used..self.slot.hash4 { + for _ in hash4_used..self.slots_count.hash4 { hints.hash4.push(None); } - for _ in hash6_used..self.slot.hash6 { + for _ in hash6_used..self.slots_count.hash6 { hints.hash6.push(None); } - for _ in hash8_used..self.slot.hash8 { + for _ in hash8_used..self.slots_count.hash8 { hints.hash8.push(None); } - for _ in commitment_used..self.slot.commitment { + for _ in commitment_used..self.slots_count.commitment { hints.commitment.push(None); } - for _ in bit_decomp_used..self.slot.bit_decomp { + for _ in bit_decomp_used..self.slots_count.bit_decomp { hints.bit_decomp.push(None); } diff --git a/src/lem/mod.rs b/src/lem/mod.rs index 24d26026e2..5a226da494 100644 --- a/src/lem/mod.rs +++ b/src/lem/mod.rs @@ -95,7 +95,7 @@ pub struct Func { pub input_params: Vec, pub output_size: usize, pub body: Block, - pub slot: SlotsCounter, + pub slots_count: SlotsCounter, } /// LEM variables @@ -315,9 +315,9 @@ impl Func { output_size: usize, body: Block, ) -> Result { - let slot = body.count_slots(); + let slots_count = body.count_slots(); let func = Func { - slot, + slots_count, name, input_params, output_size, diff --git a/src/lem/multiframe.rs b/src/lem/multiframe.rs index 044c06c838..d3f45ed4dc 100644 --- a/src/lem/multiframe.rs +++ b/src/lem/multiframe.rs @@ -160,7 +160,7 @@ fn generate_slots_witnesses( .into_iter() .for_each(|(sd_vec, st)| sd_vec.iter().for_each(|sd| slots_data.push((sd, st)))); }); - // cache the slots witnesses wit `Arc` for speedy clones + // cache dummy slots witnesses with `Arc` for speedy clones let dummy_witnesses_cache: FrozenMap<_, Box>>> = FrozenMap::default(); let gen_slot_witness = |(slot_idx, (slot_data, slot_type))| { let mk_witness = || { @@ -385,7 +385,7 @@ impl<'a, F: LurkField, C: Coprocessor + 'a> MultiFrameTrait<'a, F, C> for Mul ) -> Result { let func = self.get_func(); if cs.is_witness_generator() { - let num_slots_per_frame = func.slot.total(); + let num_slots_per_frame = func.slots_count.total(); let slots_witnesses = generate_slots_witnesses( store, frames, @@ -908,7 +908,7 @@ mod tests { #[test] fn test_sequential_and_parallel_witnesses_equivalences() { let lurk_step = eval_step(); - let num_slots_per_frame = lurk_step.slot.total(); + let num_slots_per_frame = lurk_step.slots_count.total(); let store = Store::::default(); let mut cs = WitnessCS::new(); diff --git a/src/lem/slot.rs b/src/lem/slot.rs index c87138a7d7..00282f1826 100644 --- a/src/lem/slot.rs +++ b/src/lem/slot.rs @@ -202,7 +202,7 @@ impl Block { Op::Hide(..) | Op::Open(..) => SlotsCounter::new((0, 0, 0, 1, 0)), Op::Lt(..) => SlotsCounter::new((0, 0, 0, 0, 3)), Op::Trunc(..) => SlotsCounter::new((0, 0, 0, 0, 1)), - Op::Call(_, func, _) => func.slot, + Op::Call(_, func, _) => func.slots_count, _ => SlotsCounter::default(), }; acc.add(val) diff --git a/src/lem/tests/misc.rs b/src/lem/tests/misc.rs index b880c7258a..dee64f61c3 100644 --- a/src/lem/tests/misc.rs +++ b/src/lem/tests/misc.rs @@ -21,7 +21,7 @@ fn synthesize_test_helper(func: &Func, inputs: Vec>, expected_num_slots: let nil = store.intern_nil(); let outermost = Ptr::null(Tag::Cont(Outermost)); - assert_eq!(func.slot, expected_num_slots); + assert_eq!(func.slots_count, expected_num_slots); let computed_num_constraints = func.num_constraints::(store);