Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/master' into erasure_chunk_proof…
Browse files Browse the repository at this point in the history
…_bounded
  • Loading branch information
Lldenaurois committed Aug 22, 2021
2 parents 7b7bd4b + a1b08f9 commit f442c43
Show file tree
Hide file tree
Showing 73 changed files with 2,884 additions and 2,303 deletions.
447 changes: 211 additions & 236 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ members = [
"xcm/xcm-simulator",
"xcm/xcm-simulator/example",
"xcm/pallet-xcm",
"xcm/procedural",
"node/client",
"node/collation-generation",
"node/core/approval-voting",
Expand Down Expand Up @@ -112,6 +113,7 @@ panic = "unwind"
[features]
runtime-benchmarks= [ "polkadot-cli/runtime-benchmarks" ]
try-runtime = [ "polkadot-cli/try-runtime" ]
disputes = [ "polkadot-cli/disputes" ]

# Configuration for building a .deb package - for use with `cargo-deb`
[package.metadata.deb]
Expand Down
8 changes: 4 additions & 4 deletions bridges/bin/millau/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
use millau_runtime::{self, opaque::Block, RuntimeApi};
use sc_client_api::{ExecutorProvider, RemoteBackend};
use sc_consensus_aura::{ImportQueueParams, SlotProportion, StartAuraParams};
pub use sc_executor::NativeExecutor;
pub use sc_executor::NativeElseWasmExecutor;

use sc_keystore::LocalKeystore;
use sc_service::{error::Error as ServiceError, Configuration, TaskManager};
Expand All @@ -41,9 +41,9 @@ use sp_consensus_aura::sr25519::AuthorityPair as AuraPair;
use std::{sync::Arc, time::Duration};

// Our native executor instance.
pub struct Executor;
pub struct ExecutorDispatch;

impl sc_executor::NativeExecutionDispatch for Executor {
impl sc_executor::NativeExecutionDispatch for ExecutorDispatch {
type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;

fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
Expand All @@ -55,7 +55,7 @@ impl sc_executor::NativeExecutionDispatch for Executor {
}
}

type FullClient = sc_service::TFullClient<Block, RuntimeApi, Executor>;
type FullClient = sc_service::TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<ExecutorDispatch>>;
type FullBackend = sc_service::TFullBackend<Block>;
type FullSelectChain = sc_consensus::LongestChain<FullBackend, Block>;

Expand Down
8 changes: 4 additions & 4 deletions bridges/bin/rialto/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
use rialto_runtime::{self, opaque::Block, RuntimeApi};
use sc_client_api::{ExecutorProvider, RemoteBackend};
use sc_consensus_aura::{ImportQueueParams, SlotProportion, StartAuraParams};
pub use sc_executor::NativeExecutor;
pub use sc_executor::NativeElseWasmExecutor;

use sc_keystore::LocalKeystore;
use sc_service::{error::Error as ServiceError, Configuration, TaskManager};
Expand All @@ -43,9 +43,9 @@ use sp_consensus_aura::sr25519::AuthorityPair as AuraPair;
use std::{sync::Arc, time::Duration};

// Our native executor instance.
pub struct Executor;
pub struct ExecutorDispatch;

impl sc_executor::NativeExecutionDispatch for Executor {
impl sc_executor::NativeExecutionDispatch for ExecutorDispatch {
type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;

fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
Expand All @@ -57,7 +57,7 @@ impl sc_executor::NativeExecutionDispatch for Executor {
}
}

type FullClient = sc_service::TFullClient<Block, RuntimeApi, Executor>;
type FullClient = sc_service::TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<ExecutorDispatch>>;
type FullBackend = sc_service::TFullBackend<Block>;
type FullSelectChain = sc_consensus::LongestChain<FullBackend, Block>;

Expand Down
10 changes: 1 addition & 9 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ crate-type = ["cdylib", "rlib"]
log = "0.4.13"
thiserror = "1.0.26"
structopt = { version = "0.3.21", optional = true }
wasm-bindgen = { version = "0.2.70", optional = true }
wasm-bindgen-futures = { version = "0.4.25", optional = true }
futures = "0.3.15"

service = { package = "polkadot-service", path = "../node/service", default-features = false, optional = true }
Expand All @@ -29,7 +27,6 @@ frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", bran
try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true }
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true }
sc-service = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true }
browser-utils = { package = "substrate-browser-utils", git = "https://github.com/paritytech/substrate", branch = "master", optional = true }

