Skip to content

Commit d14cbeb

Browse files
committed
Revert "refactor: remove proofs and commitments from state manager (#1065)"
This reverts commit 025c012.
1 parent 025c012 commit d14cbeb

26 files changed

+749
-430
lines changed

jolt-core/benches/e2e_profiling.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use ark_serialize::CanonicalSerialize;
22
use jolt_core::host;
3+
use jolt_core::zkvm::dag::state_manager::ProofKeys;
34
use jolt_core::zkvm::JoltVerifierPreprocessing;
45
use jolt_core::zkvm::{Jolt, JoltRV64IMAC};
56
use std::fs;
@@ -280,11 +281,9 @@ fn prove_example_with_trace(
280281
});
281282
let proof_size = jolt_proof.serialized_size(ark_serialize::Compress::Yes);
282283
let proof_size_full_compressed = proof_size
283-
- jolt_proof
284-
.reduced_opening_proof
284+
- jolt_proof.proofs[&ProofKeys::ReducedOpeningProof]
285285
.serialized_size(ark_serialize::Compress::Yes)
286-
+ (jolt_proof
287-
.reduced_opening_proof
286+
+ (jolt_proof.proofs[&ProofKeys::ReducedOpeningProof]
288287
.serialized_size(ark_serialize::Compress::No)
289288
/ 3)
290289
- jolt_proof

jolt-core/src/zkvm/bytecode/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ impl<F: JoltField, PCS: CommitmentScheme<Field = F>, T: Transcript> SumcheckStag
145145
{
146146
fn stage6_instances(
147147
&mut self,
148-
sm: &mut StateManager<'_, F, PCS>,
148+
sm: &mut StateManager<'_, F, T, PCS>,
149149
opening_accumulator: &mut ProverOpeningAccumulator<F>,
150150
transcript: &mut T,
151151
) -> Vec<Box<dyn SumcheckInstanceProver<F, T>>> {
@@ -175,7 +175,7 @@ impl<F: JoltField, PCS: CommitmentScheme<Field = F>, T: Transcript>
175175
{
176176
fn stage6_instances(
177177
&mut self,
178-
sm: &mut StateManager<'_, F, PCS>,
178+
sm: &mut StateManager<'_, F, T, PCS>,
179179
opening_accumulator: &mut VerifierOpeningAccumulator<F>,
180180
transcript: &mut T,
181181
) -> Vec<Box<dyn SumcheckInstanceVerifier<F, T>>> {
@@ -189,10 +189,10 @@ impl<F: JoltField, PCS: CommitmentScheme<Field = F>, T: Transcript>
189189
}
190190
}
191191

192-
fn gen_ra_one_hot_provers<F: JoltField>(
193-
state_manager: &mut StateManager<'_, F, impl CommitmentScheme<Field = F>>,
192+
fn gen_ra_one_hot_provers<F: JoltField, T: Transcript>(
193+
state_manager: &mut StateManager<'_, F, T, impl CommitmentScheme<Field = F>>,
194194
opening_accumulator: &ProverOpeningAccumulator<F>,
195-
transcript: &mut impl Transcript,
195+
transcript: &mut T,
196196
) -> (HammingWeightSumcheckProver<F>, BooleanitySumcheckProver<F>) {
197197
let (preprocessing, _, trace, _, _) = state_manager.get_prover_data();
198198
let bytecode_preprocessing = &preprocessing.shared.bytecode;
@@ -247,9 +247,9 @@ fn gen_ra_one_hot_provers<F: JoltField>(
247247
)
248248
}
249249

250-
fn new_ra_one_hot_verifiers<F: JoltField>(
251-
state_manager: &mut StateManager<'_, F, impl CommitmentScheme<Field = F>>,
252-
transcript: &mut impl Transcript,
250+
fn new_ra_one_hot_verifiers<F: JoltField, T: Transcript>(
251+
state_manager: &mut StateManager<'_, F, T, impl CommitmentScheme<Field = F>>,
252+
transcript: &mut T,
253253
) -> (
254254
HammingWeightSumcheckVerifier<F>,
255255
BooleanitySumcheckVerifier<F>,

jolt-core/src/zkvm/bytecode/read_raf_checking.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,10 @@ pub struct ReadRafSumcheckProver<F: JoltField> {
122122

123123
impl<F: JoltField> ReadRafSumcheckProver<F> {
124124
#[tracing::instrument(skip_all, name = "BytecodeReadRafSumcheckProver::gen")]
125-
pub fn gen(
126-
state_manager: &mut StateManager<F, impl CommitmentScheme<Field = F>>,
125+
pub fn gen<T: Transcript>(
126+
state_manager: &mut StateManager<F, T, impl CommitmentScheme<Field = F>>,
127127
opening_accumulator: &ProverOpeningAccumulator<F>,
128-
transcript: &mut impl Transcript,
128+
transcript: &mut T,
129129
) -> Self {
130130
let params = ReadRafSumcheckParams::gen(state_manager, opening_accumulator, transcript);
131131

@@ -520,10 +520,10 @@ pub struct ReadRafSumcheckVerifier<F: JoltField> {
520520
}
521521

522522
impl<F: JoltField> ReadRafSumcheckVerifier<F> {
523-
pub fn gen(
524-
state_manager: &mut StateManager<'_, F, impl CommitmentScheme<Field = F>>,
523+
pub fn gen<T: Transcript>(
524+
state_manager: &mut StateManager<'_, F, T, impl CommitmentScheme<Field = F>>,
525525
opening_accumulator: &VerifierOpeningAccumulator<F>,
526-
transcript: &mut impl Transcript,
526+
transcript: &mut T,
527527
) -> Self {
528528
Self {
529529
params: ReadRafSumcheckParams::gen(state_manager, opening_accumulator, transcript),
@@ -642,10 +642,10 @@ struct ReadRafSumcheckParams<F: JoltField> {
642642
}
643643

644644
impl<F: JoltField> ReadRafSumcheckParams<F> {
645-
fn gen(
646-
state_manager: &mut StateManager<'_, F, impl CommitmentScheme<Field = F>>,
645+
fn gen<T: Transcript>(
646+
state_manager: &mut StateManager<'_, F, T, impl CommitmentScheme<Field = F>>,
647647
opening_accumulator: &dyn OpeningAccumulator<F>,
648-
transcript: &mut impl Transcript,
648+
transcript: &mut T,
649649
) -> Self {
650650
let preprocessing = state_manager.get_shared_preprocessing();
651651
let K = preprocessing.bytecode.code_size;
@@ -757,11 +757,11 @@ impl<F: JoltField> ReadRafSumcheckParams<F> {
757757
}
758758
}
759759

760-
fn compute_val_rv(
761-
sm: &mut StateManager<F, impl CommitmentScheme<Field = F>>,
760+
fn compute_val_rv<T: Transcript>(
761+
sm: &mut StateManager<F, T, impl CommitmentScheme<Field = F>>,
762762
opening_accumulator: &dyn OpeningAccumulator<F>,
763763
val_type: ReadCheckingValType,
764-
transcript: &mut impl Transcript,
764+
transcript: &mut T,
765765
) -> (Vec<F>, F) {
766766
match val_type {
767767
ReadCheckingValType::Stage1 => {
@@ -807,7 +807,7 @@ impl<F: JoltField> ReadRafSumcheckParams<F> {
807807
/// + gamma^2 * circuit_flags[0](k) + gamma^3 * circuit_flags[1](k) + ...
808808
/// This particular Val virtualizes claims output by Spartan's "outer" sumcheck
809809
fn compute_val_1(
810-
sm: &mut StateManager<F, impl CommitmentScheme<Field = F>>,
810+
sm: &mut StateManager<F, impl Transcript, impl CommitmentScheme<Field = F>>,
811811
gamma_powers: &[F],
812812
) -> Vec<F> {
813813
sm.get_bytecode()
@@ -880,7 +880,7 @@ impl<F: JoltField> ReadRafSumcheckParams<F> {
880880
/// write_lookup_output_to_rd_flag(k) = 1 if instruction k writes lookup output to rd, 0 otherwise.
881881
/// This Val matches the fused product sumcheck.
882882
fn compute_val_2(
883-
sm: &mut StateManager<F, impl CommitmentScheme<Field = F>>,
883+
sm: &mut StateManager<F, impl Transcript, impl CommitmentScheme<Field = F>>,
884884
gamma_powers: &[F],
885885
) -> Vec<F> {
886886
sm.get_bytecode()
@@ -948,7 +948,7 @@ impl<F: JoltField> ReadRafSumcheckParams<F> {
948948
/// + gamma^3 * left_operand_is_pc(k) + ...
949949
/// This particular Val virtualizes claims output by the ShiftSumcheck.
950950
fn compute_val_3(
951-
sm: &mut StateManager<F, impl CommitmentScheme<Field = F>>,
951+
sm: &mut StateManager<F, impl Transcript, impl CommitmentScheme<Field = F>>,
952952
gamma_powers: &[F],
953953
) -> Vec<F> {
954954
sm.get_bytecode()
@@ -1067,7 +1067,7 @@ impl<F: JoltField> ReadRafSumcheckParams<F> {
10671067
/// and analogously for rs1(k, k') and rs2(k, k').
10681068
/// This particular Val virtualizes claims output by the registers read/write checking sumcheck.
10691069
fn compute_val_4(
1070-
sm: &mut StateManager<F, impl CommitmentScheme<Field = F>>,
1070+
sm: &mut StateManager<F, impl Transcript, impl CommitmentScheme<Field = F>>,
10711071
opening_accumulator: &dyn OpeningAccumulator<F>,
10721072
gamma_powers: &[F],
10731073
) -> Vec<F> {
@@ -1125,7 +1125,7 @@ impl<F: JoltField> ReadRafSumcheckParams<F> {
11251125
/// This particular Val virtualizes the claim output by the registers val-evaluation sumcheck
11261126
/// and the instruction lookups sumcheck.
11271127
fn compute_val_5(
1128-
sm: &mut StateManager<F, impl CommitmentScheme<Field = F>>,
1128+
sm: &mut StateManager<F, impl Transcript, impl CommitmentScheme<Field = F>>,
11291129
opening_accumulator: &dyn OpeningAccumulator<F>,
11301130
gamma_powers: &[F],
11311131
) -> Vec<F> {

0 commit comments

Comments
 (0)