Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
sagar-a16z committed Oct 31, 2024
1 parent dcbd290 commit 124f0df
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 19 deletions.
18 changes: 16 additions & 2 deletions jolt-core/src/benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,14 @@ where
let (io_device, trace) = program.trace();

let preprocessing: crate::jolt::vm::JoltPreprocessing<C, F, PCS, ProofTranscript> =
RV32IJoltVM::preprocess(bytecode.clone(), io_device, memory_init, 1 << 20, 1 << 20, 1 << 22);
RV32IJoltVM::preprocess(
bytecode.clone(),
io_device,
memory_init,
1 << 20,
1 << 20,
1 << 22,
);

let (jolt_proof, jolt_commitments, _) =
<RV32IJoltVM as Jolt<_, PCS, C, M, ProofTranscript>>::prove(
Expand Down Expand Up @@ -186,7 +193,14 @@ where
let (io_device, trace) = program.trace();

let preprocessing: crate::jolt::vm::JoltPreprocessing<C, F, PCS, ProofTranscript> =
RV32IJoltVM::preprocess(bytecode.clone(), io_device, memory_init, 1 << 20, 1 << 20, 1 << 22);
RV32IJoltVM::preprocess(
bytecode.clone(),
io_device,
memory_init,
1 << 20,
1 << 20,
1 << 22,
);

let (jolt_proof, jolt_commitments, _) =
<RV32IJoltVM as Jolt<_, PCS, C, M, ProofTranscript>>::prove(
Expand Down
9 changes: 7 additions & 2 deletions jolt-core/src/jolt/vm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -539,11 +539,16 @@ where
opening_accumulator
.compare_to(debug_info.opening_accumulator, &preprocessing.generators);
}
Self::fiat_shamir_preamble(&mut transcript, &preprocessing.program_io, proof.trace_length);
Self::fiat_shamir_preamble(
&mut transcript,
&preprocessing.program_io,
proof.trace_length,
);

// Regenerate the uniform Spartan key
let padded_trace_length = proof.trace_length.next_power_of_two();
let memory_start = RAM_START_ADDRESS - preprocessing.program_io.memory_layout.ram_witness_offset;
let memory_start =
RAM_START_ADDRESS - preprocessing.program_io.memory_layout.ram_witness_offset;
let r1cs_builder =
Self::Constraints::construct_constraints(padded_trace_length, memory_start);
let spartan_key = spartan::UniformSpartanProof::<C, _, F, ProofTranscript>::setup(
Expand Down
64 changes: 49 additions & 15 deletions jolt-core/src/jolt/vm/rv32i_vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,14 @@ mod tests {
let (io_device, trace) = program.trace();
drop(artifact_guard);

let preprocessing =
RV32IJoltVM::preprocess(bytecode.clone(), io_device, memory_init, 1 << 20, 1 << 20, 1 << 20);
let preprocessing = RV32IJoltVM::preprocess(
bytecode.clone(),
io_device,
memory_init,
1 << 20,
1 << 20,
1 << 20,
);
let (proof, commitments, debug_info) =
<RV32IJoltVM as Jolt<F, PCS, C, M, ProofTranscript>>::prove(
trace,
Expand Down Expand Up @@ -370,8 +376,14 @@ mod tests {
let (bytecode, memory_init) = program.decode();
let (io_device, trace) = program.trace();

let preprocessing =
RV32IJoltVM::preprocess(bytecode.clone(), io_device, memory_init, 1 << 20, 1 << 20, 1 << 20);
let preprocessing = RV32IJoltVM::preprocess(
bytecode.clone(),
io_device,
memory_init,
1 << 20,
1 << 20,
1 << 20,
);
let (jolt_proof, jolt_commitments, debug_info) =
<RV32IJoltVM as Jolt<
_,
Expand Down Expand Up @@ -400,8 +412,14 @@ mod tests {
let (io_device, trace) = program.trace();
drop(guard);

let preprocessing =
RV32IJoltVM::preprocess(bytecode.clone(), io_device, memory_init, 1 << 20, 1 << 20, 1 << 20);
let preprocessing = RV32IJoltVM::preprocess(
bytecode.clone(),
io_device,
memory_init,
1 << 20,
1 << 20,
1 << 20,
);
let (jolt_proof, jolt_commitments, debug_info) =
<RV32IJoltVM as Jolt<
_,
Expand Down Expand Up @@ -430,8 +448,14 @@ mod tests {
let (io_device, trace) = program.trace();
drop(guard);

let preprocessing =
RV32IJoltVM::preprocess(bytecode.clone(), io_device, memory_init, 1 << 20, 1 << 20, 1 << 20);
let preprocessing = RV32IJoltVM::preprocess(
bytecode.clone(),
io_device,
memory_init,
1 << 20,
1 << 20,
1 << 20,
);
let (jolt_proof, jolt_commitments, debug_info) = <RV32IJoltVM as Jolt<
_,
Zeromorph<Bn254, KeccakTranscript>,
Expand Down Expand Up @@ -461,8 +485,14 @@ mod tests {
let (io_device, trace) = program.trace();
drop(guard);

let preprocessing =
RV32IJoltVM::preprocess(bytecode.clone(), io_device, memory_init, 1 << 20, 1 << 20, 1 << 20);
let preprocessing = RV32IJoltVM::preprocess(
bytecode.clone(),
io_device,
memory_init,
1 << 20,
1 << 20,
1 << 20,
);
let (jolt_proof, jolt_commitments, debug_info) = <RV32IJoltVM as Jolt<
_,
HyperKZG<Bn254, KeccakTranscript>,
Expand Down Expand Up @@ -494,17 +524,21 @@ mod tests {
io_device.outputs[0] = 0; // change the output to 0
drop(artifact_guard);

let preprocessing =
RV32IJoltVM::preprocess(bytecode.clone(), io_device, memory_init, 1 << 20, 1 << 20, 1 << 20);
let preprocessing = RV32IJoltVM::preprocess(
bytecode.clone(),
io_device,
memory_init,
1 << 20,
1 << 20,
1 << 20,
);
let (proof, commitments, debug_info) = <RV32IJoltVM as Jolt<
Fr,
HyperKZG<Bn254, KeccakTranscript>,
C,
M,
KeccakTranscript,
>>::prove(
trace, preprocessing.clone()
);
>>::prove(trace, preprocessing.clone());
let verification_result =
RV32IJoltVM::verify(preprocessing, proof, commitments, debug_info);
assert!(
Expand Down

0 comments on commit 124f0df

Please sign in to comment.