# this crate is used only to enable `trie-memory-tracker` feature
# see https://github.com/paritytech/substrate/pull/6745
Expand Down Expand Up @@ -57,12 +54,6 @@ cli = [
# is resolved.
"service/memory-stats",
]
browser = [
"wasm-bindgen",
"wasm-bindgen-futures",
"browser-utils",
"service/light-node",
]
runtime-benchmarks = [ "service/runtime-benchmarks" ]
trie-memory-tracker = [ "sp-trie/memory-tracker" ]
full-node = [ "service/full-node" ]
Expand All @@ -76,3 +67,4 @@ westend-native = [ "service/westend-native" ]
rococo-native = [ "service/rococo-native" ]

malus = [ "full-node", "service/malus" ]
disputes = [ "service/disputes" ]
1 change: 0 additions & 1 deletion cli/browser-demo/.gitignore

This file was deleted.

9 changes: 0 additions & 9 deletions cli/browser-demo/README.md

This file was deleted.

3 changes: 0 additions & 3 deletions cli/browser-demo/build.sh

This file was deleted.

Binary file removed cli/browser-demo/favicon.png
Binary file not shown.
41 changes: 0 additions & 41 deletions cli/browser-demo/index.html

This file was deleted.

50 changes: 0 additions & 50 deletions cli/src/browser.rs

This file was deleted.

