Update to `d1cd01c7`
parent
43ee95347b
commit
25c494b81d
File diff suppressed because it is too large
Load Diff
142
Cargo.toml
142
Cargo.toml
|
@ -1,43 +1,13 @@
|
||||||
[[bin]]
|
[workspace]
|
||||||
name = 'node-template'
|
members = ['runtime']
|
||||||
path = 'src/main.rs'
|
|
||||||
|
|
||||||
[package]
|
|
||||||
authors = ['Anonymous']
|
|
||||||
build = 'build.rs'
|
|
||||||
edition = '2018'
|
|
||||||
name = 'node-template'
|
|
||||||
version = '2.0.0'
|
|
||||||
|
|
||||||
[build-dependencies]
|
|
||||||
vergen = '3.0.4'
|
|
||||||
[profile.release]
|
|
||||||
panic = 'unwind'
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
derive_more = '0.15.0'
|
futures = '0.3.1'
|
||||||
exit-future = '0.1.4'
|
|
||||||
futures = '0.1.29'
|
|
||||||
log = '0.4.8'
|
log = '0.4.8'
|
||||||
parking_lot = '0.9.0'
|
parking_lot = '0.9.0'
|
||||||
tokio = '0.1.22'
|
tokio = '0.1.22'
|
||||||
trie-root = '0.15.2'
|
trie-root = '0.15.2'
|
||||||
|
|
||||||
[dependencies.aura]
|
|
||||||
git = 'https://github.com/paritytech/substrate.git'
|
|
||||||
package = 'substrate-consensus-aura'
|
|
||||||
rev = 'd1cd01c74e8d5550396cb654f9a3f1b641efdf4c'
|
|
||||||
|
|
||||||
[dependencies.aura-primitives]
|
|
||||||
git = 'https://github.com/paritytech/substrate.git'
|
|
||||||
package = 'substrate-consensus-aura-primitives'
|
|
||||||
rev = 'd1cd01c74e8d5550396cb654f9a3f1b641efdf4c'
|
|
||||||
|
|
||||||
[dependencies.basic-authorship]
|
|
||||||
git = 'https://github.com/paritytech/substrate.git'
|
|
||||||
package = 'substrate-basic-authorship'
|
|
||||||
rev = 'd1cd01c74e8d5550396cb654f9a3f1b641efdf4c'
|
|
||||||
|
|
||||||
[dependencies.codec]
|
[dependencies.codec]
|
||||||
package = 'parity-scale-codec'
|
package = 'parity-scale-codec'
|
||||||
version = '1.0.0'
|
version = '1.0.0'
|
||||||
|
@ -46,58 +16,100 @@ version = '1.0.0'
|
||||||
features = ['termination']
|
features = ['termination']
|
||||||
version = '3.1.3'
|
version = '3.1.3'
|
||||||
|
|
||||||
|
[dependencies.futures01]
|
||||||
|
package = 'futures'
|
||||||
|
version = '0.1.29'
|
||||||
|
|
||||||
[dependencies.grandpa]
|
[dependencies.grandpa]
|
||||||
git = 'https://github.com/paritytech/substrate.git'
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
package = 'substrate-finality-grandpa'
|
package = 'sc-finality-grandpa'
|
||||||
rev = 'd1cd01c74e8d5550396cb654f9a3f1b641efdf4c'
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
[dependencies.grandpa-primitives]
|
[dependencies.grandpa-primitives]
|
||||||
git = 'https://github.com/paritytech/substrate.git'
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
package = 'substrate-finality-grandpa-primitives'
|
package = 'sp-finality-grandpa'
|
||||||
rev = 'd1cd01c74e8d5550396cb654f9a3f1b641efdf4c'
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
[dependencies.inherents]
|
|
||||||
git = 'https://github.com/paritytech/substrate.git'
|
|
||||||
package = 'substrate-inherents'
|
|
||||||
rev = 'd1cd01c74e8d5550396cb654f9a3f1b641efdf4c'
|
|
||||||
|
|
||||||
[dependencies.network]
|
|
||||||
git = 'https://github.com/paritytech/substrate.git'
|
|
||||||
package = 'substrate-network'
|
|
||||||
rev = 'd1cd01c74e8d5550396cb654f9a3f1b641efdf4c'
|
|
||||||
|
|
||||||
[dependencies.node-template-runtime]
|
[dependencies.node-template-runtime]
|
||||||
path = 'runtime'
|
path = 'runtime'
|
||||||
|
|
||||||
[dependencies.primitives]
|
[dependencies.sc-basic-authority]
|
||||||
git = 'https://github.com/paritytech/substrate.git'
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
package = 'substrate-primitives'
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
rev = 'd1cd01c74e8d5550396cb654f9a3f1b641efdf4c'
|
|
||||||
|
|
||||||
[dependencies.sr-io]
|
[dependencies.sc-cli]
|
||||||
git = 'https://github.com/paritytech/substrate.git'
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
rev = 'd1cd01c74e8d5550396cb654f9a3f1b641efdf4c'
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
[dependencies.substrate-cli]
|
[dependencies.sc-client]
|
||||||
git = 'https://github.com/paritytech/substrate.git'
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
rev = 'd1cd01c74e8d5550396cb654f9a3f1b641efdf4c'
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
[dependencies.substrate-client]
|
[dependencies.sc-consensus-aura]
|
||||||
git = 'https://github.com/paritytech/substrate.git'
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
rev = 'd1cd01c74e8d5550396cb654f9a3f1b641efdf4c'
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
[dependencies.substrate-executor]
|
[dependencies.sc-executor]
|
||||||
git = 'https://github.com/paritytech/substrate.git'
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
rev = 'd1cd01c74e8d5550396cb654f9a3f1b641efdf4c'
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
[dependencies.substrate-service]
|
[dependencies.sc-network]
|
||||||
git = 'https://github.com/paritytech/substrate.git'
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
rev = 'd1cd01c74e8d5550396cb654f9a3f1b641efdf4c'
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
[dependencies.transaction-pool]
|
[dependencies.sc-service]
|
||||||
git = 'https://github.com/paritytech/substrate.git'
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
package = 'substrate-transaction-pool'
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
rev = 'd1cd01c74e8d5550396cb654f9a3f1b641efdf4c'
|
|
||||||
|
|
||||||
[workspace]
|
[dependencies.sc-transaction-pool]
|
||||||
members = ['runtime']
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
|
[dependencies.sp-consensus]
|
||||||
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
|
[dependencies.sp-consensus-aura]
|
||||||
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
|
[dependencies.sp-core]
|
||||||
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
|
[dependencies.sp-inherents]
|
||||||
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
|
[dependencies.sp-io]
|
||||||
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
|
[dependencies.sp-runtime]
|
||||||
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
|
[dependencies.sp-transaction-pool]
|
||||||
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
|
[package]
|
||||||
|
authors = ['Anonymous']
|
||||||
|
build = 'build.rs'
|
||||||
|
edition = '2018'
|
||||||
|
name = 'node-template'
|
||||||
|
version = '2.0.0'
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = 'node-template'
|
||||||
|
path = 'src/main.rs'
|
||||||
|
[profile.release]
|
||||||
|
panic = 'unwind'
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
vergen = '3.0.4'
|
||||||
|
|
||||||
|
[build-dependencies.build-script-utils]
|
||||||
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
|
package = 'substrate-build-script-utils'
|
||||||
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
17
build.rs
17
build.rs
|
@ -1,5 +1,3 @@
|
||||||
use std::{env, path::PathBuf};
|
|
||||||
|
|
||||||
use vergen::{ConstantsFlags, generate_cargo_keys};
|
use vergen::{ConstantsFlags, generate_cargo_keys};
|
||||||
|
|
||||||
const ERROR_MSG: &str = "Failed to generate metadata files";
|
const ERROR_MSG: &str = "Failed to generate metadata files";
|
||||||
|
@ -7,18 +5,5 @@ const ERROR_MSG: &str = "Failed to generate metadata files";
|
||||||
fn main() {
|
fn main() {
|
||||||
generate_cargo_keys(ConstantsFlags::SHA_SHORT).expect(ERROR_MSG);
|
generate_cargo_keys(ConstantsFlags::SHA_SHORT).expect(ERROR_MSG);
|
||||||
|
|
||||||
let mut manifest_dir = PathBuf::from(
|
build_script_utils::rerun_if_git_head_changed();
|
||||||
env::var("CARGO_MANIFEST_DIR").expect("`CARGO_MANIFEST_DIR` is always set by cargo.")
|
|
||||||
);
|
|
||||||
|
|
||||||
while manifest_dir.parent().is_some() {
|
|
||||||
if manifest_dir.join(".git/HEAD").exists() {
|
|
||||||
println!("cargo:rerun-if-changed={}", manifest_dir.join(".git/HEAD").display());
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
manifest_dir.pop();
|
|
||||||
}
|
|
||||||
|
|
||||||
println!("cargo:warning=Could not find `.git/HEAD` from manifest dir!");
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,60 +3,53 @@ authors = ['Anonymous']
|
||||||
edition = '2018'
|
edition = '2018'
|
||||||
name = 'node-template-runtime'
|
name = 'node-template-runtime'
|
||||||
version = '2.0.0'
|
version = '2.0.0'
|
||||||
[build-dependencies.wasm-builder-runner]
|
|
||||||
package = 'substrate-wasm-builder-runner'
|
|
||||||
version = '1.0.2'
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ['std']
|
default = ['std']
|
||||||
std = [
|
std = [
|
||||||
'codec/std',
|
|
||||||
'client/std',
|
|
||||||
'rstd/std',
|
|
||||||
'runtime-io/std',
|
|
||||||
'support/std',
|
|
||||||
'balances/std',
|
|
||||||
'aura/std',
|
'aura/std',
|
||||||
'aura-primitives/std',
|
'balances/std',
|
||||||
|
'codec/std',
|
||||||
|
'frame-executive/std',
|
||||||
|
'frame-support/std',
|
||||||
'grandpa/std',
|
'grandpa/std',
|
||||||
'executive/std',
|
|
||||||
'indices/std',
|
'indices/std',
|
||||||
'primitives/std',
|
|
||||||
'sr-primitives/std',
|
|
||||||
'randomness-collective-flip/std',
|
'randomness-collective-flip/std',
|
||||||
|
'safe-mix/std',
|
||||||
|
'serde',
|
||||||
|
'sp-api/std',
|
||||||
|
'sp-block-builder/std',
|
||||||
|
'sp-consensus-aura/std',
|
||||||
|
'sp-core/std',
|
||||||
|
'sp-inherents/std',
|
||||||
|
'sp-io/std',
|
||||||
|
'sp-offchain/std',
|
||||||
|
'sp-runtime/std',
|
||||||
|
'sp-session/std',
|
||||||
|
'sp-std/std',
|
||||||
|
'sp-transaction-pool/std',
|
||||||
|
'sp-version/std',
|
||||||
|
'sudo/std',
|
||||||
'system/std',
|
'system/std',
|
||||||
'timestamp/std',
|
'timestamp/std',
|
||||||
'sudo/std',
|
|
||||||
'transaction-payment/std',
|
'transaction-payment/std',
|
||||||
'version/std',
|
|
||||||
'serde',
|
|
||||||
'safe-mix/std',
|
|
||||||
'offchain-primitives/std',
|
|
||||||
'substrate-session/std',
|
|
||||||
]
|
]
|
||||||
|
[build-dependencies.wasm-builder-runner]
|
||||||
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
|
package = 'substrate-wasm-builder-runner'
|
||||||
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
version = '1.0.4'
|
||||||
[dependencies.aura]
|
[dependencies.aura]
|
||||||
default_features = false
|
default-features = false
|
||||||
git = 'https://github.com/paritytech/substrate.git'
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
package = 'srml-aura'
|
package = 'pallet-aura'
|
||||||
rev = 'd1cd01c74e8d5550396cb654f9a3f1b641efdf4c'
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
[dependencies.aura-primitives]
|
|
||||||
default_features = false
|
|
||||||
git = 'https://github.com/paritytech/substrate.git'
|
|
||||||
package = 'substrate-consensus-aura-primitives'
|
|
||||||
rev = 'd1cd01c74e8d5550396cb654f9a3f1b641efdf4c'
|
|
||||||
|
|
||||||
[dependencies.balances]
|
[dependencies.balances]
|
||||||
default_features = false
|
default-features = false
|
||||||
git = 'https://github.com/paritytech/substrate.git'
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
package = 'srml-balances'
|
package = 'pallet-balances'
|
||||||
rev = 'd1cd01c74e8d5550396cb654f9a3f1b641efdf4c'
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
[dependencies.client]
|
|
||||||
default_features = false
|
|
||||||
git = 'https://github.com/paritytech/substrate.git'
|
|
||||||
package = 'substrate-client'
|
|
||||||
rev = 'd1cd01c74e8d5550396cb654f9a3f1b641efdf4c'
|
|
||||||
|
|
||||||
[dependencies.codec]
|
[dependencies.codec]
|
||||||
default-features = false
|
default-features = false
|
||||||
|
@ -64,53 +57,33 @@ features = ['derive']
|
||||||
package = 'parity-scale-codec'
|
package = 'parity-scale-codec'
|
||||||
version = '1.0.0'
|
version = '1.0.0'
|
||||||
|
|
||||||
[dependencies.executive]
|
[dependencies.frame-executive]
|
||||||
default_features = false
|
|
||||||
git = 'https://github.com/paritytech/substrate.git'
|
|
||||||
package = 'srml-executive'
|
|
||||||
rev = 'd1cd01c74e8d5550396cb654f9a3f1b641efdf4c'
|
|
||||||
|
|
||||||
[dependencies.grandpa]
|
|
||||||
default_features = false
|
|
||||||
git = 'https://github.com/paritytech/substrate.git'
|
|
||||||
package = 'srml-grandpa'
|
|
||||||
rev = 'd1cd01c74e8d5550396cb654f9a3f1b641efdf4c'
|
|
||||||
|
|
||||||
[dependencies.indices]
|
|
||||||
default_features = false
|
|
||||||
git = 'https://github.com/paritytech/substrate.git'
|
|
||||||
package = 'srml-indices'
|
|
||||||
rev = 'd1cd01c74e8d5550396cb654f9a3f1b641efdf4c'
|
|
||||||
|
|
||||||
[dependencies.offchain-primitives]
|
|
||||||
default-features = false
|
default-features = false
|
||||||
git = 'https://github.com/paritytech/substrate.git'
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
package = 'substrate-offchain-primitives'
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
rev = 'd1cd01c74e8d5550396cb654f9a3f1b641efdf4c'
|
|
||||||
|
|
||||||
[dependencies.primitives]
|
[dependencies.frame-support]
|
||||||
default_features = false
|
default-features = false
|
||||||
git = 'https://github.com/paritytech/substrate.git'
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
package = 'substrate-primitives'
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
rev = 'd1cd01c74e8d5550396cb654f9a3f1b641efdf4c'
|
|
||||||
|
[dependencies.grandpa]
|
||||||
|
default-features = false
|
||||||
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
|
package = 'pallet-grandpa'
|
||||||
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
|
[dependencies.indices]
|
||||||
|
default-features = false
|
||||||
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
|
package = 'pallet-indices'
|
||||||
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
[dependencies.randomness-collective-flip]
|
[dependencies.randomness-collective-flip]
|
||||||
default_features = false
|
default-features = false
|
||||||
git = 'https://github.com/paritytech/substrate.git'
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
package = 'srml-randomness-collective-flip'
|
package = 'pallet-randomness-collective-flip'
|
||||||
rev = 'd1cd01c74e8d5550396cb654f9a3f1b641efdf4c'
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
[dependencies.rstd]
|
|
||||||
default_features = false
|
|
||||||
git = 'https://github.com/paritytech/substrate.git'
|
|
||||||
package = 'sr-std'
|
|
||||||
rev = 'd1cd01c74e8d5550396cb654f9a3f1b641efdf4c'
|
|
||||||
|
|
||||||
[dependencies.runtime-io]
|
|
||||||
default_features = false
|
|
||||||
git = 'https://github.com/paritytech/substrate.git'
|
|
||||||
package = 'sr-io'
|
|
||||||
rev = 'd1cd01c74e8d5550396cb654f9a3f1b641efdf4c'
|
|
||||||
|
|
||||||
[dependencies.safe-mix]
|
[dependencies.safe-mix]
|
||||||
default-features = false
|
default-features = false
|
||||||
|
@ -121,48 +94,86 @@ features = ['derive']
|
||||||
optional = true
|
optional = true
|
||||||
version = '1.0.101'
|
version = '1.0.101'
|
||||||
|
|
||||||
[dependencies.sr-primitives]
|
[dependencies.sp-api]
|
||||||
default_features = false
|
|
||||||
git = 'https://github.com/paritytech/substrate.git'
|
|
||||||
rev = 'd1cd01c74e8d5550396cb654f9a3f1b641efdf4c'
|
|
||||||
|
|
||||||
[dependencies.substrate-session]
|
|
||||||
default-features = false
|
default-features = false
|
||||||
git = 'https://github.com/paritytech/substrate.git'
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
rev = 'd1cd01c74e8d5550396cb654f9a3f1b641efdf4c'
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
|
[dependencies.sp-block-builder]
|
||||||
|
default-features = false
|
||||||
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
|
[dependencies.sp-consensus-aura]
|
||||||
|
default-features = false
|
||||||
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
|
[dependencies.sp-core]
|
||||||
|
default-features = false
|
||||||
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
|
[dependencies.sp-inherents]
|
||||||
|
default-features = false
|
||||||
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
|
[dependencies.sp-io]
|
||||||
|
default-features = false
|
||||||
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
|
[dependencies.sp-offchain]
|
||||||
|
default-features = false
|
||||||
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
|
[dependencies.sp-runtime]
|
||||||
|
default-features = false
|
||||||
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
|
[dependencies.sp-session]
|
||||||
|
default-features = false
|
||||||
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
|
[dependencies.sp-std]
|
||||||
|
default-features = false
|
||||||
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
|
[dependencies.sp-transaction-pool]
|
||||||
|
default-features = false
|
||||||
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
|
[dependencies.sp-version]
|
||||||
|
default-features = false
|
||||||
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
[dependencies.sudo]
|
[dependencies.sudo]
|
||||||
default_features = false
|
default-features = false
|
||||||
git = 'https://github.com/paritytech/substrate.git'
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
package = 'srml-sudo'
|
package = 'pallet-sudo'
|
||||||
rev = 'd1cd01c74e8d5550396cb654f9a3f1b641efdf4c'
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
[dependencies.support]
|
|
||||||
default_features = false
|
|
||||||
git = 'https://github.com/paritytech/substrate.git'
|
|
||||||
package = 'srml-support'
|
|
||||||
rev = 'd1cd01c74e8d5550396cb654f9a3f1b641efdf4c'
|
|
||||||
|
|
||||||
[dependencies.system]
|
[dependencies.system]
|
||||||
default_features = false
|
default-features = false
|
||||||
git = 'https://github.com/paritytech/substrate.git'
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
package = 'srml-system'
|
package = 'frame-system'
|
||||||
rev = 'd1cd01c74e8d5550396cb654f9a3f1b641efdf4c'
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
[dependencies.timestamp]
|
[dependencies.timestamp]
|
||||||
default_features = false
|
default-features = false
|
||||||
git = 'https://github.com/paritytech/substrate.git'
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
package = 'srml-timestamp'
|
package = 'pallet-timestamp'
|
||||||
rev = 'd1cd01c74e8d5550396cb654f9a3f1b641efdf4c'
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
[dependencies.transaction-payment]
|
[dependencies.transaction-payment]
|
||||||
default_features = false
|
default-features = false
|
||||||
git = 'https://github.com/paritytech/substrate.git'
|
git = 'https://github.com/paritytech/substrate.git'
|
||||||
package = 'srml-transaction-payment'
|
package = 'pallet-transaction-payment'
|
||||||
rev = 'd1cd01c74e8d5550396cb654f9a3f1b641efdf4c'
|
rev = '40a16efefc070faf5a25442bc3ae1d0ea2478eee'
|
||||||
|
|
||||||
[dependencies.version]
|
|
||||||
default_features = false
|
|
||||||
git = 'https://github.com/paritytech/substrate.git'
|
|
||||||
package = 'sr-version'
|
|
||||||
rev = 'd1cd01c74e8d5550396cb654f9a3f1b641efdf4c'
|
|
||||||
|
|
|
@ -8,42 +8,44 @@
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
|
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
|
||||||
|
|
||||||
use rstd::prelude::*;
|
use sp_std::prelude::*;
|
||||||
use primitives::{OpaqueMetadata, crypto::key_types};
|
use sp_core::OpaqueMetadata;
|
||||||
use sr_primitives::{
|
use sp_runtime::{
|
||||||
ApplyResult, transaction_validity::TransactionValidity, generic, create_runtime_str,
|
ApplyExtrinsicResult, transaction_validity::TransactionValidity, generic, create_runtime_str,
|
||||||
impl_opaque_keys, AnySignature
|
impl_opaque_keys, MultiSignature
|
||||||
};
|
};
|
||||||
use sr_primitives::traits::{NumberFor, BlakeTwo256, Block as BlockT, StaticLookup, Verify, ConvertInto};
|
use sp_runtime::traits::{
|
||||||
use sr_primitives::weights::Weight;
|
NumberFor, BlakeTwo256, Block as BlockT, StaticLookup, Verify, ConvertInto, IdentifyAccount
|
||||||
use client::{
|
|
||||||
block_builder::api::{CheckInherentsResult, InherentData, self as block_builder_api},
|
|
||||||
runtime_api as client_api, impl_runtime_apis
|
|
||||||
};
|
};
|
||||||
use aura_primitives::sr25519::AuthorityId as AuraId;
|
use sp_api::impl_runtime_apis;
|
||||||
use grandpa::{AuthorityId as GrandpaId, AuthorityWeight as GrandpaWeight};
|
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
|
||||||
|
use grandpa::AuthorityList as GrandpaAuthorityList;
|
||||||
use grandpa::fg_primitives;
|
use grandpa::fg_primitives;
|
||||||
use version::RuntimeVersion;
|
use sp_version::RuntimeVersion;
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
use version::NativeVersion;
|
use sp_version::NativeVersion;
|
||||||
|
|
||||||
// A few exports that help ease life for downstream crates.
|
// A few exports that help ease life for downstream crates.
|
||||||
#[cfg(any(feature = "std", test))]
|
#[cfg(any(feature = "std", test))]
|
||||||
pub use sr_primitives::BuildStorage;
|
pub use sp_runtime::BuildStorage;
|
||||||
pub use timestamp::Call as TimestampCall;
|
pub use timestamp::Call as TimestampCall;
|
||||||
pub use balances::Call as BalancesCall;
|
pub use balances::Call as BalancesCall;
|
||||||
pub use sr_primitives::{Permill, Perbill};
|
pub use sp_runtime::{Permill, Perbill};
|
||||||
pub use support::{StorageValue, construct_runtime, parameter_types, traits::Randomness};
|
pub use frame_support::{
|
||||||
|
StorageValue, construct_runtime, parameter_types,
|
||||||
|
traits::Randomness,
|
||||||
|
weights::Weight,
|
||||||
|
};
|
||||||
|
|
||||||
/// An index to a block.
|
/// An index to a block.
|
||||||
pub type BlockNumber = u32;
|
pub type BlockNumber = u32;
|
||||||
|
|
||||||
/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.
|
/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.
|
||||||
pub type Signature = AnySignature;
|
pub type Signature = MultiSignature;
|
||||||
|
|
||||||
/// Some way of identifying an account on the chain. We intentionally make it equivalent
|
/// Some way of identifying an account on the chain. We intentionally make it equivalent
|
||||||
/// to the public key of our transaction signing scheme.
|
/// to the public key of our transaction signing scheme.
|
||||||
pub type AccountId = <Signature as Verify>::Signer;
|
pub type AccountId = <<Signature as Verify>::Signer as IdentifyAccount>::AccountId;
|
||||||
|
|
||||||
/// The type for looking up accounts. We don't expect more than 4 billion of them, but you
|
/// The type for looking up accounts. We don't expect more than 4 billion of them, but you
|
||||||
/// never know...
|
/// never know...
|
||||||
|
@ -56,7 +58,7 @@ pub type Balance = u128;
|
||||||
pub type Index = u32;
|
pub type Index = u32;
|
||||||
|
|
||||||
/// A hash of some data used by the chain.
|
/// A hash of some data used by the chain.
|
||||||
pub type Hash = primitives::H256;
|
pub type Hash = sp_core::H256;
|
||||||
|
|
||||||
/// Digest item type.
|
/// Digest item type.
|
||||||
pub type DigestItem = generic::DigestItem<Hash>;
|
pub type DigestItem = generic::DigestItem<Hash>;
|
||||||
|
@ -71,7 +73,7 @@ mod template;
|
||||||
pub mod opaque {
|
pub mod opaque {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
pub use sr_primitives::OpaqueExtrinsic as UncheckedExtrinsic;
|
pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic;
|
||||||
|
|
||||||
/// Opaque block header type.
|
/// Opaque block header type.
|
||||||
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
||||||
|
@ -82,10 +84,8 @@ pub mod opaque {
|
||||||
|
|
||||||
impl_opaque_keys! {
|
impl_opaque_keys! {
|
||||||
pub struct SessionKeys {
|
pub struct SessionKeys {
|
||||||
#[id(key_types::AURA)]
|
pub aura: Aura,
|
||||||
pub aura: AuraId,
|
pub grandpa: Grandpa,
|
||||||
#[id(key_types::GRANDPA)]
|
|
||||||
pub grandpa: GrandpaId,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,9 +94,9 @@ pub mod opaque {
|
||||||
pub const VERSION: RuntimeVersion = RuntimeVersion {
|
pub const VERSION: RuntimeVersion = RuntimeVersion {
|
||||||
spec_name: create_runtime_str!("node-template"),
|
spec_name: create_runtime_str!("node-template"),
|
||||||
impl_name: create_runtime_str!("node-template"),
|
impl_name: create_runtime_str!("node-template"),
|
||||||
authoring_version: 3,
|
authoring_version: 1,
|
||||||
spec_version: 4,
|
spec_version: 1,
|
||||||
impl_version: 4,
|
impl_version: 1,
|
||||||
apis: RUNTIME_API_VERSIONS,
|
apis: RUNTIME_API_VERSIONS,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -104,16 +104,11 @@ pub const MILLISECS_PER_BLOCK: u64 = 6000;
|
||||||
|
|
||||||
pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;
|
pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;
|
||||||
|
|
||||||
pub const EPOCH_DURATION_IN_BLOCKS: u32 = 10 * MINUTES;
|
|
||||||
|
|
||||||
// These time units are defined in number of blocks.
|
// These time units are defined in number of blocks.
|
||||||
pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber);
|
pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber);
|
||||||
pub const HOURS: BlockNumber = MINUTES * 60;
|
pub const HOURS: BlockNumber = MINUTES * 60;
|
||||||
pub const DAYS: BlockNumber = HOURS * 24;
|
pub const DAYS: BlockNumber = HOURS * 24;
|
||||||
|
|
||||||
// 1 in 4 blocks (on average, not counting collisions) will be primary babe blocks.
|
|
||||||
pub const PRIMARY_PROBABILITY: (u64, u64) = (1, 4);
|
|
||||||
|
|
||||||
/// The version infromation used to identify this runtime when compiled natively.
|
/// The version infromation used to identify this runtime when compiled natively.
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
pub fn native_version() -> NativeVersion {
|
pub fn native_version() -> NativeVersion {
|
||||||
|
@ -175,7 +170,7 @@ impl grandpa::Trait for Runtime {
|
||||||
impl indices::Trait for Runtime {
|
impl indices::Trait for Runtime {
|
||||||
/// The type for recording indexing into the account enumeration. If this ever overflows, there
|
/// The type for recording indexing into the account enumeration. If this ever overflows, there
|
||||||
/// will be problems!
|
/// will be problems!
|
||||||
type AccountIndex = u32;
|
type AccountIndex = AccountIndex;
|
||||||
/// Use the standard means of resolving an index hint from an id.
|
/// Use the standard means of resolving an index hint from an id.
|
||||||
type ResolveHint = indices::SimpleResolveHint<Self::AccountId, Self::AccountIndex>;
|
type ResolveHint = indices::SimpleResolveHint<Self::AccountId, Self::AccountIndex>;
|
||||||
/// Determine whether an account is dead.
|
/// Determine whether an account is dead.
|
||||||
|
@ -251,7 +246,7 @@ construct_runtime!(
|
||||||
Timestamp: timestamp::{Module, Call, Storage, Inherent},
|
Timestamp: timestamp::{Module, Call, Storage, Inherent},
|
||||||
Aura: aura::{Module, Config<T>, Inherent(Timestamp)},
|
Aura: aura::{Module, Config<T>, Inherent(Timestamp)},
|
||||||
Grandpa: grandpa::{Module, Call, Storage, Config, Event},
|
Grandpa: grandpa::{Module, Call, Storage, Config, Event},
|
||||||
Indices: indices::{default, Config<T>},
|
Indices: indices,
|
||||||
Balances: balances::{default, Error},
|
Balances: balances::{default, Error},
|
||||||
TransactionPayment: transaction_payment::{Module, Storage},
|
TransactionPayment: transaction_payment::{Module, Storage},
|
||||||
Sudo: sudo,
|
Sudo: sudo,
|
||||||
|
@ -285,10 +280,10 @@ pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signatu
|
||||||
/// Extrinsic type that has already been checked.
|
/// Extrinsic type that has already been checked.
|
||||||
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Call, SignedExtra>;
|
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Call, SignedExtra>;
|
||||||
/// Executive: handles dispatch to the various modules.
|
/// Executive: handles dispatch to the various modules.
|
||||||
pub type Executive = executive::Executive<Runtime, Block, system::ChainContext<Runtime>, Runtime, AllModules>;
|
pub type Executive = frame_executive::Executive<Runtime, Block, system::ChainContext<Runtime>, Runtime, AllModules>;
|
||||||
|
|
||||||
impl_runtime_apis! {
|
impl_runtime_apis! {
|
||||||
impl client_api::Core<Block> for Runtime {
|
impl sp_api::Core<Block> for Runtime {
|
||||||
fn version() -> RuntimeVersion {
|
fn version() -> RuntimeVersion {
|
||||||
VERSION
|
VERSION
|
||||||
}
|
}
|
||||||
|
@ -302,14 +297,14 @@ impl_runtime_apis! {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl client_api::Metadata<Block> for Runtime {
|
impl sp_api::Metadata<Block> for Runtime {
|
||||||
fn metadata() -> OpaqueMetadata {
|
fn metadata() -> OpaqueMetadata {
|
||||||
Runtime::metadata().into()
|
Runtime::metadata().into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl block_builder_api::BlockBuilder<Block> for Runtime {
|
impl sp_block_builder::BlockBuilder<Block> for Runtime {
|
||||||
fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyResult {
|
fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {
|
||||||
Executive::apply_extrinsic(extrinsic)
|
Executive::apply_extrinsic(extrinsic)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,11 +312,14 @@ impl_runtime_apis! {
|
||||||
Executive::finalize_block()
|
Executive::finalize_block()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn inherent_extrinsics(data: InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
|
fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
|
||||||
data.create_extrinsics()
|
data.create_extrinsics()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_inherents(block: Block, data: InherentData) -> CheckInherentsResult {
|
fn check_inherents(
|
||||||
|
block: Block,
|
||||||
|
data: sp_inherents::InherentData,
|
||||||
|
) -> sp_inherents::CheckInherentsResult {
|
||||||
data.check_extrinsics(&block)
|
data.check_extrinsics(&block)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -330,37 +328,36 @@ impl_runtime_apis! {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl client_api::TaggedTransactionQueue<Block> for Runtime {
|
impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {
|
||||||
fn validate_transaction(tx: <Block as BlockT>::Extrinsic) -> TransactionValidity {
|
fn validate_transaction(tx: <Block as BlockT>::Extrinsic) -> TransactionValidity {
|
||||||
Executive::validate_transaction(tx)
|
Executive::validate_transaction(tx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl offchain_primitives::OffchainWorkerApi<Block> for Runtime {
|
impl sp_offchain::OffchainWorkerApi<Block> for Runtime {
|
||||||
fn offchain_worker(number: NumberFor<Block>) {
|
fn offchain_worker(number: NumberFor<Block>) {
|
||||||
Executive::offchain_worker(number)
|
Executive::offchain_worker(number)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl aura_primitives::AuraApi<Block, AuraId> for Runtime {
|
impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
|
||||||
fn slot_duration() -> u64 {
|
fn slot_duration() -> u64 {
|
||||||
Aura::slot_duration()
|
Aura::slot_duration()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn authorities() -> Vec<AuraId> {
|
fn authorities() -> Vec<AuraId> {
|
||||||
Aura::authorities()
|
Aura::authorities()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl substrate_session::SessionKeys<Block> for Runtime {
|
impl sp_session::SessionKeys<Block> for Runtime {
|
||||||
fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {
|
fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {
|
||||||
let seed = seed.as_ref().map(|s| rstd::str::from_utf8(&s).expect("Seed is an utf8 string"));
|
|
||||||
opaque::SessionKeys::generate(seed)
|
opaque::SessionKeys::generate(seed)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fg_primitives::GrandpaApi<Block> for Runtime {
|
impl fg_primitives::GrandpaApi<Block> for Runtime {
|
||||||
fn grandpa_authorities() -> Vec<(GrandpaId, GrandpaWeight)> {
|
fn grandpa_authorities() -> GrandpaAuthorityList {
|
||||||
Grandpa::grandpa_authorities()
|
Grandpa::grandpa_authorities()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
|
|
||||||
|
|
||||||
/// For more guidance on Substrate modules, see the example module
|
/// For more guidance on Substrate modules, see the example module
|
||||||
/// https://github.com/paritytech/substrate/blob/master/srml/example/src/lib.rs
|
/// https://github.com/paritytech/substrate/blob/master/frame/example/src/lib.rs
|
||||||
|
|
||||||
use support::{decl_module, decl_storage, decl_event, dispatch::Result};
|
use frame_support::{decl_module, decl_storage, decl_event, dispatch};
|
||||||
use system::ensure_signed;
|
use system::ensure_signed;
|
||||||
|
|
||||||
/// The module's configuration trait.
|
/// The module's configuration trait.
|
||||||
|
@ -24,8 +24,8 @@ decl_storage! {
|
||||||
trait Store for Module<T: Trait> as TemplateModule {
|
trait Store for Module<T: Trait> as TemplateModule {
|
||||||
// Just a dummy storage item.
|
// Just a dummy storage item.
|
||||||
// Here we are declaring a StorageValue, `Something` as a Option<u32>
|
// Here we are declaring a StorageValue, `Something` as a Option<u32>
|
||||||
// `get(something)` is the default getter which returns either the stored `u32` or `None` if nothing stored
|
// `get(fn something)` is the default getter which returns either the stored `u32` or `None` if nothing stored
|
||||||
Something get(something): Option<u32>;
|
Something get(fn something): Option<u32>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ decl_module! {
|
||||||
// Just a dummy entry point.
|
// Just a dummy entry point.
|
||||||
// function that can be called by the external world as an extrinsics call
|
// function that can be called by the external world as an extrinsics call
|
||||||
// takes a parameter of the type `AccountId`, stores it and emits an event
|
// takes a parameter of the type `AccountId`, stores it and emits an event
|
||||||
pub fn do_something(origin, something: u32) -> Result {
|
pub fn do_something(origin, something: u32) -> dispatch::Result {
|
||||||
// TODO: You only need this if you want to check it was signed.
|
// TODO: You only need this if you want to check it was signed.
|
||||||
let who = ensure_signed(origin)?;
|
let who = ensure_signed(origin)?;
|
||||||
|
|
||||||
|
@ -69,10 +69,10 @@ decl_event!(
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
use primitives::H256;
|
use sp_core::H256;
|
||||||
use support::{impl_outer_origin, assert_ok, parameter_types};
|
use frame_support::{impl_outer_origin, assert_ok, parameter_types, weights::Weight};
|
||||||
use sr_primitives::{
|
use sp_runtime::{
|
||||||
traits::{BlakeTwo256, IdentityLookup}, testing::Header, weights::Weight, Perbill,
|
traits::{BlakeTwo256, IdentityLookup}, testing::Header, Perbill,
|
||||||
};
|
};
|
||||||
|
|
||||||
impl_outer_origin! {
|
impl_outer_origin! {
|
||||||
|
@ -114,7 +114,7 @@ mod tests {
|
||||||
|
|
||||||
// This function basically just builds a genesis storage key/value store according to
|
// This function basically just builds a genesis storage key/value store according to
|
||||||
// our desired mockup.
|
// our desired mockup.
|
||||||
fn new_test_ext() -> runtime_io::TestExternalities {
|
fn new_test_ext() -> sp_io::TestExternalities {
|
||||||
system::GenesisConfig::default().build_storage::<Test>().unwrap().into()
|
system::GenesisConfig::default().build_storage::<Test>().unwrap().into()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
use primitives::{Pair, Public};
|
use sp_core::{Pair, Public, sr25519};
|
||||||
use node_template_runtime::{
|
use node_template_runtime::{
|
||||||
AccountId, AuraConfig, BalancesConfig, GenesisConfig, GrandpaConfig,
|
AccountId, AuraConfig, BalancesConfig, GenesisConfig, GrandpaConfig,
|
||||||
SudoConfig, IndicesConfig, SystemConfig, WASM_BINARY,
|
SudoConfig, IndicesConfig, SystemConfig, WASM_BINARY, Signature
|
||||||
};
|
};
|
||||||
use aura_primitives::sr25519::{AuthorityId as AuraId};
|
use sp_consensus_aura::sr25519::{AuthorityId as AuraId};
|
||||||
use grandpa_primitives::{AuthorityId as GrandpaId};
|
use grandpa_primitives::{AuthorityId as GrandpaId};
|
||||||
use substrate_service;
|
use sc_service;
|
||||||
|
use sp_runtime::traits::{Verify, IdentifyAccount};
|
||||||
|
|
||||||
// Note this is the URL for the telemetry server
|
// Note this is the URL for the telemetry server
|
||||||
//const STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/";
|
//const STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/";
|
||||||
|
|
||||||
/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.
|
/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.
|
||||||
pub type ChainSpec = substrate_service::ChainSpec<GenesisConfig>;
|
pub type ChainSpec = sc_service::ChainSpec<GenesisConfig>;
|
||||||
|
|
||||||
/// The chain specification option. This is expected to come in from the CLI and
|
/// The chain specification option. This is expected to come in from the CLI and
|
||||||
/// is little more than one of a number of alternatives which can easily be converted
|
/// is little more than one of a number of alternatives which can easily be converted
|
||||||
|
@ -31,8 +32,17 @@ pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Pu
|
||||||
.public()
|
.public()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type AccountPublic = <Signature as Verify>::Signer;
|
||||||
|
|
||||||
|
/// Helper function to generate an account ID from seed
|
||||||
|
pub fn get_account_id_from_seed<TPublic: Public>(seed: &str) -> AccountId where
|
||||||
|
AccountPublic: From<<TPublic::Pair as Pair>::Public>
|
||||||
|
{
|
||||||
|
AccountPublic::from(get_from_seed::<TPublic>(seed)).into_account()
|
||||||
|
}
|
||||||
|
|
||||||
/// Helper function to generate an authority key for Aura
|
/// Helper function to generate an authority key for Aura
|
||||||
pub fn get_authority_keys_from_seed(s: &str) -> (AuraId, GrandpaId) {
|
pub fn get_authority_keys_from_seed(s: &str) -> (AuraId, GrandpaId) {
|
||||||
(
|
(
|
||||||
get_from_seed::<AuraId>(s),
|
get_from_seed::<AuraId>(s),
|
||||||
get_from_seed::<GrandpaId>(s),
|
get_from_seed::<GrandpaId>(s),
|
||||||
|
@ -49,12 +59,12 @@ impl Alternative {
|
||||||
|| testnet_genesis(vec![
|
|| testnet_genesis(vec![
|
||||||
get_authority_keys_from_seed("Alice"),
|
get_authority_keys_from_seed("Alice"),
|
||||||
],
|
],
|
||||||
get_from_seed::<AccountId>("Alice"),
|
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||||
vec![
|
vec![
|
||||||
get_from_seed::<AccountId>("Alice"),
|
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||||
get_from_seed::<AccountId>("Bob"),
|
get_account_id_from_seed::<sr25519::Public>("Bob"),
|
||||||
get_from_seed::<AccountId>("Alice//stash"),
|
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
|
||||||
get_from_seed::<AccountId>("Bob//stash"),
|
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
|
||||||
],
|
],
|
||||||
true),
|
true),
|
||||||
vec![],
|
vec![],
|
||||||
|
@ -69,21 +79,21 @@ impl Alternative {
|
||||||
|| testnet_genesis(vec![
|
|| testnet_genesis(vec![
|
||||||
get_authority_keys_from_seed("Alice"),
|
get_authority_keys_from_seed("Alice"),
|
||||||
get_authority_keys_from_seed("Bob"),
|
get_authority_keys_from_seed("Bob"),
|
||||||
],
|
],
|
||||||
get_from_seed::<AccountId>("Alice"),
|
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||||
vec![
|
vec![
|
||||||
get_from_seed::<AccountId>("Alice"),
|
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||||
get_from_seed::<AccountId>("Bob"),
|
get_account_id_from_seed::<sr25519::Public>("Bob"),
|
||||||
get_from_seed::<AccountId>("Charlie"),
|
get_account_id_from_seed::<sr25519::Public>("Charlie"),
|
||||||
get_from_seed::<AccountId>("Dave"),
|
get_account_id_from_seed::<sr25519::Public>("Dave"),
|
||||||
get_from_seed::<AccountId>("Eve"),
|
get_account_id_from_seed::<sr25519::Public>("Eve"),
|
||||||
get_from_seed::<AccountId>("Ferdie"),
|
get_account_id_from_seed::<sr25519::Public>("Ferdie"),
|
||||||
get_from_seed::<AccountId>("Alice//stash"),
|
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
|
||||||
get_from_seed::<AccountId>("Bob//stash"),
|
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
|
||||||
get_from_seed::<AccountId>("Charlie//stash"),
|
get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),
|
||||||
get_from_seed::<AccountId>("Dave//stash"),
|
get_account_id_from_seed::<sr25519::Public>("Dave//stash"),
|
||||||
get_from_seed::<AccountId>("Eve//stash"),
|
get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
|
||||||
get_from_seed::<AccountId>("Ferdie//stash"),
|
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
|
||||||
],
|
],
|
||||||
true),
|
true),
|
||||||
vec![],
|
vec![],
|
||||||
|
@ -105,7 +115,7 @@ impl Alternative {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn testnet_genesis(initial_authorities: Vec<(AuraId, GrandpaId)>,
|
fn testnet_genesis(initial_authorities: Vec<(AuraId, GrandpaId)>,
|
||||||
root_key: AccountId,
|
root_key: AccountId,
|
||||||
endowed_accounts: Vec<AccountId>,
|
endowed_accounts: Vec<AccountId>,
|
||||||
_enable_println: bool) -> GenesisConfig {
|
_enable_println: bool) -> GenesisConfig {
|
||||||
GenesisConfig {
|
GenesisConfig {
|
||||||
|
|
50
src/cli.rs
50
src/cli.rs
|
@ -1,11 +1,11 @@
|
||||||
use crate::service;
|
use crate::service;
|
||||||
use futures::{future, Future, sync::oneshot};
|
use futures::{future::{select, Map}, FutureExt, TryFutureExt, channel::oneshot, compat::Future01CompatExt};
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use tokio::runtime::Runtime;
|
use tokio::runtime::Runtime;
|
||||||
pub use substrate_cli::{VersionInfo, IntoExit, error};
|
pub use sc_cli::{VersionInfo, IntoExit, error};
|
||||||
use substrate_cli::{informant, parse_and_prepare, ParseAndPrepare, NoCustom};
|
use sc_cli::{display_role, informant, parse_and_prepare, ParseAndPrepare, NoCustom};
|
||||||
use substrate_service::{AbstractService, Roles as ServiceRoles, Configuration};
|
use sc_service::{AbstractService, Roles as ServiceRoles, Configuration};
|
||||||
use aura_primitives::sr25519::{AuthorityPair as AuraPair};
|
use sp_consensus_aura::sr25519::{AuthorityPair as AuraPair};
|
||||||
use crate::chain_spec;
|
use crate::chain_spec;
|
||||||
use log::info;
|
use log::info;
|
||||||
|
|
||||||
|
@ -24,26 +24,28 @@ pub fn run<I, T, E>(args: I, exit: E, version: VersionInfo) -> error::Result<()>
|
||||||
info!(" by {}, 2017, 2018", version.author);
|
info!(" by {}, 2017, 2018", version.author);
|
||||||
info!("Chain specification: {}", config.chain_spec.name());
|
info!("Chain specification: {}", config.chain_spec.name());
|
||||||
info!("Node name: {}", config.name);
|
info!("Node name: {}", config.name);
|
||||||
info!("Roles: {:?}", config.roles);
|
info!("Roles: {}", display_role(&config));
|
||||||
let runtime = Runtime::new().map_err(|e| format!("{:?}", e))?;
|
let runtime = Runtime::new().map_err(|e| format!("{:?}", e))?;
|
||||||
match config.roles {
|
match config.roles {
|
||||||
ServiceRoles::LIGHT => run_until_exit(
|
ServiceRoles::LIGHT => run_until_exit(
|
||||||
runtime,
|
runtime,
|
||||||
service::new_light(config).map_err(|e| format!("{:?}", e))?,
|
service::new_light(config)?,
|
||||||
exit
|
exit
|
||||||
),
|
),
|
||||||
_ => run_until_exit(
|
_ => run_until_exit(
|
||||||
runtime,
|
runtime,
|
||||||
service::new_full(config).map_err(|e| format!("{:?}", e))?,
|
service::new_full(config)?,
|
||||||
exit
|
exit
|
||||||
),
|
),
|
||||||
}.map_err(|e| format!("{:?}", e))
|
}
|
||||||
}),
|
}),
|
||||||
ParseAndPrepare::BuildSpec(cmd) => cmd.run(load_spec),
|
ParseAndPrepare::BuildSpec(cmd) => cmd.run::<NoCustom, _, _, _>(load_spec),
|
||||||
ParseAndPrepare::ExportBlocks(cmd) => cmd.run_with_builder(|config: Config<_>|
|
ParseAndPrepare::ExportBlocks(cmd) => cmd.run_with_builder(|config: Config<_>|
|
||||||
Ok(new_full_start!(config).0), load_spec, exit),
|
Ok(new_full_start!(config).0), load_spec, exit),
|
||||||
ParseAndPrepare::ImportBlocks(cmd) => cmd.run_with_builder(|config: Config<_>|
|
ParseAndPrepare::ImportBlocks(cmd) => cmd.run_with_builder(|config: Config<_>|
|
||||||
Ok(new_full_start!(config).0), load_spec, exit),
|
Ok(new_full_start!(config).0), load_spec, exit),
|
||||||
|
ParseAndPrepare::CheckBlock(cmd) => cmd.run_with_builder(|config: Config<_>|
|
||||||
|
Ok(new_full_start!(config).0), load_spec, exit),
|
||||||
ParseAndPrepare::PurgeChain(cmd) => cmd.run(load_spec),
|
ParseAndPrepare::PurgeChain(cmd) => cmd.run(load_spec),
|
||||||
ParseAndPrepare::RevertChain(cmd) => cmd.run_with_builder(|config: Config<_>|
|
ParseAndPrepare::RevertChain(cmd) => cmd.run_with_builder(|config: Config<_>|
|
||||||
Ok(new_full_start!(config).0), load_spec),
|
Ok(new_full_start!(config).0), load_spec),
|
||||||
|
@ -69,25 +71,37 @@ where
|
||||||
T: AbstractService,
|
T: AbstractService,
|
||||||
E: IntoExit,
|
E: IntoExit,
|
||||||
{
|
{
|
||||||
let (exit_send, exit) = exit_future::signal();
|
let (exit_send, exit) = oneshot::channel();
|
||||||
|
|
||||||
let informant = informant::build(&service);
|
let informant = informant::build(&service);
|
||||||
runtime.executor().spawn(exit.until(informant).map(|_| ()));
|
|
||||||
|
let future = select(exit, informant)
|
||||||
|
.map(|_| Ok(()))
|
||||||
|
.compat();
|
||||||
|
|
||||||
|
runtime.executor().spawn(future);
|
||||||
|
|
||||||
// we eagerly drop the service so that the internal exit future is fired,
|
// we eagerly drop the service so that the internal exit future is fired,
|
||||||
// but we need to keep holding a reference to the global telemetry guard
|
// but we need to keep holding a reference to the global telemetry guard
|
||||||
let _telemetry = service.telemetry();
|
let _telemetry = service.telemetry();
|
||||||
|
|
||||||
let service_res = {
|
let service_res = {
|
||||||
let exit = e.into_exit().map_err(|_| error::Error::Other("Exit future failed.".into()));
|
let exit = e.into_exit();
|
||||||
let service = service.map_err(|err| error::Error::Service(err));
|
let service = service
|
||||||
let select = service.select(exit).map(|_| ()).map_err(|(err, _)| err);
|
.map_err(|err| error::Error::Service(err))
|
||||||
|
.compat();
|
||||||
|
let select = select(service, exit)
|
||||||
|
.map(|_| Ok(()))
|
||||||
|
.compat();
|
||||||
runtime.block_on(select)
|
runtime.block_on(select)
|
||||||
};
|
};
|
||||||
|
|
||||||
exit_send.fire();
|
let _ = exit_send.send(());
|
||||||
|
|
||||||
// TODO [andre]: timeout this future #1318
|
// TODO [andre]: timeout this future #1318
|
||||||
|
|
||||||
|
use futures01::Future;
|
||||||
|
|
||||||
let _ = runtime.shutdown_on_idle().wait();
|
let _ = runtime.shutdown_on_idle().wait();
|
||||||
|
|
||||||
service_res
|
service_res
|
||||||
|
@ -96,7 +110,7 @@ where
|
||||||
// handles ctrl-c
|
// handles ctrl-c
|
||||||
pub struct Exit;
|
pub struct Exit;
|
||||||
impl IntoExit for Exit {
|
impl IntoExit for Exit {
|
||||||
type Exit = future::MapErr<oneshot::Receiver<()>, fn(oneshot::Canceled) -> ()>;
|
type Exit = Map<oneshot::Receiver<()>, fn(Result<(), oneshot::Canceled>) -> ()>;
|
||||||
fn into_exit(self) -> Self::Exit {
|
fn into_exit(self) -> Self::Exit {
|
||||||
// can't use signal directly here because CtrlC takes only `Fn`.
|
// can't use signal directly here because CtrlC takes only `Fn`.
|
||||||
let (exit_send, exit) = oneshot::channel();
|
let (exit_send, exit) = oneshot::channel();
|
||||||
|
@ -109,6 +123,6 @@ impl IntoExit for Exit {
|
||||||
}
|
}
|
||||||
}).expect("Error setting Ctrl-C handler");
|
}).expect("Error setting Ctrl-C handler");
|
||||||
|
|
||||||
exit.map_err(drop)
|
exit.map(drop)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,9 @@ mod chain_spec;
|
||||||
mod service;
|
mod service;
|
||||||
mod cli;
|
mod cli;
|
||||||
|
|
||||||
pub use substrate_cli::{VersionInfo, IntoExit, error};
|
pub use sc_cli::{VersionInfo, IntoExit, error};
|
||||||
|
|
||||||
fn main() {
|
fn main() -> Result<(), cli::error::Error> {
|
||||||
let version = VersionInfo {
|
let version = VersionInfo {
|
||||||
name: "Substrate Node",
|
name: "Substrate Node",
|
||||||
commit: env!("VERGEN_SHA_SHORT"),
|
commit: env!("VERGEN_SHA_SHORT"),
|
||||||
|
@ -21,8 +21,5 @@ fn main() {
|
||||||
support_url: "support.anonymous.an",
|
support_url: "support.anonymous.an",
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Err(e) = cli::run(::std::env::args(), cli::Exit, version) {
|
cli::run(std::env::args(), cli::Exit, version)
|
||||||
eprintln!("Fatal error: {}\n\n{:?}", e, e);
|
|
||||||
std::process::exit(1)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
100
src/service.rs
100
src/service.rs
|
@ -2,17 +2,16 @@
|
||||||
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use substrate_client::LongestChain;
|
use sc_client::LongestChain;
|
||||||
use futures::prelude::*;
|
|
||||||
use node_template_runtime::{self, GenesisConfig, opaque::Block, RuntimeApi};
|
use node_template_runtime::{self, GenesisConfig, opaque::Block, RuntimeApi};
|
||||||
use substrate_service::{error::{Error as ServiceError}, AbstractService, Configuration, ServiceBuilder};
|
use sc_service::{error::{Error as ServiceError}, AbstractService, Configuration, ServiceBuilder};
|
||||||
use transaction_pool::{self, txpool::{Pool as TransactionPool}};
|
use sp_inherents::InherentDataProviders;
|
||||||
use inherents::InherentDataProviders;
|
use sc_network::{construct_simple_protocol};
|
||||||
use network::{construct_simple_protocol};
|
use sc_executor::native_executor_instance;
|
||||||
use substrate_executor::native_executor_instance;
|
pub use sc_executor::NativeExecutor;
|
||||||
pub use substrate_executor::NativeExecutor;
|
use sp_consensus_aura::sr25519::{AuthorityPair as AuraPair};
|
||||||
use aura_primitives::sr25519::{AuthorityPair as AuraPair};
|
|
||||||
use grandpa::{self, FinalityProofProvider as GrandpaFinalityProofProvider};
|
use grandpa::{self, FinalityProofProvider as GrandpaFinalityProofProvider};
|
||||||
|
use sc_basic_authority;
|
||||||
|
|
||||||
// Our native executor instance.
|
// Our native executor instance.
|
||||||
native_executor_instance!(
|
native_executor_instance!(
|
||||||
|
@ -33,28 +32,32 @@ construct_simple_protocol! {
|
||||||
macro_rules! new_full_start {
|
macro_rules! new_full_start {
|
||||||
($config:expr) => {{
|
($config:expr) => {{
|
||||||
let mut import_setup = None;
|
let mut import_setup = None;
|
||||||
let inherent_data_providers = inherents::InherentDataProviders::new();
|
let inherent_data_providers = sp_inherents::InherentDataProviders::new();
|
||||||
|
|
||||||
let builder = substrate_service::ServiceBuilder::new_full::<
|
let builder = sc_service::ServiceBuilder::new_full::<
|
||||||
node_template_runtime::opaque::Block, node_template_runtime::RuntimeApi, crate::service::Executor
|
node_template_runtime::opaque::Block, node_template_runtime::RuntimeApi, crate::service::Executor
|
||||||
>($config)?
|
>($config)?
|
||||||
.with_select_chain(|_config, backend| {
|
.with_select_chain(|_config, backend| {
|
||||||
Ok(substrate_client::LongestChain::new(backend.clone()))
|
Ok(sc_client::LongestChain::new(backend.clone()))
|
||||||
|
})?
|
||||||
|
.with_transaction_pool(|config, client, _fetcher| {
|
||||||
|
let pool_api = sc_transaction_pool::FullChainApi::new(client.clone());
|
||||||
|
let pool = sc_transaction_pool::BasicPool::new(config, pool_api);
|
||||||
|
let maintainer = sc_transaction_pool::FullBasicPoolMaintainer::new(pool.pool().clone(), client);
|
||||||
|
let maintainable_pool = sp_transaction_pool::MaintainableTransactionPool::new(pool, maintainer);
|
||||||
|
Ok(maintainable_pool)
|
||||||
})?
|
})?
|
||||||
.with_transaction_pool(|config, client|
|
|
||||||
Ok(transaction_pool::txpool::Pool::new(config, transaction_pool::FullChainApi::new(client)))
|
|
||||||
)?
|
|
||||||
.with_import_queue(|_config, client, mut select_chain, transaction_pool| {
|
.with_import_queue(|_config, client, mut select_chain, transaction_pool| {
|
||||||
let select_chain = select_chain.take()
|
let select_chain = select_chain.take()
|
||||||
.ok_or_else(|| substrate_service::Error::SelectChainRequired)?;
|
.ok_or_else(|| sc_service::Error::SelectChainRequired)?;
|
||||||
|
|
||||||
let (grandpa_block_import, grandpa_link) =
|
let (grandpa_block_import, grandpa_link) =
|
||||||
grandpa::block_import::<_, _, _, node_template_runtime::RuntimeApi, _, _>(
|
grandpa::block_import::<_, _, _, node_template_runtime::RuntimeApi, _>(
|
||||||
client.clone(), &*client, select_chain
|
client.clone(), &*client, select_chain
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let import_queue = aura::import_queue::<_, _, AuraPair, _>(
|
let import_queue = sc_consensus_aura::import_queue::<_, _, AuraPair, _>(
|
||||||
aura::SlotDuration::get_or_compute(&*client)?,
|
sc_consensus_aura::SlotDuration::get_or_compute(&*client)?,
|
||||||
Box::new(grandpa_block_import.clone()),
|
Box::new(grandpa_block_import.clone()),
|
||||||
Some(Box::new(grandpa_block_import.clone())),
|
Some(Box::new(grandpa_block_import.clone())),
|
||||||
None,
|
None,
|
||||||
|
@ -81,6 +84,11 @@ pub fn new_full<C: Send + Default + 'static>(config: Configuration<C, GenesisCon
|
||||||
let name = config.name.clone();
|
let name = config.name.clone();
|
||||||
let disable_grandpa = config.disable_grandpa;
|
let disable_grandpa = config.disable_grandpa;
|
||||||
|
|
||||||
|
// sentry nodes announce themselves as authorities to the network
|
||||||
|
// and should run the same protocols authorities do, but it should
|
||||||
|
// never actively participate in any consensus process.
|
||||||
|
let participates_in_consensus = is_authority && !config.sentry_mode;
|
||||||
|
|
||||||
let (builder, mut import_setup, inherent_data_providers) = new_full_start!(config);
|
let (builder, mut import_setup, inherent_data_providers) = new_full_start!(config);
|
||||||
|
|
||||||
let (block_import, grandpa_link) =
|
let (block_import, grandpa_link) =
|
||||||
|
@ -93,8 +101,8 @@ pub fn new_full<C: Send + Default + 'static>(config: Configuration<C, GenesisCon
|
||||||
)?
|
)?
|
||||||
.build()?;
|
.build()?;
|
||||||
|
|
||||||
if is_authority {
|
if participates_in_consensus {
|
||||||
let proposer = basic_authorship::ProposerFactory {
|
let proposer = sc_basic_authority::ProposerFactory {
|
||||||
client: service.client(),
|
client: service.client(),
|
||||||
transaction_pool: service.transaction_pool(),
|
transaction_pool: service.transaction_pool(),
|
||||||
};
|
};
|
||||||
|
@ -103,8 +111,11 @@ pub fn new_full<C: Send + Default + 'static>(config: Configuration<C, GenesisCon
|
||||||
let select_chain = service.select_chain()
|
let select_chain = service.select_chain()
|
||||||
.ok_or(ServiceError::SelectChainRequired)?;
|
.ok_or(ServiceError::SelectChainRequired)?;
|
||||||
|
|
||||||
let aura = aura::start_aura::<_, _, _, _, _, AuraPair, _, _, _>(
|
let can_author_with =
|
||||||
aura::SlotDuration::get_or_compute(&*client)?,
|
sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone());
|
||||||
|
|
||||||
|
let aura = sc_consensus_aura::start_aura::<_, _, _, _, _, AuraPair, _, _, _, _>(
|
||||||
|
sc_consensus_aura::SlotDuration::get_or_compute(&*client)?,
|
||||||
client,
|
client,
|
||||||
select_chain,
|
select_chain,
|
||||||
block_import,
|
block_import,
|
||||||
|
@ -113,32 +124,42 @@ pub fn new_full<C: Send + Default + 'static>(config: Configuration<C, GenesisCon
|
||||||
inherent_data_providers.clone(),
|
inherent_data_providers.clone(),
|
||||||
force_authoring,
|
force_authoring,
|
||||||
service.keystore(),
|
service.keystore(),
|
||||||
|
can_author_with,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let select = aura.select(service.on_exit()).then(|_| Ok(()));
|
|
||||||
|
|
||||||
// the AURA authoring task is considered essential, i.e. if it
|
// the AURA authoring task is considered essential, i.e. if it
|
||||||
// fails we take down the service with it.
|
// fails we take down the service with it.
|
||||||
service.spawn_essential_task(select);
|
service.spawn_essential_task(aura);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if the node isn't actively participating in consensus then it doesn't
|
||||||
|
// need a keystore, regardless of which protocol we use below.
|
||||||
|
let keystore = if participates_in_consensus {
|
||||||
|
Some(service.keystore())
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
|
||||||
let grandpa_config = grandpa::Config {
|
let grandpa_config = grandpa::Config {
|
||||||
// FIXME #1578 make this available through chainspec
|
// FIXME #1578 make this available through chainspec
|
||||||
gossip_duration: Duration::from_millis(333),
|
gossip_duration: Duration::from_millis(333),
|
||||||
justification_period: 512,
|
justification_period: 512,
|
||||||
name: Some(name),
|
name: Some(name),
|
||||||
keystore: Some(service.keystore()),
|
observer_enabled: true,
|
||||||
|
keystore,
|
||||||
|
is_authority,
|
||||||
};
|
};
|
||||||
|
|
||||||
match (is_authority, disable_grandpa) {
|
match (is_authority, disable_grandpa) {
|
||||||
(false, false) => {
|
(false, false) => {
|
||||||
// start the lightweight GRANDPA observer
|
// start the lightweight GRANDPA observer
|
||||||
service.spawn_task(Box::new(grandpa::run_grandpa_observer(
|
service.spawn_task(grandpa::run_grandpa_observer(
|
||||||
grandpa_config,
|
grandpa_config,
|
||||||
grandpa_link,
|
grandpa_link,
|
||||||
service.network(),
|
service.network(),
|
||||||
service.on_exit(),
|
service.on_exit(),
|
||||||
)?));
|
service.spawn_task_handle(),
|
||||||
|
)?);
|
||||||
},
|
},
|
||||||
(true, false) => {
|
(true, false) => {
|
||||||
// start the full GRANDPA voter
|
// start the full GRANDPA voter
|
||||||
|
@ -150,6 +171,7 @@ pub fn new_full<C: Send + Default + 'static>(config: Configuration<C, GenesisCon
|
||||||
on_exit: service.on_exit(),
|
on_exit: service.on_exit(),
|
||||||
telemetry_on_connect: Some(service.telemetry_on_connect_stream()),
|
telemetry_on_connect: Some(service.telemetry_on_connect_stream()),
|
||||||
voting_rule: grandpa::VotingRulesBuilder::default().build(),
|
voting_rule: grandpa::VotingRulesBuilder::default().build(),
|
||||||
|
executor: service.spawn_task_handle(),
|
||||||
};
|
};
|
||||||
|
|
||||||
// the GRANDPA voter task is considered infallible, i.e.
|
// the GRANDPA voter task is considered infallible, i.e.
|
||||||
|
@ -178,22 +200,28 @@ pub fn new_light<C: Send + Default + 'static>(config: Configuration<C, GenesisCo
|
||||||
.with_select_chain(|_config, backend| {
|
.with_select_chain(|_config, backend| {
|
||||||
Ok(LongestChain::new(backend.clone()))
|
Ok(LongestChain::new(backend.clone()))
|
||||||
})?
|
})?
|
||||||
.with_transaction_pool(|config, client|
|
.with_transaction_pool(|config, client, fetcher| {
|
||||||
Ok(TransactionPool::new(config, transaction_pool::FullChainApi::new(client)))
|
let fetcher = fetcher
|
||||||
)?
|
.ok_or_else(|| "Trying to start light transaction pool without active fetcher")?;
|
||||||
|
let pool_api = sc_transaction_pool::LightChainApi::new(client.clone(), fetcher.clone());
|
||||||
|
let pool = sc_transaction_pool::BasicPool::new(config, pool_api);
|
||||||
|
let maintainer = sc_transaction_pool::LightBasicPoolMaintainer::with_defaults(pool.pool().clone(), client, fetcher);
|
||||||
|
let maintainable_pool = sp_transaction_pool::MaintainableTransactionPool::new(pool, maintainer);
|
||||||
|
Ok(maintainable_pool)
|
||||||
|
})?
|
||||||
.with_import_queue_and_fprb(|_config, client, backend, fetcher, _select_chain, _tx_pool| {
|
.with_import_queue_and_fprb(|_config, client, backend, fetcher, _select_chain, _tx_pool| {
|
||||||
let fetch_checker = fetcher
|
let fetch_checker = fetcher
|
||||||
.map(|fetcher| fetcher.checker().clone())
|
.map(|fetcher| fetcher.checker().clone())
|
||||||
.ok_or_else(|| "Trying to start light import queue without active fetch checker")?;
|
.ok_or_else(|| "Trying to start light import queue without active fetch checker")?;
|
||||||
let grandpa_block_import = grandpa::light_block_import::<_, _, _, RuntimeApi, _>(
|
let grandpa_block_import = grandpa::light_block_import::<_, _, _, RuntimeApi>(
|
||||||
client.clone(), backend, Arc::new(fetch_checker), client.clone()
|
client.clone(), backend, &*client.clone(), Arc::new(fetch_checker),
|
||||||
)?;
|
)?;
|
||||||
let finality_proof_import = grandpa_block_import.clone();
|
let finality_proof_import = grandpa_block_import.clone();
|
||||||
let finality_proof_request_builder =
|
let finality_proof_request_builder =
|
||||||
finality_proof_import.create_finality_proof_request_builder();
|
finality_proof_import.create_finality_proof_request_builder();
|
||||||
|
|
||||||
let import_queue = aura::import_queue::<_, _, AuraPair, ()>(
|
let import_queue = sc_consensus_aura::import_queue::<_, _, AuraPair, ()>(
|
||||||
aura::SlotDuration::get_or_compute(&*client)?,
|
sc_consensus_aura::SlotDuration::get_or_compute(&*client)?,
|
||||||
Box::new(grandpa_block_import),
|
Box::new(grandpa_block_import),
|
||||||
None,
|
None,
|
||||||
Some(Box::new(finality_proof_import)),
|
Some(Box::new(finality_proof_import)),
|
||||||
|
|
Loading…
Reference in New Issue