amareleo_node_bft_ledger_service/
lib.rs1#![forbid(unsafe_code)]
17
18#[cfg(feature = "tracing")]
19#[macro_use]
20extern crate tracing;
21
22#[cfg(feature = "tracing")]
23#[macro_use]
24extern crate amareleo_chain_tracing;
25
26#[macro_use]
27extern crate async_trait;
28
29#[cfg(feature = "ledger")]
30pub mod ledger;
31#[cfg(feature = "ledger")]
32pub use ledger::*;
33
34#[cfg(feature = "mock")]
35pub mod mock;
36#[cfg(feature = "mock")]
37pub use mock::*;
38
39pub mod traits;
40pub use traits::*;
41
42pub fn fmt_id(id: impl ToString) -> String {
44 let id = id.to_string();
45 let mut formatted_id = id.chars().take(16).collect::<String>();
46 if id.chars().count() > 16 {
47 formatted_id.push_str("..");
48 }
49 formatted_id
50}
51
52#[macro_export]
54macro_rules! spawn_blocking {
55 ($expr:expr) => {
56 match tokio::task::spawn_blocking(move || $expr).await {
57 Ok(value) => value,
58 Err(error) => Err(snarkvm::prelude::anyhow!("[tokio::spawn_blocking] {error}")),
59 }
60 };
61}