pub trait ProveRequest<'a, P>{
// Required methods
fn base(&mut self) -> &mut BaseProveRequest<'a, P>;
fn run(self) -> Result<SP1ProofWithPublicValues, P::Error>;
// Provided methods
fn mode(self, mode: SP1ProofMode) -> Self { ... }
fn compressed(self) -> Self { ... }
fn plonk(self) -> Self { ... }
fn groth16(self) -> Self { ... }
fn core(self) -> Self { ... }
fn cycle_limit(self, cycle_limit: u64) -> Self { ... }
fn deferred_proof_verification(self, value: bool) -> Self { ... }
fn expected_exit_code(self, code: StatusCode) -> Self { ... }
fn with_proof_nonce(self, nonce: [u32; 4]) -> Self { ... }
}Expand description
A unified collection of methods for all prover types.
Required Methods§
Sourcefn run(self) -> Result<SP1ProofWithPublicValues, P::Error>
fn run(self) -> Result<SP1ProofWithPublicValues, P::Error>
Run the prove request.
Provided Methods§
Sourcefn mode(self, mode: SP1ProofMode) -> Self
fn mode(self, mode: SP1ProofMode) -> Self
Set the proof mode to the given [SP1ProofKind].
§Details
This method is useful for setting the proof mode to a custom mode.
§Example
use sp1_sdk::blocking::{Elf, ProveRequest, Prover, ProverClient, SP1ProofMode, SP1Stdin};
let elf = Elf::Static(&[1, 2, 3]);
let stdin = SP1Stdin::new();
let client = ProverClient::builder().cpu().build();
let pk = client.setup(elf).unwrap();
let proof = client.prove(&pk, stdin).mode(SP1ProofMode::Groth16).run().unwrap();Sourcefn compressed(self) -> Self
fn compressed(self) -> Self
Set the proof kind to [SP1ProofKind::Compressed] mode.
§Details
This mode produces a proof that is of constant size, regardless of the number of cycles. It
takes longer to prove than [SP1ProofKind::Core] due to the need to recursively aggregate
proofs into a single proof.
§Example
use sp1_sdk::blocking::{Elf, ProveRequest, Prover, ProverClient, SP1ProofMode, SP1Stdin};
let elf = Elf::Static(&[1, 2, 3]);
let stdin = SP1Stdin::new();
let client = ProverClient::builder().cpu().build();
let pk = client.setup(elf).unwrap();
let proof = client.prove(&pk, stdin).compressed().run().unwrap();Sourcefn plonk(self) -> Self
fn plonk(self) -> Self
Set the proof mode to [SP1ProofKind::Plonk] mode.
§Details
This mode produces a const size PLONK proof that can be verified on chain for roughly ~300k
gas. This mode is useful for producing a maximally small proof that can be verified on
chain. For more efficient SNARK wrapping, you can use the [SP1ProofKind::Groth16] mode but
this mode is more .
§Example
use sp1_sdk::blocking::{Elf, ProveRequest, Prover, ProverClient, SP1ProofMode, SP1Stdin};
let elf = Elf::Static(&[1, 2, 3]);
let stdin = SP1Stdin::new();
let client = ProverClient::builder().cpu().build();
let pk = client.setup(elf).unwrap();
let proof = client.prove(&pk, stdin).plonk().run().unwrap();Sourcefn groth16(self) -> Self
fn groth16(self) -> Self
Set the proof mode to [SP1ProofKind::Groth16] mode.
§Details
This mode produces a Groth16 proof that can be verified on chain for roughly ~100k gas. This mode is useful for producing a proof that can be verified on chain with minimal gas.
§Example
use sp1_sdk::blocking::{Elf, ProveRequest, Prover, ProverClient, SP1ProofMode, SP1Stdin};
let elf = Elf::Static(&[1, 2, 3]);
let stdin = SP1Stdin::new();
let client = ProverClient::builder().cpu().build();
let pk = client.setup(elf).unwrap();
let builder = client.prove(&pk, stdin).groth16().run();Sourcefn core(self) -> Self
fn core(self) -> Self
Set the proof kind to [SP1ProofKind::Core] mode.
§Details
This is the default mode for the prover. The proofs grow linearly in size with the number of cycles.
§Example
use sp1_sdk::blocking::{Elf, ProveRequest, Prover, ProverClient, SP1ProofMode, SP1Stdin};
let elf = Elf::Static(&[1, 2, 3]);
let stdin = SP1Stdin::new();
let client = ProverClient::builder().cpu().build();
let pk = client.setup(elf).unwrap();
let builder = client.prove(&pk, stdin).core().run();Sourcefn cycle_limit(self, cycle_limit: u64) -> Self
fn cycle_limit(self, cycle_limit: u64) -> Self
Set the maximum number of cpu cycles to use for execution.
§Details
If the cycle limit is exceeded, execution will return
sp1_core_executor::ExecutionError::ExceededCycleLimit.
§Example
use sp1_sdk::blocking::{Elf, ProveRequest, Prover, ProverClient, SP1ProofMode, SP1Stdin};
let elf = Elf::Static(&[1, 2, 3]);
let stdin = SP1Stdin::new();
let client = ProverClient::builder().cpu().build();
let pk = client.setup(elf).unwrap();
let builder = client.prove(&pk, stdin).cycle_limit(1000000).run();Sourcefn deferred_proof_verification(self, value: bool) -> Self
fn deferred_proof_verification(self, value: bool) -> Self
Whether to enable deferred proof verification in the executor.
§Arguments
value- Whether to enable deferred proof verification in the executor.
§Details
Default: true. If set to false, the executor will skip deferred proof verification.
This is useful for reducing the execution time of the program and optimistically assuming
that the deferred proofs are correct. Can also be used for mock proof setups that require
verifying mock compressed proofs.
§Example
use sp1_sdk::blocking::{Elf, ProveRequest, Prover, ProverClient, SP1ProofMode, SP1Stdin};
let elf = Elf::Static(&[1, 2, 3]);
let stdin = SP1Stdin::new();
let client = ProverClient::builder().cpu().build();
let pk = client.setup(elf).unwrap();
let proof = client.prove(&pk, stdin).deferred_proof_verification(false).run().unwrap();Sourcefn expected_exit_code(self, code: StatusCode) -> Self
fn expected_exit_code(self, code: StatusCode) -> Self
Sourcefn with_proof_nonce(self, nonce: [u32; 4]) -> Self
fn with_proof_nonce(self, nonce: [u32; 4]) -> Self
Set the proof nonce for this execution.
The nonce ensures each proof is unique even for identical programs and inputs. If not provided, will default to 0.
§Arguments
nonce- A 4-element array representing 128 bits of nonce data.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".