-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(consensus): add documentation to consensus crate
- Loading branch information
1 parent
841ad08
commit 67f41c7
Showing
6 changed files
with
114 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,41 @@ | ||
#![warn(missing_docs)] | ||
// TODO(Matan): Add a description of the crate. | ||
// TODO(Matan): Add links to the spec. | ||
// TODO(Matan): fix #[allow(missing_docs)]. | ||
//! A consensus implementation for a [`Starknet`](https://www.starknet.io/) node. | ||
//! A consensus implementation for a [Starknet](https://www.starknet.io/) node. The consensus | ||
//! algorithm is based on [Tendermint](https://arxiv.org/pdf/1807.04938). | ||
//! | ||
//! Consensus communicates with other nodes via a gossip network; sending and receiving votes on one | ||
//! topic and streaming proposals on a separate topic. [details](https://github.com/starknet-io/starknet-p2p-specs/tree/main/p2p/proto/consensus). | ||
//! | ||
//! In addition to the network inputs, consensus reaches out to the rest of the node via the | ||
//! [`Context`](types::ConsensusContext) API. | ||
//! | ||
//! Consensus is generic over the content of the proposals, and merely requires an identifier to be | ||
//! produced by the Context. | ||
//! | ||
//! Consensus can run in two modes: | ||
//! 1. Observer - receive consensus messages and update the node when a decision is reached. | ||
//! 2. Active - in addition to receiving messages the node can send messages to the network. | ||
//! | ||
//! Observer mode is lower latency than sync, since we process Proposals and votes as they happen, | ||
//! not after the decision is made. | ||
//! | ||
//! Consensus is an active component, it doesn't follow the server/client model: | ||
//! 1. The outbound messages are not sent as responses to the inbound messages. | ||
//! 2. It generates and runs its own events (e.g. timeouts). | ||
pub mod config; | ||
pub mod manager; | ||
#[allow(missing_docs)] | ||
pub mod types; | ||
pub use manager::run_consensus; | ||
#[allow(missing_docs)] | ||
pub mod simulation_network_receiver; | ||
pub mod stream_handler; | ||
|
||
mod manager; | ||
#[allow(missing_docs)] | ||
pub mod single_height_consensus; | ||
mod single_height_consensus; | ||
#[allow(missing_docs)] | ||
pub mod state_machine; | ||
pub mod stream_handler; | ||
mod state_machine; | ||
#[cfg(test)] | ||
pub(crate) mod test_utils; | ||
#[allow(missing_docs)] | ||
pub mod types; | ||
|
||
pub use manager::run_consensus; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
//! Types for interfacing between consensus and the node. | ||
use std::fmt::Debug; | ||
use std::time::Duration; | ||
|
||
|