mithril_aggregator/tools/
mod.rs

1mod certificates_hash_migrator;
2mod digest_helpers;
3mod era;
4pub mod file_archiver;
5pub mod file_size;
6mod genesis;
7pub mod signer_importer;
8mod single_signature_authenticator;
9pub mod url_sanitizer;
10mod vacuum_tracker;
11
12pub use certificates_hash_migrator::CertificatesHashMigrator;
13pub use digest_helpers::extract_digest_from_path;
14pub use era::EraTools;
15pub use genesis::GenesisTools;
16pub use single_signature_authenticator::*;
17pub use vacuum_tracker::VacuumTracker;
18
19/// Default environment variable name where the GCP credentials JSON is stored.
20pub(crate) const DEFAULT_GCP_CREDENTIALS_JSON_ENV_VAR: &str = "GOOGLE_APPLICATION_CREDENTIALS_JSON";
21
22/// Downcast the error to the specified error type and check if the error satisfies the condition.
23pub(crate) fn downcast_check<E>(
24    error: &mithril_common::StdError,
25    check: impl Fn(&E) -> bool,
26) -> bool
27where
28    E: std::fmt::Display + std::fmt::Debug + Send + Sync + 'static,
29{
30    if let Some(inner_error) = error.downcast_ref::<E>() {
31        return check(inner_error);
32    }
33    false
34}