Skip to content
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

Change the alpha used when folding columns into fri layers. #972

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

alon-f
Copy link

@alon-f alon-f commented Jan 9, 2025

No description provided.

@alon-f alon-f self-assigned this Jan 9, 2025
@reviewable-StarkWare
Copy link

This change is Reviewable

@codecov-commenter
Copy link

codecov-commenter commented Jan 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.28%. Comparing base (c5af676) to head (6cee79f).
Report is 2 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #972      +/-   ##
==========================================
+ Coverage   92.26%   92.28%   +0.02%     
==========================================
  Files         105      105              
  Lines       14292    14330      +38     
  Branches    14292    14330      +38     
==========================================
+ Hits        13187    13225      +38     
  Misses       1032     1032              
  Partials       73       73              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@alon-f alon-f force-pushed the alon/change_folding_alpha branch from 38e2fe9 to a329311 Compare January 13, 2025 12:40
Copy link
Collaborator

@ohad-starkware ohad-starkware left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @alon-f)


crates/prover/src/core/fri.rs line 447 at r2 (raw file):

        let first_layer_sparse_evals =
            self.decommit_first_layer(queries, first_layer_query_evals)?;
        let inner_layer_queries = queries.fold(CIRCLE_TO_LINE_FOLD_STEP);

This change alone is fine and IMO deserves a separate PR.


crates/prover/src/core/fri.rs line 470 at r2 (raw file):

    fn decommit_inner_layers(
        &self,
        inner_layer_queries: &Queries,

inner layer is already mentioned in the function name

Suggestion:

queries: &Queries,

crates/prover/src/core/fri.rs line 489 at r2 (raw file):

            {
                // Use the previous layer's folding alpha to fold the column's circle into the
                // current layer.

Suggestion:

                // Use the previous layer's folding alpha to fold the relevant circle evaluations into the current layer. 

crates/prover/src/core/fri.rs line 495 at r2 (raw file):

                    .fold_circle(previous_folding_alpha, *column_domain);

                // Mix the folded column evaluations into the current layer's evaluations.

? or more accurate doc, but I feel code is already made clear by the extraction to a function


crates/prover/src/core/fri.rs line 506 at r2 (raw file):

            (layer_queries, layer_query_evals) =
                layer.verify_and_fold(layer_queries, layer_query_evals)?;
            previous_folding_alpha = layer.folding_alpha;

very nice!


crates/prover/src/core/fri.rs line 691 at r2 (raw file):

impl<H: MerkleHasher> FriFirstLayerVerifier<H> {
    /// Verifies the first layer's merkle decommitment, and returns the evaluations needed for
    /// folding the columns to their corresponding layer.

the latter part of the sentence sounds weird to me, mixing evals with column might be confusing?
non-blocking

@ilyalesokhin-starkware
Copy link
Collaborator

crates/prover/src/core/fri.rs line 233 at r2 (raw file):

            layer_evaluation = folded_layer_evaluation;
            layers.push(layer);
        }

wdyt?

Suggestion:

      // fold max size columns.
        while let Some(column) = columns.next_if(|c| folded_size(c) == layer_evaluation.len()) {
            B::fold_circle_into_line(&mut layer_evaluation, column, folding_alpha, twiddles);
        }
        
        while layer_evaluation.len() > config.last_layer_domain_size() {
            let layer = FriInnerLayerProver::new(layer_evaluation);
            MC::mix_root(channel, layer.merkle_tree.root());
            let folding_alpha = channel.draw_felt();
            let folded_layer_evaluation = B::fold_line(&layer.evaluation, folding_alpha, twiddles);
            layers.push(layer);
            
            layer_evaluation = folded_layer_evaluation;
            // Check for circle polys in the first layer that should be combined in this layer.
            while let Some(column) = columns.next_if(|c| folded_size(c) == layer_evaluation.len()) {
                B::fold_circle_into_line(&mut layer_evaluation, column, folding_alpha, twiddles);
            }
        }

Copy link
Author

@alon-f alon-f left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 1 files reviewed, 5 unresolved discussions (waiting on @ohad-starkware)


crates/prover/src/core/fri.rs line 447 at r2 (raw file):

Previously, ohad-starkware (Ohad) wrote…

This change alone is fine and IMO deserves a separate PR.

kk


crates/prover/src/core/fri.rs line 470 at r2 (raw file):

Previously, ohad-starkware (Ohad) wrote…

inner layer is already mentioned in the function name

Done.


crates/prover/src/core/fri.rs line 495 at r2 (raw file):

Previously, ohad-starkware (Ohad) wrote…

? or more accurate doc, but I feel code is already made clear by the extraction to a function

Done.


crates/prover/src/core/fri.rs line 506 at r2 (raw file):

Previously, ohad-starkware (Ohad) wrote…

very nice!

:D


crates/prover/src/core/fri.rs line 691 at r2 (raw file):

Previously, ohad-starkware (Ohad) wrote…

the latter part of the sentence sounds weird to me, mixing evals with column might be confusing?
non-blocking

i can change it to circle evaluations like you wrote above


crates/prover/src/core/fri.rs line 489 at r2 (raw file):

            {
                // Use the previous layer's folding alpha to fold the column's circle into the
                // current layer.

i don't like relevant, so i'll add the infamous sparse

Copy link
Collaborator

@ohad-starkware ohad-starkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @alon-f)


crates/prover/src/core/fri.rs line 691 at r2 (raw file):

Previously, alon-f wrote…

i can change it to circle evaluations like you wrote above

u decide, im not sure my confusion is justified

Copy link
Collaborator

@ohad-starkware ohad-starkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions (waiting on @alon-f)


-- commits line 1 at r3:
squash

Copy link
Author

@alon-f alon-f left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions (waiting on @ilyalesokhin-starkware and @ohad-starkware)


crates/prover/src/core/fri.rs line 233 at r2 (raw file):

Previously, ilyalesokhin-starkware wrote…

wdyt?

Done.

@alon-f alon-f force-pushed the alon/change_folding_alpha branch from 7778889 to 6cee79f Compare January 13, 2025 14:01
Copy link
Author

@alon-f alon-f left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions (waiting on @ilyalesokhin-starkware and @ohad-starkware)


-- commits line 1 at r3:

Previously, ohad-starkware (Ohad) wrote…

squash

Done.

Copy link
Collaborator

@ohad-starkware ohad-starkware left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ilyalesokhin-starkware)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants