Skip to content

Commit

Permalink
fix: preprocessed trace bug (#1821)
Browse files Browse the repository at this point in the history
  • Loading branch information
ctian1 authored Nov 26, 2024
1 parent b1bc953 commit 80a97c1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/core/machine/src/memory/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl<F: PrimeField> MachineAir<F> for MemoryProgramChip {
let mut values = zeroed_f_vec(padded_nb_rows * NUM_MEMORY_PROGRAM_PREPROCESSED_COLS);
let chunk_size = std::cmp::max((nb_rows + 1) / num_cpus::get(), 1);

let memory = program.memory_image.iter().collect::<Vec<_>>();
let memory = program.memory_image.iter().sorted().collect::<Vec<_>>();
values
.chunks_mut(chunk_size * NUM_MEMORY_PROGRAM_PREPROCESSED_COLS)
.enumerate()
Expand Down
10 changes: 10 additions & 0 deletions crates/prover/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1534,4 +1534,14 @@ pub mod tests {
setup_logger();
test_e2e_with_deferred_proofs_prover::<DefaultProverComponents>(SP1ProverOpts::default())
}

#[test]
fn test_deterministic_setup() {
setup_logger();
let prover = SP1Prover::<DefaultProverComponents>::new();
let program = test_artifacts::FIBONACCI_ELF;
let (pk, vk) = prover.setup(&program);
let pk2 = prover.setup(&program).0;
assert_eq!(pk.pk.commit, pk2.pk.commit);
}
}

0 comments on commit 80a97c1

Please sign in to comment.