Update to latest Substrate master (#320)

* Make `collator::Network` require `Send + Sync` to make it work

* Update packages

* Update to latest Substrate

* Make it compile and make tests work

* Use `polkadot-master`

* Fix CI

* Remove `build.sh` from readmes

* Delete old stuff

* Bring one back
This commit is contained in:
Bastian Köcher
2019-07-09 16:33:49 +02:00
committed by André Silva
parent d99f721540
commit c0b065837e
28 changed files with 728 additions and 4717 deletions
+25 -11
View File
@@ -21,7 +21,7 @@ use polkadot_primitives::{AccountId, SessionKey};
use polkadot_runtime::{
GenesisConfig, CouncilSeatsConfig, DemocracyConfig, SystemConfig, AuraConfig,
SessionConfig, StakingConfig, TimestampConfig, BalancesConfig, Perbill, SessionKeys,
GrandpaConfig, SudoConfig, IndicesConfig, CuratedGrandpaConfig, StakerStatus,
GrandpaConfig, SudoConfig, IndicesConfig, CuratedGrandpaConfig, StakerStatus, WASM_BINARY,
};
use telemetry::TelemetryEndpoints;
use hex_literal::hex;
@@ -76,8 +76,7 @@ fn staging_testnet_config_genesis() -> GenesisConfig {
GenesisConfig {
system: Some(SystemConfig {
// TODO: Change after Substrate 1252 is fixed (https://github.com/paritytech/substrate/issues/1252)
code: include_bytes!("../../runtime/wasm/target/wasm32-unknown-unknown/release/polkadot_runtime.compact.wasm").to_vec(),
code: WASM_BINARY.to_vec(),
changes_trie_config: Default::default(),
}),
balances: Some(BalancesConfig {
@@ -93,10 +92,9 @@ fn staging_testnet_config_genesis() -> GenesisConfig {
.collect::<Vec<_>>(),
}),
session: Some(SessionConfig {
validators: initial_authorities.iter().map(|x| x.1.clone()).collect(),
keys: initial_authorities.iter().map(|x| (
x.1.clone(),
SessionKeys(x.2.clone(), x.2.clone()),
SessionKeys { ed25519: x.2.clone() },
)).collect::<Vec<_>>(),
}),
staking: Some(StakingConfig {
@@ -203,8 +201,7 @@ pub fn testnet_genesis(
GenesisConfig {
system: Some(SystemConfig {
// TODO: Change after Substrate 1252 is fixed (https://github.com/paritytech/substrate/issues/1252)
code: include_bytes!("../../runtime/wasm/target/wasm32-unknown-unknown/release/polkadot_runtime.compact.wasm").to_vec(),
code: WASM_BINARY.to_vec(),
changes_trie_config: Default::default(),
}),
indices: Some(IndicesConfig {
@@ -215,10 +212,9 @@ pub fn testnet_genesis(
vesting: vec![],
}),
session: Some(SessionConfig {
validators: initial_authorities.iter().map(|x| x.1.clone()).collect(),
keys: initial_authorities.iter().map(|x| (
x.1.clone(),
SessionKeys(x.2.clone(), x.2.clone()),
SessionKeys { ed25519: x.2.clone() },
)).collect::<Vec<_>>(),
}),
staking: Some(StakingConfig {
@@ -277,7 +273,16 @@ fn development_config_genesis() -> GenesisConfig {
/// Development config (single validator Alice)
pub fn development_config() -> ChainSpec {
ChainSpec::from_genesis("Development", "dev", development_config_genesis, vec![], None, Some(DEFAULT_PROTOCOL_ID), None, None)
ChainSpec::from_genesis(
"Development",
"dev",
development_config_genesis,
vec![],
None,
Some(DEFAULT_PROTOCOL_ID),
None,
None,
)
}
fn local_testnet_genesis() -> GenesisConfig {
@@ -293,5 +298,14 @@ fn local_testnet_genesis() -> GenesisConfig {
/// Local testnet config (multivalidator Alice + Bob)
pub fn local_testnet_config() -> ChainSpec {
ChainSpec::from_genesis("Local Testnet", "local_testnet", local_testnet_genesis, vec![], None, Some(DEFAULT_PROTOCOL_ID), None, None)
ChainSpec::from_genesis(
"Local Testnet",
"local_testnet",
local_testnet_genesis,
vec![],
None,
Some(DEFAULT_PROTOCOL_ID),
None,
None,
)
}
+16 -16
View File
@@ -22,7 +22,7 @@ use client::LongestChain;
use consensus_common::SelectChain;
use std::sync::Arc;
use std::time::Duration;
use polkadot_primitives::{parachain, Block, Hash, BlockId};
use polkadot_primitives::{parachain, Block, Hash, BlockId, AuraPair};
use polkadot_runtime::{GenesisConfig, RuntimeApi};
use polkadot_network::gossip::{self as network_gossip, Known};
use primitives::{ed25519, Pair};
@@ -40,7 +40,7 @@ pub use service::config::full_version_from_strs;
pub use client::{backend::Backend, runtime_api::Core as CoreApi, ExecutionStrategy};
pub use polkadot_network::{PolkadotProtocol, NetworkService};
pub use polkadot_primitives::parachain::{CollatorId, ParachainHost};
pub use primitives::{Blake2Hasher};
pub use primitives::Blake2Hasher;
pub use sr_primitives::traits::ProvideRuntimeApi;
pub use chain_spec::ChainSpec;
@@ -163,7 +163,7 @@ service::construct_service_factory! {
{ |config: FactoryFullConfiguration<Self>| {
FullComponents::<Factory>::new(config)
} },
AuthoritySetup = { |mut service: Self::FullService, key: Option<Arc<ed25519::Pair>>| {
AuthoritySetup = { |mut service: Self::FullService| {
use polkadot_network::validation::ValidationNetwork;
let (block_import, link_half) = service.config.custom.grandpa_import_setup.take()
@@ -171,14 +171,14 @@ service::construct_service_factory! {
// always run GRANDPA in order to sync.
{
let local_key = if service.config.disable_grandpa {
let grandpa_key = if service.config.disable_grandpa {
None
} else {
key.clone()
service.authority_key::<grandpa_primitives::AuthorityPair>()
};
let config = grandpa::Config {
local_key,
local_key: grandpa_key.map(Arc::new),
// FIXME #1578 make this available through chainspec
gossip_duration: Duration::from_millis(333),
justification_period: 4096,
@@ -220,22 +220,22 @@ service::construct_service_factory! {
let mut path = PathBuf::from(service.config.database_path.clone());
path.push("availability");
::av_store::Store::new(::av_store::Config {
av_store::Store::new(::av_store::Config {
cache_size: None,
path,
})?
};
// run authorship only if authority.
let key = match key {
Some(key) => key,
let aura_key = match service.authority_key::<AuraPair>() {
Some(key) => Arc::new(key),
None => return Ok(service),
};
if service.config.custom.collating_for.is_some() {
info!("The node cannot start as an authority because it is also configured\
to run as a collator.");
info!(
"The node cannot start as an authority because it is also configured to run as a collator."
);
return Ok(service);
}
@@ -279,23 +279,23 @@ service::construct_service_factory! {
service.client(),
polkadot_network::validation::WrappedExecutor(service.spawn_task_handle()),
);
let proposer_factory = ::consensus::ProposerFactory::new(
let proposer_factory = consensus::ProposerFactory::new(
client.clone(),
select_chain.clone(),
validation_network.clone(),
validation_network,
service.transaction_pool(),
Arc::new(service.spawn_task_handle()),
key.clone(),
aura_key.clone(),
extrinsic_store,
SlotDuration::get_or_compute(&*client)?,
service.config.custom.max_block_data_size,
);
info!("Using authority key {}", key.public());
info!("Using authority key {}", aura_key.public());
let task = start_aura(
SlotDuration::get_or_compute(&*client)?,
key,
aura_key,
client.clone(),
select_chain,
block_import,