mithril_common/
lib.rs

1#![warn(missing_docs)]
2#![cfg_attr(docsrs, feature(doc_cfg))]
3
4//! Shared datatypes and traits used by Mithril rust projects
5//!
6//! Provide:
7//! - Helpers for the [Mithril STM](https://mithril.network/rust-doc/mithril_stm/index.html)
8//!   lib with the [crypto_helper].
9//! - [certificate chain][certificate_chain] used to validate the Certificate Chain created by an aggregator
10//! - The [entities] used by, and exchanged between, the aggregator, signers and client.
11
12macro_rules! cfg_test_tools {
13    ($($item:item)*) => {
14        $(
15            #[cfg(any(test, feature = "test_tools"))]
16            #[cfg_attr(docsrs, doc(cfg(feature = "test_tools")))]
17            $item
18        )*
19    }
20}
21
22pub mod api_version;
23pub mod certificate_chain;
24pub mod crypto_helper;
25pub mod entities;
26pub mod logging;
27pub mod messages;
28pub mod protocol;
29pub mod signable_builder;
30
31cfg_test_tools! {
32    pub mod test_utils;
33}
34
35pub use entities::{CardanoNetwork, MagicId};
36
37/// Generic error type
38pub type StdError = anyhow::Error;
39
40/// Generic result type
41pub type StdResult<T> = anyhow::Result<T, StdError>;
42
43/// Mithril API protocol version header name
44pub const MITHRIL_API_VERSION_HEADER: &str = "mithril-api-version";
45
46/// Mithril signer node version header name
47pub const MITHRIL_SIGNER_VERSION_HEADER: &str = "signer-node-version";
48
49/// Mithril aggregator node version header name
50pub const MITHRIL_AGGREGATOR_VERSION_HEADER: &str = "aggregator-node-version";
51
52/// Mithril origin of the request
53pub const MITHRIL_ORIGIN_TAG_HEADER: &str = "mithril-origin-tag";
54
55/// Mithril client type of the request
56pub const MITHRIL_CLIENT_TYPE_HEADER: &str = "mithril-client-type";
57
58/// Macro used to mark the code that should be cleaned up when the new era is activated
59#[macro_export]
60macro_rules! era_deprecate {
61    ( $comment:literal ) => {};
62}