,
@@ -227,7 +227,7 @@ impl NetworkProver {
// Calculate the remaining timeout.
if let Some(timeout) = timeout {
if start_time.elapsed() > timeout {
- return Err(anyhow::anyhow!("proof request timed out."));
+ return Err(Error::RequestTimedOut { request_id: request_id.to_vec() }.into());
}
}
let remaining_timeout = timeout.map(|t| {
@@ -239,17 +239,24 @@ impl NetworkProver {
}
});
- // Get status with retries.
+ // Get the status with retries.
let (status, maybe_proof) = with_retry(
- || async { self.client.get_proof_request_status::(request_id).await },
+ || async { self.client.get_proof_request_status(request_id).await },
remaining_timeout,
"getting proof request status",
)
.await?;
+ // Check the deadline.
+ if status.deadline < Instant::now().elapsed().as_secs() {
+ return Err(Error::RequestTimedOut { request_id: request_id.to_vec() }.into());
+ }
+
// Check the execution status.
- if status.execution_status == ExecutionStatus::Unexecutable as i32 {
- return Err(anyhow::anyhow!("proof request is unexecutable"));
+ if let Ok(ExecutionStatus::Unexecutable) =
+ ExecutionStatus::try_from(status.execution_status)
+ {
+ return Err(Error::RequestUnexecutable { request_id: request_id.to_vec() }.into());
}
// Check the fulfillment status.
@@ -259,12 +266,14 @@ impl NetworkProver {
}
Ok(FulfillmentStatus::Assigned) => {
if !is_assigned {
- log::info!("proof request assigned, proving...");
+ log::info!("Proof request assigned, proving...");
is_assigned = true;
}
}
Ok(FulfillmentStatus::Unfulfillable) => {
- return Err(anyhow::anyhow!("proof request is unfulfillable"));
+ return Err(
+ Error::RequestUnfulfillable { request_id: request_id.to_vec() }.into()
+ );
}
_ => {}
}
@@ -273,7 +282,7 @@ impl NetworkProver {
}
}
- /// Requests a proof from the prover network.
+ #[allow(clippy::too_many_arguments)]
pub(crate) async fn request_proof_impl(
&self,
pk: &SP1ProvingKey,
@@ -289,7 +298,7 @@ impl NetworkProver {
self.request_proof(&vk_hash, stdin, mode.into(), strategy, cycle_limit, timeout).await
}
- /// Requests a proof from the prover network and waits for it to be generated.
+ #[allow(clippy::too_many_arguments)]
pub(crate) async fn prove_impl(
&self,
pk: &SP1ProvingKey,
@@ -326,9 +335,11 @@ impl NetworkProver {
if skip_simulation {
Ok(DEFAULT_CYCLE_LIMIT)
} else {
- let (_, report) = self.prover.inner().execute(elf, stdin, SP1Context::default())?;
- let cycles = report.total_instruction_count();
- Ok(cycles)
+ self.prover
+ .inner()
+ .execute(elf, stdin, SP1Context::default())
+ .map(|(_, report)| report.total_instruction_count())
+ .map_err(|_| Error::SimulationFailed.into())
}
}
}
diff --git a/crates/sdk/src/network/sign_message.rs b/crates/sdk/src/network/sign_message.rs
deleted file mode 100644
index 9d1289152..000000000
--- a/crates/sdk/src/network/sign_message.rs
+++ /dev/null
@@ -1,97 +0,0 @@
-use alloy_primitives::{Address, Signature};
-use prost::Message;
-use thiserror::Error;
-
-use crate::network::proto::network::{FulfillProofRequest, MessageFormat, RequestProofRequest};
-use crate::network::utils::{format_json_message, JsonFormatError};
-
-#[allow(dead_code)]
-pub trait SignedMessage {
- fn signature(&self) -> Vec;
- fn nonce(&self) -> Result;
- fn message(&self) -> Result, MessageError>;
- fn recover_sender(&self) -> Result<(Address, Vec), RecoverSenderError>;
-}
-
-#[derive(Error, Debug)]
-#[allow(dead_code)]
-pub enum MessageError {
- #[error("Empty message")]
- EmptyMessage,
- #[error("JSON error: {0}")]
- JsonError(String),
- #[error("Binary error: {0}")]
- BinaryError(String),
-}
-
-#[derive(Error, Debug)]
-pub enum RecoverSenderError {
- #[error("Failed to deserialize signature: {0}")]
- SignatureDeserializationError(String),
- #[error("Empty message")]
- EmptyMessage,
- #[error("Failed to recover address: {0}")]
- AddressRecoveryError(String),
-}
-
-macro_rules! impl_signed_message {
- ($type:ty) => {
- impl SignedMessage for $type {
- fn signature(&self) -> Vec {
- self.signature.clone()
- }
-
- fn nonce(&self) -> Result {
- match &self.body {
- Some(body) => Ok(body.nonce as u64),
- None => Err(MessageError::EmptyMessage),
- }
- }
-
- fn message(&self) -> Result, MessageError> {
- let format = MessageFormat::try_from(self.format).unwrap_or(MessageFormat::Binary);
-
- match &self.body {
- Some(body) => match format {
- MessageFormat::Json => format_json_message(body).map_err(|e| match e {
- JsonFormatError::SerializationError(msg) => {
- MessageError::JsonError(msg)
- }
- }),
- MessageFormat::Binary => {
- let proto_bytes = body.encode_to_vec();
- Ok(proto_bytes)
- }
- MessageFormat::UnspecifiedMessageFormat => {
- let proto_bytes = body.encode_to_vec();
- Ok(proto_bytes)
- }
- },
- None => Err(MessageError::EmptyMessage),
- }
- }
-
- fn recover_sender(&self) -> Result<(Address, Vec), RecoverSenderError> {
- let message = self.message().map_err(|_| RecoverSenderError::EmptyMessage)?;
- let sender = recover_sender_raw(self.signature.clone(), message.clone())?;
- Ok((sender, message))
- }
- }
- };
-}
-
-impl_signed_message!(RequestProofRequest);
-impl_signed_message!(FulfillProofRequest);
-
-#[allow(clippy::needless_pass_by_value)]
-pub fn recover_sender_raw(
- signature: Vec,
- message: Vec,
-) -> Result {
- let signature = Signature::try_from(signature.as_slice())
- .map_err(|e| RecoverSenderError::SignatureDeserializationError(e.to_string()))?;
-
- signature
- .recover_address_from_msg(message)
- .map_err(|e| RecoverSenderError::AddressRecoveryError(e.to_string()))
-}
diff --git a/crates/sdk/src/network/utils.rs b/crates/sdk/src/network/utils.rs
index e1b7d749b..22ded7c94 100644
--- a/crates/sdk/src/network/utils.rs
+++ b/crates/sdk/src/network/utils.rs
@@ -1,11 +1,11 @@
+#![allow(deprecated)]
+
//! # Network Utils
//!
//! This module provides utility functions for the network module.
use alloy_signer::{Signature, SignerSync};
use prost::Message;
-use serde::Serialize;
-use thiserror::Error;
pub(crate) trait Signable: Message {
fn sign(&self, signer: &S) -> Signature;
@@ -16,55 +16,3 @@ impl Signable for T {
signer.sign_message_sync(&self.encode_to_vec()).unwrap()
}
}
-
-#[derive(Error, Debug)]
-pub(crate) enum JsonFormatError {
- #[error("Serialization error: {0}")]
- SerializationError(String),
-}
-
-pub(crate) fn format_json_message(body: &T) -> Result, JsonFormatError>
-where
- T: Message + Serialize,
-{
- match serde_json::to_string(body) {
- Ok(json_str) => {
- if json_str.starts_with('"') && json_str.ends_with('"') {
- let inner = &json_str[1..json_str.len() - 1];
- let unescaped = inner.replace("\\\"", "\"");
- Ok(unescaped.into_bytes())
- } else {
- Ok(json_str.into_bytes())
- }
- }
- Err(e) => Err(JsonFormatError::SerializationError(e.to_string())),
- }
-}
-
-#[cfg(test)]
-mod tests {
- use super::*;
- use prost::Message as ProstMessage;
- use serde::{Deserialize, Serialize};
-
- // Test message for JSON formatting.
- #[derive(Clone, ProstMessage, Serialize, Deserialize)]
- struct TestMessage {
- #[prost(string, tag = 1)]
- value: String,
- }
-
- #[test]
- fn test_format_json_message_simple() {
- let msg = TestMessage { value: "hello".to_string() };
- let result = format_json_message(&msg).unwrap();
- assert_eq!(result, b"{\"value\":\"hello\"}");
- }
-
- #[test]
- fn test_format_json_message_with_quotes() {
- let msg = TestMessage { value: "hello \"world\"".to_string() };
- let result = format_json_message(&msg).unwrap();
- assert_eq!(result, b"{\"value\":\"hello \\\"world\\\"\"}");
- }
-}
diff --git a/examples/aggregation/script/src/main.rs b/examples/aggregation/script/src/main.rs
index 2b1227d6c..554e2c6de 100644
--- a/examples/aggregation/script/src/main.rs
+++ b/examples/aggregation/script/src/main.rs
@@ -34,17 +34,17 @@ fn main() {
let proof_1 = tracing::info_span!("generate fibonacci proof n=10").in_scope(|| {
let mut stdin = SP1Stdin::new();
stdin.write(&10);
- client.prove(&fibonacci_pk, stdin).compressed().run().expect("proving failed")
+ client.prove(&fibonacci_pk, &stdin).compressed().run().expect("proving failed")
});
let proof_2 = tracing::info_span!("generate fibonacci proof n=20").in_scope(|| {
let mut stdin = SP1Stdin::new();
stdin.write(&20);
- client.prove(&fibonacci_pk, stdin).compressed().run().expect("proving failed")
+ client.prove(&fibonacci_pk, &stdin).compressed().run().expect("proving failed")
});
let proof_3 = tracing::info_span!("generate fibonacci proof n=30").in_scope(|| {
let mut stdin = SP1Stdin::new();
stdin.write(&30);
- client.prove(&fibonacci_pk, stdin).compressed().run().expect("proving failed")
+ client.prove(&fibonacci_pk, &stdin).compressed().run().expect("proving failed")
});
// Setup the inputs to the aggregation program.
@@ -76,6 +76,6 @@ fn main() {
}
// Generate the plonk bn254 proof.
- client.prove(&aggregation_pk, stdin).plonk().run().expect("proving failed");
+ client.prove(&aggregation_pk, &stdin).plonk().run().expect("proving failed");
});
}
diff --git a/examples/bls12381/script/src/main.rs b/examples/bls12381/script/src/main.rs
index 7e6c02fd4..096c805db 100644
--- a/examples/bls12381/script/src/main.rs
+++ b/examples/bls12381/script/src/main.rs
@@ -7,7 +7,7 @@ fn main() {
let stdin = SP1Stdin::new();
let client = ProverClient::from_env();
- let (_public_values, report) = client.execute(ELF, stdin).run().expect("failed to prove");
+ let (_public_values, report) = client.execute(ELF, &stdin).run().expect("failed to prove");
println!("executed: {}", report);
}
diff --git a/examples/bn254/script/src/main.rs b/examples/bn254/script/src/main.rs
index cd9c6e505..7aa091e1f 100644
--- a/examples/bn254/script/src/main.rs
+++ b/examples/bn254/script/src/main.rs
@@ -7,7 +7,7 @@ fn main() {
let stdin = SP1Stdin::new();
let client = ProverClient::from_env();
- let (_public_values, report) = client.execute(ELF, stdin).run().expect("failed to prove");
+ let (_public_values, report) = client.execute(ELF, &stdin).run().expect("failed to prove");
println!("executed: {}", report);
}
diff --git a/examples/chess/script/src/main.rs b/examples/chess/script/src/main.rs
index 3a1df33e5..a08496647 100644
--- a/examples/chess/script/src/main.rs
+++ b/examples/chess/script/src/main.rs
@@ -15,7 +15,7 @@ fn main() {
let client = ProverClient::from_env();
let (pk, vk) = client.setup(ELF);
- let mut proof = client.prove(&pk, stdin).run().unwrap();
+ let mut proof = client.prove(&pk, &stdin).run().unwrap();
// Read output.
let is_valid_move = proof.public_values.read::();
diff --git a/examples/cycle-tracking/script/src/main.rs b/examples/cycle-tracking/script/src/main.rs
index 03a76a80f..ee845c6ce 100644
--- a/examples/cycle-tracking/script/src/main.rs
+++ b/examples/cycle-tracking/script/src/main.rs
@@ -10,10 +10,11 @@ fn main() {
// Execute the normal program.
let client = ProverClient::from_env();
- let (_, _) = client.execute(NORMAL_ELF, SP1Stdin::new()).run().expect("proving failed");
+ let stdin = SP1Stdin::new();
+ let (_, _) = client.execute(NORMAL_ELF, &stdin).run().expect("proving failed");
// Execute the report program.
- let (_, report) = client.execute(REPORT_ELF, SP1Stdin::new()).run().expect("proving failed");
+ let (_, report) = client.execute(REPORT_ELF, &stdin).run().expect("proving failed");
// Get the "setup" cycle count from the report program.
let setup_cycles = report.cycle_tracker.get("setup").unwrap();
diff --git a/examples/fibonacci/script/Cargo.toml b/examples/fibonacci/script/Cargo.toml
index 308d3eeed..a7ffb4d7a 100644
--- a/examples/fibonacci/script/Cargo.toml
+++ b/examples/fibonacci/script/Cargo.toml
@@ -28,6 +28,10 @@ path = "bin/compressed.rs"
name = "execute"
path = "bin/execute.rs"
+[[bin]]
+name = "network"
+path = "bin/network.rs"
+
[[bin]]
name = "fibonacci-script"
path = "src/main.rs"
diff --git a/examples/fibonacci/script/bin/compressed.rs b/examples/fibonacci/script/bin/compressed.rs
index 632f9cd15..c14b23736 100644
--- a/examples/fibonacci/script/bin/compressed.rs
+++ b/examples/fibonacci/script/bin/compressed.rs
@@ -15,7 +15,7 @@ fn main() {
// Generate the constant-sized proof for the given program and input.
let client = ProverClient::from_env();
let (pk, vk) = client.setup(ELF);
- let mut proof = client.prove(&pk, stdin).compressed().run().unwrap();
+ let mut proof = client.prove(&pk, &stdin).compressed().run().unwrap();
println!("generated proof");
// Read and verify the output.
diff --git a/examples/fibonacci/script/bin/execute.rs b/examples/fibonacci/script/bin/execute.rs
index 7b92525a7..7ded48ad3 100644
--- a/examples/fibonacci/script/bin/execute.rs
+++ b/examples/fibonacci/script/bin/execute.rs
@@ -15,7 +15,7 @@ fn main() {
// Only execute the program and get a `SP1PublicValues` object.
let client = ProverClient::from_env();
- let (mut public_values, execution_report) = client.execute(ELF, stdin).run().unwrap();
+ let (mut public_values, execution_report) = client.execute(ELF, &stdin).run().unwrap();
// Print the total number of cycles executed and the full execution report with a breakdown of
// the RISC-V opcode and syscall counts.
diff --git a/examples/fibonacci/script/bin/groth16_bn254.rs b/examples/fibonacci/script/bin/groth16_bn254.rs
index 98e9fa96a..55f421b9c 100644
--- a/examples/fibonacci/script/bin/groth16_bn254.rs
+++ b/examples/fibonacci/script/bin/groth16_bn254.rs
@@ -19,7 +19,7 @@ fn main() {
println!("vk: {:?}", vk.bytes32());
// Generate the Groth16 proof.
- let proof = client.prove(&pk, stdin).groth16().run().unwrap();
+ let proof = client.prove(&pk, &stdin).groth16().run().unwrap();
println!("generated proof");
// Get the public values as bytes.
diff --git a/examples/fibonacci/script/bin/network.rs b/examples/fibonacci/script/bin/network.rs
new file mode 100644
index 000000000..153a60949
--- /dev/null
+++ b/examples/fibonacci/script/bin/network.rs
@@ -0,0 +1,77 @@
+use sp1_sdk::network::Error;
+use sp1_sdk::{include_elf, utils, ProverClient, SP1ProofWithPublicValues, SP1Stdin};
+
+/// The ELF we want to execute inside the zkVM.
+const ELF: &[u8] = include_elf!("fibonacci-program");
+
+fn main() {
+ // Setup logging.
+ utils::setup_logger();
+
+ // Create an input stream and write '500' to it.
+ let n = 1000u32;
+
+ // The input stream that the program will read from using `sp1_zkvm::io::read`. Note that the
+ // types of the elements in the input stream must match the types being read in the program.
+ let mut stdin = SP1Stdin::new();
+ stdin.write(&n);
+
+ // Create a `ProverClient` method.
+ let client = ProverClient::from_env();
+
+ // Generate the proof for the given program and input.
+ let (pk, vk) = client.setup(ELF);
+ let proof_result = client.prove(&pk, &stdin).compressed().run();
+
+ // Handle possible prover network errors.
+ let mut proof = match proof_result {
+ Ok(proof) => proof,
+ Err(e) => {
+ if let Some(network_error) = e.downcast_ref::() {
+ match network_error {
+ Error::RequestUnexecutable { request_id: _ } => {
+ eprintln!("Program is unexecutable: {}", e);
+ std::process::exit(1);
+ }
+ Error::RequestUnfulfillable { request_id: _ } => {
+ eprintln!("Proof request cannot be fulfilled: {}", e);
+ std::process::exit(1);
+ }
+ _ => {
+ eprintln!("Unexpected error: {}", e);
+ std::process::exit(1);
+ }
+ }
+ } else {
+ eprintln!("Unexpected error: {}", e);
+ std::process::exit(1);
+ }
+ }
+ };
+
+ println!("generated proof");
+
+ // Read and verify the output.
+ //
+ // Note that this output is read from values committed to in the program using
+ // `sp1_zkvm::io::commit`.
+ let _ = proof.public_values.read::();
+ let a = proof.public_values.read::();
+ let b = proof.public_values.read::();
+
+ println!("a: {}", a);
+ println!("b: {}", b);
+
+ // Verify proof and public values
+ client.verify(&proof, &vk).expect("verification failed");
+
+ // Test a round trip of proof serialization and deserialization.
+ proof.save("proof-with-pis.bin").expect("saving proof failed");
+ let deserialized_proof =
+ SP1ProofWithPublicValues::load("proof-with-pis.bin").expect("loading proof failed");
+
+ // Verify the deserialized proof.
+ client.verify(&deserialized_proof, &vk).expect("verification failed");
+
+ println!("successfully generated and verified proof for the program!")
+}
diff --git a/examples/fibonacci/script/bin/plonk_bn254.rs b/examples/fibonacci/script/bin/plonk_bn254.rs
index 48f9c51a3..5f7b3be90 100644
--- a/examples/fibonacci/script/bin/plonk_bn254.rs
+++ b/examples/fibonacci/script/bin/plonk_bn254.rs
@@ -19,7 +19,7 @@ fn main() {
println!("vk: {:?}", vk.bytes32());
// Generate the Plonk proof.
- let proof = client.prove(&pk, stdin).plonk().run().unwrap();
+ let proof = client.prove(&pk, &stdin).plonk().run().unwrap();
println!("generated proof");
// Get the public values as bytes.
diff --git a/examples/fibonacci/script/src/main.rs b/examples/fibonacci/script/src/main.rs
index 442fce04c..eb3a16f4d 100644
--- a/examples/fibonacci/script/src/main.rs
+++ b/examples/fibonacci/script/src/main.rs
@@ -19,12 +19,12 @@ fn main() {
let client = ProverClient::from_env();
// Execute the program using the `ProverClient.execute` method, without generating a proof.
- let (_, report) = client.execute(ELF, stdin.clone()).run().unwrap();
+ let (_, report) = client.execute(ELF, &stdin).run().unwrap();
println!("executed program with {} cycles", report.total_instruction_count());
// Generate the proof for the given program and input.
let (pk, vk) = client.setup(ELF);
- let mut proof = client.prove(&pk, stdin).run().unwrap();
+ let mut proof = client.prove(&pk, &stdin).run().unwrap();
println!("generated proof");
diff --git a/examples/groth16/script/src/main.rs b/examples/groth16/script/src/main.rs
index 2fecb5493..498a2e65c 100644
--- a/examples/groth16/script/src/main.rs
+++ b/examples/groth16/script/src/main.rs
@@ -28,7 +28,7 @@ fn generate_fibonacci_proof() -> (Vec, Vec, String) {
// Generate the groth16 proof for the Fibonacci program.
let (pk, vk) = client.setup(FIBONACCI_ELF);
println!("vk: {:?}", vk.bytes32());
- let proof = client.prove(&pk, stdin).groth16().run().unwrap();
+ let proof = client.prove(&pk, &stdin).groth16().run().unwrap();
(proof.bytes(), proof.public_values.to_vec(), vk.bytes32())
}
@@ -49,7 +49,7 @@ fn main() {
let client = ProverClient::from_env();
// Execute the program using the `ProverClient.execute` method, without generating a proof.
- let (_, report) = client.execute(GROTH16_ELF, stdin.clone()).run().unwrap();
+ let (_, report) = client.execute(GROTH16_ELF, &stdin).run().unwrap();
println!("executed groth16 program with {} cycles", report.total_instruction_count());
println!("{}", report);
}
diff --git a/examples/io/script/src/main.rs b/examples/io/script/src/main.rs
index 008c69e09..fa8812c38 100644
--- a/examples/io/script/src/main.rs
+++ b/examples/io/script/src/main.rs
@@ -25,7 +25,7 @@ fn main() {
// Generate the proof for the given program.
let client = ProverClient::from_env();
let (pk, vk) = client.setup(ELF);
- let mut proof = client.prove(&pk, stdin).run().unwrap();
+ let mut proof = client.prove(&pk, &stdin).run().unwrap();
// Read the output.
let r = proof.public_values.read::();
diff --git a/examples/is-prime/script/src/main.rs b/examples/is-prime/script/src/main.rs
index c96577574..1d866645e 100644
--- a/examples/is-prime/script/src/main.rs
+++ b/examples/is-prime/script/src/main.rs
@@ -16,7 +16,7 @@ fn main() {
// Generate and verify the proof
let client = ProverClient::from_env();
let (pk, vk) = client.setup(ELF);
- let mut proof = client.prove(&pk, stdin).run().unwrap();
+ let mut proof = client.prove(&pk, &stdin).run().unwrap();
let is_prime = proof.public_values.read::();
println!("Is 29 prime? {}", is_prime);
diff --git a/examples/json/script/src/main.rs b/examples/json/script/src/main.rs
index 4c3eaa03a..6c98a6e48 100644
--- a/examples/json/script/src/main.rs
+++ b/examples/json/script/src/main.rs
@@ -36,7 +36,7 @@ fn main() {
let client = ProverClient::from_env();
let (pk, vk) = client.setup(JSON_ELF);
- let mut proof = client.prove(&pk, stdin).run().expect("proving failed");
+ let mut proof = client.prove(&pk, &stdin).run().expect("proving failed");
// Read output.
let val = proof.public_values.read::();
diff --git a/examples/patch-testing/script/src/main.rs b/examples/patch-testing/script/src/main.rs
index 5e85f2b82..7195bfee4 100644
--- a/examples/patch-testing/script/src/main.rs
+++ b/examples/patch-testing/script/src/main.rs
@@ -9,7 +9,7 @@ pub fn main() {
let stdin = SP1Stdin::new();
let client = ProverClient::from_env();
- let (_, report) = client.execute(PATCH_TEST_ELF, stdin).run().expect("executing failed");
+ let (_, report) = client.execute(PATCH_TEST_ELF, &stdin).run().expect("executing failed");
// Confirm there was at least 1 SHA_COMPUTE syscall.
assert_ne!(report.syscall_counts[sp1_core_executor::syscalls::SyscallCode::SHA_COMPRESS], 0);
diff --git a/examples/regex/script/src/main.rs b/examples/regex/script/src/main.rs
index 63c8c6fe6..e5ddb0c07 100644
--- a/examples/regex/script/src/main.rs
+++ b/examples/regex/script/src/main.rs
@@ -20,7 +20,7 @@ fn main() {
// Generate the proof for the given program and input.
let client = ProverClient::from_env();
let (pk, vk) = client.setup(REGEX_IO_ELF);
- let mut proof = client.prove(&pk, stdin).run().expect("proving failed");
+ let mut proof = client.prove(&pk, &stdin).run().expect("proving failed");
// Read the output.
let res = proof.public_values.read::();
diff --git a/examples/rsa/script/src/main.rs b/examples/rsa/script/src/main.rs
index 991a458d7..1b7cae848 100644
--- a/examples/rsa/script/src/main.rs
+++ b/examples/rsa/script/src/main.rs
@@ -54,7 +54,7 @@ fn main() {
// Generate the proof for the given program and input.
let client = ProverClient::from_env();
let (pk, vk) = client.setup(RSA_ELF);
- let proof = client.prove(&pk, stdin).run().expect("proving failed");
+ let proof = client.prove(&pk, &stdin).run().expect("proving failed");
// Verify proof.
client.verify(&proof, &vk).expect("verification failed");
diff --git a/examples/rsp/script/src/main.rs b/examples/rsp/script/src/main.rs
index 08ded491e..f1dabaceb 100644
--- a/examples/rsp/script/src/main.rs
+++ b/examples/rsp/script/src/main.rs
@@ -42,8 +42,7 @@ fn main() {
stdin.write_vec(buffer);
// Only execute the program.
- let (mut public_values, execution_report) =
- client.execute(&pk.elf, stdin.clone()).run().unwrap();
+ let (mut public_values, execution_report) = client.execute(&pk.elf, &stdin).run().unwrap();
println!(
"Finished executing the block in {} cycles",
execution_report.total_instruction_count()
@@ -57,7 +56,7 @@ fn main() {
// It is strongly recommended you use the network prover given the size of these programs.
if args.prove {
println!("Starting proof generation.");
- let proof = client.prove(&pk, stdin).run().expect("Proving should work.");
+ let proof = client.prove(&pk, &stdin).run().expect("Proving should work.");
println!("Proof generation finished.");
client.verify(&proof, &vk).expect("proof verification should succeed");
diff --git a/examples/ssz-withdrawals/script/src/main.rs b/examples/ssz-withdrawals/script/src/main.rs
index 9a6450bc7..0da068396 100644
--- a/examples/ssz-withdrawals/script/src/main.rs
+++ b/examples/ssz-withdrawals/script/src/main.rs
@@ -10,7 +10,7 @@ fn main() {
let stdin = SP1Stdin::new();
let client = ProverClient::from_env();
let (pk, vk) = client.setup(ELF);
- let proof = client.prove(&pk, stdin).run().expect("proving failed");
+ let proof = client.prove(&pk, &stdin).run().expect("proving failed");
// Verify proof.
client.verify(&proof, &vk).expect("verification failed");
diff --git a/examples/tendermint/script/src/main.rs b/examples/tendermint/script/src/main.rs
index 298b8ee75..43ac8cbef 100644
--- a/examples/tendermint/script/src/main.rs
+++ b/examples/tendermint/script/src/main.rs
@@ -44,9 +44,9 @@ pub fn main() {
let client = ProverClient::from_env();
let (pk, vk) = client.setup(TENDERMINT_ELF);
- client.execute(TENDERMINT_ELF, stdin.clone()).run().expect("proving failed");
+ client.execute(TENDERMINT_ELF, &stdin).run().expect("proving failed");
- let proof = client.prove(&pk, stdin).run().expect("proving failed");
+ let proof = client.prove(&pk, &stdin).run().expect("proving failed");
// Verify proof.
client.verify(&proof, &vk).expect("verification failed");