|
105 | 105 | //! * `pallet-*` and `frame-*` crates, located under `./frame` folder. These are the crates related
|
106 | 106 | //! to FRAME. See [`frame_support`] for more information.
|
107 | 107 | //!
|
| 108 | +//! ### Wasm Build |
| 109 | +//! |
| 110 | +//! Many of the Substrate crates, such as entire `sp-*`, need to compile to both Wasm (when a Wasm |
| 111 | +//! runtime is being generated) and native (for example, when testing). To achieve this, Substrate |
| 112 | +//! follows the convention of the Rust community, and uses a `feature = "std"` to signify that a |
| 113 | +//! crate is being built with the standard library, and is built for native. Otherwise, it is built |
| 114 | +//! for `no_std`. |
| 115 | +//! |
| 116 | +//! This can be summarized in `#![cfg_attr(not(feature = "std"), no_std)]`, which you can often find |
| 117 | +//! in any Substrate-based runtime. |
| 118 | +//! |
| 119 | +//! Substrate-based runtimes use [`substrate-wasm-builder`] in their `build.rs` to automatically |
| 120 | +//! build their Wasm files as a part of normal build commandsOnce built, the wasm file is placed in |
| 121 | +//! `./target/{debug|release}/wbuild/{runtime_name}.wasm`. |
| 122 | +//! |
108 | 123 | //! ### Binaries
|
109 | 124 | //!
|
110 | 125 | //! Multiple binaries are shipped with substrate, the most important of which are located in the
|
111 | 126 | //! `./bin` folder.
|
112 | 127 | //!
|
113 | 128 | //! * [`node`] is an extensive substrate node that contains the superset of all runtime and client
|
114 | 129 | //! side features. The corresponding runtime, called [`kitchensink_runtime`] contains all of the
|
115 |
| -//! modules that are provided with `FRAME`. This node and runtime is only used for testing. |
| 130 | +//! modules that are provided with `FRAME`. This node and runtime is only used for testing and |
| 131 | +//! demonstration. |
| 132 | +//! * [`chain-spec-builder`]: Utility to build more detailed chain-specs for the aforementioned |
| 133 | +//! node. Other projects typically contain a `build-spec` subcommand that does the same. |
116 | 134 | //! * [`node-template`]: a template node that contains a minimal set of features and can act as a
|
117 | 135 | //! starting point of a project.
|
118 | 136 | //! * [`subkey`]: Substrate's key management utility.
|
119 |
| -//! * [`chain-spec-builder`]: Substrate's utility to build *chain specifications*. Such |
120 |
| -//! specifications can then be used with `--chain` argument of a typical substrate node's CLI. |
| 137 | +//! |
| 138 | +//! ### Anatomy of a Binary Crate |
| 139 | +//! |
| 140 | +//! From the above, [`node`] and [`node-template`] are essentially blueprints of a substrate-based |
| 141 | +//! project, as the name of the latter is implying. Each substrate-based project typically contains |
| 142 | +//! the following: |
| 143 | +//! |
| 144 | +//! * Under `./runtime`, a `./runtime/src/lib.rs` which is the top level runtime amalgamator file. |
| 145 | +//! This file typically contains the [`frame_support::construct_runtime`] macro, which is the |
| 146 | +//! final definition of a runtime. |
| 147 | +//! |
| 148 | +//! * Under `./node`, a `main.rs`, which is the point, and a `./service.rs`, which contains all the |
| 149 | +//! client side components. Skimming this file yields an overview of the networking, database, |
| 150 | +//! consensus and similar client side components. |
| 151 | +//! |
| 152 | +//! > The above two are conventions, not rules. |
121 | 153 | //!
|
122 | 154 | //! ## Parachain?
|
123 | 155 | //!
|
|
132 | 164 | //!
|
133 | 165 | //! Additional noteworthy crates within substrate:
|
134 | 166 | //!
|
135 |
| -//! - RPC APIs of a Substrate node: [`sc-rpc-api`] |
| 167 | +//! - RPC APIs of a Substrate node: [`sc-rpc-api`]/[`sc-rpc`] |
136 | 168 | //! - CLI Options of a Substrate node: [`sc-cli`]
|
137 | 169 | //! - All of the consensus related crates provided by Substrate:
|
138 | 170 | //! - [`sc-consensus-aura`]
|
|
151 | 183 | //!
|
152 | 184 | //! Notable upstream crates:
|
153 | 185 | //!
|
| 186 | +//! - [`parity-scale-codec`](https://github.com/paritytech/parity-scale-codec) |
154 | 187 | //! - [`parity-db`](https://github.com/paritytech/parity-db)
|
155 | 188 | //! - [`trie`](https://github.com/paritytech/trie)
|
156 | 189 | //! - [`parity-common`](https://github.com/paritytech/parity-common)
|
|
172 | 205 | //! [`sc-client-db`]: ../sc_client_db/index.html
|
173 | 206 | //! [`sc-network`]: ../sc_network/index.html
|
174 | 207 | //! [`sc-rpc-api`]: ../sc_rpc_api/index.html
|
| 208 | +//! [`sc-rpc`]: ../sc_rpc/index.html |
175 | 209 | //! [`sc-cli`]: ../sc_cli/index.html
|
176 | 210 | //! [`sc-consensus-aura`]: ../sc_consensus_aura/index.html
|
177 | 211 | //! [`sc-consensus-babe`]: ../sc_consensus_babe/index.html
|
|
182 | 216 | //! [`node`]: ../node_cli/index.html
|
183 | 217 | //! [`node-template`]: ../node_template/index.html
|
184 | 218 | //! [`kitchensink_runtime`]: ../kitchensink_runtime/index.html
|
185 |
| -//! [`subkey`]: ..//subkey/index.html |
186 |
| -//! [`chian-spec-builder`]: ../chain_spec_builder/index.html |
| 219 | +//! [`subkey`]: ../subkey/index.html |
| 220 | +//! [`chain-spec-builder`]: ../chain_spec_builder/index.html |
| 221 | +//! [`substrate-wasm-builder`]: https://crates.io/crates/substrate-wasm-builder |
187 | 222 |
|
188 | 223 | #![deny(rustdoc::broken_intra_doc_links)]
|
189 | 224 | #![deny(rustdoc::private_intra_doc_links)]
|
|
0 commit comments