Prover

Trait Prover 

Source
pub trait Prover<C: SP1ProverComponents>: Send + Sync {
    // Required methods
    fn inner(&self) -> &SP1Prover<C>;
    fn setup(&self, elf: &[u8]) -> (SP1ProvingKey, SP1VerifyingKey);
    fn prove(
        &self,
        pk: &SP1ProvingKey,
        stdin: &SP1Stdin,
        mode: SP1ProofMode,
    ) -> Result<SP1ProofWithPublicValues>;

    // Provided methods
    fn version(&self) -> &str { ... }
    fn execute(
        &self,
        elf: &[u8],
        stdin: &SP1Stdin,
    ) -> Result<(SP1PublicValues, ExecutionReport)> { ... }
    fn verify(
        &self,
        bundle: &SP1ProofWithPublicValues,
        vkey: &SP1VerifyingKey,
    ) -> Result<(), SP1VerificationError> { ... }
}
Expand description

A basic set of primitives that each prover variant must implement.

Required Methods§

Source

fn inner(&self) -> &SP1Prover<C>

The inner SP1Prover struct used by the prover.

Source

fn setup(&self, elf: &[u8]) -> (SP1ProvingKey, SP1VerifyingKey)

Generate the proving and verifying keys for the given program.

Source

fn prove( &self, pk: &SP1ProvingKey, stdin: &SP1Stdin, mode: SP1ProofMode, ) -> Result<SP1ProofWithPublicValues>

Proves 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: &[u8], stdin: &SP1Stdin, ) -> Result<(SP1PublicValues, ExecutionReport)>

Executes the program on the given input.

Source

fn verify( &self, bundle: &SP1ProofWithPublicValues, vkey: &SP1VerifyingKey, ) -> Result<(), SP1VerificationError>

Verify that an SP1 proof is valid given its vkey and metadata. For Plonk proofs, verifies that the public inputs of the PlonkBn254 proof match the hash of the VK and the committed public values of the SP1ProofWithPublicValues.

Implementors§