pub trait Prover: Sized {
type Proof: Verifiable;
type View: CheckedView;
type Error: From<ElfError>;
// Required methods
fn new(elf: &ElfFile) -> Result<Self, <Self as Prover>::Error>;
fn set_associated_data(
&mut self,
ad: &[u8],
) -> Result<(), <Self as Prover>::Error>;
fn run_with_input<S: Serialize + Sized, T: Serialize + DeserializeOwned + Sized>(
&self,
private_input: &S,
public_input: &T,
) -> Result<Self::View, <Self as Prover>::Error>;
fn prove_with_input<S: Serialize + Sized, T: Serialize + DeserializeOwned + Sized>(
self,
private_input: &S,
public_input: &T,
) -> Result<(Self::View, Self::Proof), <Self as Prover>::Error>;
// Provided methods
fn new_from_bytes(elf_bytes: &[u8]) -> Result<Self, <Self as Prover>::Error> { ... }
fn new_from_file<P: AsRef<Path> + ?Sized>(
path: &P,
) -> Result<Self, <Self as Prover>::Error> { ... }
fn run(&self) -> Result<Self::View, <Self as Prover>::Error> { ... }
fn prove(self) -> Result<(Self::View, Self::Proof), <Self as Prover>::Error>
where Self: Sized { ... }
}
Expand description
A prover for the zkVM.
Required Associated Types§
Required Methods§
Sourcefn new(elf: &ElfFile) -> Result<Self, <Self as Prover>::Error>
fn new(elf: &ElfFile) -> Result<Self, <Self as Prover>::Error>
Construct a new proving instance.
Sourcefn set_associated_data(
&mut self,
ad: &[u8],
) -> Result<(), <Self as Prover>::Error>
fn set_associated_data( &mut self, ad: &[u8], ) -> Result<(), <Self as Prover>::Error>
Set the associated data bytes to be bound into the proof.
Sourcefn run_with_input<S: Serialize + Sized, T: Serialize + DeserializeOwned + Sized>(
&self,
private_input: &S,
public_input: &T,
) -> Result<Self::View, <Self as Prover>::Error>
fn run_with_input<S: Serialize + Sized, T: Serialize + DeserializeOwned + Sized>( &self, private_input: &S, public_input: &T, ) -> Result<Self::View, <Self as Prover>::Error>
Run the zkVM on private input of type S
and public input of type T
and return a view of the execution output.
Sourcefn prove_with_input<S: Serialize + Sized, T: Serialize + DeserializeOwned + Sized>(
self,
private_input: &S,
public_input: &T,
) -> Result<(Self::View, Self::Proof), <Self as Prover>::Error>
fn prove_with_input<S: Serialize + Sized, T: Serialize + DeserializeOwned + Sized>( self, private_input: &S, public_input: &T, ) -> Result<(Self::View, Self::Proof), <Self as Prover>::Error>
Run the zkVM on private input of type S
and public input of type T
and return a verifiable proof, along with a view of the execution output.
Provided Methods§
Sourcefn new_from_bytes(elf_bytes: &[u8]) -> Result<Self, <Self as Prover>::Error>
fn new_from_bytes(elf_bytes: &[u8]) -> Result<Self, <Self as Prover>::Error>
Construct a new proving instance from raw ELF bytes.
Sourcefn new_from_file<P: AsRef<Path> + ?Sized>(
path: &P,
) -> Result<Self, <Self as Prover>::Error>
fn new_from_file<P: AsRef<Path> + ?Sized>( path: &P, ) -> Result<Self, <Self as Prover>::Error>
Construct a new proving instance by reading an ELF file.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.