a16z / jolt

The simplest and most extensible zkVM. Fast and fully open source from a16z crypto and friends. ⚡
https://jolt.a16zcrypto.com
MIT License
587 stars 106 forks source link

Refactor Hyrax Batching #318

Closed sragss closed 2 months ago

sragss commented 2 months ago

Includes a batch_size param in calls to CommitmentScheme::{batch_commit, batch_prove} and includes the batch_size param in the CommitmentScheme::BatchedProof struct if needed.

Two unfortunate things:

sragss commented 2 months ago

Currently batch_commit is called from impl StructuredOpeningProof for {Bytecode, RAM, InstructionLookups} / VM::Commit / R1CSProof::compute_witness_commit.

StructuredOpeningProof is not used anymore for Read/Write across {Bytecode, RAM, InstructionLookups} in favor of VM::commit. It is still used for Init / Final but these have a batch_size / RATIO of 1.

R1CSProof::compute_witness_commit should likely be refactored to R1CSProof::compute_witness and VM::commit should handle the batch commitment.

A decent solution would be to switch the batch_size param to an enum CS::BigBatch / CS::SmallBatch which for Hyrax would correspond to NUM_R1CS_POLYS / 1.