node/
lib.rs

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
46#![allow(clippy::if_same_then_else)]
47
48extern crate graphannis_malloc_size_of as malloc_size_of;
49extern crate graphannis_malloc_size_of_derive as malloc_size_of_derive;
50
51pub use mina_core as core;
52
53#[macro_use]
54mod action;
55pub use action::*;
56
57mod action_kind;
58pub use action_kind::ActionKind;
59
60pub mod config;
61pub use config::*;
62
63mod state;
64pub use state::{P2p, State, Substate};
65
66mod reducer;
67pub use reducer::reducer;
68
69mod effects;
70pub use effects::effects;
71
72pub mod service;
73pub use service::Service;
74
75pub mod account;
76
77pub mod recorder;
78pub mod stats;
79
80pub mod block_producer;
81pub mod block_producer_effectful;
82pub mod daemon_json;
83pub mod event_source;
84pub mod external_snark_worker;
85pub mod external_snark_worker_effectful;
86pub mod ledger;
87pub mod ledger_effectful;
88pub mod logger;
89pub mod p2p;
90pub mod rpc;
91pub mod rpc_effectful;
92pub mod snark;
93pub mod snark_pool;
94pub mod transaction_pool;
95pub mod transition_frontier;
96pub mod watched_accounts;
97
98pub type Store<S> = redux::Store<State, S, Action>;
99pub type Effects<S> = redux::Effects<State, S, Action>;