diff --git a/crates/prover/src/constraint_framework/component.rs b/crates/prover/src/constraint_framework/component.rs index bb339c381..f0dbb996d 100644 --- a/crates/prover/src/constraint_framework/component.rs +++ b/crates/prover/src/constraint_framework/component.rs @@ -119,10 +119,10 @@ pub trait FrameworkEval { } pub struct FrameworkComponent { - eval: C, - trace_locations: TreeVec, + pub(super) eval: C, + pub(super) trace_locations: TreeVec, + pub(super) preprocessed_column_indices: Vec, info: InfoEvaluator, - preprocessed_column_indices: Vec, claimed_sum: SecureField, } diff --git a/crates/prover/src/constraint_framework/relation_tracker.rs b/crates/prover/src/constraint_framework/relation_tracker.rs index 9269a6118..d51f1897d 100644 --- a/crates/prover/src/constraint_framework/relation_tracker.rs +++ b/crates/prover/src/constraint_framework/relation_tracker.rs @@ -5,8 +5,8 @@ use itertools::Itertools; use num_traits::Zero; use super::{ - Batching, EvalAtRow, FrameworkEval, InfoEvaluator, Relation, RelationEntry, - TraceLocationAllocator, INTERACTION_TRACE_IDX, + Batching, EvalAtRow, FrameworkComponent, FrameworkEval, Relation, RelationEntry, + TraceLocationAllocator, INTERACTION_TRACE_IDX, PREPROCESSED_TRACE_IDX, }; use crate::core::backend::simd::m31::{PackedBaseField, LOG_N_LANES, N_LANES}; use crate::core::backend::simd::qm31::PackedSecureField; @@ -14,7 +14,7 @@ use crate::core::backend::simd::very_packed_m31::LOG_N_VERY_PACKED_ELEMS; use crate::core::backend::simd::SimdBackend; use crate::core::backend::Column; use crate::core::fields::m31::{BaseField, M31}; -use crate::core::fields::qm31::SecureField; +use crate::core::fields::qm31::QM31; use crate::core::fields::secure_column::SECURE_EXTENSION_DEGREE; use crate::core::lookups::utils::Fraction; use crate::core::pcs::{TreeSubspan, TreeVec}; @@ -34,21 +34,21 @@ pub struct RelationTrackerEntry { pub struct RelationTrackerComponent { eval: E, trace_locations: TreeVec, + preprocessed_column_indices: Vec, n_rows: usize, } impl RelationTrackerComponent { pub fn new(location_allocator: &mut TraceLocationAllocator, eval: E, n_rows: usize) -> Self { - let info = eval.evaluate(InfoEvaluator::new( - eval.log_size(), - vec![], - SecureField::default(), - )); - let mut mask_offsets = info.mask_offsets; - mask_offsets.drain(INTERACTION_TRACE_IDX..); - let trace_locations = location_allocator.next_for_structure(&mask_offsets); + let component = FrameworkComponent::::new(location_allocator, eval, QM31::default()); + + // Interaction trace is no needed and might not exist when relation tracker is ran. + let mut trace_locations = component.trace_locations; + trace_locations.truncate(INTERACTION_TRACE_IDX); + Self { - eval, + eval: component.eval, trace_locations, + preprocessed_column_indices: component.preprocessed_column_indices, n_rows, } } @@ -60,9 +60,14 @@ impl RelationTrackerComponent { let log_size = self.eval.log_size(); // Deref the sub-tree. Only copies the references. - let sub_tree = trace + let mut sub_tree = trace .sub_tree(&self.trace_locations) .map(|vec| vec.into_iter().copied().collect_vec()); + sub_tree[PREPROCESSED_TRACE_IDX] = self + .preprocessed_column_indices + .iter() + .map(|idx| trace[PREPROCESSED_TRACE_IDX][*idx]) + .collect(); let mut entries = vec![]; for vec_row in 0..(1 << (log_size - LOG_N_LANES)) {