Skip to content

Commit e6c5135

Browse files
committed
Run make format-md
1 parent 893886a commit e6c5135

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2063
-1418
lines changed

ARCHITECTURE.md

Lines changed: 295 additions & 219 deletions
Large diffs are not rendered by default.

CLAUDE.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,19 @@ This file helps understand and navigate the OpenMina codebase structure.
44

55
## Project Overview
66

7-
OpenMina is a Rust implementation of the Mina Protocol, a lightweight
8-
blockchain using zero-knowledge proofs. It follows a Redux-style state machine
9-
architecture for predictable, debuggable behavior.
7+
OpenMina is a Rust implementation of the Mina Protocol, a lightweight blockchain
8+
using zero-knowledge proofs. It follows a Redux-style state machine architecture
9+
for predictable, debuggable behavior.
1010

11-
*For detailed architecture documentation, see [`docs/handover/`](docs/handover/)*
11+
_For detailed architecture documentation, see
12+
[`docs/handover/`](docs/handover/)_
1213

1314
## Architecture Overview
1415

1516
### State Machine Pattern
17+
1618
The codebase follows Redux principles:
19+
1720
- **State** - Centralized, immutable data structure
1821
- **Actions** - Events that trigger state changes
1922
- **Enabling Conditions** - Guards that prevent invalid state transitions
@@ -22,14 +25,17 @@ The codebase follows Redux principles:
2225
- **Services** - Separate threads handling I/O and heavy computation
2326

2427
### Architecture Styles
25-
- **New Style**: Unified reducers that handle both state updates and action dispatch
28+
29+
- **New Style**: Unified reducers that handle both state updates and action
30+
dispatch
2631
- **Old Style**: Separate reducer and effects files (being migrated)
2732

2833
## Project Structure
2934

3035
### Core Components
3136

