Update to latest Polkadot & Substrate (#75)

* Start fixing compilation errors

* Switch to git version of `WasmBuilder`

* Fix compilation

* More updates

* Adapt to latest Substrate/Polkadot changes
This commit is contained in:
Bastian Köcher
2020-04-06 21:55:32 +02:00
committed by GitHub
parent f54a6e8b4d
commit d4562c3a48
14 changed files with 2176 additions and 1881 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ use sc_service;
use sp_core::{Pair, Public};
/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.
pub type ChainSpec = sc_service::ChainSpec<GenesisConfig>;
pub type ChainSpec = sc_service::GenericChainSpec<GenesisConfig>;
/// Helper function to generate a crypto pair from seed
pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
+12 -13
View File
@@ -22,14 +22,13 @@ use std::sync::Arc;
use parachain_runtime::Block;
use sc_client::genesis;
use sc_service::{Configuration, Roles as ServiceRoles, config::PrometheusConfig};
use sc_service::{Configuration, Role as ServiceRole, config::PrometheusConfig};
use sp_core::hexdisplay::HexDisplay;
use sp_runtime::{
traits::{Block as BlockT, Hash as HashT, Header as HeaderT},
BuildStorage,
};
use sc_network::config::TransportConfig;
use polkadot_service::ChainSpec as ChainSpecPolkadot;
use codec::Encode;
use log::info;
@@ -51,7 +50,7 @@ pub fn run(version: sc_cli::VersionInfo) -> sc_cli::Result<()> {
subcommand.update_config(&mut config, load_spec, &version)?;
subcommand.run(
config,
|config: Configuration<_, _>| Ok(new_full_start!(config).0),
|config: Configuration| Ok(new_full_start!(config).0),
)
},
Some(Subcommand::ExportGenesisState(params)) => {
@@ -89,7 +88,7 @@ pub fn run(version: sc_cli::VersionInfo) -> sc_cli::Result<()> {
info!(" by {}, 2019", version.author);
info!("Chain specification: {}", config.expect_chain_spec().name());
info!("Node name: {}", config.name);
info!("Roles: {:?}", config.roles);
info!("Roles: {:?}", config.role);
info!("Parachain id: {:?}", crate::PARA_ID);
// TODO
@@ -101,7 +100,7 @@ pub fn run(version: sc_cli::VersionInfo) -> sc_cli::Result<()> {
[version.executable_name.to_string()].iter().chain(opt.relaychain_args.iter()),
&version,
);
let allow_private_ipv4 = !polkadot_opt.run.network_config.no_private_ipv4;
let allow_private_ipv4 = !polkadot_opt.run.base.network_config.no_private_ipv4;
polkadot_config.rpc_http = Some(DEFAULT_POLKADOT_RPC_HTTP.parse().unwrap());
polkadot_config.rpc_ws = Some(DEFAULT_POLKADOT_RPC_WS.parse().unwrap());
@@ -111,7 +110,7 @@ pub fn run(version: sc_cli::VersionInfo) -> sc_cli::Result<()> {
)
);
polkadot_opt.run.update_config(
polkadot_opt.run.base.update_config(
&mut polkadot_config,
load_spec_polkadot,
&version,
@@ -126,20 +125,20 @@ pub fn run(version: sc_cli::VersionInfo) -> sc_cli::Result<()> {
use_yamux_flow_control: false,
};
match config.roles {
ServiceRoles::LIGHT => unimplemented!("Light client not supported!"),
match config.role {
ServiceRole::Light => unimplemented!("Light client not supported!"),
_ => crate::service::run_collator(config, key, polkadot_config),
}
},
}
}
fn load_spec(_: &str) -> Result<Option<chain_spec::ChainSpec>, String> {
Ok(Some(chain_spec::get_chain_spec()))
fn load_spec(_: &str) -> Result<Box<dyn sc_service::ChainSpec>, String> {
Ok(Box::new(chain_spec::get_chain_spec()))
}
fn load_spec_polkadot(_: &str) -> Result<Option<ChainSpecPolkadot>, String> {
Some(polkadot_service::ChainSpec::from_json_bytes(
fn load_spec_polkadot(_: &str) -> Result<Box<dyn sc_service::ChainSpec>, String> {
polkadot_service::PolkadotChainSpec::from_json_bytes(
&include_bytes!("../res/polkadot_chainspec.json")[..],
)).transpose()
).map(|r| Box::new(r) as Box<_>)
}
+2 -4
View File
@@ -16,8 +16,6 @@
use std::sync::Arc;
use parachain_runtime::{self, GenesisConfig};
use sc_executor::native_executor_instance;
use sc_service::{AbstractService, Configuration};
use sc_finality_grandpa::{FinalityProofProvider as GrandpaFinalityProofProvider, StorageAndProofProvider};
@@ -73,8 +71,8 @@ macro_rules! new_full_start {
/// Run a collator node with the given parachain `Configuration` and relaychain `Configuration`
///
/// This function blocks until done.
pub fn run_collator<E: sc_service::ChainSpecExtension>(
parachain_config: Configuration<GenesisConfig, E>,
pub fn run_collator(
parachain_config: Configuration,
key: Arc<CollatorPair>,
mut polkadot_config: polkadot_collator::Configuration,
) -> sc_cli::Result<()> {