Add batching commit support#188
Conversation
Changes: 1. New set of API: DomainSeparator::batch_commit_statement Committer::batch_commit Prover::batch_prove Verifier::verify_batched 2. New cargo feature flag "batching" to enable disable this API 3. New traits to make the verifier generic
Merging batching branch to main
Moved some code to follow the new CommitmentReader and CommitmentWriter structure.
Main changes: 1. Unified batched and non-batched structs. Refactored `Witness` `WhirProof` and `ParsedCommitment` to work with both batched oracles as well as single oracle. 2. Removed seprate APIs for batched proving and batched verifying. The only seperate function is `CommitmentWriter::batched_commit` which takes a list of polynomials while `CommitmentWriter::commit` works with only a single polynomial. 3. Removed index based access to vectors as much as possible. Chaching friendly/sequential access to vectors still WIP. 4. Removed conjunctions within assert statements. 5. Updated tests to test different batch sizes
Fix batching test case that was taking too much time.
* Added OOD for batching oracles. * Removed index based array access. * Removed separate functions for batching and non-batching as much as possible.
Moved code from batching to the Prover side of things.
|
Moving the review conversation from Slack to Github for visibility: @WizardOfMenlo comment: @yswami-tfh response: Lets continue the review in this PR, for the sake of visibilitiy |
I don't really care about the case where the f_i have different weights, I am happy with testing the RLC at the same weight. My objection is in how f_1, ..., f_n are committed.
Since in our case |
|
I agree, option 2 is far more efficient, but not sure if anyone has free cycles to implement it. @veljkovranic The high level idea is that right now |
|
@recmo what is your opinion here, how should we proceed from here? Should I implement this on top of the codebase that we currently have, or do we want to leave it for the planned rewrite of WHIR? |
first try at combining merkle trees into one
WizardOfMenlo
left a comment
There was a problem hiding this comment.
Left a few comments, happy to merge after some cleanpu
| /// OOD response. If num_samples == 0 or batch_size == 0, nothing is added | ||
| /// | ||
| #[must_use] | ||
| fn add_committed_ood(self, num_samples: usize, batch_size: usize) -> Self; |
There was a problem hiding this comment.
How about just changing the add_ood to take as input batch size?
| #[cfg_attr(feature = "tracing", instrument(skip_all, fields(size = polynomial.num_coeffs())))] | ||
| pub fn commit<ProverState>( | ||
| #[cfg_attr(feature = "tracing", instrument(skip_all, fields(size = polynomials.first().unwrap().num_coeffs())))] | ||
| pub fn commit_batch<ProverFSState>( |
There was a problem hiding this comment.
Why change to ProverFSState? Keep as ProverState for consistency
There was a problem hiding this comment.
yeah, good catch, this is just too old of a branch :D
This PR has been in the works for months now.
The CI should be passing as well.
The batch committing to the multiple polynomials is a requirement for ZK WHIR