Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added docs to prunned_utreexo module and its submodules #401

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lucad70
Copy link
Contributor

@lucad70 lucad70 commented Mar 6, 2025

What is the purpose of this pull request?

  • Bug fix
  • Documentation update
  • New feature
  • Test
  • Other:

Which crates are being modified?

  • floresta-chain
  • floresta-cli
  • floresta-common
  • floresta-compact-filters
  • floresta-electrum
  • floresta-watch-only
  • floresta-wire
  • floresta
  • florestad
  • Other: .

Description

I added missing docs to Floresta Chain crate, prunned utreexo module and its submodules to help on #376 .

Notes to the reviewers

I avoided adding the docs for the structs inside each submodule to make it easier for review.

Checklist

  • I've signed all my commits
  • I ran just lint
  • I ran cargo test
  • I've checked the integration tests
  • I've followed the contribution guidelines
  • I'm linking the issue being fixed by this PR (if any)

Images of differences bellow

Screenshot 2025-03-06 at 12 49 36 Screenshot 2025-03-06 at 12 53 25

@Davidson-Souza Davidson-Souza added documentation Improvements or additions to documentation chore Cleaning, refactoring, reducing complexity code quality Generally improves code readability and maintainability labels Mar 6, 2025
Copy link
Contributor

@JoseSK999 JoseSK999 left a comment

Choose a reason for hiding this comment

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

Thanks for this! A few comments

@lucad70 lucad70 force-pushed the 376-floresta-chain branch from 06ceb78 to 6ba5ba3 Compare March 8, 2025 14:09
@lucad70 lucad70 force-pushed the 376-floresta-chain branch 2 times, most recently from 87dfa8a to c82587b Compare March 10, 2025 00:01
@lucad70
Copy link
Contributor Author

lucad70 commented Mar 10, 2025

Thanks for the throughout review @JoseSK999 ! I believe I have resolved every request, if there is any other just let me know and I'll fix it right away.

@JoseSK999
Copy link
Contributor

The comment on the chain_state.rs is still unresolved, you copied it on mod.rs instead.

@lucad70
Copy link
Contributor Author

lucad70 commented Mar 10, 2025

My bad. I will pay more attention in the next PRs and I appreciate your patience.

@lucad70 lucad70 force-pushed the 376-floresta-chain branch from c82587b to d8653de Compare March 10, 2025 12:03
@JoseSK999
Copy link
Contributor

No problem! The CI error is unrelated, could you push again to trigger a new CI run?

@lucad70 lucad70 force-pushed the 376-floresta-chain branch from d8653de to 11bc843 Compare March 10, 2025 12:53
Comment on lines +1 to +9
//! The pruned utreexo module is where the full blockchain logic is handled (validation, state tracking and interfacing). It uses a pruned chain, which does not keep the historical blocks.
//!
//! This module contains the main traits and types for interacting with an utreexo-enabled blockchain.
//! It also provides some utilities for inspecting the utxo set and managing chain state.
//!
//! The key components are:
//! - [BlockchainInterface]: The main interface for interacting with the blockchain
//! - [UpdatableChainstate]: Handles updates to the chain state including blocks and transactions
//! - [ChainStore]: It defines persistence and retrieval of blockchain data
Copy link
Contributor

@JoseSK999 JoseSK999 Mar 10, 2025

Choose a reason for hiding this comment

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

A final nit, can you do something like this:

//! The pruned utreexo module handles the full blockchain logic: validation, state tracking and
//! interfacing. This blockchain backend does not store the historical blocks, it's pruned.
//!
//! This module file defines the main traits for an utreexo-enabled chain backend:
//!
//! - [BlockchainInterface]: The main interface for interacting with the backend
//! - [UpdatableChainstate]: Trait defining methods for updating the chain state
//! - [ChainStore]: Trait for persisting and retrieving blockchain data (headers, block hashes,
//!   the best chain data, and the accumulator)

Copy link
Collaborator

@Davidson-Souza Davidson-Souza left a comment

Choose a reason for hiding this comment

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

Concept ACK.

Just some minor things and we should be ready-to-go.

@@ -21,6 +21,9 @@ pub use pruned_utreexo::error::*;
pub use pruned_utreexo::udata::*;
pub use pruned_utreexo::Notification;

/// Simple enum representing the network type.
///
/// Possible values are Bitcoin, Testnet, Regtest, and Signet.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
Copy link
Collaborator

Choose a reason for hiding this comment

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

As per the contributing.md:

If you need an attribute, use the attribute before the docstring

Please swap the attributes (this #[derive]) with the comment

//!
//! Key types:
//! - [ChainState]: The high-level chain backend
//! - [ChainStateInner]: Inner `ChainState` type that is guarded by a lock
Copy link
Collaborator

Choose a reason for hiding this comment

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

This struct doesn't leaks from our API. I'm not sure it should be here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Cleaning, refactoring, reducing complexity code quality Generally improves code readability and maintainability documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants