-
Notifications
You must be signed in to change notification settings - Fork 55
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,21 @@ | ||
//! This module is centered around the `ChainState` type, defining it and providing | ||
//! implementations for the [BlockchainInterface] and [UpdatableChainstate] traits. | ||
//! | ||
//! Consequently, `ChainState` serves as the blockchain backend for our node and is | ||
//! the highest-level type in `floresta-chain`. It is responsible for: | ||
//! | ||
//! - Keeping track of the chain state, and using a [ChainStore] for persisted storage | ||
//! - Correctly updating the state with the help of the `consensus.rs` functions | ||
//! - Interfacing with other components, and providing data about the current view of the chain | ||
//! | ||
//! The primary methods for updating our state are [ChainState::accept_header], which constructs | ||
//! a chain of headers, and [ChainState::connect_block], which verifies the corresponding blocks. | ||
//! | ||
//! Key types: | ||
//! - [ChainState]: The high-level chain backend | ||
//! - [ChainStateInner]: Inner `ChainState` type that is guarded by a lock | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah |
||
//! - [BlockConsumer]: Trait for receiving new block notifications | ||
//! - [BestChain]: Tracks the current best chain and alternative forks | ||
extern crate alloc; | ||
|
||
use alloc::borrow::ToOwned; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
//! 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 | ||
Comment on lines
+1
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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)
|
||
extern crate alloc; | ||
|
||
pub mod chain_state; | ||
|
@@ -158,10 +167,10 @@ pub trait UpdatableChainstate { | |
fn mark_chain_as_assumed(&self, acc: Stump, tip: BlockHash) -> Result<bool, BlockchainError>; | ||
} | ||
|
||
/// [ChainStore] is a trait defining how we interact with our chain database. This definitions | ||
/// will be used by the [ChainState] to save and retrieve data about the blockchain, likely | ||
/// This trait is defining how we interact with our chain database. This definitions | ||
/// will be used by the [ChainState](chain_state::ChainState) to save and retrieve data about the blockchain, likely | ||
/// on disk. | ||
/// Right now, you can use the [KvChainStore] in your code, it implements this trait and | ||
/// Right now, you can use the [KvChainStore](chainstore::KvChainStore) in your code, it implements this trait and | ||
/// uses a key-value store to save data. | ||
/// The [DatabaseError] is a simple trait that can be implemented by any error type that | ||
/// implements [std::error::Error] and [std::fmt::Display]. This is useful to abstract | ||
|
There was a problem hiding this comment.
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:
Please swap the attributes (this #[derive]) with the comment