1#![warn(missing_docs)]
2#![cfg_attr(docsrs, feature(doc_cfg))]
3
4macro_rules! cfg_fs {
14 ($($item:item)*) => {
15 $(
16 #[cfg(feature = "fs")]
17 #[cfg_attr(docsrs, doc(cfg(feature = "fs")))]
18 $item
19 )*
20 }
21}
22
23macro_rules! cfg_test_tools {
24 ($($item:item)*) => {
25 $(
26 #[cfg(any(test, feature = "test_tools"))]
27 #[cfg_attr(docsrs, doc(cfg(feature = "test_tools")))]
28 $item
29 )*
30 }
31}
32
33pub mod api_version;
34pub mod certificate_chain;
35pub mod chain_observer;
36pub mod crypto_helper;
37pub mod entities;
38#[macro_use]
39pub mod era;
40pub mod logging;
41pub mod messages;
42pub mod protocol;
43pub mod signable_builder;
44
45cfg_test_tools! {
46 pub mod test_utils;
47}
48
49cfg_fs! {
50 mod ticker_service;
51 pub mod digesters;
52 pub mod cardano_block_scanner;
53 pub mod chain_reader;
54
55 pub use ticker_service::{TickerService, MithrilTickerService};
56}
57
58pub use entities::{CardanoNetwork, MagicId};
59
60pub type StdError = anyhow::Error;
62
63pub type StdResult<T> = anyhow::Result<T, StdError>;
65
66pub const MITHRIL_API_VERSION_HEADER: &str = "mithril-api-version";
68
69pub const MITHRIL_SIGNER_VERSION_HEADER: &str = "signer-node-version";
71
72pub const MITHRIL_AGGREGATOR_VERSION_HEADER: &str = "aggregator-node-version";
74
75pub const MITHRIL_ORIGIN_TAG_HEADER: &str = "mithril-origin-tag";
77
78#[cfg(test)]
79mod tests {
80 #[cfg(feature = "apispec")]
81 #[test]
82 fn test_openapi_examples_conformity() {
83 use crate::test_utils::apispec::APISpec;
84 let api_spec = APISpec::from_file(&APISpec::get_default_spec_file());
85
86 let errors: Vec<String> = api_spec.verify_examples();
87
88 assert!(
89 errors.is_empty(),
90 "Errors in examples\n{}",
91 errors.join("\n")
92 );
93 }
94}