Skip to main content

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,
56    CLOSE_GROUP_MAJORITY, CLOSE_GROUP_SIZE, MAX_CHUNK_SIZE,
57};
58pub use client::{
59    compute_address, hex_node_id_to_encoded_peer_id, peer_id_to_xor_name, xor_distance, DataChunk,
60    XorName,
61};
62pub use config::{BootstrapCacheConfig, NodeConfig, StorageConfig};
63pub use devnet::{Devnet, DevnetConfig, DevnetEvmInfo, DevnetManifest};
64pub use error::{Error, Result};
65pub use event::{NodeEvent, NodeEventsChannel};
66pub use node::{NodeBuilder, RunningNode};
67pub use payment::{PaymentStatus, PaymentVerifier, PaymentVerifierConfig};
68pub use storage::{AntProtocol, LmdbStorage, LmdbStorageConfig};
69
70/// Re-exports from `saorsa-core` so downstream crates (e.g. `ant-client`)
71/// can depend on `ant-node` alone without a direct `saorsa-core` dependency.
72pub mod core {
73    pub use saorsa_core::identity::{NodeIdentity, PeerId};
74    pub use saorsa_core::{
75        IPDiversityConfig, MlDsa65, MultiAddr, NodeConfig as CoreNodeConfig, NodeMode, P2PEvent,
76        P2PNode,
77    };
78}