Skip to content

Conversation

@moodlezoup
Copy link
Collaborator

@moodlezoup moodlezoup commented Nov 23, 2025

Splits the gen function for each sumcheck prover instance into new and initialize.

The general principle:

  • Constructing sumcheck params via *::new is a relatively cheap operation, and mainly involves pulling values out of the opening accumulator and/or transcript
  • Constructing the sumcheck prover object via *::initialize is a relatively expensive operation, and typically involves reading the trace. initialize should not need the opening accumulator or transcript.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the initialization pattern for sumcheck provers and verifiers across the codebase. The main changes introduce a new SumcheckInstanceParams trait that encapsulates parameters shared between provers and verifiers, separating parameter creation from instance initialization.

Key changes:

  • Introduces SumcheckInstanceParams trait with degree(), num_rounds(), input_claim(), and normalize_opening_point() methods
  • Renames prover/verifier constructors from gen() to initialize() to distinguish from parameter generation
  • Extracts parameter structs to be public and reusable between prover and verifier
  • Adds UnivariateSkip variant to VirtualPolynomial enum for univariate skip tracking
  • Moves ValFinalSumcheck implementation to separate val_final.rs file

Reviewed changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated no comments.

Show a summary per file
File Description
jolt-core/src/zkvm/witness.rs Adds UnivariateSkip variant to VirtualPolynomial enum
jolt-core/src/zkvm/verifier.rs Updates imports and changes parameter passing to use new params pattern
jolt-core/src/zkvm/spartan/*.rs Refactors shift, product, outer sumcheck to use params pattern
jolt-core/src/zkvm/ram/*.rs Refactors RAM sumchecks and extracts val_final to separate file
jolt-core/src/zkvm/registers/*.rs Updates register sumchecks to use params pattern
jolt-core/src/zkvm/instruction_lookups/*.rs Updates instruction lookup sumchecks to use params pattern
jolt-core/src/zkvm/bytecode/*.rs Updates bytecode sumchecks to use params pattern
jolt-core/src/subprotocols/*.rs Adds SumcheckInstanceParams trait and updates univariate skip
jolt-core/src/zkvm/prover.rs Updates prover to use new initialization pattern throughout

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines -354 to -362
#[derive(Allocative)]
pub struct ValFinalSumcheckProver<F: JoltField> {
inc: MultilinearPolynomial<F>,
wa: MultilinearPolynomial<F>,
#[allocative(skip)]
params: ValFinalSumcheckParams<F>,
}

impl<F: JoltField> ValFinalSumcheckProver<F> {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ValFinal moved into its own file

@moodlezoup moodlezoup marked this pull request as ready for review December 4, 2025 22:08
Copy link
Contributor

@quangvdao quangvdao left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Just one comment

Copy link
Contributor

@danielwlz danielwlz left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! How would you feel about making members of structs like XXXXSumcheckParams public by default? I suggested changes only for those sumchecks that I knew needed it, but I figure other sumchecks will also require visibility changes.

}

#[derive(Allocative)]
pub(crate) struct ValEvaluationSumcheckProver<F: JoltField> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
pub(crate) struct ValEvaluationSumcheckProver<F: JoltField> {
pub struct ValEvaluationSumcheckProver<F: JoltField> {

struct ReadRafSumcheckParams<F: JoltField> {
pub struct ReadRafSumcheckParams<F: JoltField> {
/// Index `i` stores `gamma^i`.
gamma_powers: Vec<F>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
gamma_powers: Vec<F>,
pub gamma_powers: Vec<F>,

gamma_powers: Vec<F>,
/// RLC of stage rv_claims and RAF claims (per Stage1/Stage3) used as the sumcheck LHS.
rv_claim: F,
input_claim: F,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
input_claim: F,
pub input_claim: F,

rv_claim: F,
input_claim: F,
/// RaParams
one_hot_params: OneHotParams,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
one_hot_params: OneHotParams,
pub one_hot_params: OneHotParams,

/// RaParams
one_hot_params: OneHotParams,
/// Bytecode length.
K: usize,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
pub K: usize,

Comment on lines 615 to 627
log_K: usize,
log_T: usize,
/// Number of address chunks (and RA polynomials in the product).
d: usize,
/// Stage Val polynomials evaluated over address vars.
val_polys: [MultilinearPolynomial<F>; N_STAGES],
/// Stage rv claims.
rv_claims: [F; N_STAGES],
raf_claim: F,
raf_shift_claim: F,
/// Identity polynomial over address vars used to inject RAF contributions.
int_poly: IdentityPolynomial<F>,
r_cycles: [Vec<F::Challenge>; N_STAGES],
Copy link
Contributor

Choose a reason for hiding this comment

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

Need to make all members pub

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.

4 participants