-
Notifications
You must be signed in to change notification settings - Fork 1
refactor: decompose composition poly via squared-coset intermediate #515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5e9f05b
refactor: decompose composition poly via squared-coset intermediate
diegokingston c72a524
docs: add MMCS batched commitment implementation plan
diegokingston 80f1c29
feat: add BatchedLayout for column offset tracking in shared Merkle t…
diegokingston 321f11a
feat: add BatchedProof struct for shared Merkle tree proofs
diegokingston ab4da49
feat: batched main trace commitment across tables
diegokingston 96e893c
feat: batched composition commitment at N points (eval-form quotient)
diegokingston c8d625a
feat: implement multi_prove_batched and multi_verify_batched
diegokingston File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| /// Tracks per-table column offsets within a shared batched Merkle tree. | ||
| /// Each phase (main, aux, composition) has its own layout. | ||
| #[derive(Debug, Clone)] | ||
| pub struct BatchedLayout { | ||
| /// (col_start, col_end) for each table in the concatenated row. | ||
| pub table_ranges: Vec<(usize, usize)>, | ||
| /// Total number of columns across all tables. | ||
| pub total_columns: usize, | ||
| /// Domain size (LDE size for main/aux, trace size for composition). | ||
| pub domain_size: usize, | ||
| } | ||
|
|
||
| impl BatchedLayout { | ||
| /// Build layout from per-table column counts. | ||
| pub fn new(column_counts: &[usize], domain_size: usize) -> Self { | ||
| let mut ranges = Vec::with_capacity(column_counts.len()); | ||
| let mut offset = 0; | ||
| for &count in column_counts { | ||
| ranges.push((offset, offset + count)); | ||
| offset += count; | ||
| } | ||
| BatchedLayout { | ||
| table_ranges: ranges, | ||
| total_columns: offset, | ||
| domain_size, | ||
| } | ||
| } | ||
|
|
||
| pub fn num_tables(&self) -> usize { | ||
| self.table_ranges.len() | ||
| } | ||
|
|
||
| /// Extract one table's columns from a full row of opened values. | ||
| pub fn extract_table<T: Clone>(&self, table_idx: usize, row: &[T]) -> Vec<T> { | ||
| let (start, end) = self.table_ranges[table_idx]; | ||
| row[start..end].to_vec() | ||
| } | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
| use super::*; | ||
|
|
||
| #[test] | ||
| fn test_layout_construction() { | ||
| let layout = BatchedLayout::new(&[5, 3, 7], 1024); | ||
| assert_eq!(layout.total_columns, 15); | ||
| assert_eq!(layout.table_ranges, vec![(0, 5), (5, 8), (8, 15)]); | ||
| assert_eq!(layout.num_tables(), 3); | ||
| assert_eq!(layout.domain_size, 1024); | ||
| } | ||
|
|
||
| #[test] | ||
| fn test_extract_table() { | ||
| let layout = BatchedLayout::new(&[2, 3], 1024); | ||
| let row = vec![10, 20, 30, 40, 50]; | ||
| assert_eq!(layout.extract_table(0, &row), vec![10, 20]); | ||
| assert_eq!(layout.extract_table(1, &row), vec![30, 40, 50]); | ||
| } | ||
|
|
||
| #[test] | ||
| fn test_empty_tables() { | ||
| let layout = BatchedLayout::new(&[0, 3, 0], 512); | ||
| assert_eq!(layout.total_columns, 3); | ||
| assert_eq!(layout.table_ranges, vec![(0, 0), (0, 3), (3, 3)]); | ||
| assert_eq!(layout.extract_table::<i32>(0, &[1, 2, 3]), vec![]); | ||
| assert_eq!(layout.extract_table(1, &[1, 2, 3]), vec![1, 2, 3]); | ||
| } | ||
|
|
||
| #[test] | ||
| fn test_single_table() { | ||
| let layout = BatchedLayout::new(&[4], 2048); | ||
| assert_eq!(layout.total_columns, 4); | ||
| assert_eq!(layout.table_ranges, vec![(0, 4)]); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Low — Security]
debug_assert_eq!is compiled out in release builds. Ifinj.len() != evals.len(), the subsequentzipsilently truncates to the shorter length, producing a cryptographically incorrect FRI commitment with no error or diagnostic. This is especially dangerous for crypto code. Please use a hardassert_eq!(or returnErr) so the invariant is enforced in all build profiles.