Skip to content

Commit

Permalink
feat: execute before prove_remote_async (#530)
Browse files Browse the repository at this point in the history
  • Loading branch information
ratankaliani authored Apr 16, 2024
1 parent ad2993a commit 7a57682
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ impl ProverClient {
}

// Generate a proof remotely using the Succinct Network in an async context.
// Note: If the simulation of the runtime is expensive for user programs, we can add an optional
// flag to skip it. This shouldn't be the case for the vast majority of user programs.
pub async fn prove_remote_async(
&self,
elf: &[u8],
Expand All @@ -110,6 +112,12 @@ impl ProverClient {
.as_ref()
.ok_or_else(|| anyhow::anyhow!("Network client not initialized"))?;

// Execute the runtime before creating the proof request.
let mut runtime = Runtime::new(Program::from(elf));
runtime.write_vecs(&stdin.buffer);
runtime.run();
println!("Simulation complete.");

let proof_id = client.create_proof(elf, &stdin).await?;
println!("proof_id: {:?}", proof_id);

Expand Down

0 comments on commit 7a57682

Please sign in to comment.