Skip to main content

confium_transparency/
proof.rs

1//! Inclusion and consistency proofs.
2
3use crate::merkle::Hash;
4
5/// A Merkle inclusion proof: the list of sibling hashes needed to
6/// reconstruct the root from a given leaf.
7#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
8pub struct MerkleProof {
9    /// Sequence number of the leaf being proven.
10    pub sequence: u64,
11    /// Sibling hashes from leaf level to root.
12    pub siblings: Vec<Hash>,
13}
14
15/// A consistency proof: proves that an earlier tree state (with `from_size`
16/// entries) is a prefix of the current tree state (with `to_size` entries).
17#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
18pub struct ConsistencyProof {
19    /// Earlier tree size.
20    pub from_size: u64,
21    /// Current tree size.
22    pub to_size: u64,
23    /// Path of hashes needed to verify consistency.
24    pub path: Vec<Hash>,
25}