Skip to content

Commit

Permalink
Merge pull request #25 from substrate-developer-hub/joshy-alpha-3
Browse files Browse the repository at this point in the history
Update node template to alpha.3
  • Loading branch information
JoshOrndorff authored Mar 10, 2020
2 parents 8b6fe66 + 333b2b4 commit 5b41f0b
Show file tree
Hide file tree
Showing 19 changed files with 3,018 additions and 2,840 deletions.
4,520 changes: 2,346 additions & 2,174 deletions Cargo.lock

Large diffs are not rendered by default.

135 changes: 5 additions & 130 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,134 +1,9 @@
[profile.release]
panic = 'unwind'

[package]
authors = ['Anonymous']
build = 'build.rs'
edition = '2018'
name = 'node-template'
version = '2.0.0'

[build-dependencies]
vergen = '3.0.4'

[build-dependencies.build-script-utils]
git = 'https://github.com/paritytech/substrate.git'
package = 'substrate-build-script-utils'
rev = '3e651110aa06aa835790df63410a29676243fc54'
version = '2.0.0'

[dependencies]
futures = '0.3.1'
log = '0.4.8'
parking_lot = '0.9.0'
tokio = '0.1.22'
trie-root = '0.15.2'

[dependencies.codec]
package = 'parity-scale-codec'
version = '1.0.0'

[dependencies.ctrlc]
features = ['termination']
version = '3.1.3'

[dependencies.futures01]
package = 'futures'
version = '0.1.29'

[dependencies.grandpa]
git = 'https://github.com/paritytech/substrate.git'
package = 'sc-finality-grandpa'
rev = '3e651110aa06aa835790df63410a29676243fc54'
version = '2.0.0'

[dependencies.grandpa-primitives]
git = 'https://github.com/paritytech/substrate.git'
package = 'sp-finality-grandpa'
rev = '3e651110aa06aa835790df63410a29676243fc54'
version = '2.0.0'

[dependencies.node-template-runtime]
path = 'runtime'
version = '2.0.0'

[dependencies.sc-basic-authority]
git = 'https://github.com/paritytech/substrate.git'
rev = '3e651110aa06aa835790df63410a29676243fc54'

[dependencies.sc-cli]
git = 'https://github.com/paritytech/substrate.git'
rev = '3e651110aa06aa835790df63410a29676243fc54'
version = '2.0.0'

[dependencies.sc-client]
git = 'https://github.com/paritytech/substrate.git'
rev = '3e651110aa06aa835790df63410a29676243fc54'
version = '2.0.0'

[dependencies.sc-consensus-aura]
git = 'https://github.com/paritytech/substrate.git'
rev = '3e651110aa06aa835790df63410a29676243fc54'
version = '0.8'

[dependencies.sc-executor]
git = 'https://github.com/paritytech/substrate.git'
rev = '3e651110aa06aa835790df63410a29676243fc54'
version = '2.0.0'

[dependencies.sc-network]
git = 'https://github.com/paritytech/substrate.git'
rev = '3e651110aa06aa835790df63410a29676243fc54'
version = '0.8'

[dependencies.sc-service]
git = 'https://github.com/paritytech/substrate.git'
rev = '3e651110aa06aa835790df63410a29676243fc54'
version = '2.0.0'

[dependencies.sc-transaction-pool]
git = 'https://github.com/paritytech/substrate.git'
rev = '3e651110aa06aa835790df63410a29676243fc54'
version = '2.0.0'

[dependencies.sp-consensus]
git = 'https://github.com/paritytech/substrate.git'
rev = '3e651110aa06aa835790df63410a29676243fc54'
version = '0.8'

[dependencies.sp-consensus-aura]
git = 'https://github.com/paritytech/substrate.git'
rev = '3e651110aa06aa835790df63410a29676243fc54'
version = '0.8'

[dependencies.sp-core]
git = 'https://github.com/paritytech/substrate.git'
rev = '3e651110aa06aa835790df63410a29676243fc54'
version = '2.0.0'

[dependencies.sp-inherents]
git = 'https://github.com/paritytech/substrate.git'
rev = '3e651110aa06aa835790df63410a29676243fc54'
version = '2.0.0'

[dependencies.sp-io]
git = 'https://github.com/paritytech/substrate.git'
rev = '3e651110aa06aa835790df63410a29676243fc54'
version = '2.0.0'

