Skip to content

Commit 25e9e7c

Browse files
authored
Merge pull request #1736 from o1-labs/dw/node-crate-1
Node: add succinct top-level documentation
2 parents 82900f1 + 5b32c59 commit 25e9e7c

File tree

3 files changed

+50
-8
lines changed

3 files changed

+50
-8
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10+
### Added
11+
12+
- **Node**: add top-level documentation for the crate `node`
13+
([#1736](https://github.com/o1-labs/mina-rust/pull/1736))
14+
1015
### Changes
1116

1217
- **Dependency**: use tag instead of references of o1-labs/proof-systems, fix

node/src/block_producer/mod.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -175,14 +175,6 @@ pub fn next_epoch_first_slot(global_slot: &v2::ConsensusGlobalSlotStableV1) -> u
175175
.expect("overflow")
176176
}
177177

178-
// Returns the epoch number and whether it is the last slot of the epoch
179-
// pub fn epoch_with_bounds(global_slot: u32) -> (u32, bool) {
180-
// // let epoch_bound = |global_slot| -> (u32, bool) {
181-
// // (global_slot / SLOTS_PER_EPOCH, (global_slot + 1) % SLOTS_PER_EPOCH == 0)
182-
// // };
183-
184-
// }
185-
186178
impl BlockWithoutProof {
187179
pub fn with_hash_and_proof(
188180
self,

node/src/lib.rs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,48 @@
1+
//! # Node Crate
2+
//!
3+
//! The node crate combines all state machines of the Mina blockchain node into
4+
//! one unified state machine using a Redux-style architecture.
5+
//!
6+
//! ## Core Architecture
7+
//!
8+
//! | Component | Location | Purpose |
9+
//! |-------------|--------------------|----------------------------------------------|
10+
//! | Actions | [`Action`] | Events that trigger state changes |
11+
//! | Effects | [`effects()`] | Side-effects and service calls |
12+
//! | Reducers | [`reducer()`] | Functions that mutate state |
13+
//! | Services | [`service`] | I/O and heavy computation (separate threads) |
14+
//! | State | [`State`] | Centralized, immutable data structure |
15+
//!
16+
//! ## Execution Flow
17+
//!
18+
//! ```text
19+
//! Event arrives
20+
//! -> Dispatch Action
21+
//! -> Check Enabling Condition
22+
//! -> Reducer (mutate state)
23+
//! -> Effects (side-effects)
24+
//! -> Service callbacks
25+
//! -> Loop
26+
//! ```
27+
//!
28+
//! ## Key Components
29+
//!
30+
//! | Component | Module | Purpose |
31+
//! |------------------------|----------------------------|-------------------------------------|
32+
//! | Block Producer | [`block_producer`] | Block creation on won slots |
33+
//! | Event Source | [`event_source`] | External event ingestion |
34+
//! | External SNARK Worker | [`external_snark_worker`] | External SNARK worker management |
35+
//! | Ledger | [`ledger`] | Account state and transactions |
36+
//! | Logger | [`logger`] | Logging utilities |
37+
//! | P2P | [`p2p`] | Networking layer |
38+
//! | Recorder | [`recorder`] | Action recording for replay |
39+
//! | RPC | [`rpc`] | JSON-RPC API |
40+
//! | SNARK Pool | [`snark_pool`] | Proof work management |
41+
//! | Stats | [`stats`] | Statistics tracking |
42+
//! | Transaction Pool | [`transaction_pool`] | Mempool for pending transactions |
43+
//! | Transition Frontier | [`transition_frontier`] | Blockchain consensus and best chain |
44+
//! | Watched Accounts | [`watched_accounts`] | Account monitoring |
45+
146
#![allow(clippy::if_same_then_else)]
247

348
extern crate graphannis_malloc_size_of as malloc_size_of;

0 commit comments

Comments
 (0)