Skip to content

Commit 7d73bd3

Browse files
Preprocessed Columns Validation Through Permutation
1 parent 66c8ab1 commit 7d73bd3

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

crates/prover/src/constraint_framework/component.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,17 @@ impl TraceLocationAllocator {
9696
&self.preprocessed_columns
9797
}
9898

99-
// validates that `self.preprocessed_columns` is consistent with
99+
// Validates that `self.preprocessed_columns` is a permutation of
100100
// `preprocessed_columns`.
101-
// I.e. preprocessed_columns[i] == self.preprocessed_columns[i].
102-
// TODO(Gali): Change to only validating that this is a permutation (not necessarily the same
103-
// order).
104101
pub fn validate_preprocessed_columns(&self, preprocessed_columns: &[PreProcessedColumnId]) {
105-
assert_eq!(self.preprocessed_columns, preprocessed_columns);
102+
let mut self_columns = self.preprocessed_columns.clone();
103+
let mut input_columns = preprocessed_columns.to_vec();
104+
self_columns.sort_by_key(|col| col.id.clone());
105+
input_columns.sort_by_key(|col| col.id.clone());
106+
assert_eq!(
107+
self_columns, input_columns,
108+
"Preprocessed columns are not a permutation."
109+
);
106110
}
107111
}
108112

0 commit comments

Comments
 (0)