diff --git a/crates/nargo/src/cli/compile_cmd.rs b/crates/nargo/src/cli/compile_cmd.rs index 941f0251166..81e52b3a2fb 100644 --- a/crates/nargo/src/cli/compile_cmd.rs +++ b/crates/nargo/src/cli/compile_cmd.rs @@ -90,17 +90,17 @@ fn save_acir_to_dir>( let mut circuit_path = create_named_dir(circuit_dir.as_ref(), "target"); circuit_path.push(circuit_name); - // Save a checksum of the circuit to compare against during proving and verification - let acir_hash = hash_constraint_system(circuit); - circuit_path.set_extension(ACIR_EXT.to_owned() + ".sha256"); - write_to_file(hex::encode(acir_hash).as_bytes(), &circuit_path); - let mut serialized = Vec::new(); circuit.write(&mut serialized).expect("could not serialize circuit"); circuit_path.set_extension(ACIR_EXT); write_to_file(serialized.as_slice(), &circuit_path); + // Save a checksum of the circuit to compare against during proving and verification + let acir_hash = hash_constraint_system(circuit); + circuit_path.set_extension(ACIR_EXT.to_owned() + ".sha256"); + write_to_file(hex::encode(acir_hash).as_bytes(), &circuit_path); + circuit_path }