diff --git a/crates/cuda/src/lib.rs b/crates/cuda/src/lib.rs index 5bb38ca874..3517d159bc 100644 --- a/crates/cuda/src/lib.rs +++ b/crates/cuda/src/lib.rs @@ -122,6 +122,22 @@ impl SP1CudaProver { .spawn() .map_err(|e| format!("Failed to start Docker container: {}. Please check your Docker installation and permissions.", e))?; + let stderr = child.stderr.take().unwrap(); + std::thread::spawn(move || { + let mut reader = BufReader::new(stderr); + let mut buffer = [0; 1024]; + loop { + match reader.read(&mut buffer) { + Ok(0) => break, + Ok(n) => { + std::io::stderr().write_all(&buffer[..n]).unwrap(); + std::io::stderr().flush().unwrap(); + } + Err(_) => break, + } + } + }); + let stdout = child.stdout.take().unwrap(); std::thread::spawn(move || { let mut reader = BufReader::new(stdout); diff --git a/crates/sdk/src/provers/cuda.rs b/crates/sdk/src/provers/cuda.rs index a10bdb33f3..bfecf05283 100644 --- a/crates/sdk/src/provers/cuda.rs +++ b/crates/sdk/src/provers/cuda.rs @@ -49,6 +49,11 @@ impl Prover for CudaProver { // Generate the core proof. let proof = self.cuda_prover.prove_core(pk, &stdin)?; + + { + tracing::info!("verify core"); + self.prover.verify(&proof.proof, &pk.vk).expect("prove core failed"); + } if kind == SP1ProofKind::Core { return Ok(SP1ProofWithPublicValues { proof: SP1Proof::Core(proof.proof.0), @@ -64,6 +69,10 @@ impl Prover for CudaProver { // Generate the compressed proof. let reduce_proof = self.cuda_prover.compress(&pk.vk, proof, deferred_proofs)?; + { + tracing::info!("verify compressed"); + self.prover.verify_compressed(&reduce_proof, &pk.vk).expect("prove compressed failed"); + } if kind == SP1ProofKind::Compressed { return Ok(SP1ProofWithPublicValues { proof: SP1Proof::Compressed(Box::new(reduce_proof)), @@ -75,9 +84,17 @@ impl Prover for CudaProver { // Generate the shrink proof. let compress_proof = self.cuda_prover.shrink(reduce_proof)?; + { + tracing::info!("verify shrink"); + self.prover.verify_shrink(&compress_proof, &pk.vk).expect("prove shrink failed"); + } // Genenerate the wrap proof. - let outer_proof = self.cuda_prover.wrap_bn254(compress_proof)?; + let outer_proof = self.prover.wrap_bn254(compress_proof, _opts.sp1_prover_opts)?; + { + tracing::info!("verify wrap bn254"); + self.prover.verify_wrap_bn254(&outer_proof, &pk.vk).expect("prove wrap bn254 failed"); + } if kind == SP1ProofKind::Plonk { let plonk_bn254_aritfacts = if sp1_prover::build::sp1_dev_mode() {