hotmint-consensus
HotStuff-2 consensus state machine and engine for the Hotmint BFT framework.
This is the core crate of Hotmint. It implements the full HotStuff-2 protocol — two-chain commit, five-step view protocol, pacemaker with exponential backoff — and is completely decoupled from I/O through pluggable trait interfaces.
Architecture
ConsensusEngine
├── ConsensusState mutable state (view, locks, role)
├── view_protocol steady-state protocol (Paper Figure 1)
├── pacemaker timeout & view change (Paper Figure 2)
├── vote_collector vote aggregation & QC formation
├── commit two-chain commit rule
└── leader round-robin leader election
Pluggable Traits
| Trait | Purpose | Built-in Stub |
|---|---|---|
Application |
ABCI-like app lifecycle | NoopApplication |
BlockStore |
Block persistence | MemoryBlockStore |
NetworkSink |
Message transport | ChannelNetwork |
Usage
use ConsensusEngine;
use ConsensusState;
use MemoryBlockStore;
use ChannelNetwork;
use NoopApplication;
let engine = new;
spawn;
Implement Application
Only on_commit is required. Lifecycle: begin_block → deliver_tx (×N) → end_block → on_commit.
use *;
use Block;
use Application;
;
Prometheus Metrics
use Registry;
use ConsensusMetrics;
let mut registry = default;
let metrics = new;
// Exposes: hotmint_blocks_committed, hotmint_votes_sent,
// hotmint_view_timeouts, hotmint_view_duration_seconds, ...
License
GPL-3.0-only