Skip to content
This repository has been archived by the owner on Aug 27, 2024. It is now read-only.

Commit

Permalink
Upgrade to Substrate v2.0.0-alpha.8 (#44)
Browse files Browse the repository at this point in the history
Co-authored-by: Dan Forbes <dan@danforbes.dev>
  • Loading branch information
riusricardo and danforbes authored May 16, 2020
1 parent 3323afa commit 38058f3
Show file tree
Hide file tree
Showing 9 changed files with 677 additions and 565 deletions.
860 changes: 444 additions & 416 deletions Cargo.lock

Large diffs are not rendered by default.

11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# Substrate Node Template

A new Substrate node, ready for hacking. This node includes:

* A FRAME-based runtime
* A template pallet
* Aura block authoring
* Grandpa finality gadget
A new FRAME-based Substrate node, ready for hacking.

## Build

Expand Down Expand Up @@ -61,7 +56,7 @@ cargo run -- \
--chain=local \
--alice \
--node-key 0000000000000000000000000000000000000000000000000000000000000001 \
--telemetry-url ws://telemetry.polkadot.io:1024 \
--telemetry-url 'ws://telemetry.polkadot.io:1024 0' \
--validator
```

Expand All @@ -74,7 +69,7 @@ cargo run -- \
--chain=local \
--bob \
--port 30334 \
--telemetry-url ws://telemetry.polkadot.io:1024 \
--telemetry-url 'ws://telemetry.polkadot.io:1024 0' \
--validator
```

Expand Down
77 changes: 43 additions & 34 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,107 +1,116 @@
[package]
authors = ['Anonymous']
authors = ['Substrate DevHub <https://github.com/substrate-developer-hub>']
build = 'build.rs'
description = 'Substrate Node template'
description = 'Substrate node template'
edition = '2018'
homepage = 'https://substrate.dev'
homepage = 'https://substrate.io'
license = 'Unlicense'
name = 'node-template'
repository = 'https://github.com/paritytech/substrate/'
version = '2.0.0-alpha.7'
repository = 'https://github.com/substrate-developer-hub/substrate-node-template/'
version = '2.0.0-alpha.8'

[package.metadata.docs.rs]
targets = ['x86_64-unknown-linux-gnu']

[dependencies]
futures = '0.3.4'
log = '0.4.8'
parking_lot = '0.10.0'
structopt = '0.3.8'

[dependencies.node-template-runtime]
path = '../runtime'
version = '2.0.0-alpha.7'
version = '2.0.0-alpha.8'

[dependencies.sc-basic-authorship]
git = 'https://github.com/paritytech/substrate.git'
version = '0.8.0-alpha.7'
tag = 'v2.0.0-alpha.7'
tag = 'v2.0.0-alpha.8'
version = '0.8.0-alpha.8'

[dependencies.sc-cli]
git = 'https://github.com/paritytech/substrate.git'
version = '0.8.0-alpha.7'
tag = 'v2.0.0-alpha.7'
tag = 'v2.0.0-alpha.8'
version = '0.8.0-alpha.8'

[dependencies.sc-client-api]
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]
git = 'https://github.com/paritytech/substrate.git'
version = '0.8.0-alpha.7'
tag = 'v2.0.0-alpha.7'
tag = 'v2.0.0-alpha.8'
version = '0.8.0-alpha.8'

[dependencies.sc-consensus-aura]
git = 'https://github.com/paritytech/substrate.git'
version = '0.8.0-alpha.7'
tag = 'v2.0.0-alpha.7'
tag = 'v2.0.0-alpha.8'
version = '0.8.0-alpha.8'

[dependencies.sc-executor]
git = 'https://github.com/paritytech/substrate.git'
version = '0.8.0-alpha.7'
tag = 'v2.0.0-alpha.7'
tag = 'v2.0.0-alpha.8'
version = '0.8.0-alpha.8'

[dependencies.sc-finality-grandpa]
git = 'https://github.com/paritytech/substrate.git'
version = '0.8.0-alpha.7'
tag = 'v2.0.0-alpha.7'
tag = 'v2.0.0-alpha.8'
version = '0.8.0-alpha.8'

[dependencies.sc-network]
git = 'https://github.com/paritytech/substrate.git'
version = '0.8.0-alpha.7'
tag = 'v2.0.0-alpha.7'
tag = 'v2.0.0-alpha.8'
version = '0.8.0-alpha.8'

[dependencies.sc-service]
git = 'https://github.com/paritytech/substrate.git'
version = '0.8.0-alpha.7'
tag = 'v2.0.0-alpha.7'
tag = 'v2.0.0-alpha.8'
version = '0.8.0-alpha.8'

[dependencies.sc-transaction-pool]
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]
git = 'https://github.com/paritytech/substrate.git'
version = '0.8.0-alpha.7'
tag = 'v2.0.0-alpha.7'
tag = 'v2.0.0-alpha.8'
version = '0.8.0-alpha.8'

[dependencies.sp-consensus-aura]
git = 'https://github.com/paritytech/substrate.git'
version = '0.8.0-alpha.7'
tag = 'v2.0.0-alpha.7'
tag = 'v2.0.0-alpha.8'
version = '0.8.0-alpha.8'

