Update to latest Substrate master (#783)

* Update to latest Substrate master

* Update wasm-builder and make `run` work
This commit is contained in:
Bastian Köcher
2020-01-22 12:27:28 +01:00
committed by GitHub
parent 5b129f1292
commit e6f4c36ed9
11 changed files with 377 additions and 434 deletions
+358 -415
View File
File diff suppressed because it is too large Load Diff
+6 -2
View File
@@ -25,7 +25,7 @@ mod browser;
use chain_spec::ChainSpec; use chain_spec::ChainSpec;
use futures::{ use futures::{
Future, FutureExt, TryFutureExt, future::select, channel::oneshot, Future, FutureExt, TryFutureExt, future::select, channel::oneshot, compat::Compat,
}; };
#[cfg(feature = "cli")] #[cfg(feature = "cli")]
use tokio::runtime::Runtime; use tokio::runtime::Runtime;
@@ -156,7 +156,7 @@ where
|exit, _cli_args, custom_args, mut config| { |exit, _cli_args, custom_args, mut config| {
info!("{}", version.name); info!("{}", version.name);
info!(" version {}", config.full_version()); info!(" version {}", config.full_version());
info!(" by {}, 2017-2019", version.author); info!(" by {}, 2017-2020", version.author);
info!("Chain specification: {}", config.chain_spec.name()); info!("Chain specification: {}", config.chain_spec.name());
info!("Native runtime: {}", D::native_version().runtime_version); info!("Native runtime: {}", D::native_version().runtime_version);
if is_kusama { if is_kusama {
@@ -171,6 +171,10 @@ where
config.custom = service::CustomConfiguration::default(); config.custom = service::CustomConfiguration::default();
config.custom.authority_discovery_enabled = custom_args.authority_discovery_enabled; config.custom.authority_discovery_enabled = custom_args.authority_discovery_enabled;
let runtime = Runtime::new().map_err(|e| format!("{:?}", e))?; let runtime = Runtime::new().map_err(|e| format!("{:?}", e))?;
config.tasks_executor = {
let runtime_handle = runtime.executor();
Some(Box::new(move |fut| { runtime_handle.spawn(Compat::new(fut.map(Ok))); }))
};
match config.roles { match config.roles {
service::Roles::LIGHT => service::Roles::LIGHT =>
run_until_exit( run_until_exit(
+1 -2
View File
@@ -968,12 +968,11 @@ mod tests {
} }
impl session::Trait for Test { impl session::Trait for Test {
type OnSessionEnding = (); type SessionManager = ();
type Keys = UintAuthorityId; type Keys = UintAuthorityId;
type ShouldEndSession = session::PeriodicSessions<Period, Offset>; type ShouldEndSession = session::PeriodicSessions<Period, Offset>;
type SessionHandler = session::TestSessionHandler; type SessionHandler = session::TestSessionHandler;
type Event = (); type Event = ();
type SelectInitialValidators = staking::Module<Self>;
type ValidatorId = u64; type ValidatorId = u64;
type ValidatorIdOf = staking::StashOf<Self>; type ValidatorIdOf = staking::StashOf<Self>;
type DisabledValidatorsThreshold = DisabledValidatorsThreshold; type DisabledValidatorsThreshold = DisabledValidatorsThreshold;
+1 -2
View File
@@ -688,12 +688,11 @@ mod tests {
} }
impl session::Trait for Test { impl session::Trait for Test {
type OnSessionEnding = (); type SessionManager = ();
type Keys = UintAuthorityId; type Keys = UintAuthorityId;
type ShouldEndSession = session::PeriodicSessions<Period, Offset>; type ShouldEndSession = session::PeriodicSessions<Period, Offset>;
type SessionHandler = session::TestSessionHandler; type SessionHandler = session::TestSessionHandler;
type Event = (); type Event = ();
type SelectInitialValidators = ();
type ValidatorId = u64; type ValidatorId = u64;
type ValidatorIdOf = (); type ValidatorIdOf = ();
type DisabledValidatorsThreshold = DisabledValidatorsThreshold; type DisabledValidatorsThreshold = DisabledValidatorsThreshold;
+1 -1
View File
@@ -17,5 +17,5 @@
use wasm_builder_runner::{build_current_project, WasmBuilderSource}; use wasm_builder_runner::{build_current_project, WasmBuilderSource};
fn main() { fn main() {
build_current_project("wasm_binary.rs", WasmBuilderSource::Crates("1.0.8")); build_current_project("wasm_binary.rs", WasmBuilderSource::Crates("1.0.9"));
} }
+3 -4
View File
@@ -77,8 +77,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("kusama"), spec_name: create_runtime_str!("kusama"),
impl_name: create_runtime_str!("parity-kusama"), impl_name: create_runtime_str!("parity-kusama"),
authoring_version: 2, authoring_version: 2,
spec_version: 1042, spec_version: 1043,
impl_version: 3, impl_version: 0,
apis: RUNTIME_API_VERSIONS, apis: RUNTIME_API_VERSIONS,
}; };
@@ -241,14 +241,13 @@ parameter_types! {
} }
impl session::Trait for Runtime { impl session::Trait for Runtime {
type OnSessionEnding = Staking; type SessionManager = Staking;
type SessionHandler = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders; type SessionHandler = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type ShouldEndSession = Babe; type ShouldEndSession = Babe;
type Event = Event; type Event = Event;
type Keys = SessionKeys; type Keys = SessionKeys;
type ValidatorId = AccountId; type ValidatorId = AccountId;
type ValidatorIdOf = staking::StashOf<Self>; type ValidatorIdOf = staking::StashOf<Self>;
type SelectInitialValidators = Staking;
type DisabledValidatorsThreshold = DisabledValidatorsThreshold; type DisabledValidatorsThreshold = DisabledValidatorsThreshold;
} }
+1 -1
View File
@@ -17,5 +17,5 @@
use wasm_builder_runner::{build_current_project, WasmBuilderSource}; use wasm_builder_runner::{build_current_project, WasmBuilderSource};
fn main() { fn main() {
build_current_project("wasm_binary.rs", WasmBuilderSource::Crates("1.0.8")); build_current_project("wasm_binary.rs", WasmBuilderSource::Crates("1.0.9"));
} }
+1 -2
View File
@@ -245,14 +245,13 @@ parameter_types! {
} }
impl session::Trait for Runtime { impl session::Trait for Runtime {
type OnSessionEnding = Staking; type SessionManager = Staking;
type SessionHandler = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders; type SessionHandler = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type ShouldEndSession = Babe; type ShouldEndSession = Babe;
type Event = Event; type Event = Event;
type Keys = SessionKeys; type Keys = SessionKeys;
type ValidatorId = AccountId; type ValidatorId = AccountId;
type ValidatorIdOf = staking::StashOf<Self>; type ValidatorIdOf = staking::StashOf<Self>;
type SelectInitialValidators = Staking;
type DisabledValidatorsThreshold = DisabledValidatorsThreshold; type DisabledValidatorsThreshold = DisabledValidatorsThreshold;
} }
+3 -3
View File
@@ -21,7 +21,7 @@ pub mod chain_spec;
use futures::{ use futures::{
FutureExt, TryFutureExt, FutureExt, TryFutureExt,
task::{Spawn, SpawnError, FutureObj}, task::{Spawn, SpawnError, FutureObj},
compat::{Future01CompatExt, Stream01CompatExt}, compat::Future01CompatExt,
}; };
use sc_client::LongestChain; use sc_client::LongestChain;
use std::sync::Arc; use std::sync::Arc;
@@ -455,9 +455,9 @@ pub fn new_full<Runtime, Dispatch, Extrinsic>(config: Configuration)
if authority_discovery_enabled { if authority_discovery_enabled {
let network = service.network(); let network = service.network();
let network_event_stream = network.event_stream().compat(); let network_event_stream = network.event_stream();
let dht_event_stream = network_event_stream.filter_map(|e| async move { match e { let dht_event_stream = network_event_stream.filter_map(|e| async move { match e {
Ok(Event::Dht(e)) => Some(e), Event::Dht(e) => Some(e),
_ => None, _ => None,
}}).boxed(); }}).boxed();
let authority_discovery = authority_discovery::AuthorityDiscovery::new( let authority_discovery = authority_discovery::AuthorityDiscovery::new(
+1 -1
View File
@@ -19,7 +19,7 @@ use wasm_builder_runner::{build_current_project_with_rustflags, WasmBuilderSourc
fn main() { fn main() {
build_current_project_with_rustflags( build_current_project_with_rustflags(
"wasm_binary.rs", "wasm_binary.rs",
WasmBuilderSource::Crates("1.0.7"), WasmBuilderSource::Crates("1.0.9"),
"-C link-arg=--export=__heap_base", "-C link-arg=--export=__heap_base",
); );
} }
+1 -1
View File
@@ -19,7 +19,7 @@ use wasm_builder_runner::{build_current_project_with_rustflags, WasmBuilderSourc
fn main() { fn main() {
build_current_project_with_rustflags( build_current_project_with_rustflags(
"wasm_binary.rs", "wasm_binary.rs",
WasmBuilderSource::Crates("1.0.7"), WasmBuilderSource::Crates("1.0.9"),
"-C link-arg=--export=__heap_base", "-C link-arg=--export=__heap_base",
); );
} }