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

Refactor CTL Handling #1629

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Refactor CTL Handling #1629

wants to merge 3 commits into from

Conversation

sai-deng
Copy link
Member

@sai-deng sai-deng commented Sep 30, 2024

This PR refactors the get_ctl_vars_from_proofs function to accept auxiliary_polys and auxiliary_polys_next as explicit parameters rather than extracting them from the proofs. This change decouples the auxiliary polynomial data from the proof structure.

Copy link
Collaborator

@Nashtare Nashtare left a comment

Choose a reason for hiding this comment

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

Non-blocking comments, though I'm not sure about the full removal of MultiProof

Comment on lines +253 to +254
auxiliary_polys: &[&Option<Vec<F::Extension>>; N],
auxiliary_polys_next: &[&Option<Vec<F::Extension>>; N],
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think these could share the same lifetimes as below

@@ -250,7 +250,8 @@ where

/// Outputs all the CTL data necessary to prove a multi-STARK system.
pub fn get_ctl_vars_from_proofs<'a, F, C, const D: usize, const N: usize>(
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: the name is slightly misleading now, as we're not passing the multi_proof as arg anymore. What about get_ctl_vars_from_aux_polys?

Comment on lines -189 to -213
/// A combination of STARK proofs for independent statements operating on possibly shared variables,
/// along with Cross-Table Lookup (CTL) challenges to assert consistency of common variables across tables.
#[derive(Debug, Clone)]
pub struct MultiProof<
F: RichField + Extendable<D>,
C: GenericConfig<D, F = F>,
const D: usize,
const N: usize,
> {
/// Proofs for all the different STARK modules.
pub stark_proofs: [StarkProofWithMetadata<F, C, D>; N],
/// Cross-table lookup challenges.
pub ctl_challenges: GrandProductChallengeSet<F>,
}

impl<F: RichField + Extendable<D>, C: GenericConfig<D, F = F>, const D: usize, const N: usize>
MultiProof<F, C, D, N>
{
/// Returns the degree (i.e. the trace length) of each STARK proof,
/// from their common [`StarkConfig`].
pub fn recover_degree_bits(&self, config: &StarkConfig) -> [usize; N] {
core::array::from_fn(|i| self.stark_proofs[i].proof.recover_degree_bits(config))
}
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Are we sure we want to remove this from the API? It's a relatively convenient struct to group the whole system together. I'd rather suggest expanding it by implementing some additional helpers if needed (like extracting the aux_polys needed for the new signature above).

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

Successfully merging this pull request may close these issues.

2 participants