Unverified Commit b5cc86af authored by Gavin Wood's avatar Gavin Wood Committed by GitHub
Browse files

Bump to latest Substrate (#898)



* Flag to force kusama runtime

* Chainspecs for kusama

* Polkadot config for westend
Co-Authored-By: default avatarBastian Köcher <bkchr@users.noreply.github.com>

* network/src/legacy/gossip: Wrap GossipEngine in Arc Mutex & lock it on use

`GossipEngine` in itself has no need to be Send and Sync, given that it
does not rely on separately spawned background tasks anymore.
`RegisteredMessageValidator` needs to be `Send` and `Sync` due to the
inherited trait bounds from implementing `GossipService`. In addition
`RegisteredMessageValidator` derives `Clone`. Thereby `GossipEngine`
needs to be wrapped in an `Arc` and `Mutex` to keep the status quo.

* Needed fixes.

* Fixes

* Fixed build

* Fixed build w benchmarking CLI

* Fixed building tests

* Added --dev shortcut
Co-authored-by: Arkadiy Paronyan's avatararkpar <arkady.paronyan@gmail.com>
Co-authored-by: default avatarBastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: default avatarMax Inden <mail@max-inden.de>
parent fb06c824
Pipeline #82831 passed with stages
in 21 minutes and 39 seconds
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -35,7 +35,7 @@ use polkadot_primitives::{
use sp_runtime::traits::HashFor;
use sp_blockchain::{Result as ClientResult};
use client::{
BlockchainEvents, BlockBody,
BlockchainEvents, BlockBackend,
};
use sp_api::{ApiExt, ProvideRuntimeApi};
use codec::{Encode, Decode};
......@@ -178,7 +178,7 @@ impl Store {
keystore: KeyStorePtr,
) -> ClientResult<AvailabilityBlockImport<I, P>>
where
P: ProvideRuntimeApi<Block> + BlockchainEvents<Block> + BlockBody<Block> + Send + Sync + 'static,
P: ProvideRuntimeApi<Block> + BlockchainEvents<Block> + BlockBackend<Block> + Send + Sync + 'static,
P::Api: ParachainHost<Block>,
P::Api: ApiExt<Block, Error=sp_blockchain::Error>,
// Rust bug: https://github.com/rust-lang/rust/issues/24159
......
......@@ -24,7 +24,7 @@ use sp_blockchain::{Result as ClientResult};
use sp_runtime::traits::{Header as HeaderT, Block as BlockT, HashFor, BlakeTwo256};
use sp_api::{ApiExt, ProvideRuntimeApi};
use client::{
BlockchainEvents, BlockBody,
BlockchainEvents, BlockBackend,
blockchain::ProvideCache,
};
use consensus_common::{
......@@ -203,7 +203,7 @@ where
/// Creates a task to prune entries in availability store upon block finalization.
async fn prune_unneeded_availability<P, S>(client: Arc<P>, mut sender: S)
where
P: ProvideRuntimeApi<Block> + BlockchainEvents<Block> + BlockBody<Block> + Send + Sync + 'static,
P: ProvideRuntimeApi<Block> + BlockchainEvents<Block> + BlockBackend<Block> + Send + Sync + 'static,
P::Api: ParachainHost<Block> + ApiExt<Block, Error=sp_blockchain::Error>,
S: Sink<WorkerMsg> + Clone + Send + Sync + Unpin,
// Rust bug: https://github.com/rust-lang/rust/issues/24159
......@@ -646,7 +646,7 @@ impl<I, P> AvailabilityBlockImport<I, P> {
to_worker: mpsc::UnboundedSender<WorkerMsg>,
) -> Self
where
P: ProvideRuntimeApi<Block> + BlockBody<Block> + BlockchainEvents<Block> + Send + Sync + 'static,
P: ProvideRuntimeApi<Block> + BlockBackend<Block> + BlockchainEvents<Block> + Send + Sync + 'static,
P::Api: ParachainHost<Block>,
P::Api: ApiExt<Block, Error = sp_blockchain::Error>,
// Rust bug: https://github.com/rust-lang/rust/issues/24159
......
......@@ -22,16 +22,22 @@ use service;
/// specification).
#[derive(Clone, Debug)]
pub enum ChainSpec {
/// Whatever the current runtime is, with just Alice as an auth.
Development,
/// Whatever the current runtime is, with simple Alice/Bob auths.
LocalTestnet,
/// Whatever the current polkadot runtime is, with just Alice as an auth.
PolkadotDevelopment,
/// Whatever the current pokadot runtime is, with simple Alice/Bob auths.
PolkadotLocalTestnet,
/// The Kusama network.
Kusama,
/// Whatever the current kusama runtime is, with just Alice as an auth.
KusamaDevelopment,
/// The Westend network,
Westend,
/// Whatever the current runtime is with the "global testnet" defaults.
StagingTestnet,
/// Whatever the current polkadot runtime is with the "global testnet" defaults.
PolkadotStagingTestnet,
/// Whatever the current kusama runtime is with the "global testnet" defaults.
KusamaStagingTestnet,
/// Whatever the current kusama runtime is, with simple Alice/Bob auths.
KusamaLocalTestnet,
}
impl Default for ChainSpec {
......@@ -42,23 +48,29 @@ impl Default for ChainSpec {
/// Get a chain config from a spec setting.
impl ChainSpec {
pub(crate) fn load(self) -> Result<service::ChainSpec, String> {
match self {
ChainSpec::Development => Ok(service::chain_spec::development_config()),
ChainSpec::LocalTestnet => Ok(service::chain_spec::local_testnet_config()),
ChainSpec::StagingTestnet => Ok(service::chain_spec::staging_testnet_config()),
ChainSpec::Westend => service::chain_spec::westend_config(),
ChainSpec::Kusama => service::chain_spec::kusama_config(),
}
pub(crate) fn load(self) -> Result<Box<dyn service::ChainSpec>, String> {
Ok(match self {
ChainSpec::PolkadotDevelopment => Box::new(service::chain_spec::polkadot_development_config()),
ChainSpec::PolkadotLocalTestnet => Box::new(service::chain_spec::polkadot_local_testnet_config()),
ChainSpec::PolkadotStagingTestnet => Box::new(service::chain_spec::polkadot_staging_testnet_config()),
ChainSpec::KusamaDevelopment =>Box::new(service::chain_spec::kusama_development_config()),
ChainSpec::KusamaLocalTestnet => Box::new(service::chain_spec::kusama_local_testnet_config()),
ChainSpec::KusamaStagingTestnet => Box::new(service::chain_spec::kusama_staging_testnet_config()),
ChainSpec::Westend => Box::new(service::chain_spec::westend_config()?),
ChainSpec::Kusama => Box::new(service::chain_spec::kusama_config()?),
})
}
pub(crate) fn from(s: &str) -> Option<Self> {
match s {
"dev" => Some(ChainSpec::Development),
"local" => Some(ChainSpec::LocalTestnet),
"polkadot-dev" | "dev" => Some(ChainSpec::PolkadotDevelopment),
"polkadot-local" => Some(ChainSpec::PolkadotLocalTestnet),
"polkadot-staging" => Some(ChainSpec::PolkadotStagingTestnet),
"kusama-dev" => Some(ChainSpec::KusamaDevelopment),
"kusama-local" => Some(ChainSpec::KusamaLocalTestnet),
"kusama-staging" => Some(ChainSpec::KusamaStagingTestnet),
"kusama" => Some(ChainSpec::Kusama),
"westend" => Some(ChainSpec::Westend),
"staging" => Some(ChainSpec::StagingTestnet),
"" => Some(ChainSpec::default()),
_ => None,
}
......@@ -66,9 +78,11 @@ impl ChainSpec {
}
/// Load the `ChainSpec` for the given `id`.
pub fn load_spec(id: &str) -> Result<Option<service::ChainSpec>, String> {
/// `force_kusama` treats chain specs coming from a file as kusama specs.
pub fn load_spec(id: &str, force_kusama: bool) -> Result<Box<dyn service::ChainSpec>, String> {
Ok(match ChainSpec::from(id) {
Some(spec) => Some(spec.load()?),
None => None,
Some(spec) => spec.load()?,
None if force_kusama => Box::new(service::KusamaChainSpec::from_json_file(std::path::PathBuf::from(id))?),
None => Box::new(service::PolkadotChainSpec::from_json_file(std::path::PathBuf::from(id))?),
})
}
......@@ -17,7 +17,6 @@
//! Polkadot CLI library.
use structopt::StructOpt;
pub use sc_cli::RunCmd;
#[allow(missing_docs)]
#[derive(Debug, StructOpt, Clone)]
......@@ -45,6 +44,18 @@ pub struct ValidationWorkerCommand {
pub mem_id: String,
}
#[allow(missing_docs)]
#[derive(Debug, StructOpt, Clone)]
pub struct RunCmd {
#[allow(missing_docs)]
#[structopt(flatten)]
pub base: sc_cli::RunCmd,
/// Force using Kusama native runtime.
#[structopt(long = "force-kusama")]
pub force_kusama: bool,
}
#[allow(missing_docs)]
#[derive(Debug, StructOpt, Clone)]
#[structopt(settings = &[
......
......@@ -29,13 +29,18 @@ pub fn run(version: VersionInfo) -> sc_cli::Result<()> {
let mut config = service::Configuration::from_version(&version);
config.impl_name = "parity-polkadot";
let force_kusama = opt.run.force_kusama;
match opt.subcommand {
None => {
opt.run.init(&version)?;
opt.run.update_config(&mut config, load_spec, &version)?;
opt.run.base.init(&version)?;
opt.run.base.update_config(
&mut config,
|id| load_spec(id, force_kusama),
&version
)?;
let is_kusama = config.chain_spec.as_ref().map_or(false, |s| s.is_kusama());
let is_kusama = config.expect_chain_spec().is_kusama();
info!("{}", version.name);
info!(" version {}", config.full_version());
......@@ -69,9 +74,13 @@ pub fn run(version: VersionInfo) -> sc_cli::Result<()> {
},
Some(Subcommand::Base(cmd)) => {
cmd.init(&version)?;
cmd.update_config(&mut config, load_spec, &version)?;
cmd.update_config(
&mut config,
|id| load_spec(id, force_kusama),
&version
)?;
let is_kusama = config.chain_spec.as_ref().map_or(false, |s| s.is_kusama());
let is_kusama = config.expect_chain_spec().is_kusama();
if is_kusama {
cmd.run(config, service::new_chain_ops::<
......@@ -100,14 +109,12 @@ pub fn run(version: VersionInfo) -> sc_cli::Result<()> {
},
Some(Subcommand::Benchmark(cmd)) => {
cmd.init(&version)?;
cmd.update_config(&mut config, load_spec, &version)?;
let is_kusama = config.chain_spec.as_ref().map_or(false, |s| s.is_kusama());
cmd.update_config(&mut config, |id| load_spec(id, force_kusama), &version)?;
let is_kusama = config.expect_chain_spec().is_kusama();
if is_kusama {
cmd.run::<_, _, service::kusama_runtime::Block, service::KusamaExecutor>(config)
cmd.run::<service::kusama_runtime::Block, service::KusamaExecutor>(config)
} else {
cmd.run::<_, _, service::polkadot_runtime::Block, service::PolkadotExecutor>(config)
cmd.run::<service::polkadot_runtime::Block, service::PolkadotExecutor>(config)
}
},
}
......
......@@ -71,7 +71,7 @@ use std::sync::Arc;
use arrayvec::ArrayVec;
use futures::prelude::*;
use parking_lot::RwLock;
use parking_lot::{Mutex, RwLock};
use crate::legacy::{GossipMessageStream, GossipService};
......@@ -289,20 +289,28 @@ pub fn register_validator<C: ChainContext + 'static>(
});
let gossip_side = validator.clone();
let gossip_engine = sc_network_gossip::GossipEngine::new(
let gossip_engine = Arc::new(Mutex::new(sc_network_gossip::GossipEngine::new(
service.clone(),
POLKADOT_ENGINE_ID,
POLKADOT_PROTOCOL_NAME,
gossip_side,
);
)));
// Spawn gossip engine.
//
// Ideally this would not be spawned as an orphaned task, but polled by
// `RegisteredMessageValidator` which in turn would be polled by a `ValidationNetwork`.
let spawn_res = executor.spawn_obj(futures::task::FutureObj::from(Box::new(gossip_engine.clone())));
{
let gossip_engine = gossip_engine.clone();
let fut = futures::future::poll_fn(move |cx| {
gossip_engine.lock().poll_unpin(cx)
});
let spawn_res = executor.spawn_obj(futures::task::FutureObj::from(Box::new(fut)));
// Note: we consider the chances of an error to spawn a background task almost null.
if spawn_res.is_err() {
log::error!(target: "polkadot-gossip", "Failed to spawn background task");
// Note: we consider the chances of an error to spawn a background task almost null.
if spawn_res.is_err() {
log::error!(target: "polkadot-gossip", "Failed to spawn background task");
}
}
RegisteredMessageValidator {
......@@ -350,7 +358,7 @@ pub struct RegisteredMessageValidator {
// Note: this is always `Some` in real code and `None` in tests.
service: Option<Arc<NetworkService<Block, Hash>>>,
// Note: this is always `Some` in real code and `None` in tests.
gossip_engine: Option<sc_network_gossip::GossipEngine<Block>>,
gossip_engine: Option<Arc<Mutex<sc_network_gossip::GossipEngine<Block>>>>,
}
impl RegisteredMessageValidator {
......@@ -398,7 +406,7 @@ impl RegisteredMessageValidator {
pub(crate) fn gossip_messages_for(&self, topic: Hash) -> GossipMessageStream {
let topic_stream = if let Some(gossip_engine) = self.gossip_engine.as_ref() {
gossip_engine.messages_for(topic)
gossip_engine.lock().messages_for(topic)
} else {
log::error!("Called gossip_messages_for on a test engine");
futures::channel::mpsc::unbounded().1
......@@ -409,7 +417,7 @@ impl RegisteredMessageValidator {
pub(crate) fn gossip_message(&self, topic: Hash, message: GossipMessage) {
if let Some(gossip_engine) = self.gossip_engine.as_ref() {
gossip_engine.gossip_message(
gossip_engine.lock().gossip_message(
topic,
message.encode(),
false,
......@@ -421,7 +429,7 @@ impl RegisteredMessageValidator {
pub(crate) fn send_message(&self, who: PeerId, message: GossipMessage) {
if let Some(gossip_engine) = self.gossip_engine.as_ref() {
gossip_engine.send_message(vec![who], message.encode());
gossip_engine.lock().send_message(vec![who], message.encode());
} else {
log::error!("Called send_message on a test engine");
}
......
......@@ -31,6 +31,7 @@ use sc_client_api::{
BlockchainEvents, BlockImportNotification,
FinalityNotifications, ImportNotifications,
FinalityNotification,
client::BlockBackend,
backend::{TransactionFor, AuxStore, Backend, Finalizer},
};
use sc_block_builder::{BlockBuilder, BlockBuilderProvider};
......
......@@ -164,9 +164,11 @@ pub fn validate_candidate_internal<E: Externalities + 'static>(
Some(1024),
HostFunctions::host_functions(),
false,
8
);
let res = executor.call_in_wasm(
validation_code,
None,
"validate_block",
encoded_call_data,
&mut ext,
......@@ -192,22 +194,6 @@ impl sp_externalities::Externalities for ValidationExternalities {
panic!("child_storage_hash: unsupported feature for parachain validation")
}
fn original_storage(&self, _: &[u8]) -> Option<Vec<u8>> {
panic!("original_sorage: unsupported feature for parachain validation")
}
fn original_child_storage(&self, _: ChildStorageKey, _: ChildInfo, _: &[u8]) -> Option<Vec<u8>> {
panic!("original_child_storage: unsupported feature for parachain validation")
}
fn original_storage_hash(&self, _: &[u8]) -> Option<Vec<u8>> {
panic!("original_storage_hash: unsupported feature for parachain validation")
}
fn original_child_storage_hash(&self, _: ChildStorageKey, _: ChildInfo, _: &[u8]) -> Option<Vec<u8>> {
panic!("original_child_storage_hash: unsupported feature for parachain validation")
}
fn child_storage(&self, _: ChildStorageKey, _: ChildInfo, _: &[u8]) -> Option<Vec<u8>> {
panic!("child_storage: unsupported feature for parachain validation")
}
......
......@@ -319,5 +319,5 @@ pub fn new_light_fetcher() -> LightFetcher {
/// Create a new native executor.
pub fn new_native_executor() -> sc_executor::NativeExecutor<LocalExecutor> {
sc_executor::NativeExecutor::new(sc_executor::WasmExecutionMethod::Interpreted, None)
sc_executor::NativeExecutor::new(sc_executor::WasmExecutionMethod::Interpreted, None, 8)
}
......@@ -19,7 +19,9 @@
use sp_core::{Pair, Public, crypto::UncheckedInto, sr25519};
use polkadot_primitives::{AccountId, AccountPublic, parachain::ValidatorId};
use polkadot_runtime as polkadot;
use polkadot_runtime::constants::currency::DOTS;
use kusama_runtime as kusama;
use polkadot::constants::currency::DOTS;
use kusama::constants::currency::DOTS as KSM;
use sc_chain_spec::ChainSpecExtension;
use sp_runtime::{traits::IdentifyAccount, Perbill};
use serde::{Serialize, Deserialize};
......@@ -31,7 +33,8 @@ use im_online::sr25519::{AuthorityId as ImOnlineId};
use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
use pallet_staking::Forcing;
const STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/";
const POLKADOT_STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/";
const KUSAMA_STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/";
const DEFAULT_PROTOCOL_ID: &str = "dot";
/// Node `ChainSpec` extensions.
......@@ -47,24 +50,27 @@ pub struct Extensions {
pub bad_blocks: sc_client::BadBlocks<polkadot_primitives::Block>,
}
/// The `ChainSpec`.
///
/// We use the same `ChainSpec` type for Polkadot and Kusama. As Kusama
/// is only loaded from a file, the `GenesisConfig` type is not used.
pub type ChainSpec = service::ChainSpec<
/// The `ChainSpec parametrised for polkadot runtime`.
pub type PolkadotChainSpec = service::GenericChainSpec<
polkadot::GenesisConfig,
Extensions,
>;
pub fn kusama_config() -> Result<ChainSpec, String> {
ChainSpec::from_json_bytes(&include_bytes!("../res/kusama.json")[..])
/// The `ChainSpec parametrised for kusama runtime`.
pub type KusamaChainSpec = service::GenericChainSpec<
kusama::GenesisConfig,
Extensions,
>;
pub fn kusama_config() -> Result<KusamaChainSpec, String> {
KusamaChainSpec::from_json_bytes(&include_bytes!("../res/kusama.json")[..])
}
pub fn westend_config() -> Result<ChainSpec, String> {
ChainSpec::from_json_bytes(&include_bytes!("../res/westend.json")[..])
pub fn westend_config() -> Result<PolkadotChainSpec, String> {
PolkadotChainSpec::from_json_bytes(&include_bytes!("../res/westend.json")[..])
}
fn session_keys(
fn polkadot_session_keys(
babe: BabeId,
grandpa: GrandpaId,
im_online: ImOnlineId,
......@@ -74,18 +80,20 @@ fn session_keys(
polkadot::SessionKeys { babe, grandpa, im_online, parachain_validator, authority_discovery }
}
fn staging_testnet_config_genesis() -> polkadot::GenesisConfig {
fn kusama_session_keys(
babe: BabeId,
grandpa: GrandpaId,
im_online: ImOnlineId,
parachain_validator: ValidatorId,
authority_discovery: AuthorityDiscoveryId
) -> kusama::SessionKeys {
kusama::SessionKeys { babe, grandpa, im_online, parachain_validator, authority_discovery }
}
fn polkadot_staging_testnet_config_genesis() -> polkadot::GenesisConfig {
// subkey inspect "$SECRET"
let endowed_accounts = vec![
// 5CVFESwfkk7NmhQ6FwHCM9roBvr9BGa4vJHFYU8DnGQxrXvz
hex!["12b782529c22032ed4694e0f6e7d486be7daa6d12088f6bc74d593b3900b8438"].into(),
];
let endowed_accounts = vec![];
// for i in 1 2 3 4; do for j in stash controller; do subkey inspect "$SECRET//$i//$j"; done; done
// for i in 1 2 3 4; do for j in babe; do subkey --sr25519 inspect "$SECRET//$i//$j"; done; done
// for i in 1 2 3 4; do for j in grandpa; do subkey --ed25519 inspect "$SECRET//$i//$j"; done; done
// for i in 1 2 3 4; do for j in im_online; do subkey --sr25519 inspect "$SECRET//$i//$j"; done; done
// for i in 1 2 3 4; do for j in parachains; do subkey --sr25519 inspect "$SECRET//$i//$j"; done; done
let initial_authorities: Vec<(
AccountId,
AccountId,
......@@ -94,67 +102,7 @@ fn staging_testnet_config_genesis() -> polkadot::GenesisConfig {
ImOnlineId,
ValidatorId,
AuthorityDiscoveryId
)> = vec![(
// 5DD7Q4VEfPTLEdn11CnThoHT5f9xKCrnofWJL5SsvpTghaAT
hex!["32a5718e87d16071756d4b1370c411bbbb947eb62f0e6e0b937d5cbfc0ea633b"].into(),
// 5GNzaEqhrZAtUQhbMe2gn9jBuNWfamWFZHULryFwBUXyd1cG
hex!["bee39fe862c85c91aaf343e130d30b643c6ea0b4406a980206f1df8331f7093b"].into(),
// 5FpewyS2VY8Cj3tKgSckq8ECkjd1HKHvBRnWhiHqRQsWfFC1
hex!["a639b507ee1585e0b6498ff141d6153960794523226866d1b44eba3f25f36356"].unchecked_into(),
// 5EjvdwATjyFFikdZibVvx1q5uBHhphS2Mnsq5c7yfaYK25vm
hex!["76620f7c98bce8619979c2b58cf2b0aff71824126d2b039358729dad993223db"].unchecked_into(),
// 5FpewyS2VY8Cj3tKgSckq8ECkjd1HKHvBRnWhiHqRQsWfFC1
hex!["a639b507ee1585e0b6498ff141d6153960794523226866d1b44eba3f25f36356"].unchecked_into(),
// 5FpewyS2VY8Cj3tKgSckq8ECkjd1HKHvBRnWhiHqRQsWfFC1
hex!["a639b507ee1585e0b6498ff141d6153960794523226866d1b44eba3f25f36356"].unchecked_into(),
// 5FpewyS2VY8Cj3tKgSckq8ECkjd1HKHvBRnWhiHqRQsWfFC1
hex!["a639b507ee1585e0b6498ff141d6153960794523226866d1b44eba3f25f36356"].unchecked_into(),
),(
// 5G9VGb8ESBeS8Ca4or43RfhShzk9y7T5iTmxHk5RJsjZwsRx
hex!["b496c98a405ceab59b9e970e59ef61acd7765a19b704e02ab06c1cdfe171e40f"].into(),
// 5F7V9Y5FcxKXe1aroqvPeRiUmmeQwTFcL3u9rrPXcMuMiCNx
hex!["86d3a7571dd60139d297e55d8238d0c977b2e208c5af088f7f0136b565b0c103"].into(),
// 5GvuM53k1Z4nAB5zXJFgkRSHv4Bqo4BsvgbQWNWkiWZTMwWY
hex!["765e46067adac4d1fe6c783aa2070dfa64a19f84376659e12705d1734b3eae01"].unchecked_into(),
// 5HBDAaybNqjmY7ww8ZcZZY1L5LHxvpnyfqJwoB7HhR6raTmG
hex!["e2234d661bee4a04c38392c75d1566200aa9e6ae44dd98ee8765e4cc9af63cb7"].unchecked_into(),
// 5GvuM53k1Z4nAB5zXJFgkRSHv4Bqo4BsvgbQWNWkiWZTMwWY
hex!["765e46067adac4d1fe6c783aa2070dfa64a19f84376659e12705d1734b3eae01"].unchecked_into(),
// 5GvuM53k1Z4nAB5zXJFgkRSHv4Bqo4BsvgbQWNWkiWZTMwWY
hex!["765e46067adac4d1fe6c783aa2070dfa64a19f84376659e12705d1734b3eae01"].unchecked_into(),
// 5GvuM53k1Z4nAB5zXJFgkRSHv4Bqo4BsvgbQWNWkiWZTMwWY
hex!["765e46067adac4d1fe6c783aa2070dfa64a19f84376659e12705d1734b3eae01"].unchecked_into(),
),(
// 5FzwpgGvk2kk9agow6KsywLYcPzjYc8suKej2bne5G5b9YU3
hex!["ae12f70078a22882bf5135d134468f77301927aa67c376e8c55b7ff127ace115"].into(),
// 5EqoZhVC2BcsM4WjvZNidu2muKAbu5THQTBKe3EjvxXkdP7A
hex!["7addb914ec8486bbc60643d2647685dcc06373401fa80e09813b630c5831d54b"].into(),
// 5CXNq1mSKJT4Sc2CbyBBdANeSkbUvdWvE4czJjKXfBHi9sX5
hex!["664eae1ca4713dd6abf8c15e6c041820cda3c60df97dc476c2cbf7cb82cb2d2e"].unchecked_into(),
// 5E8ULLQrDAtWhfnVfZmX41Yux86zNAwVJYguWJZVWrJvdhBe
hex!["5b57ed1443c8967f461db1f6eb2ada24794d163a668f1cf9d9ce3235dfad8799"].unchecked_into(),
// 5CXNq1mSKJT4Sc2CbyBBdANeSkbUvdWvE4czJjKXfBHi9sX5
hex!["664eae1ca4713dd6abf8c15e6c041820cda3c60df97dc476c2cbf7cb82cb2d2e"].unchecked_into(),
// 5CXNq1mSKJT4Sc2CbyBBdANeSkbUvdWvE4czJjKXfBHi9sX5
hex!["664eae1ca4713dd6abf8c15e6c041820cda3c60df97dc476c2cbf7cb82cb2d2e"].unchecked_into(),
// 5CXNq1mSKJT4Sc2CbyBBdANeSkbUvdWvE4czJjKXfBHi9sX5
hex!["664eae1ca4713dd6abf8c15e6c041820cda3c60df97dc476c2cbf7cb82cb2d2e"].unchecked_into(),
),(
// 5CFj6Kg9rmVn1vrqpyjau2ztyBzKeVdRKwNPiA3tqhB5HPqq
hex!["0867dbb49721126df589db100dda728dc3b475cbf414dad8f72a1d5e84897252"].into(),
// 5CwQXP6nvWzigFqNhh2jvCaW9zWVzkdveCJY3tz2MhXMjTon
hex!["26ab2b4b2eba2263b1e55ceb48f687bb0018130a88df0712fbdaf6a347d50e2a"].into(),
// 5FCd9Y7RLNyxz5wnCAErfsLbXGG34L2BaZRHzhiJcMUMd5zd
hex!["2adb17a5cafbddc7c3e00ec45b6951a8b12ce2264235b4def342513a767e5d3d"].unchecked_into(),
// 5HGLmrZsiTFTPp3QoS1W8w9NxByt8PVq79reqvdxNcQkByqK
hex!["e60d23f49e93c1c1f2d7c115957df5bbd7faf5ebf138d1e9d02e8b39a1f63df0"].unchecked_into(),
// 5FCd9Y7RLNyxz5wnCAErfsLbXGG34L2BaZRHzhiJcMUMd5zd
hex!["2adb17a5cafbddc7c3e00ec45b6951a8b12ce2264235b4def342513a767e5d3d"].unchecked_into(),
// 5FCd9Y7RLNyxz5wnCAErfsLbXGG34L2BaZRHzhiJcMUMd5zd
hex!["2adb17a5cafbddc7c3e00ec45b6951a8b12ce2264235b4def342513a767e5d3d"].unchecked_into(),
// 5FCd9Y7RLNyxz5wnCAErfsLbXGG34L2BaZRHzhiJcMUMd5zd
hex!["2adb17a5cafbddc7c3e00ec45b6951a8b12ce2264235b4def342513a767e5d3d"].unchecked_into(),
)];
)> = vec![];
const ENDOWMENT: u128 = 1_000_000 * DOTS;
const STASH: u128 = 100 * DOTS;
......@@ -177,7 +125,7 @@ fn staging_testnet_config_genesis() -> polkadot::GenesisConfig {
keys: initial_authorities.iter().map(|x| (
x.0.clone(),
x.0.clone(),
session_keys(x.2.clone(), x.3.clone(), x.4.clone(), x.5.clone(), x.6.clone()),
polkadot_session_keys(x.2.clone(), x.3.clone(), x.4.clone(), x.5.clone(), x.6.clone()),
)).collect::<Vec<_>>(),
}),
staking: Some(polkadot::StakingConfig {
......@@ -228,15 +176,181 @@ fn staging_testnet_config_genesis() -> polkadot::GenesisConfig {
}
}
fn kusama_staging_testnet_config_genesis() -> kusama::GenesisConfig {
// subkey inspect "$SECRET"
let endowed_accounts = vec![
// 5CVFESwfkk7NmhQ6FwHCM9roBvr9BGa4vJHFYU8DnGQxrXvz
hex!["12b782529c22032ed4694e0f6e7d486be7daa6d12088f6bc74d593b3900b8438"].into(),
];
// for i in 1 2 3 4; do for j in stash controller; do subkey inspect "$SECRET//$i//$j"; done; done
// for i in 1 2 3 4; do for j in babe; do subkey --sr25519 inspect "$SECRET//$i//$j"; done; done
// for i in 1 2 3 4; do for j in grandpa; do subkey --ed25519 inspect "$SECRET//$i//$j"; done; done
// for i in 1 2 3 4; do for j in im_online; do subkey --sr25519 inspect "$SECRET//$i//$j"; done; done
// for i in 1 2 3 4; do for j in parachains; do subkey --sr25519 inspect "$SECRET//$i//$j"; done; done
let initial_authorities: Vec<(
AccountId,
AccountId,
BabeId,
GrandpaId,
ImOnlineId,
ValidatorId,
AuthorityDiscoveryId
)> = vec![(
// 5DD7Q4VEfPTLEdn11CnThoHT5f9xKCrnofWJL5SsvpTghaAT
hex!["32a5718e87d16071756d4b1370c411bbbb947eb62f0e6e0b937d5cbfc0ea633b"].into(),
// 5GNzaEqhrZAtUQhbMe2gn9jBuNWfamWFZHULryFwBUXyd1cG
hex!["bee39fe862c85c91aaf343e130d30b643c6ea0b4406a980206f1df8331f7093b"].into(),
// 5FpewyS2VY8Cj3tKgSckq8ECkjd1HKHvBRnWhiHqRQsWfFC1
hex!["a639b507ee1585e0b6498ff141d6153960794523226866d1b44eba3f25f36356"].unchecked_into(),
// 5EjvdwATjyFFikdZibVvx1q5uBHhphS2Mnsq5c7yfaYK25vm
hex!["76620f7c98bce8619979c2b58cf2b0aff71824126d2b039358729dad993223db"].unchecked_into(),
// 5FpewyS2VY8Cj3tKgSckq8ECkjd1HKHvBRnWhiHqRQsWfFC1
hex!["a639b507ee1585e0b6498ff141d6153960794523226866d1b44eba3f25f36356"].unchecked_into(),
// 5FpewyS2VY8Cj3tKgSckq8ECkjd1HKHvBRnWhiHqRQsWfFC1
hex!["a639b507ee1585e0b6498ff141d6153960794523226866d1b44eba3f25f36356"].unchecked_into(),
// 5FpewyS2VY8Cj3tKgSckq8ECkjd1HKHvBRnWhiHqRQsWfFC1
hex!["a639b507ee1585e0b6498ff141d6153960794523226866d1b44eba3f25f36356"].unchecked_into(),
),(
// 5G9VGb8ESBeS8Ca4or43RfhShzk9y7T5iTmxHk5RJsjZwsRx
hex!["b496c98a405ceab59b9e970e59ef61acd7765a19b704e02ab06c1cdfe171e40f"].into(),
// 5F7V9Y5FcxKXe1aroqvPeRiUmmeQwTFcL3u9rrPXcMuMiCNx
hex!["86d3a7571dd60139d297e55d8238d0c977b2e208c5af088f7f0136b565b0c103"].into(),
// 5GvuM53k1Z4nAB5zXJFgkRSHv4Bqo4BsvgbQWNWkiWZTMwWY
hex!["765e46067adac4d1fe6c783aa2070dfa64a19f84376659e12705d1734b3eae01"].unchecked_into(),
// 5HBDAaybNqjmY7ww8ZcZZY1L5LHxvpnyfqJwoB7HhR6raTmG
hex!["e2234d661bee4a04c38392c75d1566200aa9e6ae44dd98ee8765e4cc9af63cb7"].unchecked_into(),
// 5GvuM53k1Z4nAB5zXJFgkRSHv4Bqo4BsvgbQWNWkiWZTMwWY
hex!["765e46067adac4d1fe6c783aa2070dfa64a19f84376659e12705d1734b3eae01"].unchecked_into(),
// 5GvuM53k1Z4nAB5zXJFgkRSHv4Bqo4BsvgbQWNWkiWZTMwWY
hex!["765e46067adac4d1fe6c783aa2070dfa64a19f84376659e12705d1734b3eae01"].unchecked_into(),
// 5GvuM53k1Z4nAB5zXJFgkRSHv4Bqo4BsvgbQWNWkiWZTMwWY
hex!["765e46067adac4d1fe6c783aa2070dfa64a19f84376659e12705d1734b3eae01"].unchecked_into(),
),(
// 5FzwpgGvk2kk9agow6KsywLYcPzjYc8suKej2bne5G5b9YU3
hex!["ae12f70078a22882bf5135d134468f77301927aa67c376e8c55b7ff127ace115"].into(),
// 5EqoZhVC2BcsM4WjvZNidu2muKAbu5THQTBKe3EjvxXkdP7A
hex!["7addb914ec8486bbc60643d2647685dcc06373401fa80e09813b630c5831d54b"].into(),
// 5CXNq1mSKJT4Sc2CbyBBdANeSkbUvdWvE4czJjKXfBHi9sX5
hex!["664eae1ca4713dd6abf8c15e6c041820cda3c60df97dc476c2cbf7cb82cb2d2e"].unchecked_into(),
// 5E8ULLQrDAtWhfnVfZmX41Yux86zNAwVJYguWJZVWrJvdhBe
hex!["5b57ed1443c8967f461db1f6eb2ada24794d163a668f1cf9d9ce3235dfad8799"].unchecked_into(),
// 5CXNq1mSKJT4Sc2CbyBBdANeSkbUvdWvE4czJjKXfBHi9sX5
hex!["664eae1ca4713dd6abf8c15e6c041820cda3c60df97dc476c2cbf7cb82cb2d2e"].unchecked_into(),
// 5CXNq1mSKJT4Sc2CbyBBdANeSkbUvdWvE4czJjKXfBHi9sX5
hex!["664eae1ca4713dd6abf8c15e6c041820cda3c60df97dc476c2cbf7cb82cb2d2e"].unchecked_into(),
// 5CXNq1mSKJT4Sc2CbyBBdANeSkbUvdWvE4czJjKXfBHi9sX5
hex!["664eae1ca4713dd6abf8c15e6c041820cda3c60df97dc476c2cbf7cb82cb2d2e"].unchecked_into(),
),(
// 5CFj6Kg9rmVn1vrqpyjau2ztyBzKeVdRKwNPiA3tqhB5HPqq
hex!["0867dbb49721126df589db100dda728dc3b475cbf414dad8f72a1d5e84897252"].into(),
// 5CwQXP6nvWzigFqNhh2jvCaW9zWVzkdveCJY3tz2MhXMjTon
hex!["26ab2b4b2eba2263b1e55ceb48f687bb0018130a88df0712fbdaf6a347d50e2a"].into(),
// 5FCd9Y7RLNyxz5wnCAErfsLbXGG34L2BaZRHzhiJcMUMd5zd
hex!["2adb17a5cafbddc7c3e00ec45b6951a8b12ce2264235b4def342513a767e5d3d"].unchecked_into(),
// 5HGLmrZsiTFTPp3QoS1W8w9NxByt8PVq79reqvdxNcQkByqK
hex!["e60d23f49e93c1c1f2d7c115957df5bbd7faf5ebf138d1e9d02e8b39a1f63df0"].unchecked_into(),
// 5FCd9Y7RLNyxz5wnCAErfsLbXGG34L2BaZRHzhiJcMUMd5zd
hex!["2adb17a5cafbddc7c3e00ec45b6951a8b12ce2264235b4def342513a767e5d3d"].unchecked_into(),
// 5FCd9Y7RLNyxz5wnCAErfsLbXGG34L2BaZRHzhiJcMUMd5zd
hex!["2adb17a5cafbddc7c3e00ec45b6951a8b12ce2264235b4def342513a767e5d3d"].unchecked_into(),
// 5FCd9Y7RLNyxz5wnCAErfsLbXGG34L2BaZRHzhiJcMUMd5zd
hex!["2adb17a5cafbddc7c3e00ec45b6951a8b12ce2264235b4def342513a767e5d3d"].unchecked_into(),
)];
const ENDOWMENT: u128 = 1_000_000 * KSM;
const STASH: u128 = 100 * KSM;
kusama::GenesisConfig {
system: Some(kusama::SystemC