Upgrade to Substrate v2.0.0-alpha.8 (#44)

Co-authored-by: Dan Forbes <dan@danforbes.dev>
main
Ricardo Rius 2020-05-16 15:32:11 +02:00 committed by GitHub
parent 3323afae5a
commit 38058f3ef0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 679 additions and 567 deletions

860
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,6 @@
# Substrate Node Template # Substrate Node Template
A new Substrate node, ready for hacking. This node includes: A new FRAME-based Substrate node, ready for hacking.
* A FRAME-based runtime
* A template pallet
* Aura block authoring
* Grandpa finality gadget
## Build ## Build
@ -61,7 +56,7 @@ cargo run -- \
--chain=local \ --chain=local \
--alice \ --alice \
--node-key 0000000000000000000000000000000000000000000000000000000000000001 \ --node-key 0000000000000000000000000000000000000000000000000000000000000001 \
--telemetry-url ws://telemetry.polkadot.io:1024 \ --telemetry-url 'ws://telemetry.polkadot.io:1024 0' \
--validator --validator
``` ```
@ -74,7 +69,7 @@ cargo run -- \
--chain=local \ --chain=local \
--bob \ --bob \
--port 30334 \ --port 30334 \
--telemetry-url ws://telemetry.polkadot.io:1024 \ --telemetry-url 'ws://telemetry.polkadot.io:1024 0' \
--validator --validator
``` ```

View File

@ -1,13 +1,13 @@
[package] [package]
authors = ['Anonymous'] authors = ['Substrate DevHub <https://github.com/substrate-developer-hub>']
build = 'build.rs' build = 'build.rs'
description = 'Substrate Node template' description = 'Substrate node template'
edition = '2018' edition = '2018'
homepage = 'https://substrate.dev' homepage = 'https://substrate.io'
license = 'Unlicense' license = 'Unlicense'
name = 'node-template' name = 'node-template'
repository = 'https://github.com/paritytech/substrate/' repository = 'https://github.com/substrate-developer-hub/substrate-node-template/'
version = '2.0.0-alpha.7' version = '2.0.0-alpha.8'
[package.metadata.docs.rs] [package.metadata.docs.rs]
targets = ['x86_64-unknown-linux-gnu'] targets = ['x86_64-unknown-linux-gnu']
@ -15,93 +15,102 @@ targets = ['x86_64-unknown-linux-gnu']
[dependencies] [dependencies]
futures = '0.3.4' futures = '0.3.4'
log = '0.4.8' log = '0.4.8'
parking_lot = '0.10.0'
structopt = '0.3.8' structopt = '0.3.8'
[dependencies.node-template-runtime] [dependencies.node-template-runtime]
path = '../runtime' path = '../runtime'
version = '2.0.0-alpha.7' version = '2.0.0-alpha.8'
[dependencies.sc-basic-authorship] [dependencies.sc-basic-authorship]
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
version = '0.8.0-alpha.7' tag = 'v2.0.0-alpha.8'
tag = 'v2.0.0-alpha.7' version = '0.8.0-alpha.8'
[dependencies.sc-cli] [dependencies.sc-cli]
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
version = '0.8.0-alpha.7' tag = 'v2.0.0-alpha.8'
tag = 'v2.0.0-alpha.7' version = '0.8.0-alpha.8'
[dependencies.sc-client-api] [dependencies.sc-client-api]
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-alpha.7' tag = 'v2.0.0-alpha.8'
version = '2.0.0-alpha.8'
[dependencies.sc-consensus] [dependencies.sc-consensus]
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
version = '0.8.0-alpha.7' tag = 'v2.0.0-alpha.8'
tag = 'v2.0.0-alpha.7' version = '0.8.0-alpha.8'
[dependencies.sc-consensus-aura] [dependencies.sc-consensus-aura]
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
version = '0.8.0-alpha.7' tag = 'v2.0.0-alpha.8'
tag = 'v2.0.0-alpha.7' version = '0.8.0-alpha.8'
[dependencies.sc-executor] [dependencies.sc-executor]
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
version = '0.8.0-alpha.7' tag = 'v2.0.0-alpha.8'
tag = 'v2.0.0-alpha.7' version = '0.8.0-alpha.8'
[dependencies.sc-finality-grandpa] [dependencies.sc-finality-grandpa]
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
version = '0.8.0-alpha.7' tag = 'v2.0.0-alpha.8'
tag = 'v2.0.0-alpha.7' version = '0.8.0-alpha.8'
[dependencies.sc-network] [dependencies.sc-network]
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
version = '0.8.0-alpha.7' tag = 'v2.0.0-alpha.8'
tag = 'v2.0.0-alpha.7' version = '0.8.0-alpha.8'
[dependencies.sc-service] [dependencies.sc-service]
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
version = '0.8.0-alpha.7' tag = 'v2.0.0-alpha.8'
tag = 'v2.0.0-alpha.7' version = '0.8.0-alpha.8'
[dependencies.sc-transaction-pool] [dependencies.sc-transaction-pool]
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-alpha.7' tag = 'v2.0.0-alpha.8'
version = '2.0.0-alpha.8'
[dependencies.sp-consensus] [dependencies.sp-consensus]
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
version = '0.8.0-alpha.7' tag = 'v2.0.0-alpha.8'
tag = 'v2.0.0-alpha.7' version = '0.8.0-alpha.8'
[dependencies.sp-consensus-aura] [dependencies.sp-consensus-aura]
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
version = '0.8.0-alpha.7' tag = 'v2.0.0-alpha.8'
tag = 'v2.0.0-alpha.7' version = '0.8.0-alpha.8'
[dependencies.sp-core] [dependencies.sp-core]
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-alpha.7' tag = 'v2.0.0-alpha.8'
version = '2.0.0-alpha.8'
[dependencies.sp-finality-grandpa] [dependencies.sp-finality-grandpa]
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-alpha.7' tag = 'v2.0.0-alpha.8'
version = '2.0.0-alpha.8'
[dependencies.sp-inherents] [dependencies.sp-inherents]
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-alpha.7' tag = 'v2.0.0-alpha.8'
version = '2.0.0-alpha.8'
[dependencies.sp-runtime] [dependencies.sp-runtime]
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-alpha.7' tag = 'v2.0.0-alpha.8'
version = '2.0.0-alpha.8'
[dependencies.sp-transaction-pool] [dependencies.sp-transaction-pool]
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-alpha.7' tag = 'v2.0.0-alpha.8'
version = '2.0.0-alpha.8'
[build-dependencies.substrate-build-script-utils] [build-dependencies.substrate-build-script-utils]
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-alpha.7' tag = 'v2.0.0-alpha.8'
version = '2.0.0-alpha.8'
[[bin]] [[bin]]
name = 'node-template' name = 'node-template'

View File

@ -1,24 +1,24 @@
// Copyright 2017-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate. // This file is part of Substrate.
// Substrate is free software: you can redistribute it and/or modify // Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
// it under the terms of the GNU General Public License as published by // SPDX-License-Identifier: Apache-2.0
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Substrate is distributed in the hope that it will be useful, // Licensed under the Apache License, Version 2.0 (the "License");
// but WITHOUT ANY WARRANTY; without even the implied warranty of // you may not use this file except in compliance with the License.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // You may obtain a copy of the License at
// GNU General Public License for more details. //
// http://www.apache.org/licenses/LICENSE-2.0
// You should have received a copy of the GNU General Public License //
// along with Substrate. If not, see <http://www.gnu.org/licenses/>. // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::chain_spec; use crate::chain_spec;
use crate::cli::Cli; use crate::cli::Cli;
use crate::service; use crate::service;
use sc_cli::SubstrateCli; use sc_cli::SubstrateCli;
use sp_consensus_aura::sr25519::AuthorityPair as AuraPair;
impl SubstrateCli for Cli { impl SubstrateCli for Cli {
fn impl_name() -> &'static str { fn impl_name() -> &'static str {

View File

@ -11,7 +11,7 @@ use sc_executor::native_executor_instance;
pub use sc_executor::NativeExecutor; pub use sc_executor::NativeExecutor;
use sp_consensus_aura::sr25519::{AuthorityPair as AuraPair}; use sp_consensus_aura::sr25519::{AuthorityPair as AuraPair};
use sc_finality_grandpa::{ use sc_finality_grandpa::{
self, FinalityProofProvider as GrandpaFinalityProofProvider, SharedVoterState, StorageAndProofProvider FinalityProofProvider as GrandpaFinalityProofProvider, StorageAndProofProvider, SharedVoterState,
}; };
// Our native executor instance. // Our native executor instance.
@ -28,6 +28,8 @@ native_executor_instance!(
macro_rules! new_full_start { macro_rules! new_full_start {
($config:expr) => {{ ($config:expr) => {{
use std::sync::Arc; use std::sync::Arc;
use sp_consensus_aura::sr25519::AuthorityPair as AuraPair;
let mut import_setup = None; let mut import_setup = None;
let inherent_data_providers = sp_inherents::InherentDataProviders::new(); let inherent_data_providers = sp_inherents::InherentDataProviders::new();
@ -41,12 +43,22 @@ macro_rules! new_full_start {
let pool_api = sc_transaction_pool::FullChainApi::new(client.clone()); let pool_api = sc_transaction_pool::FullChainApi::new(client.clone());
Ok(sc_transaction_pool::BasicPool::new(config, std::sync::Arc::new(pool_api), prometheus_registry)) Ok(sc_transaction_pool::BasicPool::new(config, std::sync::Arc::new(pool_api), prometheus_registry))
})? })?
.with_import_queue(|_config, client, mut select_chain, _transaction_pool, spawn_task_handle| { .with_import_queue(|
_config,
client,
mut select_chain,
_transaction_pool,
spawn_task_handle,
registry,
| {
let select_chain = select_chain.take() let select_chain = select_chain.take()
.ok_or_else(|| sc_service::Error::SelectChainRequired)?; .ok_or_else(|| sc_service::Error::SelectChainRequired)?;
let (grandpa_block_import, grandpa_link) = let (grandpa_block_import, grandpa_link) = sc_finality_grandpa::block_import(
sc_finality_grandpa::block_import(client.clone(), &(client.clone() as Arc<_>), select_chain)?; client.clone(),
&(client.clone() as Arc<_>),
select_chain,
)?;
let aura_block_import = sc_consensus_aura::AuraBlockImport::<_, _, _, AuraPair>::new( let aura_block_import = sc_consensus_aura::AuraBlockImport::<_, _, _, AuraPair>::new(
grandpa_block_import.clone(), client.clone(), grandpa_block_import.clone(), client.clone(),
@ -60,6 +72,7 @@ macro_rules! new_full_start {
client, client,
inherent_data_providers.clone(), inherent_data_providers.clone(),
spawn_task_handle, spawn_task_handle,
registry,
)?; )?;
import_setup = Some((grandpa_block_import, grandpa_link)); import_setup = Some((grandpa_block_import, grandpa_link));
@ -72,9 +85,7 @@ macro_rules! new_full_start {
} }
/// Builds a new service for a full client. /// Builds a new service for a full client.
pub fn new_full(config: Configuration) pub fn new_full(config: Configuration) -> Result<impl AbstractService, ServiceError> {
-> Result<impl AbstractService, ServiceError>
{
let role = config.role.clone(); let role = config.role.clone();
let force_authoring = config.force_authoring; let force_authoring = config.force_authoring;
let name = config.network.node_name.clone(); let name = config.network.node_name.clone();
@ -157,7 +168,7 @@ pub fn new_full(config: Configuration)
telemetry_on_connect: Some(service.telemetry_on_connect_stream()), telemetry_on_connect: Some(service.telemetry_on_connect_stream()),
voting_rule: sc_finality_grandpa::VotingRulesBuilder::default().build(), voting_rule: sc_finality_grandpa::VotingRulesBuilder::default().build(),
prometheus_registry: service.prometheus_registry(), prometheus_registry: service.prometheus_registry(),
shared_voter_state: SharedVoterState::empty() shared_voter_state: SharedVoterState::empty(),
}; };
// the GRANDPA voter task is considered infallible, i.e. // the GRANDPA voter task is considered infallible, i.e.
@ -178,9 +189,7 @@ pub fn new_full(config: Configuration)
} }
/// Builds a new service for a light client. /// Builds a new service for a light client.
pub fn new_light(config: Configuration) pub fn new_light(config: Configuration) -> Result<impl AbstractService, ServiceError> {
-> Result<impl AbstractService, ServiceError>
{
let inherent_data_providers = InherentDataProviders::new(); let inherent_data_providers = InherentDataProviders::new();
ServiceBuilder::new_light::<Block, RuntimeApi, Executor>(config)? ServiceBuilder::new_light::<Block, RuntimeApi, Executor>(config)?
@ -197,7 +206,16 @@ pub fn new_light(config: Configuration)
); );
Ok(pool) Ok(pool)
})? })?
.with_import_queue_and_fprb(|_config, client, backend, fetcher, _select_chain, _tx_pool, spawn_task_handle| { .with_import_queue_and_fprb(|
_config,
client,
backend,
fetcher,
_select_chain,
_tx_pool,
spawn_task_handle,
prometheus_registry,
| {
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")?;
@ -219,6 +237,7 @@ pub fn new_light(config: Configuration)
client, client,
inherent_data_providers.clone(), inherent_data_providers.clone(),
spawn_task_handle, spawn_task_handle,
prometheus_registry,
)?; )?;
Ok((import_queue, finality_proof_request_builder)) Ok((import_queue, finality_proof_request_builder))

View File

@ -1,12 +1,12 @@
[package] [package]
authors = ['Anonymous'] authors = ['Substrate DevHub <https://github.com/substrate-developer-hub>']
description = 'FRAME pallet template' description = 'Substrate FRAME pallet template'
edition = '2018' edition = '2018'
homepage = 'https://substrate.dev' homepage = 'https://substrate.io'
license = 'Unlicense' license = 'Unlicense'
name = 'pallet-template' name = 'pallet-template'
repository = 'https://github.com/paritytech/substrate/' repository = 'https://github.com/paritytech/substrate/'
version = '2.0.0-alpha.7' version = '2.0.0-alpha.8'
[package.metadata.docs.rs] [package.metadata.docs.rs]
targets = ['x86_64-unknown-linux-gnu'] targets = ['x86_64-unknown-linux-gnu']
@ -18,29 +18,34 @@ package = 'parity-scale-codec'
version = '1.3.0' version = '1.3.0'
[dependencies.frame-support] [dependencies.frame-support]
git = 'https://github.com/paritytech/substrate.git'
default-features = false default-features = false
tag = 'v2.0.0-alpha.7' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-alpha.8'
version = '2.0.0-alpha.8'
[dependencies.frame-system] [dependencies.frame-system]
git = 'https://github.com/paritytech/substrate.git'
default-features = false default-features = false
tag = 'v2.0.0-alpha.7' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-alpha.8'
version = '2.0.0-alpha.8'
[dev-dependencies.sp-core] [dev-dependencies.sp-core]
git = 'https://github.com/paritytech/substrate.git'
default-features = false default-features = false
tag = 'v2.0.0-alpha.7' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-alpha.8'
version = '2.0.0-alpha.8'
[dev-dependencies.sp-io] [dev-dependencies.sp-io]
git = 'https://github.com/paritytech/substrate.git'
default-features = false default-features = false
tag = 'v2.0.0-alpha.7' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-alpha.8'
version = '2.0.0-alpha.8'
[dev-dependencies.sp-runtime] [dev-dependencies.sp-runtime]
git = 'https://github.com/paritytech/substrate.git'
default-features = false default-features = false
tag = 'v2.0.0-alpha.7' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-alpha.8'
version = '2.0.0-alpha.8'
[features] [features]
default = ['std'] default = ['std']

View File

@ -36,11 +36,11 @@ impl system::Trait for Test {
type Event = (); type Event = ();
type BlockHashCount = BlockHashCount; type BlockHashCount = BlockHashCount;
type MaximumBlockWeight = MaximumBlockWeight; type MaximumBlockWeight = MaximumBlockWeight;
type DbWeight = ();
type BlockExecutionWeight = ();
type ExtrinsicBaseWeight = ();
type MaximumBlockLength = MaximumBlockLength; type MaximumBlockLength = MaximumBlockLength;
type AvailableBlockRatio = AvailableBlockRatio; type AvailableBlockRatio = AvailableBlockRatio;
type BlockExecutionWeight = ();
type DbWeight = ();
type ExtrinsicBaseWeight = ();
type Version = (); type Version = ();
type ModuleToIndex = (); type ModuleToIndex = ();
type AccountData = (); type AccountData = ();

View File

@ -1,14 +1,16 @@
[dependencies.aura] [dependencies.aura]
git = 'https://github.com/paritytech/substrate.git'
default-features = false default-features = false
git = 'https://github.com/paritytech/substrate.git'
package = 'pallet-aura' package = 'pallet-aura'
tag = 'v2.0.0-alpha.7' tag = 'v2.0.0-alpha.8'
version = '2.0.0-alpha.8'
[dependencies.balances] [dependencies.balances]
git = 'https://github.com/paritytech/substrate.git'
default-features = false default-features = false
git = 'https://github.com/paritytech/substrate.git'
package = 'pallet-balances' package = 'pallet-balances'
tag = 'v2.0.0-alpha.7' tag = 'v2.0.0-alpha.8'
version = '2.0.0-alpha.8'
[dependencies.codec] [dependencies.codec]
default-features = false default-features = false
@ -17,26 +19,30 @@ package = 'parity-scale-codec'
version = '1.3.0' version = '1.3.0'
[dependencies.frame-executive] [dependencies.frame-executive]
git = 'https://github.com/paritytech/substrate.git'
default-features = false default-features = false
tag = 'v2.0.0-alpha.7' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-alpha.8'
version = '2.0.0-alpha.8'
[dependencies.frame-support] [dependencies.frame-support]
git = 'https://github.com/paritytech/substrate.git'
default-features = false default-features = false
tag = 'v2.0.0-alpha.7' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-alpha.8'
version = '2.0.0-alpha.8'
[dependencies.grandpa] [dependencies.grandpa]
git = 'https://github.com/paritytech/substrate.git'
default-features = false default-features = false
git = 'https://github.com/paritytech/substrate.git'
package = 'pallet-grandpa' package = 'pallet-grandpa'
tag = 'v2.0.0-alpha.7' tag = 'v2.0.0-alpha.8'
version = '2.0.0-alpha.8'
[dependencies.randomness-collective-flip] [dependencies.randomness-collective-flip]
git = 'https://github.com/paritytech/substrate.git'
default-features = false default-features = false
git = 'https://github.com/paritytech/substrate.git'
package = 'pallet-randomness-collective-flip' package = 'pallet-randomness-collective-flip'
tag = 'v2.0.0-alpha.7' tag = 'v2.0.0-alpha.8'
version = '2.0.0-alpha.8'
[dependencies.serde] [dependencies.serde]
features = ['derive'] features = ['derive']
@ -44,109 +50,125 @@ optional = true
version = '1.0.101' version = '1.0.101'
[dependencies.sp-api] [dependencies.sp-api]
git = 'https://github.com/paritytech/substrate.git'
default-features = false default-features = false
tag = 'v2.0.0-alpha.7' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-alpha.8'
version = '2.0.0-alpha.8'
[dependencies.sp-block-builder] [dependencies.sp-block-builder]
git = 'https://github.com/paritytech/substrate.git'
default-features = false default-features = false
tag = 'v2.0.0-alpha.7' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-alpha.8'
version = '2.0.0-alpha.8'
[dependencies.sp-consensus-aura] [dependencies.sp-consensus-aura]
git = 'https://github.com/paritytech/substrate.git'
default-features = false default-features = false
version = '0.8.0-alpha.7' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-alpha.7' tag = 'v2.0.0-alpha.8'
version = '0.8.0-alpha.8'
[dependencies.sp-core] [dependencies.sp-core]
git = 'https://github.com/paritytech/substrate.git'
default-features = false default-features = false
tag = 'v2.0.0-alpha.7' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-alpha.8'
version = '2.0.0-alpha.8'
[dependencies.sp-inherents] [dependencies.sp-inherents]
git = 'https://github.com/paritytech/substrate.git'
default-features = false default-features = false
tag = 'v2.0.0-alpha.7' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-alpha.8'
version = '2.0.0-alpha.8'
[dependencies.sp-io] [dependencies.sp-io]
git = 'https://github.com/paritytech/substrate.git'
default-features = false default-features = false
tag = 'v2.0.0-alpha.7' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-alpha.8'
version = '2.0.0-alpha.8'
[dependencies.sp-offchain] [dependencies.sp-offchain]
git = 'https://github.com/paritytech/substrate.git'
default-features = false default-features = false
tag = 'v2.0.0-alpha.7' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-alpha.8'
version = '2.0.0-alpha.8'
[dependencies.sp-runtime] [dependencies.sp-runtime]
git = 'https://github.com/paritytech/substrate.git'
default-features = false default-features = false
tag = 'v2.0.0-alpha.7' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-alpha.8'
version = '2.0.0-alpha.8'
[dependencies.sp-session] [dependencies.sp-session]
git = 'https://github.com/paritytech/substrate.git'
default-features = false default-features = false
tag = 'v2.0.0-alpha.7' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-alpha.8'
version = '2.0.0-alpha.8'
[dependencies.sp-std] [dependencies.sp-std]
git = 'https://github.com/paritytech/substrate.git'
default-features = false default-features = false
tag = 'v2.0.0-alpha.7' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-alpha.8'
version = '2.0.0-alpha.8'
[dependencies.sp-transaction-pool] [dependencies.sp-transaction-pool]
git = 'https://github.com/paritytech/substrate.git'
default-features = false default-features = false
tag = 'v2.0.0-alpha.7' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-alpha.8'
version = '2.0.0-alpha.8'
[dependencies.sp-version] [dependencies.sp-version]
git = 'https://github.com/paritytech/substrate.git'
default-features = false default-features = false
tag = 'v2.0.0-alpha.7' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-alpha.8'
version = '2.0.0-alpha.8'
[dependencies.sudo] [dependencies.sudo]
git = 'https://github.com/paritytech/substrate.git'
default-features = false default-features = false
git = 'https://github.com/paritytech/substrate.git'
package = 'pallet-sudo' package = 'pallet-sudo'
tag = 'v2.0.0-alpha.7' tag = 'v2.0.0-alpha.8'
version = '2.0.0-alpha.8'
[dependencies.system] [dependencies.system]
git = 'https://github.com/paritytech/substrate.git'
default-features = false default-features = false
git = 'https://github.com/paritytech/substrate.git'
package = 'frame-system' package = 'frame-system'
tag = 'v2.0.0-alpha.7' tag = 'v2.0.0-alpha.8'
version = '2.0.0-alpha.8'
[dependencies.template] [dependencies.template]
default-features = false default-features = false
package = 'pallet-template' package = 'pallet-template'
path = '../pallets/template' path = '../pallets/template'
version = '2.0.0-alpha.7' version = '2.0.0-alpha.8'
[dependencies.timestamp] [dependencies.timestamp]
git = 'https://github.com/paritytech/substrate.git'
default-features = false default-features = false
git = 'https://github.com/paritytech/substrate.git'
package = 'pallet-timestamp' package = 'pallet-timestamp'
tag = 'v2.0.0-alpha.7' tag = 'v2.0.0-alpha.8'
version = '2.0.0-alpha.8'
[dependencies.transaction-payment] [dependencies.transaction-payment]
git = 'https://github.com/paritytech/substrate.git'
default-features = false default-features = false
git = 'https://github.com/paritytech/substrate.git'
package = 'pallet-transaction-payment' package = 'pallet-transaction-payment'
tag = 'v2.0.0-alpha.7' tag = 'v2.0.0-alpha.8'
version = '2.0.0-alpha.8'
[build-dependencies.wasm-builder-runner] [build-dependencies.wasm-builder-runner]
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
package = 'substrate-wasm-builder-runner' package = 'substrate-wasm-builder-runner'
tag = 'v2.0.0-alpha.8'
version = '1.0.5' version = '1.0.5'
[package] [package]
authors = ['Anonymous'] authors = ['Substrate DevHub <https://github.com/substrate-developer-hub>']
edition = '2018' edition = '2018'
homepage = 'https://substrate.dev' homepage = 'https://substrate.io'
license = 'Unlicense' license = 'Unlicense'
name = 'node-template-runtime' name = 'node-template-runtime'
repository = 'https://github.com/paritytech/substrate/' repository = 'https://github.com/substrate-developer-hub/substrate-node-template/'
version = '2.0.0-alpha.7' version = '2.0.0-alpha.8'
[package.metadata.docs.rs] [package.metadata.docs.rs]
targets = ['x86_64-unknown-linux-gnu'] targets = ['x86_64-unknown-linux-gnu']

View File

@ -9,17 +9,17 @@
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
use sp_std::prelude::*; use sp_std::prelude::*;
use sp_core::OpaqueMetadata; use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
use sp_runtime::{ use sp_runtime::{
ApplyExtrinsicResult, generic, create_runtime_str, impl_opaque_keys, MultiSignature, ApplyExtrinsicResult, generic, create_runtime_str, impl_opaque_keys, MultiSignature,
transaction_validity::{TransactionValidity, TransactionSource}, transaction_validity::{TransactionValidity, TransactionSource},
}; };
use sp_runtime::traits::{ use sp_runtime::traits::{
BlakeTwo256, Block as BlockT, IdentityLookup, Verify, ConvertInto, IdentifyAccount BlakeTwo256, Block as BlockT, IdentityLookup, Verify, ConvertInto, IdentifyAccount, NumberFor,
}; };
use sp_api::impl_runtime_apis; use sp_api::impl_runtime_apis;
use sp_consensus_aura::sr25519::AuthorityId as AuraId; use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use grandpa::AuthorityList as GrandpaAuthorityList; use grandpa::{AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList};
use grandpa::fg_primitives; use grandpa::fg_primitives;
use sp_version::RuntimeVersion; use sp_version::RuntimeVersion;
#[cfg(feature = "std")] #[cfg(feature = "std")]
@ -32,8 +32,8 @@ pub use timestamp::Call as TimestampCall;
pub use balances::Call as BalancesCall; pub use balances::Call as BalancesCall;
pub use sp_runtime::{Permill, Perbill}; pub use sp_runtime::{Permill, Perbill};
pub use frame_support::{ pub use frame_support::{
StorageValue, construct_runtime, parameter_types, construct_runtime, parameter_types, StorageValue,
traits::Randomness, traits::{KeyOwnerProofSystem, Randomness},
weights::{ weights::{
Weight, Weight,
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND}, constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
@ -100,8 +100,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
authoring_version: 1, authoring_version: 1,
spec_version: 1, spec_version: 1,
impl_version: 1, impl_version: 1,
transaction_version: 1,
apis: RUNTIME_API_VERSIONS, apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
}; };
pub const MILLISECS_PER_BLOCK: u64 = 6000; pub const MILLISECS_PER_BLOCK: u64 = 6000;
@ -123,7 +123,7 @@ pub fn native_version() -> NativeVersion {
} }
parameter_types! { parameter_types! {
pub const BlockHashCount: BlockNumber = 250; pub const BlockHashCount: BlockNumber = 2400;
/// We allow for 2 seconds of compute with a 6 second average block time. /// We allow for 2 seconds of compute with a 6 second average block time.
pub const MaximumBlockWeight: Weight = 2 * WEIGHT_PER_SECOND; pub const MaximumBlockWeight: Weight = 2 * WEIGHT_PER_SECOND;
pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75); pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);
@ -156,18 +156,18 @@ impl system::Trait for Runtime {
type BlockHashCount = BlockHashCount; type BlockHashCount = BlockHashCount;
/// Maximum weight of each block. /// Maximum weight of each block.
type MaximumBlockWeight = MaximumBlockWeight; type MaximumBlockWeight = MaximumBlockWeight;
/// The weight of database operations that the runtime can invoke.
type DbWeight = RocksDbWeight;
/// The weight of the overhead invoked on the block import process, independent of the
/// extrinsics included in that block.
type BlockExecutionWeight = BlockExecutionWeight;
/// The base weight of any extrinsic processed by the runtime, independent of the
/// logic of that extrinsic. (Signature verification, nonce increment, fee, etc...)
type ExtrinsicBaseWeight = ExtrinsicBaseWeight;
/// Maximum size of all encoded transactions (in bytes) that are allowed in one block. /// Maximum size of all encoded transactions (in bytes) that are allowed in one block.
type MaximumBlockLength = MaximumBlockLength; type MaximumBlockLength = MaximumBlockLength;
/// Portion of the block weight that is available to all normal transactions. /// Portion of the block weight that is available to all normal transactions.
type AvailableBlockRatio = AvailableBlockRatio; type AvailableBlockRatio = AvailableBlockRatio;
/// The weight of the overhead invoked on the block import process, independent of the
/// extrinsics included in that block.
type BlockExecutionWeight = BlockExecutionWeight;
/// The weight of database operations that the runtime can invoke.
type DbWeight = RocksDbWeight;
/// The base weight of any extrinsic processed by the runtime, independent of the
/// logic of that extrinsic. (Signature verification, nonce increment, fee, etc...)
type ExtrinsicBaseWeight = ExtrinsicBaseWeight;
/// Version of the runtime. /// Version of the runtime.
type Version = Version; type Version = Version;
/// Converts a module to the index of the module in `construct_runtime!`. /// Converts a module to the index of the module in `construct_runtime!`.
@ -188,6 +188,19 @@ impl aura::Trait for Runtime {
impl grandpa::Trait for Runtime { impl grandpa::Trait for Runtime {
type Event = Event; type Event = Event;
type Call = Call;
type KeyOwnerProofSystem = ();
type KeyOwnerProof =
<Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;
type KeyOwnerIdentification = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
KeyTypeId,
GrandpaId,
)>>::IdentificationTuple;
type HandleEquivocation = ();
} }
parameter_types! { parameter_types! {
@ -268,7 +281,8 @@ pub type SignedBlock = generic::SignedBlock<Block>;
pub type BlockId = generic::BlockId<Block>; pub type BlockId = generic::BlockId<Block>;
/// The SignedExtension to the basic transaction logic. /// The SignedExtension to the basic transaction logic.
pub type SignedExtra = ( pub type SignedExtra = (
system::CheckVersion<Runtime>, system::CheckSpecVersion<Runtime>,
system::CheckTxVersion<Runtime>,
system::CheckGenesis<Runtime>, system::CheckGenesis<Runtime>,
system::CheckEra<Runtime>, system::CheckEra<Runtime>,
system::CheckNonce<Runtime>, system::CheckNonce<Runtime>,
@ -360,7 +374,7 @@ impl_runtime_apis! {
fn decode_session_keys( fn decode_session_keys(
encoded: Vec<u8>, encoded: Vec<u8>,
) -> Option<Vec<(Vec<u8>, sp_core::crypto::KeyTypeId)>> { ) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {
opaque::SessionKeys::decode_into_raw_public_keys(&encoded) opaque::SessionKeys::decode_into_raw_public_keys(&encoded)
} }
} }
@ -369,5 +383,25 @@ impl_runtime_apis! {
fn grandpa_authorities() -> GrandpaAuthorityList { fn grandpa_authorities() -> GrandpaAuthorityList {
Grandpa::grandpa_authorities() Grandpa::grandpa_authorities()
} }
fn submit_report_equivocation_extrinsic(
_equivocation_proof: fg_primitives::EquivocationProof<
<Block as BlockT>::Hash,
NumberFor<Block>,
>,
_key_owner_proof: fg_primitives::OpaqueKeyOwnershipProof,
) -> Option<()> {
None
}
fn generate_key_ownership_proof(
_set_id: fg_primitives::SetId,
_authority_id: GrandpaId,
) -> Option<fg_primitives::OpaqueKeyOwnershipProof> {
// NOTE: this is the only implementation possible since we've
// defined our key owner proof type as a bottom type (i.e. a type
// with no values).
None
}
} }
} }