Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

minor updates to the substrate doc crate #14614

Merged
merged 10 commits into from
Jul 23, 2023
6 changes: 6 additions & 0 deletions bin/utils/chain-spec-builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@
//!
//! A chain-spec is short for `chain-configuration`. See the [`sc-chain-spec`] for more information.
//!
//! Note that this binary is analogous to the `build-spec` subcommand, contained in typical
//! substrate-based nodes. See [`node-cli`] for more information.
//!
//! See [`ChainSpecBuilder`] for a list of available commands.
//!
//! [`sc-chain-spec`]: ../sc_chain_spec/index.html
//! [`node-cli`]: ../node_cli/index.html

use std::path::{Path, PathBuf};

Expand Down
12 changes: 12 additions & 0 deletions client/chain-spec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,19 @@
//! ```json
//! // The human readable name of the chain.
//! "name": "Flaming Fir",
//!
//! // The id of the chain.
//! "id": "flamingfir9",
//!
//! // The chain type of this chain.
//! // Possible values are `Live`, `Development`, `Local`.
//! "chainType": "Live",
//!
//! // A list of multi addresses that belong to boot nodes of the chain.
//! "bootNodes": [
//! "/dns/0.flamingfir.paritytech.net/tcp/30333/p2p/12D3KooWLK2gMLhWsYJzjW3q35zAs9FDDVqfqVfVuskiGZGRSMvR",
//! ],
//!
//! // Optional list of "multi address, verbosity" of telemetry endpoints.
//! // The verbosity goes from `0` to `9`. With `0` being the mode with the lowest verbosity.
//! "telemetryEndpoints": [
Expand All @@ -133,19 +137,24 @@
//! 0
//! ]
//! ],
//!
//! // Optional networking protocol id that identifies the chain.
//! "protocolId": "fir9",
//!
//! // Optional fork id. Should most likely be left empty.
//! // Can be used to signal a fork on the network level when two chains have the
//! // same genesis hash.
//! "forkId": "random_fork",
//!
//! // Custom properties.
//! "properties": {
//! "tokenDecimals": 15,
//! "tokenSymbol": "FIR"
//! },
//!
//! // Deprecated field. Should be ignored.
//! "consensusEngine": null,
//!
//! // The genesis declaration of the chain.
//! //
//! // `runtime`, `raw`, `stateRootHash` denote the type of the genesis declaration.
Expand All @@ -159,6 +168,7 @@
//! // type depends on the hash used by the chain.
//! //
//! "genesis": { "runtime": {} },
//!
//! /// Optional map of `block_number` to `wasm_code`.
//! ///
//! /// The given `wasm_code` will be used to substitute the on-chain wasm code starting with the
Expand All @@ -172,6 +182,8 @@
//! "codeSubstitutes": [],
//! ```
//!
//! See [`ChainSpec`] for a trait representation of the above.
//!
//! The chain spec can be extended with other fields that are opaque to the default chain spec.
//! Specific node implementations will need to be able to deserialize these extensions.

Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/gitlab/pipeline/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ build-rustdoc:
- .test-refs
variables:
SKIP_WASM_BUILD: 1
DOC_INDEX_PAGE: "sc_service/index.html" # default redirected page
DOC_INDEX_PAGE: "substrate/index.html" # default redirected page
# this variable gets overriden by "rusty-cachier environment inject", use the value as default
CARGO_TARGET_DIR: "$CI_PROJECT_DIR/target"
artifacts:
Expand Down
40 changes: 37 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,21 @@
//! * `pallet-*` and `frame-*` crates, located under `./frame` folder. These are the crates related
//! to FRAME. See [`frame_support`] for more information.
//!
//! ### Wasm Build
//!
//! Many of the Substrate crates, such as entire `sp-*`, need to compile to both Wasm (when a Wasm
//! runtime is being generated) and native ! (for example, when testing). To achieve this, Substrate
kianenigma marked this conversation as resolved.
Show resolved Hide resolved
//! follows the convention of the Rust community, and uses a `feature = "std"` to signify that a
//! crate is being built with the standard library, and is built for native. Otherwise, it is built
//! for `no_std`.
//!
//! This can be summarized in `#![cfg_attr(not(feature = "std"), no_std)]`, which you can often find
//! in any Substrate-based runtime.
//!
//! Substrate-based runtimes use [`substrate-wasm-builder`] in their `build.rs` to automatically
//! build their Wasm files as a part of normal build commandsOnce built, the wasm file is placed in
//! `./target/{debug|release}/wbuild/{runtime_name}.wasm`.
//!
//! ### Binaries
//!
//! Multiple binaries are shipped with substrate, the most important of which are located in the
Expand All @@ -119,6 +134,22 @@
//! * [`chain-spec-builder`]: Substrate's utility to build *chain specifications*. Such
//! specifications can then be used with `--chain` argument of a typical substrate node's CLI.
//!
//! ### Anatomy of a Binary Crate
//!
//! From the above, [`node`] and [`node-template`] are essentially blueprints of a substrate-based
//! project, as the name of the latter is implying. Each substrate-based project typically contains
//! the following:
//!
//! * Under `./runtime`, a `./runtime/src/lib.rs` which is the top level runtime amalgamator file.
//! This file typically contains the [`frame_support::construct_runtime`] macro, which is the
//! final definition of a runtime.
//!
//! * Under `./node`, a `main.rs`, which is the point, and a `./service.rs`, which contains all the
//! client side components. Skimming this file yield an overview of the networking, database,
kianenigma marked this conversation as resolved.
Show resolved Hide resolved
//! consensus and similar client side components.
//!
//! > The above two are conventions, not rules.
//!
//! ## Parachain?
//!
//! As noted above, Substrate is the main engine behind the Polkadot ecosystem. One of the ways
Expand All @@ -132,7 +163,7 @@
//!
//! Additional noteworthy crates within substrate:
//!
//! - RPC APIs of a Substrate node: [`sc-rpc-api`]
//! - RPC APIs of a Substrate node: [`sc-rpc-api`]/[`sc-rpc`]
//! - CLI Options of a Substrate node: [`sc-cli`]
//! - All of the consensus related crates provided by Substrate:
//! - [`sc-consensus-aura`]
Expand All @@ -151,6 +182,7 @@
//!
//! Notable upstream crates:
//!
//! - [`parity-scale-codec`](https://github.com/paritytech/parity-scale-codec)
//! - [`parity-db`](https://github.com/paritytech/parity-db)
//! - [`trie`](https://github.com/paritytech/trie)
//! - [`parity-common`](https://github.com/paritytech/parity-common)
Expand All @@ -172,6 +204,7 @@
//! [`sc-client-db`]: ../sc_client_db/index.html
//! [`sc-network`]: ../sc_network/index.html
//! [`sc-rpc-api`]: ../sc_rpc_api/index.html
//! [`sc-rpc`]: ../sc_rpc/index.html
//! [`sc-cli`]: ../sc_cli/index.html
//! [`sc-consensus-aura`]: ../sc_consensus_aura/index.html
//! [`sc-consensus-babe`]: ../sc_consensus_babe/index.html
Expand All @@ -182,8 +215,9 @@
//! [`node`]: ../node_cli/index.html
//! [`node-template`]: ../node_template/index.html
//! [`kitchensink_runtime`]: ../kitchensink_runtime/index.html
//! [`subkey`]: ..//subkey/index.html
//! [`chian-spec-builder`]: ../chain_spec_builder/index.html
//! [`subkey`]: ../subkey/index.html
//! [`chain-spec-builder`]: ../chain_spec_builder/index.html
//! [`substrate-wasm-builder`]: https://crates.io/crates/substrate-wasm-builder

#![deny(rustdoc::broken_intra_doc_links)]
#![deny(rustdoc::private_intra_doc_links)]
Expand Down