Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
nhtyy committed Dec 12, 2024
1 parent 2873a73 commit 7474d78
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 100 deletions.
10 changes: 2 additions & 8 deletions crates/sdk/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,14 @@ use std::{env, sync::Arc};
use crate::ProofOpts;

mod request;
use request::DynProofRequest;
pub use request::DynProofRequest;
mod builder;
use builder::{ProverClientBuilder, None};
pub use builder::{ProverClientBuilder, None};

pub struct ProverClient {
inner: Box<dyn Prover>,
}

impl Default for ProverClient {
fn default() -> Self {
Self::new()
}
}

impl ProverClient {
pub fn builder() -> ProverClientBuilder<None> {
ProverClientBuilder::new()
Expand Down
1 change: 0 additions & 1 deletion crates/sdk/src/client/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ pub struct ProverClientBuilder<T> {
inner_builder: T,
}


impl Default for ProverClientBuilder<None> {
fn default() -> Self {
Self::new()
Expand Down
2 changes: 1 addition & 1 deletion crates/sdk/src/client/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl<'a> DynProofRequest<'a> {
}

#[cfg(feature = "blocking")]
fn run(self) -> Result<SP1ProofWithPublicValues> {
pub fn run(self) -> Result<SP1ProofWithPublicValues> {
self.prover.prove_with_options_sync(&self.pk, self.stdin, self.opts)
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/sdk/src/local/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,11 @@ impl Prover for LocalProver {
#[cfg(feature = "blocking")]
fn prove_with_options_sync(
&self,
pk: &SP1ProvingKey,
pk: &Arc<SP1ProvingKey>,
stdin: SP1Stdin,
opts: ProofOpts,
) -> Result<SP1ProofWithPublicValues> {
self.prove(&pk, stdin)
self.prove(pk, stdin)
.with_mode(opts.mode)
.with_timeout(opts.timeout)
.with_cycle_limit(opts.cycle_limit)
Expand Down
18 changes: 9 additions & 9 deletions crates/sdk/src/network-v2/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub struct NetworkProver {
prover: Arc<SP1Prover<DefaultProverComponents>>,
network_client: NetworkClient,
timeout: u64,
max_cycle_limit: u64,
max_cycle_limit: Option<u64>,

}

Expand All @@ -66,7 +66,7 @@ impl NetworkProver {
prover: Arc::new(SP1Prover::new()),
network_client: NetworkClient::new(&private_key).rpc_url(rpc_url),
timeout: DEFAULT_TIMEOUT,
max_cycle_limit: DEFAULT_CYCLE_LIMIT,
max_cycle_limit: None,
}
}

Expand All @@ -83,7 +83,7 @@ impl NetworkProver {
/// Create a new proof request.
pub fn prove<'a>(
&'a self,
pk: &'a Arc<SP1ProvingKey>,
pk: &'a SP1ProvingKey,
stdin: SP1Stdin,
) -> NetworkProofRequest<'a> {
NetworkProofRequest::new(self, pk, stdin)
Expand Down Expand Up @@ -258,14 +258,14 @@ impl NetworkProverBuilder {
prover: Arc::new(SP1Prover::new()),
network_client: NetworkClient::new(&self.private_key.expect("A private key set on the builder")).rpc_url(self.rpc_url.expect("An RPC URL set on the builder")),
timeout: self.timeout.unwrap_or(DEFAULT_TIMEOUT),
max_cycle_limit: self.max_cycle_limit.unwrap_or(DEFAULT_CYCLE_LIMIT),
max_cycle_limit: self.max_cycle_limit,
}
}
}

pub struct NetworkProofRequest<'a> {
prover: &'a NetworkProver,
pk: &'a Arc<SP1ProvingKey>,
pk: &'a SP1ProvingKey,
stdin: SP1Stdin,
mode: ProofMode,
version: String,
Expand All @@ -276,15 +276,15 @@ pub struct NetworkProofRequest<'a> {
}

impl<'a> NetworkProofRequest<'a> {
pub fn new(prover: &'a NetworkProver, pk: &'a Arc<SP1ProvingKey>, stdin: SP1Stdin) -> Self {
pub fn new(prover: &'a NetworkProver, pk: &'a SP1ProvingKey, stdin: SP1Stdin) -> Self {
Self {
prover,
pk,
stdin,
mode: Mode::default().into(),
version: SP1_CIRCUIT_VERSION.to_string(),
timeout: DEFAULT_TIMEOUT,
cycle_limit: None,
timeout: prover.timeout,
cycle_limit: prover.max_cycle_limit,
skip_simulation: false,
strategy: DEFAULT_FULFILLMENT_STRATEGY,
}
Expand Down Expand Up @@ -434,7 +434,7 @@ impl Prover for NetworkProver {
#[cfg(feature = "blocking")]
fn prove_with_options_sync(
&self,
pk: &SP1ProvingKey,
pk: &Arc<SP1ProvingKey>,
stdin: SP1Stdin,
opts: ProofOpts,
) -> Result<SP1ProofWithPublicValues> {
Expand Down
2 changes: 1 addition & 1 deletion crates/sdk/src/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub trait Prover: Sync {
#[cfg(feature = "blocking")]
fn prove_with_options_sync(
&self,
pk: &SP1ProvingKey,
pk: &Arc<SP1ProvingKey>,
stdin: SP1Stdin,
opts: ProofOpts,
) -> Result<SP1ProofWithPublicValues>;
Expand Down
78 changes: 0 additions & 78 deletions crates/sdk/src/request.rs

This file was deleted.

0 comments on commit 7474d78

Please sign in to comment.