Skip to content

Conversation

dannywillems
Copy link
Member

No description provided.

@dannywillems dannywillems changed the title Documentation: add network configuration + fix test-docs Documentation: add network configuration + fix cargo test --doc Jul 25, 2025
@dannywillems dannywillems force-pushed the dw/ledger-configuration-documentation branch 5 times, most recently from 1815fc6 to 532c918 Compare July 25, 2025 16:02
@dannywillems dannywillems requested review from volhovm and 0xMimir and removed request for volhovm July 25, 2025 16:02
@dannywillems dannywillems enabled auto-merge July 25, 2025 16:03
@dannywillems dannywillems force-pushed the dw/ledger-configuration-documentation branch 2 times, most recently from cb0e598 to 366efbc Compare July 25, 2025 17:04
@@ -5,35 +5,53 @@ Derives `[openmina_core::ActionEvent]` trait implementation for action.
For action containers, it simply delegates to inner actions.

```rust
# use openmina_core::ActionEvent;
#
use openmina_core::{ActionEvent, log::EventContext};
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Rust in this markdown gets compiled and checked by make test-docs.

@dannywillems dannywillems force-pushed the dw/ledger-configuration-documentation branch from 366efbc to 375b2e8 Compare July 25, 2025 17:33
…ead of std

Move inline `use` statements from function bodies to the top of consensus.rs
to follow Rust best practices. Replace `std::cmp` with `core::cmp` for basic
comparison functionality that doesn't require the full standard library,
making the code more suitable for no_std environments.

Changes:
- Move `use std::cmp::{max, min}` from `relative_min_window_density()` to file top
- Move `use std::cmp::Ordering::*` from fork choice functions to file top
- Replace `std::cmp` with `core::cmp`
- Use fully qualified `Ordering::` variants instead of wildcard imports
- Update all match expressions to use explicit `Ordering::Greater/Less/Equal`

All tests pass and documentation builds successfully.
@dannywillems dannywillems force-pushed the dw/ledger-configuration-documentation branch from 8b58b20 to 5be465c Compare July 25, 2025 17:48
/// ## Timing Hierarchy
///
/// The consensus protocol operates on a hierarchical timing structure:
/// - **Slots**: Basic time units (3 minutes each)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/// attempt to create blocks during their assigned slots. The duration affects
/// network synchronization requirements and transaction confirmation times.
///
/// **Value**: 180,000ms (3 minutes)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dannywillems dannywillems mentioned this pull request Jul 25, 2025
1 task
@dannywillems dannywillems changed the title Documentation: add network configuration + fix cargo test --doc Documentation: add network configuration and consensus doc + fix cargo test --doc Jul 25, 2025
Copy link
Contributor

@volhovm volhovm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. My comments are mostly minor, feel free to merge.

/// ## Timing Hierarchy
///
/// The consensus protocol operates on a hierarchical timing structure:
/// - **Slots**: Basic time units (3 minutes each)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Subjective but a bit too detailed for my taste. Slot time might change with hardfork, I'd just add "minutes" and "days" instead.

///
/// Two chains are considered short-range forks if:
/// 1. They are in the same epoch with matching staking epoch lock checkpoints, OR
/// 2. One chain is exactly one epoch ahead and the trailing chain is not in seed update range
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is "seed update range"? 🤔

///
/// ## Returns
///
/// `true` if the states represent a short-range fork, `false` for long-range forks.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does it return if there is no fork = states are identical or one is prefix of another?

///
/// ## Consensus Protocol Overview
///
/// Mina uses Ouroboros Samasika, a succinct blockchain consensus algorithm that provides:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds a bit offtop to me, I'd say the doc is not the place to discuss pros and cons of our choice of consensus protocol? I'm assuming all these comments are cowritten by claude because they are so well-formatted (correct me if I'm wrong?), but I think some of them are a bit too verbose? wdyt

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, cowritten by claude by providing the OCaml codebase and technical documents. The initial idea was to get a mapping between the OCaml and the Rust codebase, and ease the changes from one to the other.

I should have set this PR in draft. I did not review.

@dannywillems dannywillems marked this pull request as draft July 29, 2025 08:26
auto-merge was automatically disabled July 29, 2025 08:26

Pull request was converted to draft

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants