From 953e5a024abd961419f2cc0dd47f266b7c7490f7 Mon Sep 17 00:00:00 2001 From: nhtyy Date: Wed, 11 Dec 2024 18:36:38 -0800 Subject: [PATCH] fix: move defualt limits --- crates/sdk/src/client.rs | 11 ++------ crates/sdk/src/lib.rs | 40 +++++++++++++++++------------ crates/sdk/src/local/prover.rs | 2 +- crates/sdk/src/network-v2/prover.rs | 2 +- 4 files changed, 27 insertions(+), 28 deletions(-) diff --git a/crates/sdk/src/client.rs b/crates/sdk/src/client.rs index b87c1e978..74f2cdb39 100644 --- a/crates/sdk/src/client.rs +++ b/crates/sdk/src/client.rs @@ -13,7 +13,7 @@ use sp1_core_executor::{ExecutionError, ExecutionReport}; use sp1_core_machine::io::SP1Stdin; use sp1_primitives::io::SP1PublicValues; use sp1_prover::{SP1ProvingKey, SP1VerifyingKey}; -use std::{env, sync::Arc}; +use std::sync::Arc; use crate::ProofOpts; mod request; @@ -37,7 +37,7 @@ impl ProverClient { fn create_from_env() -> Self { #[cfg(feature = "network-v2")] - match env::var("SP1_PROVER").unwrap_or("local".to_string()).as_str() { + match std::env::var("SP1_PROVER").unwrap_or("local".to_string()).as_str() { "network" => { let rpc_url = env::var("PROVER_NETWORK_RPC") .unwrap_or_else(|_| DEFAULT_PROVER_NETWORK_RPC.to_string()); @@ -83,10 +83,3 @@ impl ProverClient { self.inner.verify(proof, vk).await } } - -/// The default timeout seconds for a proof request to be generated (4 hours). -pub const DEFAULT_TIMEOUT: u64 = 14400; - -/// The default cycle limit for a proof request. -pub const DEFAULT_CYCLE_LIMIT: u64 = 100_000_000; - diff --git a/crates/sdk/src/lib.rs b/crates/sdk/src/lib.rs index 21770b261..9f5ccbba9 100644 --- a/crates/sdk/src/lib.rs +++ b/crates/sdk/src/lib.rs @@ -5,23 +5,6 @@ //! Visit the [Getting Started](https://succinctlabs.github.io/sp1/getting-started.html) section //! in the official SP1 documentation for a quick start guide. -mod client; -mod prover; -mod request; -mod verify; - -pub mod artifacts; -pub mod install; - -#[cfg(feature = "network-v2")] -#[path = "network-v2/mod.rs"] -pub mod network_v2; - -#[cfg(feature = "cuda")] -pub use crate::local::CudaProver; -#[cfg(feature = "network-v2")] -pub use crate::network_v2::NetworkProver; - pub mod local; pub mod proof; pub mod utils { @@ -43,6 +26,29 @@ pub use sp1_prover::{ use sp1_stark::MachineVerificationError; use thiserror::Error; +mod client; +mod prover; +mod verify; + +pub mod artifacts; +pub mod install; + +#[cfg(feature = "cuda")] +pub use crate::local::CudaProver; + +#[cfg(feature = "network-v2")] +pub use crate::network_v2::NetworkProver; + +#[cfg(feature = "network-v2")] +#[path = "network-v2/mod.rs"] +pub mod network_v2;/// The default timeout seconds for a proof request to be generated (4 hours). +/// +pub const DEFAULT_TIMEOUT: u64 = 14400; + +/// The default cycle limit for a proof request. +pub const DEFAULT_CYCLE_LIMIT: u64 = 100_000_000; + + pub struct ProofOpts { pub mode: Mode, pub timeout: u64, diff --git a/crates/sdk/src/local/prover.rs b/crates/sdk/src/local/prover.rs index 0e33212be..49fc7ba01 100644 --- a/crates/sdk/src/local/prover.rs +++ b/crates/sdk/src/local/prover.rs @@ -3,7 +3,7 @@ use crate::Mode; use crate::ProofOpts; use crate::proof::{SP1Proof, SP1ProofWithPublicValues}; use crate::prover::Prover; -use crate::request::{DEFAULT_CYCLE_LIMIT, DEFAULT_TIMEOUT}; +use crate::{DEFAULT_CYCLE_LIMIT, DEFAULT_TIMEOUT}; use crate::verify; use crate::SP1VerificationError; diff --git a/crates/sdk/src/network-v2/prover.rs b/crates/sdk/src/network-v2/prover.rs index 390815a5f..80e7ac5c5 100644 --- a/crates/sdk/src/network-v2/prover.rs +++ b/crates/sdk/src/network-v2/prover.rs @@ -26,7 +26,7 @@ use crate::network_v2::{ use crate::ProofOpts; use crate::proof::SP1ProofWithPublicValues; use crate::prover::Prover; -use crate::request::{DEFAULT_CYCLE_LIMIT, DEFAULT_TIMEOUT}; +use crate::{DEFAULT_CYCLE_LIMIT, DEFAULT_TIMEOUT}; use crate::verify; use crate::SP1VerificationError;