diff --git a/crates/core/machine/src/memory/program.rs b/crates/core/machine/src/memory/program.rs index 699e052c0d..4dc8b196ad 100644 --- a/crates/core/machine/src/memory/program.rs +++ b/crates/core/machine/src/memory/program.rs @@ -82,7 +82,7 @@ impl MachineAir 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::>(); + let memory = program.memory_image.iter().sorted().collect::>(); values .chunks_mut(chunk_size * NUM_MEMORY_PROGRAM_PREPROCESSED_COLS) .enumerate() diff --git a/crates/prover/src/lib.rs b/crates/prover/src/lib.rs index f72f7c9df7..a6aa17187e 100644 --- a/crates/prover/src/lib.rs +++ b/crates/prover/src/lib.rs @@ -1534,4 +1534,14 @@ pub mod tests { setup_logger(); test_e2e_with_deferred_proofs_prover::(SP1ProverOpts::default()) } + + #[test] + fn test_deterministic_setup() { + setup_logger(); + let prover = SP1Prover::::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); + } }