use sp1_core_machine::riscv::RiscvAir;
use sp1_hypercube::Machine;
use sp1_primitives::SP1Field;
use super::CpuProver;
use sp1_core_executor::SP1CoreOpts;
pub struct CpuProverBuilder {
core_opts: Option<SP1CoreOpts>,
machine: Machine<SP1Field, RiscvAir<SP1Field>>,
}
impl Default for CpuProverBuilder {
fn default() -> Self {
Self::new()
}
}
impl CpuProverBuilder {
#[must_use]
pub fn new() -> Self {
Self::new_with_machine(RiscvAir::machine())
}
#[must_use]
pub const fn new_with_machine(machine: Machine<SP1Field, RiscvAir<SP1Field>>) -> Self {
Self { core_opts: None, machine }
}
#[must_use]
pub fn core_opts(mut self, opts: SP1CoreOpts) -> Self {
self.core_opts = Some(opts);
self
}
#[must_use]
pub fn with_opts(self, opts: SP1CoreOpts) -> Self {
self.core_opts(opts)
}
#[must_use]
pub async fn build(self) -> CpuProver {
CpuProver::new_with_opts_and_machine(self.core_opts, self.machine).await
}
}