Skip to main content

moloch_chain/
lib.rs

1//! Chain operations for Moloch audit chain.
2//!
3//! This crate provides chain management without networking:
4//! - Chain state machine (apply/revert blocks)
5//! - Validator registry (PoA consensus)
6//! - Mempool (pending event queue)
7//! - Block producer (timer-based production)
8//!
9//! # Architecture
10//!
11//! ```text
12//! ┌─────────────────────────────────────────────────────────┐
13//! │                    BlockProducer                        │
14//! │  (Timer-based block creation from mempool events)       │
15//! └─────────────────────────────────────────────────────────┘
16//!                            │
17//!                            ▼
18//! ┌─────────────────────────────────────────────────────────┐
19//! │                      Mempool                            │
20//! │  (Pending events: priority queue, dedup, expiration)    │
21//! └─────────────────────────────────────────────────────────┘
22//!                            │
23//!                            ▼
24//! ┌─────────────────────────────────────────────────────────┐
25//! │                    ChainState                           │
26//! │  (Head, height, validator set, apply/revert blocks)     │
27//! └─────────────────────────────────────────────────────────┘
28//!                            │
29//!                            ▼
30//! ┌─────────────────────────────────────────────────────────┐
31//! │                   ValidatorSet                          │
32//! │  (Authorized sealers, round-robin leader selection)     │
33//! └─────────────────────────────────────────────────────────┘
34//! ```
35
36mod concurrent_mempool;
37mod mempool;
38mod producer;
39mod state;
40mod validators;
41
42pub use concurrent_mempool::{ConcurrentMempool, ConcurrentMempoolConfig, ConcurrentMempoolStats};
43pub use mempool::{Mempool, MempoolConfig, MempoolEntry};
44pub use producer::{BlockProducer, ProducerConfig};
45pub use state::{ApplyResult, ChainConfig, ChainError, ChainSnapshot, ChainState};
46pub use validators::{
47    MisbehaviorKind, SlashingEvidence, ValidatorChange, ValidatorChangeKind, ValidatorSet,
48};