Skip to content

Use zk-whir variant instead of the leaky one#132

Merged
veljkovranic merged 15 commits into
mainfrom
add_zk_to_latest_whir
Aug 26, 2025
Merged

Use zk-whir variant instead of the leaky one#132
veljkovranic merged 15 commits into
mainfrom
add_zk_to_latest_whir

Conversation

@veljkovranic
Copy link
Copy Markdown
Collaborator

@veljkovranic veljkovranic commented Jul 21, 2025

Opening this instead of this work:
#32

It is relying on an unmerged PR in WHIR: WizardOfMenlo/whir#188

The goal of this PR is to rely on WHIRs batching option to perform polynomial commitment in the ZK fashion.

The crux of it is, instead of performing WHIR rounds on the witness polynomial, you mask and blind its values with a huge random polynomial and do the batch commit on [masked, blinding] pair of polynomials.

Theoretical explanation can be found here: https://github.com/worldfnd/ProveKit/blob/main/sage/fri-and-friends/Zero%20Knowledge%20for%20WHIR.md

Comment thread gnark-whir/mt.go
}
}

// TODO: refactor this function
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

TODO: refactor this whole project 😅

Copy link
Copy Markdown
Collaborator

@wzmuda wzmuda left a comment

Choose a reason for hiding this comment

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

I'm unable to verify the correctness of cryptographic changes, so I reviewed the PR from the programming perspective and I don't see anything obviously wrong (other than this project is super unreadable with its humongous functions and 200-character-long lines, but this is not this PR's fault).

I wish we could refactor this project one day because it will quickly become unmaintainable.

EvaluationsList<FieldElement>,
) {
let mask = generate_mask(witness_polynomial_evals.evals().len());
let masked_polynomial = create_masked_polynomial(&witness_polynomial_evals, &mask);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Very minor: IMO, generate_mask and create_masked_polynomia can be combined to just one function called mask_polynomial(&whitness_polynomial_evals).

}

#[instrument(skip_all)]
pub fn run_zk_whir_pcs_prover(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This seems to replace run_whir_pcs_prover, making it a dead code. Should we remove it?

Copy link
Copy Markdown
Collaborator

@batmendbar batmendbar left a comment

Choose a reason for hiding this comment

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

There are some changes that might conflict with the Spark implementation, but I can handle them when merging Spark to this. I left some comments on small issues. Otherwise, looks good.

@veljkovranic veljkovranic merged commit 6630730 into main Aug 26, 2025
2 of 5 checks passed
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.

3 participants