Trait Zkvm

Source
pub trait Zkvm {
    type CodeCommitment: Matches<Self::CodeCommitment> + Clone + Debug + Serialize + DeserializeOwned;
    type Error: Debug + From<Error>;

    // Required methods
    fn verify<'a>(
        serialized_proof: &'a [u8],
        code_commitment: &Self::CodeCommitment,
    ) -> Result<&'a [u8], Self::Error>;
    fn verify_and_extract_output<Add: RollupAddress, Da: DaSpec, Root: Serialize + DeserializeOwned>(
        serialized_proof: &[u8],
        code_commitment: &Self::CodeCommitment,
    ) -> Result<StateTransition<Da, Add, Root>, Self::Error>;
}
Expand description

A Zk proof system capable of proving and verifying arbitrary Rust code Must support recursive proofs.

Required Associated Types§

Source

type CodeCommitment: Matches<Self::CodeCommitment> + Clone + Debug + Serialize + DeserializeOwned

A commitment to the zkVM program which is being proven

Source

type Error: Debug + From<Error>

The error type which is returned when a proof fails to verify

Required Methods§

Source

fn verify<'a>( serialized_proof: &'a [u8], code_commitment: &Self::CodeCommitment, ) -> Result<&'a [u8], Self::Error>

Interpret a sequence of a bytes as a proof and attempt to verify it against the code commitment. If the proof is valid, return a reference to the public outputs of the proof.

Source

fn verify_and_extract_output<Add: RollupAddress, Da: DaSpec, Root: Serialize + DeserializeOwned>( serialized_proof: &[u8], code_commitment: &Self::CodeCommitment, ) -> Result<StateTransition<Da, Add, Root>, Self::Error>

Same as verify, except that instead of returning the output as a serialized array, it returns a state transition structure. TODO: specify a deserializer for the output

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§