Trait sunscreen_zkp_backend::ZkpBackend
source · 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§
Required Methods§
sourcefn prove(
&self,
graph: &ExecutableZkpProgram,
inputs: &[BigInt]
) -> Result<Proof>
fn prove( &self, graph: &ExecutableZkpProgram, inputs: &[BigInt] ) -> Result<Proof>
Create a proof for the given executable Sunscreen program with the given inputs.
sourcefn verify(&self, graph: &ExecutableZkpProgram, proof: &Proof) -> Result<()>
fn verify(&self, graph: &ExecutableZkpProgram, proof: &Proof) -> Result<()>
Verify the given proof for the given executable Sunscreen program.
sourcefn jit_prover(
&self,
prog: &CompiledZkpProgram,
private_inputs: &[BigInt],
public_inputs: &[BigInt],
constant_inputs: &[BigInt]
) -> Result<ExecutableZkpProgram>
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.
sourcefn jit_verifier(
&self,
prog: &CompiledZkpProgram,
public_inputs: &[BigInt],
constant_inputs: &[BigInt]
) -> Result<ExecutableZkpProgram>
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.