Commit 26082b48 authored by Gav Wood's avatar Gav Wood
Browse files

Upgrade key

parent 9bbcfe01
Pipeline #27402 passed with stages
in 14 minutes and 58 seconds
...@@ -2081,6 +2081,7 @@ dependencies = [ ...@@ -2081,6 +2081,7 @@ dependencies = [
"srml-system 0.1.0 (git+https://github.com/paritytech/substrate)", "srml-system 0.1.0 (git+https://github.com/paritytech/substrate)",
"srml-timestamp 0.1.0 (git+https://github.com/paritytech/substrate)", "srml-timestamp 0.1.0 (git+https://github.com/paritytech/substrate)",
"srml-treasury 0.1.0 (git+https://github.com/paritytech/substrate)", "srml-treasury 0.1.0 (git+https://github.com/paritytech/substrate)",
"srml-upgrade-key 0.1.0 (git+https://github.com/paritytech/substrate)",
"substrate-client 0.1.0 (git+https://github.com/paritytech/substrate)", "substrate-client 0.1.0 (git+https://github.com/paritytech/substrate)",
"substrate-consensus-aura-primitives 0.1.0 (git+https://github.com/paritytech/substrate)", "substrate-consensus-aura-primitives 0.1.0 (git+https://github.com/paritytech/substrate)",
"substrate-keyring 0.1.0 (git+https://github.com/paritytech/substrate)", "substrate-keyring 0.1.0 (git+https://github.com/paritytech/substrate)",
...@@ -3008,6 +3009,25 @@ dependencies = [ ...@@ -3008,6 +3009,25 @@ dependencies = [
"substrate-primitives 0.1.0 (git+https://github.com/paritytech/substrate)", "substrate-primitives 0.1.0 (git+https://github.com/paritytech/substrate)",
] ]
[[package]]
name = "srml-upgrade-key"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#873e8c7df9b041b98255683a2e91626169ce5209"
dependencies = [
"hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
"sr-io 0.1.0 (git+https://github.com/paritytech/substrate)",
"sr-primitives 0.1.0 (git+https://github.com/paritytech/substrate)",
"sr-std 0.1.0 (git+https://github.com/paritytech/substrate)",
"srml-consensus 0.1.0 (git+https://github.com/paritytech/substrate)",
"srml-support 0.1.0 (git+https://github.com/paritytech/substrate)",
"srml-support-procedural 0.1.0 (git+https://github.com/paritytech/substrate)",
"srml-system 0.1.0 (git+https://github.com/paritytech/substrate)",
"substrate-primitives 0.1.0 (git+https://github.com/paritytech/substrate)",
]
[[package]] [[package]]
name = "stable_deref_trait" name = "stable_deref_trait"
version = "1.1.1" version = "1.1.1"
...@@ -4577,6 +4597,7 @@ dependencies = [ ...@@ -4577,6 +4597,7 @@ dependencies = [
"checksum srml-system 0.1.0 (git+https://github.com/paritytech/substrate)" = "<none>" "checksum srml-system 0.1.0 (git+https://github.com/paritytech/substrate)" = "<none>"
"checksum srml-timestamp 0.1.0 (git+https://github.com/paritytech/substrate)" = "<none>" "checksum srml-timestamp 0.1.0 (git+https://github.com/paritytech/substrate)" = "<none>"
"checksum srml-treasury 0.1.0 (git+https://github.com/paritytech/substrate)" = "<none>" "checksum srml-treasury 0.1.0 (git+https://github.com/paritytech/substrate)" = "<none>"
"checksum srml-upgrade-key 0.1.0 (git+https://github.com/paritytech/substrate)" = "<none>"
"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8"
"checksum static_assertions 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c19be23126415861cb3a23e501d34a708f7f9b2183c5252d690941c2e69199d5" "checksum static_assertions 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c19be23126415861cb3a23e501d34a708f7f9b2183c5252d690941c2e69199d5"
"checksum stdweb 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ef5430c8e36b713e13b48a9f709cc21e046723fe44ce34587b73a830203b533e" "checksum stdweb 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ef5430c8e36b713e13b48a9f709cc21e046723fe44ce34587b73a830203b533e"
......
...@@ -26,8 +26,8 @@ pub enum ChainSpec { ...@@ -26,8 +26,8 @@ pub enum ChainSpec {
Development, Development,
/// Whatever the current runtime is, with simple Alice/Bob auths. /// Whatever the current runtime is, with simple Alice/Bob auths.
LocalTestnet, LocalTestnet,
/// The PoC-1 & PoC-2 era testnet. /// The PoC-3 era testnet.
KrummeLanke, Alexander,
/// Whatever the current runtime is with the "global testnet" defaults. /// Whatever the current runtime is with the "global testnet" defaults.
StagingTestnet, StagingTestnet,
} }
...@@ -36,7 +36,7 @@ pub enum ChainSpec { ...@@ -36,7 +36,7 @@ pub enum ChainSpec {
impl ChainSpec { impl ChainSpec {
pub(crate) fn load(self) -> Result<service::ChainSpec, String> { pub(crate) fn load(self) -> Result<service::ChainSpec, String> {
Ok(match self { Ok(match self {
ChainSpec::KrummeLanke => service::chain_spec::poc_1_testnet_config()?, ChainSpec::Alexander => service::chain_spec::poc_3_testnet_config()?,
ChainSpec::Development => service::chain_spec::development_config(), ChainSpec::Development => service::chain_spec::development_config(),
ChainSpec::LocalTestnet => service::chain_spec::local_testnet_config(), ChainSpec::LocalTestnet => service::chain_spec::local_testnet_config(),
ChainSpec::StagingTestnet => service::chain_spec::staging_testnet_config(), ChainSpec::StagingTestnet => service::chain_spec::staging_testnet_config(),
...@@ -47,8 +47,7 @@ impl ChainSpec { ...@@ -47,8 +47,7 @@ impl ChainSpec {
match s { match s {
"dev" => Some(ChainSpec::Development), "dev" => Some(ChainSpec::Development),
"local" => Some(ChainSpec::LocalTestnet), "local" => Some(ChainSpec::LocalTestnet),
"poc-1" => Some(ChainSpec::KrummeLanke), "poc-3" | "alex" | "alexander" => Some(ChainSpec::Alexander),
"" | "krummelanke" => Some(ChainSpec::KrummeLanke),
"staging" => Some(ChainSpec::StagingTestnet), "staging" => Some(ChainSpec::StagingTestnet),
_ => None, _ => None,
} }
......
...@@ -33,6 +33,7 @@ srml-staking = { git = "https://github.com/paritytech/substrate" } ...@@ -33,6 +33,7 @@ srml-staking = { git = "https://github.com/paritytech/substrate" }
srml-system = { git = "https://github.com/paritytech/substrate" } srml-system = { git = "https://github.com/paritytech/substrate" }
srml-timestamp = { git = "https://github.com/paritytech/substrate" } srml-timestamp = { git = "https://github.com/paritytech/substrate" }
srml-treasury = { git = "https://github.com/paritytech/substrate" } srml-treasury = { git = "https://github.com/paritytech/substrate" }
srml-upgrade-key = { git = "https://github.com/paritytech/substrate" }
sr-version = { git = "https://github.com/paritytech/substrate" } sr-version = { git = "https://github.com/paritytech/substrate" }
[dev-dependencies] [dev-dependencies]
......
...@@ -54,6 +54,7 @@ extern crate srml_staking as staking; ...@@ -54,6 +54,7 @@ extern crate srml_staking as staking;
extern crate srml_system as system; extern crate srml_system as system;
extern crate srml_timestamp as timestamp; extern crate srml_timestamp as timestamp;
extern crate srml_treasury as treasury; extern crate srml_treasury as treasury;
extern crate srml_upgrade_key as upgrade_key;
extern crate polkadot_primitives as primitives; extern crate polkadot_primitives as primitives;
...@@ -214,6 +215,11 @@ impl parachains::Trait for Runtime { ...@@ -214,6 +215,11 @@ impl parachains::Trait for Runtime {
const SET_POSITION: u32 = PARACHAINS_SET_POSITION; const SET_POSITION: u32 = PARACHAINS_SET_POSITION;
} }
impl upgrade_key::Trait for Runtime {
/// The uniquitous event type.
type Event = Event;
}
construct_runtime!( construct_runtime!(
pub enum Runtime with Log(InternalLog: DigestItem<Hash, SessionKey>) where pub enum Runtime with Log(InternalLog: DigestItem<Hash, SessionKey>) where
Block = Block, Block = Block,
...@@ -236,6 +242,7 @@ construct_runtime!( ...@@ -236,6 +242,7 @@ construct_runtime!(
CouncilSeats: council_seats::{Config<T>}, CouncilSeats: council_seats::{Config<T>},
Treasury: treasury, Treasury: treasury,
Parachains: parachains::{Module, Call, Storage, Config<T>, Inherent}, Parachains: parachains::{Module, Call, Storage, Config<T>, Inherent},
UpgradeKey: upgrade_key,
} }
); );
......
...@@ -175,6 +175,7 @@ dependencies = [ ...@@ -175,6 +175,7 @@ dependencies = [
"srml-system 0.1.0 (git+https://github.com/paritytech/substrate)", "srml-system 0.1.0 (git+https://github.com/paritytech/substrate)",
"srml-timestamp 0.1.0 (git+https://github.com/paritytech/substrate)", "srml-timestamp 0.1.0 (git+https://github.com/paritytech/substrate)",
"srml-treasury 0.1.0 (git+https://github.com/paritytech/substrate)", "srml-treasury 0.1.0 (git+https://github.com/paritytech/substrate)",
"srml-upgrade-key 0.1.0 (git+https://github.com/paritytech/substrate)",
"substrate-client 0.1.0 (git+https://github.com/paritytech/substrate)", "substrate-client 0.1.0 (git+https://github.com/paritytech/substrate)",
"substrate-consensus-aura-primitives 0.1.0 (git+https://github.com/paritytech/substrate)", "substrate-consensus-aura-primitives 0.1.0 (git+https://github.com/paritytech/substrate)",
"substrate-primitives 0.1.0 (git+https://github.com/paritytech/substrate)", "substrate-primitives 0.1.0 (git+https://github.com/paritytech/substrate)",
...@@ -587,6 +588,25 @@ dependencies = [ ...@@ -587,6 +588,25 @@ dependencies = [
"substrate-primitives 0.1.0 (git+https://github.com/paritytech/substrate)", "substrate-primitives 0.1.0 (git+https://github.com/paritytech/substrate)",
] ]
[[package]]
name = "srml-upgrade-key"
version = "0.1.0"
source = "git+https://github.com/paritytech/substrate#873e8c7df9b041b98255683a2e91626169ce5209"
dependencies = [
"hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
"sr-io 0.1.0 (git+https://github.com/paritytech/substrate)",
"sr-primitives 0.1.0 (git+https://github.com/paritytech/substrate)",
"sr-std 0.1.0 (git+https://github.com/paritytech/substrate)",
"srml-consensus 0.1.0 (git+https://github.com/paritytech/substrate)",
"srml-support 0.1.0 (git+https://github.com/paritytech/substrate)",
"srml-support-procedural 0.1.0 (git+https://github.com/paritytech/substrate)",
"srml-system 0.1.0 (git+https://github.com/paritytech/substrate)",
"substrate-primitives 0.1.0 (git+https://github.com/paritytech/substrate)",
]
[[package]] [[package]]
name = "static_assertions" name = "static_assertions"
version = "0.2.5" version = "0.2.5"
...@@ -738,6 +758,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" ...@@ -738,6 +758,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum srml-system 0.1.0 (git+https://github.com/paritytech/substrate)" = "<none>" "checksum srml-system 0.1.0 (git+https://github.com/paritytech/substrate)" = "<none>"
"checksum srml-timestamp 0.1.0 (git+https://github.com/paritytech/substrate)" = "<none>" "checksum srml-timestamp 0.1.0 (git+https://github.com/paritytech/substrate)" = "<none>"
"checksum srml-treasury 0.1.0 (git+https://github.com/paritytech/substrate)" = "<none>" "checksum srml-treasury 0.1.0 (git+https://github.com/paritytech/substrate)" = "<none>"
"checksum srml-upgrade-key 0.1.0 (git+https://github.com/paritytech/substrate)" = "<none>"
"checksum static_assertions 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c19be23126415861cb3a23e501d34a708f7f9b2183c5252d690941c2e69199d5" "checksum static_assertions 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c19be23126415861cb3a23e501d34a708f7f9b2183c5252d690941c2e69199d5"
"checksum substrate-client 0.1.0 (git+https://github.com/paritytech/substrate)" = "<none>" "checksum substrate-client 0.1.0 (git+https://github.com/paritytech/substrate)" = "<none>"
"checksum substrate-consensus-aura-primitives 0.1.0 (git+https://github.com/paritytech/substrate)" = "<none>" "checksum substrate-consensus-aura-primitives 0.1.0 (git+https://github.com/paritytech/substrate)" = "<none>"
......
...@@ -32,6 +32,7 @@ srml-staking = { git = "https://github.com/paritytech/substrate", default-featur ...@@ -32,6 +32,7 @@ srml-staking = { git = "https://github.com/paritytech/substrate", default-featur
srml-system = { git = "https://github.com/paritytech/substrate", default-features = false } srml-system = { git = "https://github.com/paritytech/substrate", default-features = false }
srml-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false } srml-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false }
srml-treasury = { git = "https://github.com/paritytech/substrate", default-features = false } srml-treasury = { git = "https://github.com/paritytech/substrate", default-features = false }
srml-upgrade-key = { git = "https://github.com/paritytech/substrate", default-features = false }
sr-version = { git = "https://github.com/paritytech/substrate", default-features = false } sr-version = { git = "https://github.com/paritytech/substrate", default-features = false }
[profile.release] [profile.release]
......
...@@ -16,10 +16,11 @@ ...@@ -16,10 +16,11 @@
//! Polkadot chain configurations. //! Polkadot chain configurations.
use primitives::{AuthorityId, ed25519}; use primitives::{H256, AuthorityId, ed25519};
use polkadot_runtime::{ use polkadot_runtime::{
GenesisConfig, ConsensusConfig, CouncilSeatsConfig, DemocracyConfig, GenesisConfig, ConsensusConfig, CouncilSeatsConfig, DemocracyConfig,
SessionConfig, StakingConfig, TimestampConfig, BalancesConfig, Perbill, CouncilVotingConfig, GrandpaConfig SessionConfig, StakingConfig, TimestampConfig, BalancesConfig, Perbill,
CouncilVotingConfig, GrandpaConfig, UpgradeKeyConfig
}; };
const STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/"; const STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/";
...@@ -28,8 +29,8 @@ const DEFAULT_PROTOCOL_ID: &str = "dot"; ...@@ -28,8 +29,8 @@ const DEFAULT_PROTOCOL_ID: &str = "dot";
/// Specialised `ChainSpec`. /// Specialised `ChainSpec`.
pub type ChainSpec = ::service::ChainSpec<GenesisConfig>; pub type ChainSpec = ::service::ChainSpec<GenesisConfig>;
pub fn poc_1_testnet_config() -> Result<ChainSpec, String> { pub fn poc_3_testnet_config() -> Result<ChainSpec, String> {
ChainSpec::from_embedded(include_bytes!("../res/krummelanke.json")) ChainSpec::from_embedded(include_bytes!("../res/alexander.json"))
} }
fn staging_testnet_config_genesis() -> GenesisConfig { fn staging_testnet_config_genesis() -> GenesisConfig {
...@@ -106,6 +107,9 @@ fn staging_testnet_config_genesis() -> GenesisConfig { ...@@ -106,6 +107,9 @@ fn staging_testnet_config_genesis() -> GenesisConfig {
period: 2, // 2*2=4 second block time. period: 2, // 2*2=4 second block time.
}), }),
treasury: Some(Default::default()), treasury: Some(Default::default()),
upgrade_key: Some(UpgradeKeyConfig {
key: endowed_accounts[0],
}),
} }
} }
...@@ -124,7 +128,7 @@ pub fn staging_testnet_config() -> ChainSpec { ...@@ -124,7 +128,7 @@ pub fn staging_testnet_config() -> ChainSpec {
) )
} }
fn testnet_genesis(initial_authorities: Vec<AuthorityId>) -> GenesisConfig { fn testnet_genesis(initial_authorities: Vec<AuthorityId>, upgrade_key: H256) -> GenesisConfig {
let endowed_accounts = vec![ let endowed_accounts = vec![
ed25519::Pair::from_seed(b"Alice ").public().0.into(), ed25519::Pair::from_seed(b"Alice ").public().0.into(),
ed25519::Pair::from_seed(b"Bob ").public().0.into(), ed25519::Pair::from_seed(b"Bob ").public().0.into(),
...@@ -197,13 +201,19 @@ fn testnet_genesis(initial_authorities: Vec<AuthorityId>) -> GenesisConfig { ...@@ -197,13 +201,19 @@ fn testnet_genesis(initial_authorities: Vec<AuthorityId>) -> GenesisConfig {
period: 2, // 2*2=4 second block time. period: 2, // 2*2=4 second block time.
}), }),
treasury: Some(Default::default()), treasury: Some(Default::default()),
upgrade_key: Some(UpgradeKeyConfig {
key: upgrade_key,
}),
} }
} }
fn development_config_genesis() -> GenesisConfig { fn development_config_genesis() -> GenesisConfig {
testnet_genesis(vec![ testnet_genesis(
ed25519::Pair::from_seed(b"Alice ").public().into(), vec![
]) ed25519::Pair::from_seed(b"Alice ").public().into(),
],
ed25519::Pair::from_seed(b"Alice ").public().0.into()
)
} }
/// Development config (single validator Alice) /// Development config (single validator Alice)
...@@ -221,10 +231,13 @@ pub fn development_config() -> ChainSpec { ...@@ -221,10 +231,13 @@ pub fn development_config() -> ChainSpec {
} }
fn local_testnet_genesis() -> GenesisConfig { fn local_testnet_genesis() -> GenesisConfig {
testnet_genesis(vec![ testnet_genesis(
ed25519::Pair::from_seed(b"Alice ").public().into(), vec![
ed25519::Pair::from_seed(b"Bob ").public().into(), ed25519::Pair::from_seed(b"Alice ").public().into(),
]) ed25519::Pair::from_seed(b"Bob ").public().into(),
],
ed25519::Pair::from_seed(b"Alice ").public().0.into()
)
} }
/// Local testnet config (multivalidator Alice + Bob) /// Local testnet config (multivalidator Alice + Bob)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment