ant_node/lib.rs
1//! # ant-node
2//!
3//! A pure quantum-proof network node for the Autonomi decentralized network.
4//!
5//! This crate provides a thin wrapper around `saorsa-core` that adds:
6//! - Auto-upgrade system with ML-DSA signature verification
7//! - CLI interface and configuration
8//! - Content-addressed chunk storage with EVM payment
9//!
10//! ## Architecture
11//!
12//! `ant-node` delegates all core functionality to `saorsa-core`:
13//! - Networking via `P2PNode`
14//! - DHT via `AdaptiveDHT`
15//! - Trust via `TrustEngine`
16//! - Security via `IPDiversityConfig`
17//!
18//! ## Data Types
19//!
20//! Currently supports a single data type:
21//! - **Chunk**: Immutable content-addressed data (hash(value) == key)
22//!
23//! ## Example
24//!
25//! ```rust,no_run
26//! use ant_node::{NodeBuilder, NodeConfig};
27//!
28//! #[tokio::main]
29//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
30//! let config = NodeConfig::default();
31//! let mut node = NodeBuilder::new(config).build().await?;
32//! node.run().await?;
33//! Ok(())
34//! }
35//! ```
36
37#![deny(unsafe_code)]
38#![warn(missing_docs)]
39#![warn(clippy::all)]
40#![warn(clippy::pedantic)]
41
42pub mod ant_protocol;
43pub mod client;
44pub mod config;
45pub mod devnet;
46pub mod error;
47pub mod event;
48pub mod node;
49pub mod payment;
50pub mod storage;
51pub mod upgrade;
52
53pub use ant_protocol::{
54 ChunkGetRequest, ChunkGetResponse, ChunkMessage, ChunkMessageBody, ChunkPutRequest,
55 ChunkPutResponse, ChunkQuoteRequest, ChunkQuoteResponse, CHUNK_PROTOCOL_ID, MAX_CHUNK_SIZE,
56};
57pub use client::{
58 compute_address, hex_node_id_to_encoded_peer_id, peer_id_to_xor_name, xor_distance, DataChunk,
59 XorName,
60};
61pub use config::{BootstrapCacheConfig, NodeConfig, StorageConfig};
62pub use devnet::{Devnet, DevnetConfig, DevnetEvmInfo, DevnetManifest};
63pub use error::{Error, Result};
64pub use event::{NodeEvent, NodeEventsChannel};
65pub use node::{NodeBuilder, RunningNode};
66pub use payment::{PaymentStatus, PaymentVerifier, PaymentVerifierConfig};
67pub use storage::{AntProtocol, LmdbStorage, LmdbStorageConfig};
68
69/// Re-exports from `saorsa-core` so downstream crates (e.g. `ant-client`)
70/// can depend on `ant-node` alone without a direct `saorsa-core` dependency.
71pub mod core {
72 pub use saorsa_core::identity::{NodeIdentity, PeerId};
73 pub use saorsa_core::{
74 IPDiversityConfig, MlDsa65, MultiAddr, NodeConfig as CoreNodeConfig, NodeMode, P2PEvent,
75 P2PNode,
76 };
77}