dig-capsule 0.5.0

The DIG Network .dig capsule data plane — one crate over the DIGS format, capsule read-crypto, compiler, staging, and the guest/host serve triad.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use crate::imp::core::ChiaBlockRef;
use crate::imp::prover::error::Result;

/// A source of Chia chain state for anchoring proofs to wall-clock time
/// (§13.8). Implemented by [`crate::imp::prover::mock_chain::MockChainSource`] and
/// [`crate::imp::prover::coinset::CoinsetChainSource`].
pub trait ChainSource {
    /// The current peak block of the trusted chain.
    fn get_peak(&self) -> Result<ChiaBlockRef>;

    /// Confirm `block` is a real block on the trusted chain AND that its
    /// timestamp falls within `freshness_window_secs` of "now". Rejects blocks
    /// that are unknown, too old, or in the future.
    fn verify_block(&self, block: &ChiaBlockRef, freshness_window_secs: u64) -> Result<()>;
}