oasis_core_runtime/consensus/roothash/commitment/
mod.rs

1//! Roothash commitments.
2//!
3//! # Note
4//!
5//! This **MUST** be kept in sync with go/roothash/api/commitment.
6//!
7use std::any::Any;
8
9use crate::common::crypto::hash::Hash;
10
11// Modules.
12mod executor;
13mod pool;
14
15// Re-exports.
16pub use executor::*;
17pub use pool::*;
18
19/// Verified roothash commitment.
20pub trait OpenCommitment {
21    /// Returns true if the commitment is mostly equal to another
22    /// specified commitment as per discrepancy detection criteria.
23    ///
24    /// The caller MUST guarantee that the passed commitment is of the same
25    /// type.
26    fn mostly_equal(&self, other: &Self) -> bool
27    where
28        Self: Sized;
29
30    /// Returns true if this commitment indicates a failure.
31    fn is_indicating_failure(&self) -> bool;
32
33    /// Returns a hash that represents a vote for this commitment as
34    /// per discrepancy resolution criteria.
35    fn to_vote(&self) -> Hash;
36
37    /// Returns a commitment-specific result after discrepancy
38    /// detection.
39    fn to_dd_result(&self) -> &dyn Any;
40}