[dependencies.sp-runtime]
git = 'https://github.com/paritytech/substrate.git'
rev = '3e651110aa06aa835790df63410a29676243fc54'
version = '2.0.0'

[dependencies.sp-transaction-pool]
git = 'https://github.com/paritytech/substrate.git'
rev = '3e651110aa06aa835790df63410a29676243fc54'
version = '2.0.0'

[workspace]
members = ['runtime']

[[bin]]
name = 'node-template'
path = 'src/main.rs'
members = [
'node',
'pallets/template',
'runtime',
]
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Substrate Node Template

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

* A FRAME-based runtime
* A template pallet
* Aura block authoring
* Grandpa finality gadget

## Build

Expand Down
112 changes: 112 additions & 0 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
[build-dependencies]
vergen = '3.0.4'

[build-dependencies.build-script-utils]
git = 'https://github.com/paritytech/substrate.git'
package = 'substrate-build-script-utils'
rev = '013c1ee167354a08283fb69915fda56a62fee943'
version = '2.0.0-alpha.3'

[package]
authors = ['Anonymous']
build = 'build.rs'
edition = '2018'
homepage = 'https://substrate.dev'
license = 'Unlicense'
name = 'node-template'
repository = 'https://github.com/paritytech/substrate/'
version = '2.0.0-alpha.3'

[[bin]]
name = 'node-template'

[dependencies]
futures = '0.3.1'
log = '0.4.8'
structopt = '0.3.8'

[dependencies.grandpa]
git = 'https://github.com/paritytech/substrate.git'
package = 'sc-finality-grandpa'
rev = '013c1ee167354a08283fb69915fda56a62fee943'
version = '0.8.0-alpha.3'

[dependencies.grandpa-primitives]
git = 'https://github.com/paritytech/substrate.git'
package = 'sp-finality-grandpa'
rev = '013c1ee167354a08283fb69915fda56a62fee943'
version = '2.0.0-alpha.3'

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

[dependencies.sc-basic-authorship]
git = 'https://github.com/paritytech/substrate.git'
rev = '013c1ee167354a08283fb69915fda56a62fee943'
version = '0.8.0-alpha.3'

[dependencies.sc-cli]
git = 'https://github.com/paritytech/substrate.git'
rev = '013c1ee167354a08283fb69915fda56a62fee943'
version = '0.8.0-alpha.3'

[dependencies.sc-client]
git = 'https://github.com/paritytech/substrate.git'
rev = '013c1ee167354a08283fb69915fda56a62fee943'
version = '0.8.0-alpha.3'

[dependencies.sc-consensus-aura]
git = 'https://github.com/paritytech/substrate.git'
rev = '013c1ee167354a08283fb69915fda56a62fee943'
version = '0.8.0-alpha.3'

[dependencies.sc-executor]
git = 'https://github.com/paritytech/substrate.git'
rev = '013c1ee167354a08283fb69915fda56a62fee943'
version = '0.8.0-alpha.3'

[dependencies.sc-network]
git = 'https://github.com/paritytech/substrate.git'
rev = '013c1ee167354a08283fb69915fda56a62fee943'
version = '0.8.0-alpha.3'

[dependencies.sc-service]
git = 'https://github.com/paritytech/substrate.git'
rev = '013c1ee167354a08283fb69915fda56a62fee943'
version = '0.8.0-alpha.3'

[dependencies.sc-transaction-pool]
git = 'https://github.com/paritytech/substrate.git'
rev = '013c1ee167354a08283fb69915fda56a62fee943'
version = '2.0.0-alpha.3'

[dependencies.sp-consensus]
git = 'https://github.com/paritytech/substrate.git'
rev = '013c1ee167354a08283fb69915fda56a62fee943'
version = '0.8.0-alpha.3'

[dependencies.sp-consensus-aura]
git = 'https://github.com/paritytech/substrate.git'
rev = '013c1ee167354a08283fb69915fda56a62fee943'
version = '0.8.0-alpha.3'

[dependencies.sp-core]
git = 'https://github.com/paritytech/substrate.git'
rev = '013c1ee167354a08283fb69915fda56a62fee943'
version = '2.0.0-alpha.3'

[dependencies.sp-inherents]
git = 'https://github.com/paritytech/substrate.git'
rev = '013c1ee167354a08283fb69915fda56a62fee943'
version = '2.0.0-alpha.3'

