update to polkadot-v.0.9.17 (#313)
parent
0fa941470d
commit
54163b0205
File diff suppressed because it is too large
Load Diff
|
@ -78,12 +78,12 @@ RUST_BACKTRACE=1 ./target/release/node-template -ldebug --dev
|
||||||
> [genesis state](https://github.com/substrate-developer-hub/substrate-node-template/blob/main/node/src/chain_spec.rs#L49).
|
> [genesis state](https://github.com/substrate-developer-hub/substrate-node-template/blob/main/node/src/chain_spec.rs#L49).
|
||||||
> At the same time the following accounts will be pre-funded:
|
> At the same time the following accounts will be pre-funded:
|
||||||
> - Alice
|
> - Alice
|
||||||
> - Bob
|
> - Bob
|
||||||
> - Alice//stash
|
> - Alice//stash
|
||||||
> - Bob//stash
|
> - Bob//stash
|
||||||
|
|
||||||
In case of being interested in maintaining the chain' state between runs a base path must be added
|
In case of being interested in maintaining the chain' state between runs a base path must be added
|
||||||
so the db can be stored in the provided folder instead of a temporal one. We could use this folder
|
so the db can be stored in the provided folder instead of a temporal one. We could use this folder
|
||||||
to store different chain databases, as a different folder will be created per different chain that
|
to store different chain databases, as a different folder will be created per different chain that
|
||||||
is ran. The following commands shows how to use a newly created folder as our db base path.
|
is ran. The following commands shows how to use a newly created folder as our db base path.
|
||||||
|
|
||||||
|
|
|
@ -2,32 +2,21 @@
|
||||||
title: Installation
|
title: Installation
|
||||||
---
|
---
|
||||||
|
|
||||||
This page will guide you through the steps needed to prepare a computer for development with the
|
This guide is for reference only, please check the latest information on getting starting with Substrate
|
||||||
Substrate Node Template. Since Substrate is built with
|
[here](https://docs.substrate.io/v3/getting-started/installation/).
|
||||||
[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.
|
|
||||||
|
|
||||||
## 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
|
Substrate development is easiest on Unix-based operating systems like macOS or Linux. The examples
|
||||||
in the Substrate [Tutorials](https://docs.substrate.io/tutorials/v3) and
|
in the [Substrate Docs](https://docs.substrate.io) use Unix-style terminals to demonstrate how to
|
||||||
[How-to Guides](https://docs.substrate.io/how-to-guides/v3) use Unix-style terminals to demonstrate
|
interact with Substrate from the command line.
|
||||||
how to interact with Substrate from the command line.
|
|
||||||
|
|
||||||
### macOS
|
|
||||||
|
|
||||||
Open the Terminal application and execute the following commands:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Install Homebrew if necessary https://brew.sh/
|
|
||||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
|
|
||||||
|
|
||||||
# Make sure Homebrew is up-to-date, install openssl and cmake
|
|
||||||
brew update
|
|
||||||
brew install openssl cmake
|
|
||||||
```
|
|
||||||
|
|
||||||
### Ubuntu/Debian
|
### Ubuntu/Debian
|
||||||
|
|
||||||
|
@ -36,7 +25,7 @@ Use a terminal shell to execute the following commands:
|
||||||
```bash
|
```bash
|
||||||
sudo apt update
|
sudo apt update
|
||||||
# May prompt for location information
|
# May prompt for location information
|
||||||
sudo apt install -y cmake pkg-config libssl-dev git build-essential clang libclang-dev curl
|
sudo apt install -y git clang curl libssl-dev llvm libudev-dev
|
||||||
```
|
```
|
||||||
|
|
||||||
### Arch Linux
|
### Arch Linux
|
||||||
|
@ -44,39 +33,193 @@ sudo apt install -y cmake pkg-config libssl-dev git build-essential clang libcla
|
||||||
Run these commands from a terminal:
|
Run these commands from a terminal:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pacman -Syu --needed --noconfirm cmake gcc openssl-1.0 pkgconf git clang
|
pacman -Syu --needed --noconfirm curl git clang
|
||||||
export OPENSSL_LIB_DIR="/usr/lib/openssl-1.0"
|
|
||||||
export OPENSSL_INCLUDE_DIR="/usr/include/openssl-1.0"
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Fedora/RHEL/CentOS
|
### Fedora
|
||||||
|
|
||||||
Use a terminal to run the following commands:
|
Run these commands from a terminal:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Update
|
|
||||||
sudo dnf update
|
sudo dnf update
|
||||||
# Install packages
|
sudo dnf install clang curl git openssl-devel
|
||||||
sudo dnf install cmake pkgconfig rocksdb rocksdb-devel llvm git libcurl libcurl-devel curl-devel clang
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Rust Developer Environment
|
### OpenSUSE
|
||||||
|
|
||||||
This project uses [`rustup`](https://rustup.rs/) to help manage the Rust toolchain. First install
|
Run these commands from a terminal:
|
||||||
and configure `rustup`:
|
|
||||||
|
```bash
|
||||||
|
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.
|
||||||
|
|
||||||
|
Open the Terminal application and execute the following commands:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Install Homebrew if necessary https://brew.sh/
|
||||||
|
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
|
||||||
|
|
||||||
|
# Make sure Homebrew is up-to-date, install openssl
|
||||||
|
brew update
|
||||||
|
brew install openssl
|
||||||
|
```
|
||||||
|
|
||||||
|
### Windows
|
||||||
|
|
||||||
|
**_PLEASE NOTE:_** Native development of Substrate is _not_ very well supported! It is _highly_
|
||||||
|
recommend to use [Windows Subsystem Linux](https://docs.microsoft.com/en-us/windows/wsl/install-win10)
|
||||||
|
(WSL) and follow the instructions for [Ubuntu/Debian](#ubuntudebian).
|
||||||
|
Please refer to the separate
|
||||||
|
[guide for native Windows development](https://docs.substrate.io/v3/getting-started/windows-users/).
|
||||||
|
|
||||||
|
## Rust developer environment
|
||||||
|
|
||||||
|
This guide uses <https://rustup.rs> installer and the `rustup` tool to manage the Rust toolchain.
|
||||||
|
First install and configure `rustup`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Install
|
# Install
|
||||||
curl https://sh.rustup.rs -sSf | sh
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
||||||
# Configure
|
# Configure
|
||||||
source ~/.cargo/env
|
source ~/.cargo/env
|
||||||
```
|
```
|
||||||
|
|
||||||
Finally, configure the Rust toolchain:
|
Configure the Rust toolchain to default to the latest stable version, add nightly and the nightly wasm target:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
rustup default stable
|
rustup default stable
|
||||||
|
rustup update
|
||||||
rustup update nightly
|
rustup update nightly
|
||||||
rustup update stable
|
|
||||||
rustup target add wasm32-unknown-unknown --toolchain nightly
|
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/).
|
||||||
|
|
||||||
|
## 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.
|
||||||
|
|
||||||
|
### Rust configuration check
|
||||||
|
|
||||||
|
To see what Rust toolchain you are presently using, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
rustup show
|
||||||
|
```
|
||||||
|
|
||||||
|
This will show something like this (Ubuntu example) output:
|
||||||
|
|
||||||
|
```text
|
||||||
|
Default host: x86_64-unknown-linux-gnu
|
||||||
|
rustup home: /home/user/.rustup
|
||||||
|
|
||||||
|
installed toolchains
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
stable-x86_64-unknown-linux-gnu (default)
|
||||||
|
nightly-2020-10-06-x86_64-unknown-linux-gnu
|
||||||
|
nightly-x86_64-unknown-linux-gnu
|
||||||
|
|
||||||
|
installed targets for active toolchain
|
||||||
|
--------------------------------------
|
||||||
|
|
||||||
|
wasm32-unknown-unknown
|
||||||
|
x86_64-unknown-linux-gnu
|
||||||
|
|
||||||
|
active toolchain
|
||||||
|
----------------
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
### 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.
|
||||||
|
|
||||||
|
> 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.
|
||||||
|
|
||||||
|
#### 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:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
rustup update
|
||||||
|
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).
|
||||||
|
|
||||||
|
#### 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).
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Specify the specific nightly toolchain in the date below:
|
||||||
|
rustup install nightly-<yyyy-MM-dd>
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Wasm toolchain
|
||||||
|
|
||||||
|
Now, configure the nightly version to work with the Wasm compilation target:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
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:
|
||||||
|
|
||||||
|
```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.
|
||||||
|
|
||||||
|
### 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:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
rustup uninstall nightly
|
||||||
|
rustup install nightly-<yyyy-MM-dd>
|
||||||
|
rustup target add wasm32-unknown-unknown --toolchain nightly-<yyyy-MM-dd>
|
||||||
|
```
|
||||||
|
|
|
@ -17,10 +17,10 @@ targets = ["x86_64-unknown-linux-gnu"]
|
||||||
name = "node-template"
|
name = "node-template"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
structopt = "0.3.25"
|
clap = { version = "3.0", features = ["derive"] }
|
||||||
|
|
||||||
sc-cli = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
sc-cli = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest", features = ["wasmtime"] }
|
||||||
sp-core = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
sp-core = { version = "5.0.0", git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
||||||
sc-executor = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
sc-executor = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
||||||
sc-service = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
sc-service = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
||||||
sc-telemetry = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
sc-telemetry = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
||||||
|
@ -34,7 +34,7 @@ sc-consensus = { version = "0.10.0-dev", git = "https://github.com/paritytech/su
|
||||||
sc-finality-grandpa = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
sc-finality-grandpa = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
||||||
sp-finality-grandpa = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
sp-finality-grandpa = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
||||||
sc-client-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
sc-client-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
||||||
sp-runtime = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
sp-runtime = { version = "5.0.0", git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
||||||
sp-timestamp = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
sp-timestamp = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
||||||
|
|
||||||
# These dependencies are used for the node template's RPCs
|
# These dependencies are used for the node template's RPCs
|
||||||
|
@ -60,6 +60,4 @@ substrate-build-script-utils = { version = "3.0.0", git = "https://github.com/pa
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
runtime-benchmarks = [
|
runtime-benchmarks = ["node-template-runtime/runtime-benchmarks"]
|
||||||
"node-template-runtime/runtime-benchmarks",
|
|
||||||
]
|
|
||||||
|
|
|
@ -68,6 +68,7 @@ pub fn development_config() -> Result<ChainSpec, String> {
|
||||||
None,
|
None,
|
||||||
// Protocol ID
|
// Protocol ID
|
||||||
None,
|
None,
|
||||||
|
None,
|
||||||
// Properties
|
// Properties
|
||||||
None,
|
None,
|
||||||
// Extensions
|
// Extensions
|
||||||
|
@ -117,6 +118,7 @@ pub fn local_testnet_config() -> Result<ChainSpec, String> {
|
||||||
None,
|
None,
|
||||||
// Properties
|
// Properties
|
||||||
None,
|
None,
|
||||||
|
None,
|
||||||
// Extensions
|
// Extensions
|
||||||
None,
|
None,
|
||||||
))
|
))
|
||||||
|
@ -147,7 +149,7 @@ fn testnet_genesis(
|
||||||
},
|
},
|
||||||
sudo: SudoConfig {
|
sudo: SudoConfig {
|
||||||
// Assign network admin rights.
|
// Assign network admin rights.
|
||||||
key: root_key,
|
key: Some(root_key),
|
||||||
},
|
},
|
||||||
transaction_payment: Default::default(),
|
transaction_payment: Default::default(),
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,20 @@
|
||||||
use sc_cli::RunCmd;
|
use sc_cli::RunCmd;
|
||||||
use structopt::StructOpt;
|
|
||||||
|
|
||||||
#[derive(Debug, StructOpt)]
|
#[derive(Debug, clap::Parser)]
|
||||||
pub struct Cli {
|
pub struct Cli {
|
||||||
#[structopt(subcommand)]
|
#[clap(subcommand)]
|
||||||
pub subcommand: Option<Subcommand>,
|
pub subcommand: Option<Subcommand>,
|
||||||
|
|
||||||
#[structopt(flatten)]
|
#[clap(flatten)]
|
||||||
pub run: RunCmd,
|
pub run: RunCmd,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, StructOpt)]
|
#[derive(Debug, clap::Subcommand)]
|
||||||
pub enum Subcommand {
|
pub enum Subcommand {
|
||||||
/// Key management cli utilities
|
/// Key management cli utilities
|
||||||
|
#[clap(subcommand)]
|
||||||
Key(sc_cli::KeySubcommand),
|
Key(sc_cli::KeySubcommand),
|
||||||
|
|
||||||
/// Build a chain specification.
|
/// Build a chain specification.
|
||||||
BuildSpec(sc_cli::BuildSpecCmd),
|
BuildSpec(sc_cli::BuildSpecCmd),
|
||||||
|
|
||||||
|
@ -36,6 +37,6 @@ pub enum Subcommand {
|
||||||
Revert(sc_cli::RevertCmd),
|
Revert(sc_cli::RevertCmd),
|
||||||
|
|
||||||
/// The custom benchmark subcommand benchmarking runtime pallets.
|
/// The custom benchmark subcommand benchmarking runtime pallets.
|
||||||
#[structopt(name = "benchmark", about = "Benchmark runtime pallets.")]
|
#[clap(name = "benchmark", about = "Benchmark runtime pallets.")]
|
||||||
Benchmark(frame_benchmarking_cli::BenchmarkCmd),
|
Benchmark(frame_benchmarking_cli::BenchmarkCmd),
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//! Service and ServiceFactory implementation. Specialized wrapper over substrate service.
|
//! Service and ServiceFactory implementation. Specialized wrapper over substrate service.
|
||||||
|
|
||||||
use node_template_runtime::{self, opaque::Block, RuntimeApi};
|
use node_template_runtime::{self, opaque::Block, RuntimeApi};
|
||||||
use sc_client_api::ExecutorProvider;
|
use sc_client_api::{BlockBackend, ExecutorProvider};
|
||||||
use sc_consensus_aura::{ImportQueueParams, SlotProportion, StartAuraParams};
|
use sc_consensus_aura::{ImportQueueParams, SlotProportion, StartAuraParams};
|
||||||
pub use sc_executor::NativeElseWasmExecutor;
|
pub use sc_executor::NativeElseWasmExecutor;
|
||||||
use sc_finality_grandpa::SharedVoterState;
|
use sc_finality_grandpa::SharedVoterState;
|
||||||
|
@ -60,7 +60,7 @@ pub fn new_partial(
|
||||||
ServiceError,
|
ServiceError,
|
||||||
> {
|
> {
|
||||||
if config.keystore_remote.is_some() {
|
if config.keystore_remote.is_some() {
|
||||||
return Err(ServiceError::Other(format!("Remote Keystores are not supported.")))
|
return Err(ServiceError::Other("Remote Keystores are not supported.".into()))
|
||||||
}
|
}
|
||||||
|
|
||||||
let telemetry = config
|
let telemetry = config
|
||||||
|
@ -78,6 +78,7 @@ pub fn new_partial(
|
||||||
config.wasm_method,
|
config.wasm_method,
|
||||||
config.default_heap_pages,
|
config.default_heap_pages,
|
||||||
config.max_runtime_instances,
|
config.max_runtime_instances,
|
||||||
|
config.runtime_cache_size,
|
||||||
);
|
);
|
||||||
|
|
||||||
let (client, backend, keystore_container, task_manager) =
|
let (client, backend, keystore_container, task_manager) =
|
||||||
|
@ -179,8 +180,15 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
||||||
))),
|
))),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
let grandpa_protocol_name = sc_finality_grandpa::protocol_standard_name(
|
||||||
|
&client.block_hash(0).ok().flatten().expect("Genesis block exists; qed"),
|
||||||
|
&config.chain_spec,
|
||||||
|
);
|
||||||
|
|
||||||
config.network.extra_sets.push(sc_finality_grandpa::grandpa_peers_set_config());
|
config
|
||||||
|
.network
|
||||||
|
.extra_sets
|
||||||
|
.push(sc_finality_grandpa::grandpa_peers_set_config(grandpa_protocol_name.clone()));
|
||||||
let warp_sync = Arc::new(sc_finality_grandpa::warp_proof::NetworkProvider::new(
|
let warp_sync = Arc::new(sc_finality_grandpa::warp_proof::NetworkProvider::new(
|
||||||
backend.clone(),
|
backend.clone(),
|
||||||
grandpa_link.shared_authority_set().clone(),
|
grandpa_link.shared_authority_set().clone(),
|
||||||
|
@ -305,6 +313,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
||||||
keystore,
|
keystore,
|
||||||
local_role: role,
|
local_role: role,
|
||||||
telemetry: telemetry.as_ref().map(|x| x.handle()),
|
telemetry: telemetry.as_ref().map(|x| x.handle()),
|
||||||
|
protocol_name: grandpa_protocol_name,
|
||||||
};
|
};
|
||||||
|
|
||||||
if enable_grandpa {
|
if enable_grandpa {
|
||||||
|
|
|
@ -22,9 +22,9 @@ frame-system = { default-features = false, version = "4.0.0-dev", git = "https:/
|
||||||
frame-benchmarking = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest", optional = true }
|
frame-benchmarking = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest", optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
sp-core = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
sp-core = { default-features = false, version = "5.0.0", git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
||||||
sp-io = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
sp-io = { default-features = false, version = "5.0.0", git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
||||||
sp-runtime = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
sp-runtime = { default-features = false, version = "5.0.0", git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std"]
|
default = ["std"]
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate as pallet_template;
|
use crate as pallet_template;
|
||||||
use frame_support::parameter_types;
|
use frame_support::traits::{ConstU16, ConstU64};
|
||||||
use frame_system as system;
|
use frame_system as system;
|
||||||
use sp_core::H256;
|
use sp_core::H256;
|
||||||
use sp_runtime::{
|
use sp_runtime::{
|
||||||
|
@ -22,11 +22,6 @@ frame_support::construct_runtime!(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
parameter_types! {
|
|
||||||
pub const BlockHashCount: u64 = 250;
|
|
||||||
pub const SS58Prefix: u8 = 42;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl system::Config for Test {
|
impl system::Config for Test {
|
||||||
type BaseCallFilter = frame_support::traits::Everything;
|
type BaseCallFilter = frame_support::traits::Everything;
|
||||||
type BlockWeights = ();
|
type BlockWeights = ();
|
||||||
|
@ -42,15 +37,16 @@ impl system::Config for Test {
|
||||||
type Lookup = IdentityLookup<Self::AccountId>;
|
type Lookup = IdentityLookup<Self::AccountId>;
|
||||||
type Header = Header;
|
type Header = Header;
|
||||||
type Event = Event;
|
type Event = Event;
|
||||||
type BlockHashCount = BlockHashCount;
|
type BlockHashCount = ConstU64<250>;
|
||||||
type Version = ();
|
type Version = ();
|
||||||
type PalletInfo = PalletInfo;
|
type PalletInfo = PalletInfo;
|
||||||
type AccountData = ();
|
type AccountData = ();
|
||||||
type OnNewAccount = ();
|
type OnNewAccount = ();
|
||||||
type OnKilledAccount = ();
|
type OnKilledAccount = ();
|
||||||
type SystemWeightInfo = ();
|
type SystemWeightInfo = ();
|
||||||
type SS58Prefix = SS58Prefix;
|
type SS58Prefix = ConstU16<42>;
|
||||||
type OnSetCode = ();
|
type OnSetCode = ();
|
||||||
|
type MaxConsumers = frame_support::traits::ConstU32<16>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_template::Config for Test {
|
impl pallet_template::Config for Test {
|
||||||
|
|
|
@ -29,10 +29,10 @@ frame-executive = { version = "4.0.0-dev", default-features = false, git = "http
|
||||||
sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
||||||
sp-block-builder = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest"}
|
sp-block-builder = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest"}
|
||||||
sp-consensus-aura = { version = "0.10.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
sp-consensus-aura = { version = "0.10.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
||||||
sp-core = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
sp-core = { version = "5.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
||||||
sp-inherents = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest"}
|
sp-inherents = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest"}
|
||||||
sp-offchain = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
sp-offchain = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
||||||
sp-runtime = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
sp-runtime = { version = "5.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
||||||
sp-session = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
sp-session = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
||||||
sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
||||||
sp-transaction-pool = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
sp-transaction-pool = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }
|
||||||
|
|
|
@ -26,7 +26,7 @@ use sp_version::RuntimeVersion;
|
||||||
// A few exports that help ease life for downstream crates.
|
// A few exports that help ease life for downstream crates.
|
||||||
pub use frame_support::{
|
pub use frame_support::{
|
||||||
construct_runtime, parameter_types,
|
construct_runtime, parameter_types,
|
||||||
traits::{KeyOwnerProofSystem, Randomness, StorageInfo},
|
traits::{ConstU128, ConstU32, ConstU8, KeyOwnerProofSystem, Randomness, StorageInfo},
|
||||||
weights::{
|
weights::{
|
||||||
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
|
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
|
||||||
IdentityFee, Weight,
|
IdentityFee, Weight,
|
||||||
|
@ -102,6 +102,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
|
||||||
impl_version: 1,
|
impl_version: 1,
|
||||||
apis: RUNTIME_API_VERSIONS,
|
apis: RUNTIME_API_VERSIONS,
|
||||||
transaction_version: 1,
|
transaction_version: 1,
|
||||||
|
state_version: 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// This determines the average expected block time that we are targeting.
|
/// This determines the average expected block time that we are targeting.
|
||||||
|
@ -191,18 +192,15 @@ impl frame_system::Config for Runtime {
|
||||||
type SS58Prefix = SS58Prefix;
|
type SS58Prefix = SS58Prefix;
|
||||||
/// The set code logic, just the default since we're not a parachain.
|
/// The set code logic, just the default since we're not a parachain.
|
||||||
type OnSetCode = ();
|
type OnSetCode = ();
|
||||||
|
type MaxConsumers = frame_support::traits::ConstU32<16>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_randomness_collective_flip::Config for Runtime {}
|
impl pallet_randomness_collective_flip::Config for Runtime {}
|
||||||
|
|
||||||
parameter_types! {
|
|
||||||
pub const MaxAuthorities: u32 = 32;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl pallet_aura::Config for Runtime {
|
impl pallet_aura::Config for Runtime {
|
||||||
type AuthorityId = AuraId;
|
type AuthorityId = AuraId;
|
||||||
type DisabledValidators = ();
|
type DisabledValidators = ();
|
||||||
type MaxAuthorities = MaxAuthorities;
|
type MaxAuthorities = ConstU32<32>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_grandpa::Config for Runtime {
|
impl pallet_grandpa::Config for Runtime {
|
||||||
|
@ -222,7 +220,7 @@ impl pallet_grandpa::Config for Runtime {
|
||||||
type HandleEquivocation = ();
|
type HandleEquivocation = ();
|
||||||
|
|
||||||
type WeightInfo = ();
|
type WeightInfo = ();
|
||||||
type MaxAuthorities = MaxAuthorities;
|
type MaxAuthorities = ConstU32<32>;
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
|
@ -237,13 +235,8 @@ impl pallet_timestamp::Config for Runtime {
|
||||||
type WeightInfo = ();
|
type WeightInfo = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
|
||||||
pub const ExistentialDeposit: u128 = 500;
|
|
||||||
pub const MaxLocks: u32 = 50;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl pallet_balances::Config for Runtime {
|
impl pallet_balances::Config for Runtime {
|
||||||
type MaxLocks = MaxLocks;
|
type MaxLocks = ConstU32<50>;
|
||||||
type MaxReserves = ();
|
type MaxReserves = ();
|
||||||
type ReserveIdentifier = [u8; 8];
|
type ReserveIdentifier = [u8; 8];
|
||||||
/// The type for recording an account's balance.
|
/// The type for recording an account's balance.
|
||||||
|
@ -251,20 +244,19 @@ impl pallet_balances::Config for Runtime {
|
||||||
/// The ubiquitous event type.
|
/// The ubiquitous event type.
|
||||||
type Event = Event;
|
type Event = Event;
|
||||||
type DustRemoval = ();
|
type DustRemoval = ();
|
||||||
type ExistentialDeposit = ExistentialDeposit;
|
type ExistentialDeposit = ConstU128<500>;
|
||||||
type AccountStore = System;
|
type AccountStore = System;
|
||||||
type WeightInfo = pallet_balances::weights::SubstrateWeight<Runtime>;
|
type WeightInfo = pallet_balances::weights::SubstrateWeight<Runtime>;
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const TransactionByteFee: Balance = 1;
|
pub const TransactionByteFee: Balance = 1;
|
||||||
pub OperationalFeeMultiplier: u8 = 5;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_transaction_payment::Config for Runtime {
|
impl pallet_transaction_payment::Config for Runtime {
|
||||||
type OnChargeTransaction = CurrencyAdapter<Balances, ()>;
|
type OnChargeTransaction = CurrencyAdapter<Balances, ()>;
|
||||||
type TransactionByteFee = TransactionByteFee;
|
type TransactionByteFee = TransactionByteFee;
|
||||||
type OperationalFeeMultiplier = OperationalFeeMultiplier;
|
type OperationalFeeMultiplier = ConstU8<5>;
|
||||||
type WeightToFee = IdentityFee<Balance>;
|
type WeightToFee = IdentityFee<Balance>;
|
||||||
type FeeMultiplierUpdate = ();
|
type FeeMultiplierUpdate = ();
|
||||||
}
|
}
|
||||||
|
@ -307,6 +299,7 @@ pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
||||||
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||||
/// The SignedExtension to the basic transaction logic.
|
/// The SignedExtension to the basic transaction logic.
|
||||||
pub type SignedExtra = (
|
pub type SignedExtra = (
|
||||||
|
frame_system::CheckNonZeroSender<Runtime>,
|
||||||
frame_system::CheckSpecVersion<Runtime>,
|
frame_system::CheckSpecVersion<Runtime>,
|
||||||
frame_system::CheckTxVersion<Runtime>,
|
frame_system::CheckTxVersion<Runtime>,
|
||||||
frame_system::CheckGenesis<Runtime>,
|
frame_system::CheckGenesis<Runtime>,
|
||||||
|
@ -323,9 +316,24 @@ pub type Executive = frame_executive::Executive<
|
||||||
Block,
|
Block,
|
||||||
frame_system::ChainContext<Runtime>,
|
frame_system::ChainContext<Runtime>,
|
||||||
Runtime,
|
Runtime,
|
||||||
AllPallets,
|
AllPalletsWithSystem,
|
||||||
>;
|
>;
|
||||||
|
|
||||||
|
#[cfg(feature = "runtime-benchmarks")]
|
||||||
|
#[macro_use]
|
||||||
|
extern crate frame_benchmarking;
|
||||||
|
|
||||||
|
#[cfg(feature = "runtime-benchmarks")]
|
||||||
|
mod benches {
|
||||||
|
define_benchmarks!(
|
||||||
|
[frame_benchmarking, BaselineBench::<Runtime>]
|
||||||
|
[frame_system, SystemBench::<Runtime>]
|
||||||
|
[pallet_balances, Balances]
|
||||||
|
[pallet_timestamp, Timestamp]
|
||||||
|
[pallet_template, TemplateModule]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
impl_runtime_apis! {
|
impl_runtime_apis! {
|
||||||
impl sp_api::Core<Block> for Runtime {
|
impl sp_api::Core<Block> for Runtime {
|
||||||
fn version() -> RuntimeVersion {
|
fn version() -> RuntimeVersion {
|
||||||
|
@ -463,18 +471,13 @@ impl_runtime_apis! {
|
||||||
Vec<frame_benchmarking::BenchmarkList>,
|
Vec<frame_benchmarking::BenchmarkList>,
|
||||||
Vec<frame_support::traits::StorageInfo>,
|
Vec<frame_support::traits::StorageInfo>,
|
||||||
) {
|
) {
|
||||||
use frame_benchmarking::{list_benchmark, baseline, Benchmarking, BenchmarkList};
|
use frame_benchmarking::{baseline, Benchmarking, BenchmarkList};
|
||||||
use frame_support::traits::StorageInfoTrait;
|
use frame_support::traits::StorageInfoTrait;
|
||||||
use frame_system_benchmarking::Pallet as SystemBench;
|
use frame_system_benchmarking::Pallet as SystemBench;
|
||||||
use baseline::Pallet as BaselineBench;
|
use baseline::Pallet as BaselineBench;
|
||||||
|
|
||||||
let mut list = Vec::<BenchmarkList>::new();
|
let mut list = Vec::<BenchmarkList>::new();
|
||||||
|
list_benchmarks!(list, extra);
|
||||||
list_benchmark!(list, extra, frame_benchmarking, BaselineBench::<Runtime>);
|
|
||||||
list_benchmark!(list, extra, frame_system, SystemBench::<Runtime>);
|
|
||||||
list_benchmark!(list, extra, pallet_balances, Balances);
|
|
||||||
list_benchmark!(list, extra, pallet_timestamp, Timestamp);
|
|
||||||
list_benchmark!(list, extra, pallet_template, TemplateModule);
|
|
||||||
|
|
||||||
let storage_info = AllPalletsWithSystem::storage_info();
|
let storage_info = AllPalletsWithSystem::storage_info();
|
||||||
|
|
||||||
|
@ -484,7 +487,7 @@ impl_runtime_apis! {
|
||||||
fn dispatch_benchmark(
|
fn dispatch_benchmark(
|
||||||
config: frame_benchmarking::BenchmarkConfig
|
config: frame_benchmarking::BenchmarkConfig
|
||||||
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
|
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
|
||||||
use frame_benchmarking::{baseline, Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};
|
use frame_benchmarking::{baseline, Benchmarking, BenchmarkBatch, TrackedStorageKey};
|
||||||
|
|
||||||
use frame_system_benchmarking::Pallet as SystemBench;
|
use frame_system_benchmarking::Pallet as SystemBench;
|
||||||
use baseline::Pallet as BaselineBench;
|
use baseline::Pallet as BaselineBench;
|
||||||
|
@ -507,12 +510,7 @@ impl_runtime_apis! {
|
||||||
|
|
||||||
let mut batches = Vec::<BenchmarkBatch>::new();
|
let mut batches = Vec::<BenchmarkBatch>::new();
|
||||||
let params = (&config, &whitelist);
|
let params = (&config, &whitelist);
|
||||||
|
add_benchmarks!(params, batches);
|
||||||
add_benchmark!(params, batches, frame_benchmarking, BaselineBench::<Runtime>);
|
|
||||||
add_benchmark!(params, batches, frame_system, SystemBench::<Runtime>);
|
|
||||||
add_benchmark!(params, batches, pallet_balances, Balances);
|
|
||||||
add_benchmark!(params, batches, pallet_timestamp, Timestamp);
|
|
||||||
add_benchmark!(params, batches, pallet_template, TemplateModule);
|
|
||||||
|
|
||||||
Ok(batches)
|
Ok(batches)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue