|
| 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 | +
|
1 | 46 | #![allow(clippy::if_same_then_else)] |
2 | 47 |
|
3 | 48 | extern crate graphannis_malloc_size_of as malloc_size_of; |
|
0 commit comments