[dependencies.sp-core]
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]
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]
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]
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]
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]
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]]
name = 'node-template'
26 changes: 13 additions & 13 deletions node/src/command.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
// Copyright 2017-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.

// Substrate is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0

// Substrate is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// 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::cli::Cli;
use crate::service;
use sc_cli::SubstrateCli;
use sp_consensus_aura::sr25519::AuthorityPair as AuraPair;

impl SubstrateCli for Cli {
fn impl_name() -> &'static str {
Expand Down
43 changes: 31 additions & 12 deletions node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use sc_executor::native_executor_instance;
pub use sc_executor::NativeExecutor;
use sp_consensus_aura::sr25519::{AuthorityPair as AuraPair};
use sc_finality_grandpa::{
self, FinalityProofProvider as GrandpaFinalityProofProvider, SharedVoterState, StorageAndProofProvider
FinalityProofProvider as GrandpaFinalityProofProvider, StorageAndProofProvider, SharedVoterState,
};

// Our native executor instance.
Expand All @@ -28,6 +28,8 @@ native_executor_instance!(
macro_rules! new_full_start {
($config:expr) => {{
use std::sync::Arc;
use sp_consensus_aura::sr25519::AuthorityPair as AuraPair;

let mut import_setup = None;
let inherent_data_providers = sp_inherents::InherentDataProviders::new();

Expand All @@ -41,12 +43,22 @@ macro_rules! new_full_start {
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))
})?
.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()
.ok_or_else(|| sc_service::Error::SelectChainRequired)?;

let (grandpa_block_import, grandpa_link) =
sc_finality_grandpa::block_import(client.clone(), &(client.clone() as Arc<_>), select_chain)?;
let (grandpa_block_import, grandpa_link) = sc_finality_grandpa::block_import(
client.clone(),
&(client.clone() as Arc<_>),
select_chain,
)?;

let aura_block_import = sc_consensus_aura::AuraBlockImport::<_, _, _, AuraPair>::new(
grandpa_block_import.clone(), client.clone(),
Expand All @@ -60,6 +72,7 @@ macro_rules! new_full_start {
client,
inherent_data_providers.clone(),
spawn_task_handle,
registry,
)?;

import_setup = Some((grandpa_block_import, grandpa_link));
Expand All @@ -72,9 +85,7 @@ macro_rules! new_full_start {
}

/// Builds a new service for a full client.
pub fn new_full(config: Configuration)
-> Result<impl AbstractService, ServiceError>
{
pub fn new_full(config: Configuration) -> Result<impl AbstractService, ServiceError> {
let role = config.role.clone();
let force_authoring = config.force_authoring;
let name = config.network.node_name.clone();
Expand Down Expand Up @@ -157,7 +168,7 @@ pub fn new_full(config: Configuration)
telemetry_on_connect: Some(service.telemetry_on_connect_stream()),
voting_rule: sc_finality_grandpa::VotingRulesBuilder::default().build(),
prometheus_registry: service.prometheus_registry(),
shared_voter_state: SharedVoterState::empty()
shared_voter_state: SharedVoterState::empty(),
};

// the GRANDPA voter task is considered infallible, i.e.
Expand All @@ -178,9 +189,7 @@ pub fn new_full(config: Configuration)
}

/// Builds a new service for a light client.
pub fn new_light(config: Configuration)
-> Result<impl AbstractService, ServiceError>
{
pub fn new_light(config: Configuration) -> Result<impl AbstractService, ServiceError> {
let inherent_data_providers = InherentDataProviders::new();

ServiceBuilder::new_light::<Block, RuntimeApi, Executor>(config)?
Expand All @@ -197,7 +206,16 @@ pub fn new_light(config: Configuration)
);
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
.map(|fetcher| fetcher.checker().clone())
.ok_or_else(|| "Trying to start light import queue without active fetch checker")?;
Expand All @@ -219,6 +237,7 @@ pub fn new_light(config: Configuration)
client,
inherent_data_providers.clone(),
spawn_task_handle,
prometheus_registry,
)?;

Ok((import_queue, finality_proof_request_builder))
Expand Down
33 changes: 19 additions & 14 deletions pallets/template/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[package]
authors = ['Anonymous']
description = 'FRAME pallet template'
authors = ['Substrate DevHub <https://github.com/substrate-developer-hub>']
description = 'Substrate FRAME pallet template'
edition = '2018'
homepage = 'https://substrate.dev'
homepage = 'https://substrate.io'
license = 'Unlicense'
name = 'pallet-template'
repository = 'https://github.com/paritytech/substrate/'
version = '2.0.0-alpha.7'
version = '2.0.0-alpha.8'

[package.metadata.docs.rs]
targets = ['x86_64-unknown-linux-gnu']
Expand All @@ -18,29 +18,34 @@ package = 'parity-scale-codec'
version = '1.3.0'

[dependencies.frame-support]
git = 'https://github.com/paritytech/substrate.git'
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]
git = 'https://github.com/paritytech/substrate.git'
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]
git = 'https://github.com/paritytech/substrate.git'
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]
git = 'https://github.com/paritytech/substrate.git'
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]
git = 'https://github.com/paritytech/substrate.git'
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]
default = ['std']
Expand Down
Loading

0 comments on commit 38058f3

Please sign in to comment.