guts_consensus/simplex/mod.rs
1//! Simplex BFT consensus implementation for Guts.
2//!
3//! This module provides a production-ready BFT consensus implementation
4//! based on the Simplex consensus protocol from commonware. It provides:
5//!
6//! - Fast block times (2 network hops)
7//! - Optimal finalization latency (3 network hops)
8//! - Byzantine fault tolerance (up to f < n/3 faulty validators)
9//! - Externalized uptime and fault proofs
10//!
11//! # Architecture
12//!
13//! The consensus engine is composed of several actors:
14//!
15//! - **Application**: Handles block proposal and verification
16//! - **Marshal**: Manages block storage and synchronization
17//! - **Buffer**: Buffers broadcast messages
18//! - **Consensus (Voter/Batcher/Resolver)**: Core BFT logic
19//!
20//! # Usage
21//!
22//! ```ignore
23//! use guts_consensus::simplex::{Engine, Config};
24//!
25//! // Create configuration
26//! let config = Config::new(
27//! blocker,
28//! my_public_key,
29//! my_private_key,
30//! validator_public_keys,
31//! );
32//!
33//! // Create engine
34//! let engine = Engine::new(context, config).await;
35//!
36//! // Start with P2P channels
37//! engine.start(pending, recovered, resolver, broadcast, marshal);
38//! ```
39
40pub mod application;
41pub mod block;
42pub mod engine;
43pub mod types;
44
45pub use application::{Actor as ApplicationActor, Config as ApplicationConfig, Mailbox, Message};
46pub use block::SimplexBlock;
47pub use engine::{Config, Engine, EngineMetrics, StaticSchemeProvider, EPOCH, NAMESPACE};
48pub use types::{
49 Activity, Finalization, Notarization, Scheme, ValidatorPrivateKey, ValidatorPublicKey,
50};