Skip to content

Commit

Permalink
Finish all core libraries docs (#253)
Browse files Browse the repository at this point in the history
* Doc

* Doc
  • Loading branch information
aurexav authored Oct 30, 2022
1 parent cf170ff commit 08dedaf
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion doc/src/user/cli/state.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ darwinia --chain darwinia-dev.json.export --alice --tmp
2022-08-25 15:32:41 💤 Idle (0 peers), best: #4 (0xfd60…b2f2), finalized #2 (0x6027…c86e), ⬇ 14 B/s ⬆ 0
```

With the `--simple-governance` flag, you could perform a runtime upgrade test though sudo or council locally.
With the `--simple-governance` flag, you could perform a runtime upgrade test through sudo or council locally.

It's a really useful testing tool.

Expand Down
2 changes: 2 additions & 0 deletions lib/core/src/check/features/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Cargo features checker.
#[cfg(test)] mod test;

// crates.io
Expand Down
6 changes: 1 addition & 5 deletions lib/core/src/check/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
//! A series of Substrate checkers.
//!
//! CI setup examples: <https://github.com/darwinia-network/darwinia-common/blob/main/.github/workflows/checks.yml>
//! A series of checkers.
/// Features checker.
pub mod features;
/// Runtime checkers.
pub mod runtime;
9 changes: 6 additions & 3 deletions lib/core/src/check/runtime.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Substrate-like runtime checker.
// std
use std::{
fmt::{Debug, Write},
Expand All @@ -10,8 +12,8 @@ use submetadatan::{
StorageEntryMetadata,
};

/// Compare the nodes' runtime versions.
/// If there is no difference, return `None`.
/// Fetch two nodes' runtime versions through their HTTP RPC endpoints.
/// Compare the versions, then return the differences in markdown diff style.
pub async fn check_version(a_uri: &str, b_uri: &str) -> Result<Option<String>> {
const E_WRITE_TO_STRING_NEVER_FAILS: &str = "[core::check] write to string never fails; qed";

Expand Down Expand Up @@ -39,7 +41,8 @@ pub async fn check_version(a_uri: &str, b_uri: &str) -> Result<Option<String>> {
Ok(Some(result))
}

/// Compare the nodes' runtime storages.
/// Fetch two nodes' runtime storage through their HTTP RPC endpoints.
/// Compare the storage, then return the differences in markdown diff style.
pub async fn check_storage(
a_uri: &str,
b_uri: &str,
Expand Down
2 changes: 1 addition & 1 deletion lib/core/src/http/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ use std::sync::Arc;
use once_cell::sync::Lazy;
use reqwest::Client;

/// Global HTTP client.
/// Subalfred's global HTTP client.
pub static CLIENT: Lazy<Arc<Client>> = Lazy::new(|| Arc::new(Client::new()));
2 changes: 1 addition & 1 deletion lib/core/src/jsonrpc/http/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use serde::{de::DeserializeOwned, Serialize};
use super::*;
use crate::{http::CLIENT, prelude::*};

/// Send the JSONRPC through the [`CLIENT`] with the given JSON.
/// Send a JSONRPC request through the [`CLIENT`].
pub async fn send<S, D>(uri: &str, s: &S) -> Result<Response<D>>
where
S: Serialize,
Expand Down
14 changes: 7 additions & 7 deletions lib/core/src/jsonrpc/ws/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ impl Default for Initializer {
}
}

/// Ws instance.
/// A Ws instance.
///
/// Use this to interact with the server.
pub struct Ws {
Expand Down Expand Up @@ -395,13 +395,13 @@ enum Call {
Batch(RawCall<BatchNotifier>),
}

/// A single request object.
/// `id`: Request Id.
// A single request object.
// `id`: Request Id.
//
/// Or
///
/// A batch requests object to send several request objects simultaneously.
/// `id`: The first request's id.
// Or
//
// A batch requests object to send several request objects simultaneously.
// `id`: The first request's id.
#[derive(Debug)]
struct RawCall<N> {
id: Id,
Expand Down

0 comments on commit 08dedaf

Please sign in to comment.