From 0616efc9a156a1b5ef705101f051199d3490a929 Mon Sep 17 00:00:00 2001 From: Liu-Cheng Xu Date: Sun, 14 Jul 2024 14:45:51 +0800 Subject: [PATCH] Fix rustdoc warnings (#21) --- crates/pallet-bitcoin/src/lib.rs | 11 +++++----- .../sc-consensus-nakamoto/src/block_import.rs | 20 +++++++++++++++++++ .../sc-consensus-nakamoto/src/import_queue.rs | 2 +- crates/subcoin-node/src/lib.rs | 4 ++++ crates/subcoin-rpc/src/subcoin.rs | 2 +- crates/subcoin-runtime/src/lib.rs | 7 ++++--- 6 files changed, 36 insertions(+), 10 deletions(-) diff --git a/crates/pallet-bitcoin/src/lib.rs b/crates/pallet-bitcoin/src/lib.rs index 3ea401b7..328ee0db 100644 --- a/crates/pallet-bitcoin/src/lib.rs +++ b/crates/pallet-bitcoin/src/lib.rs @@ -1,10 +1,11 @@ //! # Bitcoin Pallet //! -//! This pallet is designed to be minimalist, containing only one storage item for maintaining the state -//! of the UTXO (Unspent Transaction Output) set by processing the inputs and outputs of each Bitcoin -//! transaction wrapped in [`Call::transact`]. There is no verification logic within the -//! pallet, all validation work should be performed outside the runtime. This approach simplifies -//! off-runtime execution, allowing for easier syncing performance optimization. +//! This pallet is designed to be minimalist, containing only one storage item for maintaining +//! the state of the UTXO (Unspent Transaction Output) set by processing the inputs and outputs +//! of each Bitcoin transaction wrapped in [`Call::transact`]. There is no verification logic +//! within the pallet, all validation work should be performed outside the runtime. This approach +//! simplifies off-runtime execution, allowing for easier syncing performance optimization off +//! chain. // Ensure we're `no_std` when compiling for Wasm. #![cfg_attr(not(feature = "std"), no_std)] diff --git a/crates/sc-consensus-nakamoto/src/block_import.rs b/crates/sc-consensus-nakamoto/src/block_import.rs index 496e13fa..f63f1f72 100644 --- a/crates/sc-consensus-nakamoto/src/block_import.rs +++ b/crates/sc-consensus-nakamoto/src/block_import.rs @@ -1,3 +1,23 @@ +//! This module provides the implementation for importing Bitcoin blocks into Subcoin. +//! +//! Each Bitcoin block is converted into a Substrate block and imported into the database. +//! The Bitcoin header is included in the Substrate header as a `DigestItem`, each Bitcoin +//! transaction is wrapped into an unsigned extrinsic defined in pallet-bitcoin. +//! +//! Key components: +//! +//! - [`BitcoinBlockImporter`] +//! The main struct responsible for importing Bitcoin blocks and managing the import process. +//! +//! - [`BitcoinBlockImport`] +//! An async trait for importing Bitcoin blocks, which is implemented by [`BitcoinBlockImporter`]. +//! +//! - [`ImportConfig`] +//! Configuration for block import, including network type, verification level, and execution options. +//! +//! - [`ImportStatus`] +//! An enum representing the result of an import operation, with variants for different import outcomes. + use crate::block_executor::{BlockExecutor, ExecuteBlockResult}; use crate::verification::{BlockVerification, BlockVerifier}; use bitcoin::hashes::Hash; diff --git a/crates/sc-consensus-nakamoto/src/import_queue.rs b/crates/sc-consensus-nakamoto/src/import_queue.rs index 92c0941e..7aadb576 100644 --- a/crates/sc-consensus-nakamoto/src/import_queue.rs +++ b/crates/sc-consensus-nakamoto/src/import_queue.rs @@ -128,7 +128,7 @@ async fn block_import_process( type BlockImportStatus = sc_consensus::BlockImportStatus; -/// Result of [`import_many_blocks`]. +/// Result of `import_many_blocks`. #[derive(Debug)] pub struct ImportManyBlocksResult { /// The number of blocks imported successfully. diff --git a/crates/subcoin-node/src/lib.rs b/crates/subcoin-node/src/lib.rs index 8b63e513..036d928d 100644 --- a/crates/subcoin-node/src/lib.rs +++ b/crates/subcoin-node/src/lib.rs @@ -1,3 +1,7 @@ +//! Subcoin Node Library. +//! +//! The main feature of this library is to start and run the node as a CLI application. + mod cli; mod commands; mod rpc; diff --git a/crates/subcoin-rpc/src/subcoin.rs b/crates/subcoin-rpc/src/subcoin.rs index 8f3ef4ad..a3fa985c 100644 --- a/crates/subcoin-rpc/src/subcoin.rs +++ b/crates/subcoin-rpc/src/subcoin.rs @@ -40,7 +40,7 @@ where Block: BlockT + 'static, Client: HeaderBackend + BlockBackend + AuxStore + 'static, { - /// Constructs a new instance of [`Blockchain`]. + /// Constructs a new instance of [`Subcoin`]. pub fn new(client: Arc, network_handle: NetworkHandle) -> Self { Self { client, diff --git a/crates/subcoin-runtime/src/lib.rs b/crates/subcoin-runtime/src/lib.rs index 1c59d8fe..58791663 100644 --- a/crates/subcoin-runtime/src/lib.rs +++ b/crates/subcoin-runtime/src/lib.rs @@ -15,8 +15,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! Subcoin runtime is a minimalistic Substrate runtime, it does not implement all the typical -//! runtime APIs the other runtimes would do. +//! Subcoin runtime is a minimalistic Substrate runtime consisting of frame-system and +//! pallet-bitcoin. It does not implement all the typical runtime APIs the normal runtimes +//! would do as many of them does not make sense in Subcoin. #![cfg_attr(not(feature = "std"), no_std)] @@ -255,7 +256,7 @@ mod types_common { // circular dependency (self-referential generics). pub type BlockOf = generic::Block>; - /// The opaque block type. This is the same [`BlockOf`], but it has + /// The opaque block type. This is the same `BlockOf`, but it has /// [`sp_runtime::OpaqueExtrinsic`] as its final extrinsic type. /// /// This should be provided to the client side as the extrinsic type.