Trait sov_modules_api::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, Da>(
serialized_proof: &[u8],
code_commitment: &Self::CodeCommitment
) -> Result<StateTransition<Da, Add>, Self::Error>
where Add: RollupAddress,
Da: DaSpec;
}
Expand description
A Zk proof system capable of proving and verifying arbitrary Rust code Must support recursive proofs.
Required Associated Types§
sourcetype CodeCommitment: Matches<Self::CodeCommitment> + Clone + Debug + Serialize + DeserializeOwned
type CodeCommitment: Matches<Self::CodeCommitment> + Clone + Debug + Serialize + DeserializeOwned
A commitment to the zkVM program which is being proven
Required Methods§
sourcefn verify<'a>(
serialized_proof: &'a [u8],
code_commitment: &Self::CodeCommitment
) -> Result<&'a [u8], Self::Error>
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.
sourcefn verify_and_extract_output<Add, Da>(
serialized_proof: &[u8],
code_commitment: &Self::CodeCommitment
) -> Result<StateTransition<Da, Add>, Self::Error>where
Add: RollupAddress,
Da: DaSpec,
fn verify_and_extract_output<Add, Da>( serialized_proof: &[u8], code_commitment: &Self::CodeCommitment ) -> Result<StateTransition<Da, Add>, Self::Error>where Add: RollupAddress, Da: DaSpec,
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