2023-12-30 12:50:47 +00:00
|
|
|
pub mod cw;
|
|
|
|
pub mod ics23;
|
|
|
|
pub mod multi;
|
|
|
|
|
|
|
|
trait Verifier {
|
|
|
|
type Proof;
|
|
|
|
type Root: Eq;
|
|
|
|
type Key;
|
2023-12-31 11:42:54 +00:00
|
|
|
type Value;
|
2023-12-30 12:50:47 +00:00
|
|
|
type Error;
|
|
|
|
|
|
|
|
fn verify(
|
|
|
|
&self,
|
|
|
|
proof: &Self::Proof,
|
|
|
|
key: &Self::Key,
|
2023-12-31 11:42:54 +00:00
|
|
|
value: &Self::Value,
|
2023-12-30 12:50:47 +00:00
|
|
|
) -> Result<Self::Root, Self::Error>;
|
|
|
|
|
|
|
|
fn verify_against_root(
|
|
|
|
&self,
|
|
|
|
proof: &Self::Proof,
|
|
|
|
key: &Self::Key,
|
2023-12-31 11:42:54 +00:00
|
|
|
value: &Self::Value,
|
2023-12-30 12:50:47 +00:00
|
|
|
root: &Self::Root,
|
|
|
|
) -> Result<bool, Self::Error> {
|
|
|
|
let found_root = self.verify(proof, key, value)?;
|
|
|
|
Ok(root == &found_root)
|
|
|
|
}
|
|
|
|
}
|