Skip to main content

Prover

Trait Prover 

Source
pub trait Prover:
    Clone
    + Send
    + Sync {
    type ProvingKey: ProvingKey;
    type Error: Debug + Display;
    type ProveRequest<'a>: ProveRequest<'a, Self>
       where Self: 'a;

    // Required methods
    fn inner(&self) -> &SP1NodeCore;
    fn setup(&self, elf: Elf) -> Result<Self::ProvingKey, Self::Error>;
    fn prove<'a>(
        &'a self,
        pk: &'a Self::ProvingKey,
        stdin: SP1Stdin,
    ) -> Self::ProveRequest<'a>;

    // Provided methods
    fn version(&self) -> &str { ... }
    fn execute(&self, elf: Elf, stdin: SP1Stdin) -> ExecuteRequest<'_, Self> { ... }
    fn verify(
        &self,
        proof: &SP1ProofWithPublicValues,
        vkey: &SP1VerifyingKey,
        status_code: Option<StatusCode>,
    ) -> Result<(), SP1VerificationError> { ... }
}
Expand description

The entire user-facing functionality of a prover.

Required Associated Types§

Source

type ProvingKey: ProvingKey

The proving key used for this prover type.

Source

type Error: Debug + Display

The possible errors that can occur when proving.

Source

type ProveRequest<'a>: ProveRequest<'a, Self> where Self: 'a

The prove request builder.

Required Methods§

Source

fn inner(&self) -> &SP1NodeCore

The inner SP1NodeCore struct used by the prover.

Source

fn setup(&self, elf: Elf) -> Result<Self::ProvingKey, Self::Error>

Setup the prover with the given ELF.

Source

fn prove<'a>( &'a self, pk: &'a Self::ProvingKey, stdin: SP1Stdin, ) -> Self::ProveRequest<'a>

Prove the given program on the given input in the given proof mode.

Provided Methods§

Source

fn version(&self) -> &str

The version of the current SP1 circuit.

Source

fn execute(&self, elf: Elf, stdin: SP1Stdin) -> ExecuteRequest<'_, Self>

Execute the program on the given input.

Source

fn verify( &self, proof: &SP1ProofWithPublicValues, vkey: &SP1VerifyingKey, status_code: Option<StatusCode>, ) -> Result<(), SP1VerificationError>

Verify the given proof.

If the status code is not set, the verification process will check for success.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Prover for EnvProver

Source§

type Error = Error

Source§

type ProvingKey = EnvProvingKey

Source§

type ProveRequest<'a> = EnvProveRequest<'a>

Source§

impl Prover for CpuProver

Source§

type ProvingKey = SP1ProvingKey

Source§

type Error = CPUProverError

Source§

type ProveRequest<'a> = CpuProveBuilder<'a>

Source§

impl Prover for LightProver

Source§

type ProvingKey = SP1ProvingKey

Source§

type Error = CPUProverError

Source§

type ProveRequest<'a> = LightProveRequest<'a>

Source§

impl Prover for MockProver

Source§

type ProvingKey = SP1ProvingKey

Source§

type Error = CPUProverError

Source§

type ProveRequest<'a> = MockProveRequest<'a>

Source§

impl Prover for NetworkProver

Source§

type ProvingKey = SP1ProvingKey

Source§

type Error = Error

Source§

type ProveRequest<'a> = NetworkProveBuilder<'a>