nexus_sdk

Trait Verifiable

Source
pub trait Verifiable: Serialize + DeserializeOwned {
    type View: CheckedView;
    type Error: From<ElfError> + From<IOError>;

    // Required methods
    fn get_memory_layout(&self) -> &LinearMemoryLayout;
    fn verify(
        &self,
        expected_view: &Self::View,
    ) -> Result<(), <Self as Verifiable>::Error>;
    fn size_estimate(&self) -> usize;

    // Provided methods
    fn verify_expected<T: Serialize + DeserializeOwned + Sized, U: Serialize + DeserializeOwned + Sized>(
        &self,
        expected_public_input: &T,
        expected_exit_code: u32,
        expected_public_output: &U,
        expected_elf: &ElfFile,
        expected_ad: &[u8],
    ) -> Result<(), <Self as Verifiable>::Error> { ... }
    fn verify_expected_from_program_bytes<T: Serialize + DeserializeOwned + Sized, U: Serialize + DeserializeOwned + Sized>(
        &self,
        expected_public_input: &T,
        expected_exit_code: u32,
        expected_public_output: &U,
        expected_elf_bytes: &[u8],
        expected_ad: &[u8],
    ) -> Result<(), <Self as Verifiable>::Error> { ... }
    fn verify_expected_from_program_path<P: AsRef<Path> + ?Sized, T: Serialize + DeserializeOwned + Sized, U: Serialize + DeserializeOwned + Sized>(
        &self,
        expected_public_input: &T,
        expected_exit_code: u32,
        expected_public_output: &U,
        expected_elf_path: &P,
        expected_ad: &[u8],
    ) -> Result<(), <Self as Verifiable>::Error> { ... }
}
Expand description

A verifiable proof of a zkVM execution.

Required Associated Types§

Required Methods§

Source

fn get_memory_layout(&self) -> &LinearMemoryLayout

Get the memory layout configuration used for proving.

Source

fn verify( &self, expected_view: &Self::View, ) -> Result<(), <Self as Verifiable>::Error>

Verify the proof of an execution for a constructed CheckedView.

Source

fn size_estimate(&self) -> usize

Return a size estimate for the proof, in bytes.

Provided Methods§

Source

fn verify_expected<T: Serialize + DeserializeOwned + Sized, U: Serialize + DeserializeOwned + Sized>( &self, expected_public_input: &T, expected_exit_code: u32, expected_public_output: &U, expected_elf: &ElfFile, expected_ad: &[u8], ) -> Result<(), <Self as Verifiable>::Error>

Verify the proof of an execution.

Source

fn verify_expected_from_program_bytes<T: Serialize + DeserializeOwned + Sized, U: Serialize + DeserializeOwned + Sized>( &self, expected_public_input: &T, expected_exit_code: u32, expected_public_output: &U, expected_elf_bytes: &[u8], expected_ad: &[u8], ) -> Result<(), <Self as Verifiable>::Error>

Verify the proof of an execution, with the elf provided as raw bytes.

Source

fn verify_expected_from_program_path<P: AsRef<Path> + ?Sized, T: Serialize + DeserializeOwned + Sized, U: Serialize + DeserializeOwned + Sized>( &self, expected_public_input: &T, expected_exit_code: u32, expected_public_output: &U, expected_elf_path: &P, expected_ad: &[u8], ) -> Result<(), <Self as Verifiable>::Error>

Verify the proof of an execution, sourcing the program elf from a path.

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.

Implementors§