31 changes: 16 additions & 15 deletions cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,6 @@ fn run_node_inner(cli: Cli, overseer_gen: impl service::OverseerGen) -> Result<(
let role = config.role.clone();

match role {
#[cfg(feature = "browser")]
Role::Light => service::build_light(config)
.map(|(task_manager, _)| task_manager)
.map_err(Into::into),
#[cfg(not(feature = "browser"))]
Role::Light => Err(Error::Other("Light client not enabled".into())),
_ => service::build_full(
config,
Expand Down Expand Up @@ -338,15 +333,15 @@ pub fn run() -> Result<()> {
builder.with_colors(false);
let _ = builder.init();

#[cfg(any(target_os = "android", feature = "browser"))]
#[cfg(target_os = "android")]
{
return Err(sc_cli::Error::Input(
"PVF preparation workers are not supported under this platform".into(),
)
.into())
}

#[cfg(not(any(target_os = "android", feature = "browser")))]
#[cfg(not(target_os = "android"))]
{
polkadot_node_core_pvf::prepare_worker_entrypoint(&cmd.socket_path);
Ok(())
Expand All @@ -357,15 +352,15 @@ pub fn run() -> Result<()> {
builder.with_colors(false);
let _ = builder.init();

#[cfg(any(target_os = "android", feature = "browser"))]
#[cfg(target_os = "android")]
{
return Err(sc_cli::Error::Input(
"PVF execution workers are not supported under this platform".into(),
)
.into())
}

#[cfg(not(any(target_os = "android", feature = "browser")))]
#[cfg(not(target_os = "android"))]
{
polkadot_node_core_pvf::execute_worker_entrypoint(&cmd.socket_path);
Ok(())
Expand All @@ -381,23 +376,29 @@ pub fn run() -> Result<()> {
#[cfg(feature = "kusama-native")]
if chain_spec.is_kusama() {
return Ok(runner.sync_run(|config| {
cmd.run::<service::kusama_runtime::Block, service::KusamaExecutor>(config)
.map_err(|e| Error::SubstrateCli(e))
cmd.run::<service::kusama_runtime::Block, service::KusamaExecutorDispatch>(
config,
)
.map_err(|e| Error::SubstrateCli(e))
})?)
}

#[cfg(feature = "westend-native")]
if chain_spec.is_westend() {
return Ok(runner.sync_run(|config| {
cmd.run::<service::westend_runtime::Block, service::WestendExecutor>(config)
.map_err(|e| Error::SubstrateCli(e))
cmd.run::<service::westend_runtime::Block, service::WestendExecutorDispatch>(
config,
)
.map_err(|e| Error::SubstrateCli(e))
})?)
}

// else we assume it is polkadot.
Ok(runner.sync_run(|config| {
cmd.run::<service::polkadot_runtime::Block, service::PolkadotExecutor>(config)
.map_err(|e| Error::SubstrateCli(e))
cmd.run::<service::polkadot_runtime::Block, service::PolkadotExecutorDispatch>(
config,
)
.map_err(|e| Error::SubstrateCli(e))
})?)
},
Some(Subcommand::Key(cmd)) => Ok(cmd.run(&cli)?),
Expand Down
2 changes: 0 additions & 2 deletions cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

#![warn(missing_docs)]

#[cfg(feature = "browser")]
mod browser;
#[cfg(feature = "cli")]
mod cli;
#[cfg(feature = "cli")]
Expand Down
28 changes: 15 additions & 13 deletions node/client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use polkadot_primitives::v1::{
AccountId, Balance, Block, BlockNumber, Hash, Header, Nonce, ParachainHost,
};
use sc_client_api::{AuxStore, Backend as BackendT, BlockchainEvents, KeyIterator, UsageProvider};
use sc_executor::NativeElseWasmExecutor;
use sp_api::{CallApiAt, NumberFor, ProvideRuntimeApi};
use sp_blockchain::HeaderBackend;
use sp_consensus::BlockStatus;
Expand All @@ -36,12 +37,13 @@ use std::sync::Arc;

pub type FullBackend = sc_service::TFullBackend<Block>;

pub type FullClient<RuntimeApi, Executor> = sc_service::TFullClient<Block, RuntimeApi, Executor>;
pub type FullClient<RuntimeApi, ExecutorDispatch> =
sc_service::TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<ExecutorDispatch>>;

/// The native executor instance for Polkadot.
pub struct PolkadotExecutor;
pub struct PolkadotExecutorDispatch;

impl sc_executor::NativeExecutionDispatch for PolkadotExecutor {
impl sc_executor::NativeExecutionDispatch for PolkadotExecutorDispatch {
type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;

fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
Expand All @@ -55,10 +57,10 @@ impl sc_executor::NativeExecutionDispatch for PolkadotExecutor {

#[cfg(feature = "kusama")]
/// The native executor instance for Kusama.
pub struct KusamaExecutor;
pub struct KusamaExecutorDispatch;

#[cfg(feature = "kusama")]
impl sc_executor::NativeExecutionDispatch for KusamaExecutor {
impl sc_executor::NativeExecutionDispatch for KusamaExecutorDispatch {
type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;

fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
Expand All @@ -72,10 +74,10 @@ impl sc_executor::NativeExecutionDispatch for KusamaExecutor {

#[cfg(feature = "westend")]
/// The native executor instance for Westend.
pub struct WestendExecutor;
pub struct WestendExecutorDispatch;

#[cfg(feature = "westend")]
impl sc_executor::NativeExecutionDispatch for WestendExecutor {
impl sc_executor::NativeExecutionDispatch for WestendExecutorDispatch {
type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;

fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
Expand All @@ -89,10 +91,10 @@ impl sc_executor::NativeExecutionDispatch for WestendExecutor {

#[cfg(feature = "rococo")]
/// The native executor instance for Rococo.
pub struct RococoExecutor;
pub struct RococoExecutorDispatch;

#[cfg(feature = "rococo")]
impl sc_executor::NativeExecutionDispatch for RococoExecutor {
impl sc_executor::NativeExecutionDispatch for RococoExecutorDispatch {
type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;

fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
Expand Down Expand Up @@ -247,13 +249,13 @@ macro_rules! with_client {
/// See [`ExecuteWithClient`] for more information.
#[derive(Clone)]
pub enum Client {
Polkadot(Arc<FullClient<polkadot_runtime::RuntimeApi, PolkadotExecutor>>),
Polkadot(Arc<FullClient<polkadot_runtime::RuntimeApi, PolkadotExecutorDispatch>>),
#[cfg(feature = "westend")]
Westend(Arc<FullClient<westend_runtime::RuntimeApi, WestendExecutor>>),
Westend(Arc<FullClient<westend_runtime::RuntimeApi, WestendExecutorDispatch>>),
#[cfg(feature = "kusama")]
Kusama(Arc<FullClient<kusama_runtime::RuntimeApi, KusamaExecutor>>),
Kusama(Arc<FullClient<kusama_runtime::RuntimeApi, KusamaExecutorDispatch>>),
#[cfg(feature = "rococo")]
Rococo(Arc<FullClient<rococo_runtime::RuntimeApi, RococoExecutor>>),
Rococo(Arc<FullClient<rococo_runtime::RuntimeApi, RococoExecutorDispatch>>),
}

impl ClientHandle for Client {
Expand Down
Loading

0 comments on commit f442c43

Please sign in to comment.