pub trait ZkpBackend {
    type Field: FieldSpec;

    // Required methods
    fn prove(
        &self,
        graph: &ExecutableZkpProgram,
        inputs: &[BigInt]
    ) -> Result<Proof>;
    fn verify(&self, graph: &ExecutableZkpProgram, proof: &Proof) -> Result<()>;
    fn jit_prover(
        &self,
        prog: &CompiledZkpProgram,
        private_inputs: &[BigInt],
        public_inputs: &[BigInt],
        constant_inputs: &[BigInt]
    ) -> Result<ExecutableZkpProgram>;
    fn jit_verifier(
        &self,
        prog: &CompiledZkpProgram,
        public_inputs: &[BigInt],
        constant_inputs: &[BigInt]
    ) -> Result<ExecutableZkpProgram>;
}
Expand description

The methods needed for a type to serve as a proof system in the Sunscreen ecosystem.

Required Associated Types§

source

type Field: FieldSpec

The field this backend uses in computation.

Required Methods§

source

fn prove( &self, graph: &ExecutableZkpProgram, inputs: &[BigInt] ) -> Result<Proof>

Create a proof for the given executable Sunscreen program with the given inputs.

source

fn verify(&self, graph: &ExecutableZkpProgram, proof: &Proof) -> Result<()>

Verify the given proof for the given executable Sunscreen program.

source

fn jit_prover( &self, prog: &CompiledZkpProgram, private_inputs: &[BigInt], public_inputs: &[BigInt], constant_inputs: &[BigInt] ) -> Result<ExecutableZkpProgram>

JIT the given frontend-compiled ZKP program to an executable Sunscreen program for use by a prover.

Remarks

Implementors should generally just call jit_prover<U>, passing the appropriate backend field type for U.

source

fn jit_verifier( &self, prog: &CompiledZkpProgram, public_inputs: &[BigInt], constant_inputs: &[BigInt] ) -> Result<ExecutableZkpProgram>

JIT the given backend-compiled ZKP program to an executable Sunscreen program for use by a verifier.

Remarks

Implementors should generally just call jit_verifier<U>, passing the appropriate backend field type for U.

Implementors§