51 lines
1.3 KiB
Rust
51 lines
1.3 KiB
Rust
// NAC CBPP L0 - Constitutional Block Production Protocol L0 Layer
|
|
// 宪政区块生产协议 L0层实现
|
|
|
|
|
|
pub mod cr_cache;
|
|
pub mod params;
|
|
pub mod propagation;
|
|
|
|
pub use cr_cache::{CRCache, CRCacheEntry, CRCacheError, CRCacheStats};
|
|
pub use params::{CBPPParams, ParamsManager, ParamsError};
|
|
pub use propagation::{
|
|
PropagationManager, PropagationConfig, PropagationError,
|
|
BackboneConnection, BlockAnnounce, PropagationStats,
|
|
};
|
|
|
|
/// CBPP L0 Layer Version
|
|
pub const VERSION: &str = "0.1.0";
|
|
|
|
#[cfg(test)]
|
|
mod tests {
|
|
use super::*;
|
|
|
|
#[test]
|
|
fn test_version() {
|
|
assert_eq!(VERSION, "0.1.0");
|
|
}
|
|
|
|
#[test]
|
|
fn test_cr_cache_creation() {
|
|
let cache = CRCache::with_default_size();
|
|
let stats = cache.stats();
|
|
assert_eq!(stats.size, 0);
|
|
assert_eq!(stats.max_size, 10000);
|
|
}
|
|
|
|
#[test]
|
|
fn test_params_manager_creation() {
|
|
let manager = ParamsManager::new();
|
|
let params = manager.get();
|
|
assert_eq!(params.delta_t_min, 100);
|
|
assert_eq!(params.delta_t_max, 2000);
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn test_propagation_manager_creation() {
|
|
let manager = PropagationManager::with_default_config();
|
|
let stats = manager.get_stats().await;
|
|
assert_eq!(stats.total_connections, 0);
|
|
}
|
|
}
|