Skip to content

Commit

Permalink
env var
Browse files Browse the repository at this point in the history
  • Loading branch information
mattstam committed May 30, 2024
1 parent dbed499 commit a48107a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sdk/src/provers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ use anyhow::Result;
pub use local::LocalProver;
pub use mock::MockProver;
pub use network::NetworkProver;
use sp1_core::runtime::ExecutionReport;
use sp1_core::stark::MachineVerificationError;
use sp1_prover::CoreSC;
use sp1_prover::SP1CoreProofData;
use sp1_prover::SP1Prover;
use sp1_prover::SP1PublicValues;
use sp1_prover::SP1ReduceProof;
use sp1_prover::{SP1ProvingKey, SP1Stdin, SP1VerifyingKey};
use strum_macros::EnumString;
Expand All @@ -31,6 +33,11 @@ pub trait Prover: Send + Sync {

fn setup(&self, elf: &[u8]) -> (SP1ProvingKey, SP1VerifyingKey);

/// Execute the given program with the given input.
fn execute(&self, elf: &[u8], stdin: SP1Stdin) -> Result<(SP1PublicValues, ExecutionReport)> {

Check warning on line 37 in sdk/src/provers/mod.rs

View workflow job for this annotation

GitHub Actions / Test (ARM)

function cannot return without recursing

Check warning on line 37 in sdk/src/provers/mod.rs

View workflow job for this annotation

GitHub Actions / Test (ARM)

function cannot return without recursing

Check warning on line 37 in sdk/src/provers/mod.rs

View workflow job for this annotation

GitHub Actions / Test (x86-64)

function cannot return without recursing

Check warning on line 37 in sdk/src/provers/mod.rs

View workflow job for this annotation

GitHub Actions / Test (x86-64)

function cannot return without recursing

Check failure on line 37 in sdk/src/provers/mod.rs

View workflow job for this annotation

GitHub Actions / Formatting & Clippy

function cannot return without recursing

Check failure on line 37 in sdk/src/provers/mod.rs

View workflow job for this annotation

GitHub Actions / Formatting & Clippy

parameter is only used in recursion

Check failure on line 37 in sdk/src/provers/mod.rs

View workflow job for this annotation

GitHub Actions / Formatting & Clippy

parameter is only used in recursion
self.execute(elf, stdin)
}

/// Prove the execution of a RISCV ELF with the given inputs.
fn prove(&self, pk: &SP1ProvingKey, stdin: SP1Stdin) -> Result<SP1Proof>;

Expand Down
14 changes: 14 additions & 0 deletions sdk/src/provers/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,20 @@ impl NetworkProver {
) -> Result<P> {
let client = &self.client;

let skip_simulation = env::var("SKIP_SIMULATION")
.map(|val| val == "true")
.unwrap_or(false);

if !skip_simulation {
let (_, report) = self.local_prover.execute(elf, stdin.clone())?;
log::info!(
"Simulation complete, cycles: {}",
report.total_instruction_count()
);
} else {
log::info!("Skipping simulation");
}

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

Expand Down

0 comments on commit a48107a

Please sign in to comment.