mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11:09 +00:00
Markdown linter (#1309)
* Add markdown linting - add linter default rules - adapt rules to current code - fix the code for linting to pass - add CI check fix #1243 * Fix markdown for Substrate * Fix tooling install * Fix workflow * Add documentation * Remove trailing spaces * Update .github/.markdownlint.yaml Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fix mangled markdown/lists * Fix captalization issues on known words
This commit is contained in:
@@ -2,17 +2,26 @@
|
||||
|
||||
A fresh [Substrate](https://substrate.io/) node, ready for hacking :rocket:
|
||||
|
||||
A standalone version of this template is available for each release of Polkadot in the [Substrate Developer Hub Parachain Template](https://github.com/substrate-developer-hub/substrate-parachain-template/) repository.
|
||||
The parachain template is generated directly at each Polkadot release branch from the [Node Template in Substrate](https://github.com/paritytech/substrate/tree/master/bin/node-template) upstream
|
||||
A standalone version of this template is available for each release of Polkadot
|
||||
in the [Substrate Developer Hub Parachain
|
||||
Template](https://github.com/substrate-developer-hub/substrate-parachain-template/)
|
||||
repository. The parachain template is generated directly at each Polkadot
|
||||
release branch from the [Node Template in
|
||||
Substrate](https://github.com/paritytech/substrate/tree/master/bin/node-template)
|
||||
upstream
|
||||
|
||||
It is usually best to use the stand-alone version to start a new project.
|
||||
All bugs, suggestions, and feature requests should be made upstream in the [Substrate](https://github.com/paritytech/substrate/tree/master/bin/node-template) repository.
|
||||
It is usually best to use the stand-alone version to start a new project. All
|
||||
bugs, suggestions, and feature requests should be made upstream in the
|
||||
[Substrate](https://github.com/paritytech/substrate/tree/master/bin/node-template)
|
||||
repository.
|
||||
|
||||
## Getting Started
|
||||
|
||||
Depending on your operating system and Rust version, there might be additional packages required to compile this template.
|
||||
Check the [Install](https://docs.substrate.io/install/) instructions for your platform for the most common dependencies.
|
||||
Alternatively, you can use one of the [alternative installation](#alternatives-installations) options.
|
||||
Depending on your operating system and Rust version, there might be additional
|
||||
packages required to compile this template. Check the
|
||||
[Install](https://docs.substrate.io/install/) instructions for your platform for
|
||||
the most common dependencies. Alternatively, you can use one of the [alternative
|
||||
installation](#alternatives-installations) options.
|
||||
|
||||
### Build
|
||||
|
||||
@@ -24,13 +33,16 @@ cargo build --release
|
||||
|
||||
### Embedded Docs
|
||||
|
||||
After you build the project, you can use the following command to explore its parameters and subcommands:
|
||||
After you build the project, you can use the following command to explore its
|
||||
parameters and subcommands:
|
||||
|
||||
```sh
|
||||
./target/release/node-template -h
|
||||
```
|
||||
|
||||
You can generate and view the [Rust Docs](https://doc.rust-lang.org/cargo/commands/cargo-doc.html) for this template with this command:
|
||||
You can generate and view the [Rust
|
||||
Docs](https://doc.rust-lang.org/cargo/commands/cargo-doc.html) for this template
|
||||
with this command:
|
||||
|
||||
```sh
|
||||
cargo +nightly doc --open
|
||||
@@ -38,7 +50,8 @@ cargo +nightly doc --open
|
||||
|
||||
### Single-Node Development Chain
|
||||
|
||||
The following command starts a single-node development chain that doesn't persist state:
|
||||
The following command starts a single-node development chain that doesn't
|
||||
persist state:
|
||||
|
||||
```sh
|
||||
./target/release/node-template --dev
|
||||
@@ -61,10 +74,12 @@ Development chains:
|
||||
- Maintain state in a `tmp` folder while the node is running.
|
||||
- Use the **Alice** and **Bob** accounts as default validator authorities.
|
||||
- Use the **Alice** account as the default `sudo` account.
|
||||
- Are preconfigured with a genesis state (`/node/src/chain_spec.rs`) that includes several prefunded development accounts.
|
||||
- Are preconfigured with a genesis state (`/node/src/chain_spec.rs`) that
|
||||
includes several prefunded development accounts.
|
||||
|
||||
|
||||
To persist chain state between runs, specify a base path by running a command similar to the following:
|
||||
To persist chain state between runs, specify a base path by running a command
|
||||
similar to the following:
|
||||
|
||||
```sh
|
||||
// Create a folder to use as the db base path
|
||||
@@ -84,81 +99,127 @@ db keystore network
|
||||
|
||||
### Connect with Polkadot-JS Apps Front-End
|
||||
|
||||
After you start the node template locally, you can interact with it using the hosted version of the [Polkadot/Substrate Portal](https://polkadot.js.org/apps/#/explorer?rpc=ws://localhost:9944) front-end by connecting to the local node endpoint.
|
||||
A hosted version is also available on [IPFS (redirect) here](https://dotapps.io/) or [IPNS (direct) here](ipns://dotapps.io/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/explorer).
|
||||
You can also find the source code and instructions for hosting your own instance on the [polkadot-js/apps](https://github.com/polkadot-js/apps) repository.
|
||||
After you start the node template locally, you can interact with it using the
|
||||
hosted version of the [Polkadot/Substrate
|
||||
Portal](https://polkadot.js.org/apps/#/explorer?rpc=ws://localhost:9944)
|
||||
front-end by connecting to the local node endpoint. A hosted version is also
|
||||
available on [IPFS (redirect) here](https://dotapps.io/) or [IPNS (direct)
|
||||
here](ipns://dotapps.io/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/explorer). You can
|
||||
also find the source code and instructions for hosting your own instance on the
|
||||
[`polkadot-js/apps`](https://github.com/polkadot-js/apps) repository.
|
||||
|
||||
### Multi-Node Local Testnet
|
||||
|
||||
If you want to see the multi-node consensus algorithm in action, see [Simulate a network](https://docs.substrate.io/tutorials/build-a-blockchain/simulate-network/).
|
||||
If you want to see the multi-node consensus algorithm in action, see [Simulate a
|
||||
network](https://docs.substrate.io/tutorials/build-a-blockchain/simulate-network/).
|
||||
|
||||
## Template Structure
|
||||
|
||||
A Substrate project such as this consists of a number of components that are spread across a few directories.
|
||||
A Substrate project such as this consists of a number of components that are
|
||||
spread across a few directories.
|
||||
|
||||
### Node
|
||||
|
||||
A blockchain node is an application that allows users to participate in a blockchain network.
|
||||
Substrate-based blockchain nodes expose a number of capabilities:
|
||||
A blockchain node is an application that allows users to participate in a
|
||||
blockchain network. Substrate-based blockchain nodes expose a number of
|
||||
capabilities:
|
||||
|
||||
- Networking: Substrate nodes use the [`libp2p`](https://libp2p.io/) networking stack to allow the
|
||||
nodes in the network to communicate with one another.
|
||||
- Consensus: Blockchains must have a way to come to [consensus](https://docs.substrate.io/fundamentals/consensus/) on the state of the network.
|
||||
Substrate makes it possible to supply custom consensus engines and also ships with several consensus mechanisms that have been built on top of [Web3 Foundation research](https://research.web3.foundation/en/latest/polkadot/NPoS/index.html).
|
||||
- RPC Server: A remote procedure call (RPC) server is used to interact with Substrate nodes.
|
||||
- Networking: Substrate nodes use the [`libp2p`](https://libp2p.io/) networking
|
||||
stack to allow the nodes in the network to communicate with one another.
|
||||
- Consensus: Blockchains must have a way to come to
|
||||
[consensus](https://docs.substrate.io/fundamentals/consensus/) on the state of
|
||||
the network. Substrate makes it possible to supply custom consensus engines
|
||||
and also ships with several consensus mechanisms that have been built on top
|
||||
of [Web3 Foundation
|
||||
research](https://research.web3.foundation/en/latest/polkadot/NPoS/index.html).
|
||||
- RPC Server: A remote procedure call (RPC) server is used to interact with
|
||||
Substrate nodes.
|
||||
|
||||
There are several files in the `node` directory.
|
||||
Take special note of the following:
|
||||
|
||||
- [`chain_spec.rs`](./node/src/chain_spec.rs): A [chain specification](https://docs.substrate.io/build/chain-spec/) is a source code file that defines a Substrate chain's initial (genesis) state.
|
||||
Chain specifications are useful for development and testing, and critical when architecting the launch of a production chain.
|
||||
Take note of the `development_config` and `testnet_genesis` functions,.
|
||||
These functions are used to define the genesis state for the local development chain configuration.
|
||||
These functions identify some [well-known accounts](https://docs.substrate.io/reference/command-line-tools/subkey/) and use them to configure the blockchain's initial state.
|
||||
- [`service.rs`](./node/src/service.rs): This file defines the node implementation.
|
||||
Take note of the libraries that this file imports and the names of the functions it invokes.
|
||||
In particular, there are references to consensus-related topics, such as the [block finalization and forks](https://docs.substrate.io/fundamentals/consensus/#finalization-and-forks) and other [consensus mechanisms](https://docs.substrate.io/fundamentals/consensus/#default-consensus-models) such as Aura for block authoring and GRANDPA for finality.
|
||||
There are several files in the `node` directory. Take special note of the
|
||||
following:
|
||||
|
||||
- [`chain_spec.rs`](./node/src/chain_spec.rs): A [chain
|
||||
specification](https://docs.substrate.io/build/chain-spec/) is a source code
|
||||
file that defines a Substrate chain's initial (genesis) state. Chain
|
||||
specifications are useful for development and testing, and critical when
|
||||
architecting the launch of a production chain. Take note of the
|
||||
`development_config` and `testnet_genesis` functions,. These functions are
|
||||
used to define the genesis state for the local development chain
|
||||
configuration. These functions identify some [well-known
|
||||
accounts](https://docs.substrate.io/reference/command-line-tools/subkey/) and
|
||||
use them to configure the blockchain's initial state.
|
||||
- [`service.rs`](./node/src/service.rs): This file defines the node
|
||||
implementation. Take note of the libraries that this file imports and the
|
||||
names of the functions it invokes. In particular, there are references to
|
||||
consensus-related topics, such as the [block finalization and
|
||||
forks](https://docs.substrate.io/fundamentals/consensus/#finalization-and-forks)
|
||||
and other [consensus
|
||||
mechanisms](https://docs.substrate.io/fundamentals/consensus/#default-consensus-models)
|
||||
such as Aura for block authoring and GRANDPA for finality.
|
||||
|
||||
|
||||
### Runtime
|
||||
|
||||
In Substrate, the terms "runtime" and "state transition function" are analogous.
|
||||
Both terms refer to the core logic of the blockchain that is responsible for validating blocks and executing the state changes they define.
|
||||
The Substrate project in this repository uses [FRAME](https://docs.substrate.io/learn/runtime-development/#frame) to construct a blockchain runtime.
|
||||
FRAME allows runtime developers to declare domain-specific logic in modules called "pallets".
|
||||
At the heart of FRAME is a helpful [macro language](https://docs.substrate.io/reference/frame-macros/) that makes it easy to create pallets and flexibly compose them to create blockchains that can address [a variety of needs](https://substrate.io/ecosystem/projects/).
|
||||
Both terms refer to the core logic of the blockchain that is responsible for
|
||||
validating blocks and executing the state changes they define. The Substrate
|
||||
project in this repository uses
|
||||
[FRAME](https://docs.substrate.io/learn/runtime-development/#frame) to construct
|
||||
a blockchain runtime. FRAME allows runtime developers to declare domain-specific
|
||||
logic in modules called "pallets". At the heart of FRAME is a helpful [macro
|
||||
language](https://docs.substrate.io/reference/frame-macros/) that makes it easy
|
||||
to create pallets and flexibly compose them to create blockchains that can
|
||||
address [a variety of needs](https://substrate.io/ecosystem/projects/).
|
||||
|
||||
Review the [FRAME runtime implementation](./runtime/src/lib.rs) included in this template and note the following:
|
||||
Review the [FRAME runtime implementation](./runtime/src/lib.rs) included in this
|
||||
template and note the following:
|
||||
|
||||
- This file configures several pallets to include in the runtime.
|
||||
Each pallet configuration is defined by a code block that begins with `impl $PALLET_NAME::Config for Runtime`.
|
||||
- The pallets are composed into a single runtime by way of the [`construct_runtime!`](https://paritytech.github.io/substrate/master/frame_support/macro.construct_runtime.html) macro, which is part of the [core FRAME pallet library](https://docs.substrate.io/reference/frame-pallets/#system-pallets).
|
||||
- This file configures several pallets to include in the runtime. Each pallet
|
||||
configuration is defined by a code block that begins with `impl
|
||||
$PALLET_NAME::Config for Runtime`.
|
||||
- The pallets are composed into a single runtime by way of the
|
||||
[`construct_runtime!`](https://paritytech.github.io/substrate/master/frame_support/macro.construct_runtime.html)
|
||||
macro, which is part of the [core FRAME pallet
|
||||
library](https://docs.substrate.io/reference/frame-pallets/#system-pallets).
|
||||
|
||||
### Pallets
|
||||
|
||||
The runtime in this project is constructed using many FRAME pallets that ship with [the Substrate repository](https://github.com/paritytech/substrate/tree/master/frame) and a template pallet that is [defined in the `pallets`](./pallets/template/src/lib.rs) directory.
|
||||
The runtime in this project is constructed using many FRAME pallets that ship
|
||||
with [the Substrate
|
||||
repository](https://github.com/paritytech/substrate/tree/master/frame) and a
|
||||
template pallet that is [defined in the
|
||||
`pallets`](./pallets/template/src/lib.rs) directory.
|
||||
|
||||
A FRAME pallet is comprised of a number of blockchain primitives, including:
|
||||
|
||||
- Storage: FRAME defines a rich set of powerful [storage abstractions](https://docs.substrate.io/build/runtime-storage/) that makes it easy to use Substrate's efficient key-value database to manage the evolving state of a blockchain.
|
||||
- Dispatchables: FRAME pallets define special types of functions that can be invoked (dispatched) from outside of the runtime in order to update its state.
|
||||
- Events: Substrate uses [events](https://docs.substrate.io/build/events-and-errors/) to notify users of significant state changes.
|
||||
- Storage: FRAME defines a rich set of powerful [storage
|
||||
abstractions](https://docs.substrate.io/build/runtime-storage/) that makes it
|
||||
easy to use Substrate's efficient key-value database to manage the evolving
|
||||
state of a blockchain.
|
||||
- Dispatchables: FRAME pallets define special types of functions that can be
|
||||
invoked (dispatched) from outside of the runtime in order to update its state.
|
||||
- Events: Substrate uses
|
||||
[events](https://docs.substrate.io/build/events-and-errors/) to notify users
|
||||
of significant state changes.
|
||||
- Errors: When a dispatchable fails, it returns an error.
|
||||
|
||||
Each pallet has its own `Config` trait which serves as a configuration interface to generically define the types and parameters it depends on.
|
||||
Each pallet has its own `Config` trait which serves as a configuration interface
|
||||
to generically define the types and parameters it depends on.
|
||||
|
||||
## Alternatives Installations
|
||||
|
||||
Instead of installing dependencies and building this source directly, consider the following alternatives.
|
||||
Instead of installing dependencies and building this source directly, consider
|
||||
the following alternatives.
|
||||
|
||||
### Nix
|
||||
|
||||
Install [nix](https://nixos.org/) and
|
||||
[nix-direnv](https://github.com/nix-community/nix-direnv) for a fully plug-and-play
|
||||
experience for setting up the development environment.
|
||||
To get all the correct dependencies, activate direnv `direnv allow`.
|
||||
[nix-direnv](https://github.com/nix-community/nix-direnv) for a fully
|
||||
plug-and-play experience for setting up the development environment. To get all
|
||||
the correct dependencies, activate direnv `direnv allow`.
|
||||
|
||||
### Docker
|
||||
|
||||
Please follow the [Substrate Docker instructions here](https://github.com/paritytech/substrate/blob/master/docker/README.md) to build the Docker container with the Substrate Node Template binary.
|
||||
Please follow the [Substrate Docker instructions
|
||||
here](https://github.com/paritytech/substrate/blob/master/docker/README.md) to
|
||||
build the Docker container with the Substrate Node Template binary.
|
||||
|
||||
@@ -1,22 +1,18 @@
|
||||
---
|
||||
title: Installation
|
||||
---
|
||||
# Installation
|
||||
|
||||
This guide is for reference only, please check the latest information on getting started with Substrate
|
||||
[here](https://docs.substrate.io/main-docs/install/).
|
||||
This guide is for reference only, please check the latest information on getting started with Substrate [here](https://docs.substrate.io/main-docs/install/).
|
||||
|
||||
This page will guide you through the **2 steps** needed to prepare a computer for **Substrate** development.
|
||||
Since Substrate is built with [the Rust programming language](https://www.rust-lang.org/), the first
|
||||
thing you will need to do is prepare the computer for Rust development - these steps will vary based
|
||||
on the computer's operating system. Once Rust is configured, you will use its toolchains to interact
|
||||
with Rust projects; the commands for Rust's toolchains will be the same for all supported,
|
||||
Unix-based operating systems.
|
||||
This page will guide you through the **2 steps** needed to prepare a computer for **Substrate** development. Since
|
||||
Substrate is built with [the Rust programming language](https://www.rust-lang.org/), the first thing you will need to do
|
||||
is prepare the computer for Rust development - these steps will vary based on the computer's operating system. Once Rust
|
||||
is configured, you will use its toolchains to interact with Rust projects; the commands for Rust's toolchains will be
|
||||
the same for all supported, Unix-based operating systems.
|
||||
|
||||
## Build dependencies
|
||||
|
||||
Substrate development is easiest on Unix-based operating systems like macOS or Linux. The examples
|
||||
in the [Substrate Docs](https://docs.substrate.io) use Unix-style terminals to demonstrate how to
|
||||
interact with Substrate from the command line.
|
||||
Substrate development is easiest on Unix-based operating systems like macOS or Linux. The examples in the [Substrate
|
||||
Docs](https://docs.substrate.io) use Unix-style terminals to demonstrate how to interact with Substrate from the command
|
||||
line.
|
||||
|
||||
### Ubuntu/Debian
|
||||
|
||||
@@ -55,10 +51,9 @@ sudo zypper install clang curl git openssl-devel llvm-devel libudev-devel
|
||||
|
||||
### macOS
|
||||
|
||||
> **Apple M1 ARM**
|
||||
> If you have an Apple M1 ARM system on a chip, make sure that you have Apple Rosetta 2
|
||||
> installed through `softwareupdate --install-rosetta`. This is only needed to run the
|
||||
> `protoc` tool during the build. The build itself and the target binaries would remain native.
|
||||
> **Apple M1 ARM** If you have an Apple M1 ARM system on a chip, make sure that you have Apple Rosetta 2 installed
|
||||
> through `softwareupdate --install-rosetta`. This is only needed to run the `protoc` tool during the build. The build
|
||||
> itself and the target binaries would remain native.
|
||||
|
||||
Open the Terminal application and execute the following commands:
|
||||
|
||||
@@ -81,8 +76,8 @@ Please refer to the separate
|
||||
|
||||
## Rust developer environment
|
||||
|
||||
This guide uses <https://rustup.rs> installer and the `rustup` tool to manage the Rust toolchain.
|
||||
First install and configure `rustup`:
|
||||
This guide uses <https://rustup.rs> installer and the `rustup` tool to manage the Rust toolchain. First install and
|
||||
configure `rustup`:
|
||||
|
||||
```bash
|
||||
# Install
|
||||
@@ -102,13 +97,13 @@ rustup target add wasm32-unknown-unknown --toolchain nightly
|
||||
|
||||
## Test your set-up
|
||||
|
||||
Now the best way to ensure that you have successfully prepared a computer for Substrate
|
||||
development is to follow the steps in [our first Substrate tutorial](https://docs.substrate.io/tutorials/v3/create-your-first-substrate-chain/).
|
||||
Now the best way to ensure that you have successfully prepared a computer for Substrate development is to follow the
|
||||
steps in [our first Substrate tutorial](https://docs.substrate.io/tutorials/v3/create-your-first-substrate-chain/).
|
||||
|
||||
## Troubleshooting Substrate builds
|
||||
|
||||
Sometimes you can't get the Substrate node template
|
||||
to compile out of the box. Here are some tips to help you work through that.
|
||||
Sometimes you can't get the Substrate node template to compile out of the box. Here are some tips to help you work
|
||||
through that.
|
||||
|
||||
### Rust configuration check
|
||||
|
||||
@@ -144,27 +139,27 @@ stable-x86_64-unknown-linux-gnu (default)
|
||||
rustc 1.50.0 (cb75ad5db 2021-02-10)
|
||||
```
|
||||
|
||||
As you can see above, the default toolchain is stable, and the
|
||||
`nightly-x86_64-unknown-linux-gnu` toolchain as well as its `wasm32-unknown-unknown` target is installed.
|
||||
You also see that `nightly-2020-10-06-x86_64-unknown-linux-gnu` is installed, but is not used unless explicitly defined as illustrated in the [specify your nightly version](#specifying-nightly-version)
|
||||
section.
|
||||
As you can see above, the default toolchain is stable, and the `nightly-x86_64-unknown-linux-gnu` toolchain as well as
|
||||
its `wasm32-unknown-unknown` target is installed. You also see that `nightly-2020-10-06-x86_64-unknown-linux-gnu` is
|
||||
installed, but is not used unless explicitly defined as illustrated in the [specify your nightly
|
||||
version](#specifying-nightly-version) section.
|
||||
|
||||
### WebAssembly compilation
|
||||
|
||||
Substrate uses [WebAssembly](https://webassembly.org) (Wasm) to produce portable blockchain
|
||||
runtimes. You will need to configure your Rust compiler to use
|
||||
[`nightly` builds](https://doc.rust-lang.org/book/appendix-07-nightly-rust.html) to allow you to
|
||||
compile Substrate runtime code to the Wasm target.
|
||||
Substrate uses [WebAssembly](https://webassembly.org) (Wasm) to produce portable blockchain runtimes. You will need to
|
||||
configure your Rust compiler to use [`nightly` builds](https://doc.rust-lang.org/book/appendix-07-nightly-rust.html) to
|
||||
allow you to compile Substrate runtime code to the Wasm target.
|
||||
|
||||
> There are upstream issues in Rust that need to be resolved before all of Substrate can use the stable Rust toolchain.
|
||||
> [This is our tracking issue](https://github.com/paritytech/substrate/issues/1252) if you're curious as to why and how this will be resolved.
|
||||
> [This is our tracking issue](https://github.com/paritytech/substrate/issues/1252) if you're curious as to why and how
|
||||
> this will be resolved.
|
||||
|
||||
#### Latest nightly for Substrate `master`
|
||||
|
||||
Developers who are building Substrate _itself_ should always use the latest bug-free versions of
|
||||
Rust stable and nightly. This is because the Substrate codebase follows the tip of Rust nightly,
|
||||
which means that changes in Substrate often depend on upstream changes in the Rust nightly compiler.
|
||||
To ensure your Rust compiler is always up to date, you should run:
|
||||
Developers who are building Substrate _itself_ should always use the latest bug-free versions of Rust stable and
|
||||
nightly. This is because the Substrate codebase follows the tip of Rust nightly, which means that changes in Substrate
|
||||
often depend on upstream changes in the Rust nightly compiler. To ensure your Rust compiler is always up to date, you
|
||||
should run:
|
||||
|
||||
```bash
|
||||
rustup update
|
||||
@@ -172,21 +167,19 @@ rustup update nightly
|
||||
rustup target add wasm32-unknown-unknown --toolchain nightly
|
||||
```
|
||||
|
||||
> NOTE: It may be necessary to occasionally rerun `rustup update` if a change in the upstream Substrate
|
||||
> codebase depends on a new feature of the Rust compiler. When you do this, both your nightly
|
||||
> and stable toolchains will be pulled to the most recent release, and for nightly, it is
|
||||
> generally _not_ expected to compile WASM without error (although it very often does).
|
||||
> Be sure to [specify your nightly version](#specifying-nightly-version) if you get WASM build errors
|
||||
> from `rustup` and [downgrade nightly as needed](#downgrading-rust-nightly).
|
||||
> NOTE: It may be necessary to occasionally rerun `rustup update` if a change in the upstream Substrate codebase depends
|
||||
> on a new feature of the Rust compiler. When you do this, both your nightly and stable toolchains will be pulled to the
|
||||
> most recent release, and for nightly, it is generally _not_ expected to compile WASM without error (although it very
|
||||
> often does). Be sure to [specify your nightly version](#specifying-nightly-version) if you get WASM build errors from
|
||||
> `rustup` and [downgrade nightly as needed](#downgrading-rust-nightly).
|
||||
|
||||
#### Rust nightly toolchain
|
||||
|
||||
If you want to guarantee that your build works on your computer as you update Rust and other
|
||||
dependencies, you should use a specific Rust nightly version that is known to be
|
||||
compatible with the version of Substrate they are using; this version will vary from project to
|
||||
project and different projects may use different mechanisms to communicate this version to
|
||||
developers. For instance, the Polkadot client specifies this information in its
|
||||
[release notes](https://github.com/paritytech/polkadot/releases).
|
||||
If you want to guarantee that your build works on your computer as you update Rust and other dependencies, you should
|
||||
use a specific Rust nightly version that is known to be compatible with the version of Substrate they are using; this
|
||||
version will vary from project to project and different projects may use different mechanisms to communicate this
|
||||
version to developers. For instance, the Polkadot client specifies this information in its [release
|
||||
notes](https://github.com/paritytech/polkadot/releases).
|
||||
|
||||
```bash
|
||||
# Specify the specific nightly toolchain in the date below:
|
||||
@@ -203,20 +196,20 @@ rustup target add wasm32-unknown-unknown --toolchain nightly-<yyyy-MM-dd>
|
||||
|
||||
### Specifying nightly version
|
||||
|
||||
Use the `WASM_BUILD_TOOLCHAIN` environment variable to specify the Rust nightly version a Substrate
|
||||
project should use for Wasm compilation:
|
||||
Use the `WASM_BUILD_TOOLCHAIN` environment variable to specify the Rust nightly version a Substrate project should use
|
||||
for Wasm compilation:
|
||||
|
||||
```bash
|
||||
WASM_BUILD_TOOLCHAIN=nightly-<yyyy-MM-dd> cargo build --release
|
||||
```
|
||||
|
||||
> Note that this only builds _the runtime_ with the specified nightly. The rest of project will be
|
||||
> compiled with **your default toolchain**, i.e. the latest installed stable toolchain.
|
||||
> Note that this only builds _the runtime_ with the specified nightly. The rest of project will be compiled with **your
|
||||
> default toolchain**, i.e. the latest installed stable toolchain.
|
||||
|
||||
### Downgrading Rust nightly
|
||||
|
||||
If your computer is configured to use the latest Rust nightly and you would like to downgrade to a
|
||||
specific nightly version, follow these steps:
|
||||
If your computer is configured to use the latest Rust nightly and you would like to downgrade to a specific nightly
|
||||
version, follow these steps:
|
||||
|
||||
```bash
|
||||
rustup uninstall nightly
|
||||
|
||||
@@ -1 +1 @@
|
||||
License: MIT-0
|
||||
License: MIT-0
|
||||
|
||||
Reference in New Issue
Block a user