[dependencies.sp-runtime]
git = 'https://github.com/paritytech/substrate.git'
rev = '013c1ee167354a08283fb69915fda56a62fee943'
version = '2.0.0-alpha.3'

[dependencies.sp-transaction-pool]
git = 'https://github.com/paritytech/substrate.git'
rev = '013c1ee167354a08283fb69915fda56a62fee943'
version = '2.0.0-alpha.3'
9 changes: 9 additions & 0 deletions node/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use vergen::{ConstantsFlags, generate_cargo_keys};

const ERROR_MSG: &str = "Failed to generate metadata files";

fn main() {
generate_cargo_keys(ConstantsFlags::SHA_SHORT).expect(ERROR_MSG);

build_script_utils::rerun_if_git_head_changed();
}
81 changes: 44 additions & 37 deletions src/chain_spec.rs → node/src/chain_spec.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use sp_core::{Pair, Public, sr25519};
use node_template_runtime::{
AccountId, AuraConfig, BalancesConfig, GenesisConfig, GrandpaConfig,
SudoConfig, IndicesConfig, SystemConfig, WASM_BINARY, Signature
SudoConfig, SystemConfig, WASM_BINARY, Signature
};
use sp_consensus_aura::sr25519::{AuthorityId as AuraId};
use grandpa_primitives::{AuthorityId as GrandpaId};
Expand Down Expand Up @@ -56,17 +56,19 @@ impl Alternative {
Alternative::Development => ChainSpec::from_genesis(
"Development",
"dev",
|| testnet_genesis(vec![
get_authority_keys_from_seed("Alice"),
],
get_account_id_from_seed::<sr25519::Public>("Alice"),
vec![
|| testnet_genesis(
vec![
get_authority_keys_from_seed("Alice"),
],
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
],
true),
vec![
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
],
true,
),
vec![],
None,
None,
Expand All @@ -76,26 +78,28 @@ impl Alternative {
Alternative::LocalTestnet => ChainSpec::from_genesis(
"Local Testnet",
"local_testnet",
|| testnet_genesis(vec![
get_authority_keys_from_seed("Alice"),
get_authority_keys_from_seed("Bob"),
],
get_account_id_from_seed::<sr25519::Public>("Alice"),
vec![
|| testnet_genesis(
vec![
get_authority_keys_from_seed("Alice"),
get_authority_keys_from_seed("Bob"),
],
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_account_id_from_seed::<sr25519::Public>("Charlie"),
get_account_id_from_seed::<sr25519::Public>("Dave"),
get_account_id_from_seed::<sr25519::Public>("Eve"),
get_account_id_from_seed::<sr25519::Public>("Ferdie"),
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),
get_account_id_from_seed::<sr25519::Public>("Dave//stash"),
get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
],
true),
vec![
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_account_id_from_seed::<sr25519::Public>("Charlie"),
get_account_id_from_seed::<sr25519::Public>("Dave"),
get_account_id_from_seed::<sr25519::Public>("Eve"),
get_account_id_from_seed::<sr25519::Public>("Ferdie"),
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),
get_account_id_from_seed::<sr25519::Public>("Dave//stash"),
get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
],
true,
),
vec![],
None,
None,
Expand Down Expand Up @@ -123,21 +127,24 @@ fn testnet_genesis(initial_authorities: Vec<(AuraId, GrandpaId)>,
code: WASM_BINARY.to_vec(),
changes_trie_config: Default::default(),
}),
indices: Some(IndicesConfig {
ids: endowed_accounts.clone(),
}),
balances: Some(BalancesConfig {
balances: endowed_accounts.iter().cloned().map(|k|(k, 1 << 60)).collect(),
vesting: vec![],
}),
sudo: Some(SudoConfig {
key: root_key,
}),
aura: Some(AuraConfig {
authorities: initial_authorities.iter().map(|x| (x.0.clone())).collect(),
}),
grandpa: Some(GrandpaConfig {
authorities: initial_authorities.iter().map(|x| (x.1.clone(), 1)).collect(),
}),
sudo: Some(SudoConfig {
key: root_key,
}),
}
}

pub fn load_spec(id: &str) -> Result<Option<ChainSpec>, String> {
Ok(match Alternative::from(id) {
Some(spec) => Some(spec.load()?),
None => None,
})
}
Loading

0 comments on commit 5b41f0b

Please sign in to comment.