Skip to content

Commit

Permalink
FRI: Enforce one column per size. (#905)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyalesokhin-starkware authored Nov 28, 2024
1 parent 9b25738 commit 260bcb2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
9 changes: 6 additions & 3 deletions crates/prover/src/core/fri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ pub struct FriProver<'a, B: FriOps + MerkleOps<MC::H>, MC: MerkleChannel> {
impl<'a, B: FriOps + MerkleOps<MC::H>, MC: MerkleChannel> FriProver<'a, B, MC> {
/// Commits to multiple circle polynomials.
///
/// `columns` must be provided in descending order by size.
/// `columns` must be provided in descending order by size with at most one column per size.
///
/// This is a batched commitment that handles multiple mixed-degree polynomials, each
/// evaluated over domains of varying sizes. Instead of combining these evaluations into
Expand All @@ -147,7 +147,7 @@ impl<'a, B: FriOps + MerkleOps<MC::H>, MC: MerkleChannel> FriProver<'a, B, MC> {
/// # Panics
///
/// Panics if:
/// * `columns` is empty or not sorted in ascending order by domain size.
/// * `columns` is empty or not sorted in descending order by domain size.
/// * An evaluation is not from a sufficiently low degree circle polynomial.
/// * An evaluation's domain is smaller than the last layer.
/// * An evaluation's domain is not a canonic circle domain.
Expand All @@ -159,8 +159,11 @@ impl<'a, B: FriOps + MerkleOps<MC::H>, MC: MerkleChannel> FriProver<'a, B, MC> {
twiddles: &TwiddleTree<B>,
) -> Self {
assert!(!columns.is_empty(), "no columns");
assert!(columns.is_sorted_by_key(|e| Reverse(e.len())), "not sorted");
assert!(columns.iter().all(|e| e.domain.is_canonic()), "not canonic");
assert!(
columns.array_windows().all(|[a, b]| a.len() > b.len()),
"column sizes not decreasing"
);

let first_layer = Self::commit_first_layer(channel, columns);
let (inner_layers, last_layer_evaluation) =
Expand Down
1 change: 1 addition & 0 deletions crates/prover/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
array_chunks,
array_methods,
array_try_from_fn,
array_windows,
assert_matches,
exact_size_is_empty,
generic_const_exprs,
Expand Down

1 comment on commit 260bcb2

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 260bcb2 Previous: cd8b37b Ratio
iffts/simd ifft/22 13092913 ns/iter (± 151827) 6306399 ns/iter (± 210024) 2.08
merkle throughput/simd merkle 30069296 ns/iter (± 544734) 13712527 ns/iter (± 579195) 2.19

This comment was automatically generated by workflow using github-action-benchmark.

CC: @shaharsamocha7

Please sign in to comment.