casper_node/components/consensus/
highway_core.rs

1//! # Highway
2//!
3//! The core logic of Casper' Highway consensus protocol.
4//!
5//! At the center of Highway are:
6//! * the _protocol state_, a grow-only data structure which can be considered a directed acyclic
7//!   graph (DAG), and needs to be continually synchronized among the participating nodes,
8//! * rules for the active participants — the _validators_ — to create and add new vertices, and
9//! * a finality detector that provides a criterion to consider a block "finalized". Finalized
10//!   blocks are guaranteed to remain finalized as the DAG grows further, unless too many validators
11//!   are malicious.
12//!
13//! It's not a complete protocol. To implement permissioned consensus, several components must be
14//! added:
15//! * Networking, serialization and cryptographic primitives for signing and hashing.
16//! * A _synchronizer_ that exchanges messages with other participating nodes to exchange their DAG
17//!   vertices and ensure that each vertex becomes eventually known to every node.
18//! * Semantics for the consensus values, which can e.g. represent token transfers, or programs to
19//!   be executed in a virtual machine for a smart contract platform.
20//! * Signing of finalized blocks, as a finality proof to third parties/clients.
21//!
22//! Note that consensus values should be small. If they represent a lot of data, e.g. lists of
23//! complex transactions, they should not be passed into `highway_core` directly. Instead, the
24//! consensus value should be the list's hash.
25//!
26//! Permissioned consensus protocols can also be used in a _permissionless_ Proof-of-Stake context,
27//! or with some other governance system that can add and remove validators, by starting a new
28//! protocol instance whenever the set of validators changes.
29
30// This needs to come before the other modules, so the macros are available everywhere.
31#[cfg(test)]
32#[macro_use]
33mod test_macros;
34
35pub(crate) mod active_validator;
36pub mod finality_detector;
37pub mod highway;
38pub(crate) mod state;
39pub(super) mod synchronizer;
40
41mod endorsement;
42mod evidence;
43#[cfg(test)]
44pub(crate) mod highway_testing;
45
46pub use state::{Observation, Panorama, State};
47
48// Enables the endorsement mechanism.
49const ENABLE_ENDORSEMENTS: bool = false;