Skip to content

Commit

Permalink
Consistently pass through random_tape
Browse files Browse the repository at this point in the history
  • Loading branch information
moodlezoup committed Dec 4, 2023
1 parent a2e525d commit 9a9002d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
5 changes: 3 additions & 2 deletions jolt-core/src/benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::jolt::vm::instruction_lookups::InstructionLookupsProof;
use crate::jolt::vm::rv32i_vm::{RV32IJoltVM, RV32I};
use crate::jolt::vm::Jolt;
use crate::lasso::surge::Surge;
use crate::utils::math::Math;
use crate::utils::{math::Math, random::RandomTape};
use crate::{jolt::instruction::xor::XORInstruction, utils::gen_random_point};
use ark_curve25519::{EdwardsProjective, Fr};
use ark_std::{log2, test_rng};
Expand Down Expand Up @@ -145,8 +145,9 @@ fn rv32i_lookup_benchmarks() -> Vec<(tracing::Span, Box<dyn FnOnce()>)> {

let r: Vec<Fr> = gen_random_point::<Fr>(ops.len().log_2());
let mut prover_transcript = Transcript::new(b"example");
let mut random_tape = RandomTape::new(b"test_tape");
let proof: InstructionLookupsProof<Fr, EdwardsProjective> =
RV32IJoltVM::prove_instruction_lookups(ops, r.clone(), &mut prover_transcript);
RV32IJoltVM::prove_instruction_lookups(ops, r.clone(), &mut prover_transcript, &mut random_tape);
let mut verifier_transcript = Transcript::new(b"example");
assert!(RV32IJoltVM::verify_instruction_lookups(proof, r, &mut verifier_transcript).is_ok());
});
Expand Down
9 changes: 4 additions & 5 deletions jolt-core/src/jolt/vm/instruction_lookups.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::{
dense_mlpoly::{DensePolynomial, PolyCommitmentGens},
eq_poly::EqPolynomial,
identity_poly::IdentityPolynomial,
structured_poly::{StructuredOpeningProof, BatchablePolynomials},
structured_poly::{BatchablePolynomials, StructuredOpeningProof},
unipoly::{CompressedUniPoly, UniPoly},
},
subprotocols::{
Expand Down Expand Up @@ -751,6 +751,7 @@ where
&self,
r: Vec<F>,
transcript: &mut Transcript,
random_tape: &mut RandomTape<G>,
) -> InstructionLookupsProof<F, G> {
<Transcript as ProofTranscript<G>>::append_protocol_name(transcript, Self::protocol_name());
let polynomials = self.polynomialize();
Expand Down Expand Up @@ -785,16 +786,14 @@ where
transcript,
);

let mut random_tape = RandomTape::new(b"proof");

// Create a single opening proof for the flag_evals and memory_evals
let sumcheck_openings = PrimarySumcheckOpenings::prove_openings(
&batched_polys,
&commitment,
&r_primary_sumcheck,
(E_evals, flag_evals),
transcript,
&mut random_tape,
random_tape,
);

let primary_sumcheck = PrimarySumcheck {
Expand All @@ -809,7 +808,7 @@ where
&batched_polys,
&commitment,
transcript,
&mut random_tape,
random_tape,
);

InstructionLookupsProof {
Expand Down
7 changes: 4 additions & 3 deletions jolt-core/src/jolt/vm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@ pub trait Jolt<F: PrimeField, G: CurveGroup<ScalarField = F>, const C: usize, co
ops: Vec<Self::InstructionSet>,
r: Vec<F>,
transcript: &mut Transcript,
random_tape: &mut RandomTape<G>,
) -> InstructionLookupsProof<F, G> {
let instruction_lookups =
InstructionLookups::<F, G, Self::InstructionSet, Self::Subtables, C, M>::new(ops);
instruction_lookups.prove_lookups(r, transcript)
instruction_lookups.prove_lookups(r, transcript, random_tape)
}

fn verify_instruction_lookups(
Expand Down Expand Up @@ -91,6 +92,7 @@ pub trait Jolt<F: PrimeField, G: CurveGroup<ScalarField = F>, const C: usize, co
memory_trace: Vec<MemoryOp>,
memory_size: usize,
transcript: &mut Transcript,
random_tape: &mut RandomTape<G>,
) -> (
MemoryCheckingProof<
G,
Expand All @@ -110,13 +112,12 @@ pub trait Jolt<F: PrimeField, G: CurveGroup<ScalarField = F>, const C: usize, co
let batched_polys = memory.batch();
let commitments: MemoryCommitment<G> = ReadWriteMemory::commit(&batched_polys);

let mut random_tape = RandomTape::new(b"proof");
let memory_checking_proof = memory.prove_memory_checking(
&memory,
&batched_polys,
&commitments,
transcript,
&mut random_tape,
random_tape,
);

let timestamp_validity_lookups: Vec<SLTUInstruction> = read_timestamps
Expand Down

0 comments on commit 9a9002d

Please sign in to comment.