3237
**node/** - Main node logic
38+
3339
- `block_producer/` - Block production
3440
- `transaction_pool/` - Transaction mempool
3541
- `transition_frontier/` - Consensus and blockchain state
@@ -40,6 +46,7 @@ The codebase follows Redux principles:
4046
- `service/` - Service implementations
4147

4248
**p2p/** - Networking layer
49+
4350
- Dual transport: libp2p and WebRTC
4451
- Channel abstractions for message types
4552
- Peer discovery and connection management
@@ -54,6 +61,7 @@ logic, staged ledger, scan state, and proof verification
5461
## Code Organization
5562

5663
### File Patterns
64+
5765
- `*_state.rs` - State definitions
5866
- `*_actions.rs` - Action types
5967
- `*_reducer.rs` - State transitions
@@ -62,6 +70,7 @@ logic, staged ledger, scan state, and proof verification
6270
- `summary.md` - Component documentation and technical debt notes
6371

6472
### Key Files
73+
6574
- `node/src/state.rs` - Global state structure
6675
- `node/src/action.rs` - Top-level action enum
6776
- `node/src/reducer.rs` - Main reducer dispatch
@@ -77,14 +86,17 @@ logic, staged ledger, scan state, and proof verification
7786
## Key Patterns
7887

7988
### Defensive Programming
89+
8090
- `bug_condition!` macro marks theoretically unreachable code paths
8191
- Used after enabling condition checks for invariant validation
8292

8393
### State Methods
94+
8495
- Complex logic extracted from reducers into state methods
8596
- Keeps reducers focused on orchestration
8697

8798
### Callbacks
99+
88100
- Enable decoupled component communication
89101
- Used for async operation completion
90102

@@ -107,6 +119,7 @@ find . -name "summary.md" -path "*/component/*"
107119
## Component Documentation
108120

109121
Each component directory contains a `summary.md` file documenting:
122+
110123
- Component purpose and responsibilities
111124
- Known technical debt
112125
- Implementation notes

docker.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ Images are available at the Docker Hub repository `openmina/openmina`.
88
For the branch itself, two tags produced, one derived from the commit hash
99
(first 8 chars), and another one is `latest`.
1010

11-
For a PR from a branch named `some/branch`, two tags are produced, one is `some-branch-<commit-hash>` and another one is `some-branch-latest`.
12-
11+
For a PR from a branch named `some/branch`, two tags are produced, one is
12+
`some-branch-<commit-hash>` and another one is `some-branch-latest`.

docs/alpha-testing-guide.md

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Run Non-Block Producing Node on Devnet
22

3-
This guide will walk you through running the **Alpha Rust Node** on Devnet using Docker. Follow these steps to set up the node and [Provide Feedback](#4-provide-feedback) on this Alpha release.
3+
This guide will walk you through running the **Alpha Rust Node** on Devnet using
4+
Docker. Follow these steps to set up the node and
5+
[Provide Feedback](#4-provide-feedback) on this Alpha release.
46

57
## 1. Prerequisites
68

@@ -11,8 +13,8 @@ Ensure you have **Docker** installed:
1113
## 2. Download & Start the Node
1214

1315
1. **Download the Latest Release**:
14-
15-
- Visit the [Open Mina Releases](https://github.com/openmina/openmina/releases).
16+
- Visit the
17+
[Open Mina Releases](https://github.com/openmina/openmina/releases).
1618
- Download the latest `openmina-vX.Y.Z-docker-compose.zip`.
1719

1820
2. **Extract the Files**:
@@ -24,28 +26,32 @@ Ensure you have **Docker** installed:
2426

2527
Additional optional parameters:
2628

27-
`OPENMINA_LIBP2P_EXTERNAL_IP` Sets your node’s external IP address to help other nodes find it.
29+
`OPENMINA_LIBP2P_EXTERNAL_IP` Sets your node’s external IP address to help
30+
other nodes find it.
2831

2932
`OPENMINA_LIBP2P_PORT` Sets the port for Libp2p communication.
3033

31-
3. **Start the Node on Devnet and Save Logs**:
32-
Start the node and save the logs for later analysis:
34+
3. **Start the Node on Devnet and Save Logs**: Start the node and save the logs
35+
for later analysis:
3336

3437
```bash
3538
docker compose up --pull always && docker compose logs > openmina-node.log
3639
```
3740

38-
4. **Access the Dashboard**:
39-
Open `http://localhost:8070` in your browser.
41+
4. **Access the Dashboard**: Open `http://localhost:8070` in your browser.
4042

4143
The dashboard will show the syncing process in real time.
4244
<img width="1417" alt="image" src="https://github.com/user-attachments/assets/d9a5f5b3-522f-479b-9829-37402c63bb98">
4345

44-
> **1. Connecting to Peers:** The node connects to peers. You’ll see the number of connected, connecting, and disconnected peers grow.
46+
> **1. Connecting to Peers:** The node connects to peers. You’ll see the
47+
> number of connected, connecting, and disconnected peers grow.
4548
>
46-
> **2. Fetching Ledgers:** The node downloads key data: Staking ledger, Next epoch ledger, and Snarked ledger. Progress bars show the download status.
49+
> **2. Fetching Ledgers:** The node downloads key data: Staking ledger, Next
50+
> epoch ledger, and Snarked ledger. Progress bars show the download status.
4751
>
48-
> **3. Fetching & Applying Blocks:** The node downloads recent blocks to match the network’s current state. The dashboard tracks how many blocks are fetched and applied.
52+
> **3. Fetching & Applying Blocks:** The node downloads recent blocks to
53+
> match the network’s current state. The dashboard tracks how many blocks are
54+
> fetched and applied.
4955
5056
## 3. Monitoring and troubleshooting
5157

@@ -68,10 +74,15 @@ docker compose up --pull always
6874

6975
## 4. Provide Feedback
7076

71-
This Alpha release is for testing purposes. Your feedback is essential. Follow these steps to report any issues:
77+
This Alpha release is for testing purposes. Your feedback is essential. Follow
78+
these steps to report any issues:
7279

73-
1. **Collect Logs**: Use the [commands above to save logs](#2-download--start-the-node)
74-
2. **Visit Discord**: [Open Mina Discord Channel](https://discord.com/channels/484437221055922177/1290662938734231552/1290667779317305354)
80+
1. **Collect Logs**: Use the
81+
[commands above to save logs](#2-download--start-the-node)
82+
2. **Visit Discord**:
83+
[Open Mina Discord Channel](https://discord.com/channels/484437221055922177/1290662938734231552/1290667779317305354)
7584
3. **Describe the Issue**: Briefly explain the problem and steps to reproduce it
76-
4. **Attach Logs**: Discord allows files up to 25MB. If your logs are larger, use Google Drive or similar
77-
5. **Include a Screenshot**: A dashboard screenshot provides details about node status, making it easier to diagnose the issue
85+
4. **Attach Logs**: Discord allows files up to 25MB. If your logs are larger,
86+
use Google Drive or similar
87+
5. **Include a Screenshot**: A dashboard screenshot provides details about node
88+
status, making it easier to diagnose the issue

docs/archive-node-guide.md

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,40 @@
11
# Run Archive Node on Devnet
22

3-
This guide is intended for setting up archive nodes on **Mina Devnet** only. Do not use this guide for Mina Mainnet
3+
This guide is intended for setting up archive nodes on **Mina Devnet** only. Do
4+
not use this guide for Mina Mainnet
45

56
## Archive Mode Configuration
67

7-
We start archive mode in openmina by setting one of the following flags along with their associated environment variables:
8+
We start archive mode in openmina by setting one of the following flags along
9+
with their associated environment variables:
810

911
### Archiver Process (`--archive-archiver-process`)
1012

1113
Stores blocks in a database by receiving them directly from the openmina node
1214

1315
**Required Environment Variables**:
16+
1417
- `OPENMINA_ARCHIVE_ADDRESS`: Network address for the archiver service
1518

1619
### Local Storage (`--archive-local-storage`)
1720

1821
Stores blocks in the local filesystem
1922

2023
**Required Environment Variables**:
24+
2125
- (None)
2226

2327
**Optional Environment Variables**:
24-
- `OPENMINA_ARCHIVE_LOCAL_STORAGE_PATH`: Custom path for block storage (default: ~/.openmina/archive-precomputed)
28+
29+
- `OPENMINA_ARCHIVE_LOCAL_STORAGE_PATH`: Custom path for block storage (default:
30+
~/.openmina/archive-precomputed)
2531

2632
### GCP Storage (`--archive-gcp-storage`)
2733

2834
Uploads blocks to a Google Cloud Platform bucket
2935

3036
**Required Environment Variables**:
37+
3138
- `GCP_CREDENTIALS_JSON`: Service account credentials JSON
3239
- `GCP_BUCKET_NAME`: Target storage bucket name
3340

@@ -36,6 +43,7 @@ Uploads blocks to a Google Cloud Platform bucket
3643
Uploads blocks to an AWS S3 bucket
3744

3845
**Required Environment Variables**:
46+
3947
- `AWS_ACCESS_KEY_ID`: IAM user access key
4048
- `AWS_SECRET_ACCESS_KEY`: IAM user secret key
4149
- `AWS_DEFAULT_REGION`: AWS region name
@@ -44,17 +52,22 @@ Uploads blocks to an AWS S3 bucket
4452

4553
## Redundancy
4654

47-
The archive mode is designed to be redundant. We can combine the flags to have multiple options running simultaneously.
55+
The archive mode is designed to be redundant. We can combine the flags to have
56+
multiple options running simultaneously.
4857

4958
## Prerequisites
5059

51-
Ensure Docker and Docker Compose are installed on your system - [Docker Installation Guide](./docker-installation.md)
60+
Ensure Docker and Docker Compose are installed on your system -
61+
[Docker Installation Guide](./docker-installation.md)
5262

5363
## Docker compose setup (with archiver process)
5464

55-
The compose file sets up a PG database, the archiver process and the openmina node. The archiver process is responsible for storing the blocks in the database by receiving the blocks from the openmina node.
65+
The compose file sets up a PG database, the archiver process and the openmina
66+
node. The archiver process is responsible for storing the blocks in the database
67+
by receiving the blocks from the openmina node.
5668

57-
See [docker-compose.archive.devnet.yml](../docker-compose.archive.devnet.yml) for more details.
69+
See [docker-compose.archive.devnet.yml](../docker-compose.archive.devnet.yml)
70+
for more details.
5871

5972
### Starting the setup
6073

docs/block-producer-guide.md

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
# Run Block Producing Node on Devnet
22

3-
This guide is intended for setting up block producer nodes on **Mina Devnet** only.
4-
Do not use this guide for Mina Mainnet until necessary security audits are complete.
3+
This guide is intended for setting up block producer nodes on **Mina Devnet**
4+
only.
5+
Do not use this guide for Mina Mainnet until necessary security audits are
6+
complete.
57

68
---
79

810
## Prerequisites
911

10-
Ensure Docker and Docker Compose are installed on your system - [Docker Installation Guide](./docker-installation.md)
12+
Ensure Docker and Docker Compose are installed on your system -
13+
[Docker Installation Guide](./docker-installation.md)
1114

1215
## Download & Start the Node
1316

@@ -25,18 +28,22 @@ Ensure Docker and Docker Compose are installed on your system - [Docker Installa
2528

2629
2. **Prepare Your Keys**
2730

28-
[Docker Compose](../docker-compose.block-producer.yml) references `openmina-workdir`. It stores a private key and logs for block production.
29-
Place your block producer's private key into the `openmina-workdir` directory and name it `producer-key`:
31+
[Docker Compose](../docker-compose.block-producer.yml) references
32+
`openmina-workdir`. It stores a private key and logs for block production.
33+
Place your block producer's private key into the `openmina-workdir` directory
34+
and name it `producer-key`:
3035

3136
```bash
3237
cp /path/to/your/private_key openmina-workdir/producer-key
3338
```
3439

35-
Replace `/path/to/your/private_key` with the actual path to your private key file.
40+
Replace `/path/to/your/private_key` with the actual path to your private key
41+
file.
3642

3743
3. **Launch Block Producer**
3844

39-
Use `MINA_PRIVKEY_PASS` to set the private key password. Optionally, use `COINBASE_RECEIVER` to set a different coinbase receiver:
45+
Use `MINA_PRIVKEY_PASS` to set the private key password. Optionally, use
46+
`COINBASE_RECEIVER` to set a different coinbase receiver:
4047

4148
```bash
4249
env COINBASE_RECEIVER="YourWalletAddress" MINA_PRIVKEY_PASS="YourPassword" \
@@ -45,18 +52,24 @@ Ensure Docker and Docker Compose are installed on your system - [Docker Installa
4552

4653
Optional parameters:
4754

48-
`OPENMINA_LIBP2P_EXTERNAL_IP` Sets your node’s external IP address to help other nodes find it.
55+
`OPENMINA_LIBP2P_EXTERNAL_IP` Sets your node’s external IP address to help
56+
other nodes find it.
4957

5058
`OPENMINA_LIBP2P_PORT` Sets the port for Libp2p communication.
5159

5260
4. **Go to Dashboard**
5361

54-
Visit [http://localhost:8070](http://localhost:8070) to [monitor sync](http://localhost:8070/dashboard) and [block production](http://localhost:8070/block-production).
62+
Visit [http://localhost:8070](http://localhost:8070) to
63+
[monitor sync](http://localhost:8070/dashboard) and
64+
[block production](http://localhost:8070/block-production).
5565

5666
### Access Logs
5767

58-
Logs are stored in `openmina-workdir` with filenames like `openmina.log.2024-10-14`, `openmina.log.2024-10-15`, etc.
68+
Logs are stored in `openmina-workdir` with filenames like
69+
`openmina.log.2024-10-14`, `openmina.log.2024-10-15`, etc.
5970

6071
### Provide Feedback
6172

62-
Collect logs from `openmina-workdir` and report issues on the [rust-node-testing](https://discord.com/channels/484437221055922177/1290662938734231552) discord channel. Include reproduction steps if possible.
73+
Collect logs from `openmina-workdir` and report issues on the
74+
[rust-node-testing](https://discord.com/channels/484437221055922177/1290662938734231552)
75+
discord channel. Include reproduction steps if possible.

docs/building-from-source-guide.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# How to build and launch a node from source
22

3-
This installation guide has been tested on Debian and Ubuntu and should work on most distributions of Linux.
3+
This installation guide has been tested on Debian and Ubuntu and should work on
4+
most distributions of Linux.
45

56
## Prerequisites
67

@@ -73,7 +74,8 @@ nvm install 20.11.1
7374

7475
#### Windows
7576

76-
Download [Node.js v20.11.1](https://nodejs.org/) from the official website, open the installer and follow the prompts to complete the installation.
77+
Download [Node.js v20.11.1](https://nodejs.org/) from the official website, open
78+
the installer and follow the prompts to complete the installation.
7779

7880
### 2. Angular CLI v16.2.0
7981

0 commit comments

Comments
 (0)