Skip to content

Commit

Permalink
more cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jtguibas committed Dec 19, 2024
1 parent e0a83b3 commit 6be4185
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/sdk/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ use crate::network::builder::NetworkProverBuilder;
/// An entrypoint for interacting with the prover for the SP1 RISC-V zkVM.
pub struct ProverClient;

/// A builder to define which proving client to use.
pub struct ProverClientBuilder;

impl ProverClient {
/// Creates a new [EnvProver] from the environment.
///
Expand Down Expand Up @@ -53,6 +50,9 @@ impl ProverClient {
}
}

/// A builder to define which proving client to use.
pub struct ProverClientBuilder;

impl ProverClientBuilder {
/// Builds a [CpuProver] specifically for mock proving.
///
Expand Down
28 changes: 28 additions & 0 deletions crates/sdk/src/cpu/builder.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//! # CPU Prover Builder
//!
//! This module provides a builder for the [CpuProver].
use super::CpuProver;

/// A builder for the [CpuProver].
///
/// The builder is used to configure the [CpuProver] before it is built.
pub struct CpuProverBuilder {
pub(crate) mock: bool,
}

impl CpuProverBuilder {
/// Builds a [CpuProver].
///
/// # Details
/// This method will build a [CpuProver] with the given parameters. In particular, it will
/// build a mock prover if the `mock` flag is set.
///
/// # Example
/// ```rust,no_run
/// let prover = ProverClient::builder().mock().build();
/// ```
pub fn build(self) -> CpuProver {
if self.mock { CpuProver::mock() } else { CpuProver::new() }
}
}
28 changes: 28 additions & 0 deletions crates/sdk/src/cuda/builder.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//! # CPU Prover Builder
//!
//! This module provides a builder for the [CpuProver].
use sp1_prover::SP1Prover;

use super::CudaProver;

/// A builder for the [CudaProver].
///
/// The builder is used to configure the [CudaProver] before it is built.
pub struct CudaProverBuilder;

impl CudaProverBuilder {
/// Builds a [CudaProver].
///
/// # Details
/// This method will build a [CudaProver] with the given parameters. In particular, it will
/// build a mock prover if the `mock` flag is set.
///
/// # Example
/// ```rust,no_run
/// let prover = ProverClient::builder().cuda().build();
/// ```
pub fn build(self) -> CudaProver {
CudaProver::new(SP1Prover::new())
}
}

0 comments on commit 6be4185

Please sign in to comment.