mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 20:31:13 +00:00
Make choosing an executor (native/wasm) an explicit part of service construction (#9525)
* Split native executor stuff from wasm executor stuff * Remove `native_runtime_version` in places * Fix warning * Fix test warning * Remove redundant NativeRuntimeInfo trait * Add a warning for use_native * Run cargo fmt * Revert "Add a warning for use_native" This reverts commit 9494f765a06037e991dd60524f2ed1b14649bfd6. * Make choosing an executor (native/wasm) an explicit part of service construction * Add Cargo.lock * Rename Executor to ExecutorDispatch * Update bin/node/executor/src/lib.rs Co-authored-by: Squirrel <gilescope@gmail.com> * Fix tests * Fix minor node-executor error * Fix node cli command thing Co-authored-by: Squirrel <gilescope@gmail.com>
This commit is contained in:
Generated
+2
@@ -4224,6 +4224,7 @@ dependencies = [
|
||||
"sc-consensus-epochs",
|
||||
"sc-consensus-slots",
|
||||
"sc-consensus-uncles",
|
||||
"sc-executor",
|
||||
"sc-finality-grandpa",
|
||||
"sc-keystore",
|
||||
"sc-network",
|
||||
@@ -4296,6 +4297,7 @@ dependencies = [
|
||||
"parity-scale-codec",
|
||||
"sc-cli",
|
||||
"sc-client-api",
|
||||
"sc-executor",
|
||||
"sc-service",
|
||||
"sp-blockchain",
|
||||
"sp-core",
|
||||
|
||||
@@ -119,7 +119,7 @@ pub fn run() -> sc_cli::Result<()> {
|
||||
if cfg!(feature = "runtime-benchmarks") {
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
|
||||
runner.sync_run(|config| cmd.run::<Block, service::Executor>(config))
|
||||
runner.sync_run(|config| cmd.run::<Block, service::ExecutorDispatch>(config))
|
||||
} else {
|
||||
Err("Benchmarking wasn't enabled when building the node. You can enable it with \
|
||||
`--features runtime-benchmarks`."
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
use node_template_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_finality_grandpa::SharedVoterState;
|
||||
use sc_keystore::LocalKeystore;
|
||||
use sc_service::{error::Error as ServiceError, Configuration, TaskManager};
|
||||
@@ -13,9 +13,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>> {
|
||||
@@ -27,7 +27,8 @@ 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>;
|
||||
|
||||
@@ -68,10 +69,17 @@ pub fn new_partial(
|
||||
})
|
||||
.transpose()?;
|
||||
|
||||
let executor = NativeElseWasmExecutor::<ExecutorDispatch>::new(
|
||||
config.wasm_method,
|
||||
config.default_heap_pages,
|
||||
config.max_runtime_instances,
|
||||
);
|
||||
|
||||
let (client, backend, keystore_container, task_manager) =
|
||||
sc_service::new_full_parts::<Block, RuntimeApi, Executor>(
|
||||
sc_service::new_full_parts::<Block, RuntimeApi, _>(
|
||||
&config,
|
||||
telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),
|
||||
executor,
|
||||
)?;
|
||||
let client = Arc::new(client);
|
||||
|
||||
@@ -336,10 +344,17 @@ pub fn new_light(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
||||
})
|
||||
.transpose()?;
|
||||
|
||||
let executor = NativeElseWasmExecutor::<ExecutorDispatch>::new(
|
||||
config.wasm_method,
|
||||
config.default_heap_pages,
|
||||
config.max_runtime_instances,
|
||||
);
|
||||
|
||||
let (client, backend, keystore_container, mut task_manager, on_demand) =
|
||||
sc_service::new_light_parts::<Block, RuntimeApi, Executor>(
|
||||
sc_service::new_light_parts::<Block, RuntimeApi, _>(
|
||||
&config,
|
||||
telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),
|
||||
executor,
|
||||
)?;
|
||||
|
||||
let mut telemetry = telemetry.map(|(worker, telemetry)| {
|
||||
|
||||
@@ -72,6 +72,7 @@ sc-rpc = { version = "4.0.0-dev", path = "../../../client/rpc" }
|
||||
sc-basic-authorship = { version = "0.10.0-dev", path = "../../../client/basic-authorship" }
|
||||
sc-service = { version = "0.10.0-dev", default-features = false, path = "../../../client/service" }
|
||||
sc-telemetry = { version = "4.0.0-dev", path = "../../../client/telemetry" }
|
||||
sc-executor = { version = "0.10.0-dev", path = "../../../client/executor" }
|
||||
sc-authority-discovery = { version = "0.10.0-dev", path = "../../../client/authority-discovery" }
|
||||
sc-sync-state-rpc = { version = "0.10.0-dev", path = "../../../client/sync-state-rpc" }
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{chain_spec, service, service::new_partial, Cli, Subcommand};
|
||||
use node_executor::Executor;
|
||||
use node_executor::ExecutorDispatch;
|
||||
use node_runtime::{Block, RuntimeApi};
|
||||
use sc_cli::{ChainSpec, Result, Role, RuntimeVersion, SubstrateCli};
|
||||
use sc_service::PartialComponents;
|
||||
@@ -87,13 +87,13 @@ pub fn run() -> Result<()> {
|
||||
Some(Subcommand::Inspect(cmd)) => {
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
|
||||
runner.sync_run(|config| cmd.run::<Block, RuntimeApi, Executor>(config))
|
||||
runner.sync_run(|config| cmd.run::<Block, RuntimeApi, ExecutorDispatch>(config))
|
||||
},
|
||||
Some(Subcommand::Benchmark(cmd)) =>
|
||||
if cfg!(feature = "runtime-benchmarks") {
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
|
||||
runner.sync_run(|config| cmd.run::<Block, Executor>(config))
|
||||
runner.sync_run(|config| cmd.run::<Block, ExecutorDispatch>(config))
|
||||
} else {
|
||||
Err("Benchmarking wasn't enabled when building the node. \
|
||||
You can enable it with `--features runtime-benchmarks`."
|
||||
@@ -159,7 +159,7 @@ pub fn run() -> Result<()> {
|
||||
sc_service::TaskManager::new(config.task_executor.clone(), registry)
|
||||
.map_err(|e| sc_cli::Error::Service(sc_service::Error::Prometheus(e)))?;
|
||||
|
||||
Ok((cmd.run::<Block, Executor>(config), task_manager))
|
||||
Ok((cmd.run::<Block, ExecutorDispatch>(config), task_manager))
|
||||
})
|
||||
},
|
||||
#[cfg(not(feature = "try-runtime"))]
|
||||
|
||||
@@ -21,23 +21,26 @@
|
||||
//! Service implementation. Specialized wrapper over substrate service.
|
||||
|
||||
use futures::prelude::*;
|
||||
use node_executor::Executor;
|
||||
use node_executor::ExecutorDispatch;
|
||||
use node_primitives::Block;
|
||||
use node_runtime::RuntimeApi;
|
||||
use sc_client_api::{ExecutorProvider, RemoteBackend};
|
||||
use sc_consensus_babe::{self, SlotProportion};
|
||||
use sc_executor::NativeElseWasmExecutor;
|
||||
use sc_network::{Event, NetworkService};
|
||||
use sc_service::{config::Configuration, error::Error as ServiceError, RpcHandlers, TaskManager};
|
||||
use sc_telemetry::{Telemetry, TelemetryWorker};
|
||||
use sp_runtime::traits::Block as BlockT;
|
||||
use std::sync::Arc;
|
||||
|
||||
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>;
|
||||
type FullGrandpaBlockImport =
|
||||
grandpa::GrandpaBlockImport<FullBackend, Block, FullClient, FullSelectChain>;
|
||||
type LightClient = sc_service::TLightClient<Block, RuntimeApi, Executor>;
|
||||
type LightClient =
|
||||
sc_service::TLightClient<Block, RuntimeApi, NativeElseWasmExecutor<ExecutorDispatch>>;
|
||||
|
||||
pub fn new_partial(
|
||||
config: &Configuration,
|
||||
@@ -75,10 +78,17 @@ pub fn new_partial(
|
||||
})
|
||||
.transpose()?;
|
||||
|
||||
let executor = NativeElseWasmExecutor::<ExecutorDispatch>::new(
|
||||
config.wasm_method,
|
||||
config.default_heap_pages,
|
||||
config.max_runtime_instances,
|
||||
);
|
||||
|
||||
let (client, backend, keystore_container, task_manager) =
|
||||
sc_service::new_full_parts::<Block, RuntimeApi, Executor>(
|
||||
sc_service::new_full_parts::<Block, RuntimeApi, _>(
|
||||
&config,
|
||||
telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),
|
||||
executor,
|
||||
)?;
|
||||
let client = Arc::new(client);
|
||||
|
||||
@@ -447,10 +457,17 @@ pub fn new_light_base(
|
||||
})
|
||||
.transpose()?;
|
||||
|
||||
let executor = NativeElseWasmExecutor::<ExecutorDispatch>::new(
|
||||
config.wasm_method,
|
||||
config.default_heap_pages,
|
||||
config.max_runtime_instances,
|
||||
);
|
||||
|
||||
let (client, backend, keystore_container, mut task_manager, on_demand) =
|
||||
sc_service::new_light_parts::<Block, RuntimeApi, Executor>(
|
||||
sc_service::new_light_parts::<Block, RuntimeApi, _>(
|
||||
&config,
|
||||
telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),
|
||||
executor,
|
||||
)?;
|
||||
|
||||
let mut telemetry = telemetry.map(|(worker, telemetry)| {
|
||||
|
||||
@@ -18,14 +18,14 @@
|
||||
use codec::{Decode, Encode};
|
||||
use criterion::{criterion_group, criterion_main, BatchSize, Criterion};
|
||||
use frame_support::Hashable;
|
||||
use node_executor::Executor;
|
||||
use node_executor::ExecutorDispatch;
|
||||
use node_primitives::{BlockNumber, Hash};
|
||||
use node_runtime::{
|
||||
constants::currency::*, Block, BuildStorage, Call, CheckedExtrinsic, GenesisConfig, Header,
|
||||
UncheckedExtrinsic,
|
||||
};
|
||||
use node_testing::keyring::*;
|
||||
use sc_executor::{Externalities, NativeExecutor, RuntimeVersionOf, WasmExecutionMethod};
|
||||
use sc_executor::{Externalities, NativeElseWasmExecutor, RuntimeVersionOf, WasmExecutionMethod};
|
||||
use sp_core::{
|
||||
storage::well_known_keys,
|
||||
traits::{CodeExecutor, RuntimeCode},
|
||||
@@ -77,7 +77,7 @@ fn new_test_ext(genesis_config: &GenesisConfig) -> TestExternalities<BlakeTwo256
|
||||
}
|
||||
|
||||
fn construct_block<E: Externalities>(
|
||||
executor: &NativeExecutor<Executor>,
|
||||
executor: &NativeElseWasmExecutor<ExecutorDispatch>,
|
||||
ext: &mut E,
|
||||
number: BlockNumber,
|
||||
parent_hash: Hash,
|
||||
@@ -157,7 +157,7 @@ fn construct_block<E: Externalities>(
|
||||
|
||||
fn test_blocks(
|
||||
genesis_config: &GenesisConfig,
|
||||
executor: &NativeExecutor<Executor>,
|
||||
executor: &NativeElseWasmExecutor<ExecutorDispatch>,
|
||||
) -> Vec<(Vec<u8>, Hash)> {
|
||||
let mut test_ext = new_test_ext(genesis_config);
|
||||
let mut block1_extrinsics = vec![CheckedExtrinsic {
|
||||
@@ -191,7 +191,7 @@ fn bench_execute_block(c: &mut Criterion) {
|
||||
ExecutionMethod::Wasm(wasm_method) => (false, wasm_method),
|
||||
};
|
||||
|
||||
let executor = NativeExecutor::new(wasm_method, None, 8);
|
||||
let executor = NativeElseWasmExecutor::new(wasm_method, None, 8);
|
||||
let runtime_code = RuntimeCode {
|
||||
code_fetcher: &sp_core::traits::WrappedRuntimeCode(compact_code_unwrap().into()),
|
||||
hash: vec![1, 2, 3],
|
||||
|
||||
@@ -18,13 +18,13 @@
|
||||
//! A `CodeExecutor` specialization which uses natively compiled runtime when the wasm to be
|
||||
//! executed is equivalent to the natively compiled code.
|
||||
|
||||
pub use sc_executor::NativeExecutor;
|
||||
pub use sc_executor::NativeElseWasmExecutor;
|
||||
|
||||
// Declare an instance of the native executor named `Executor`. Include the wasm binary as the
|
||||
// equivalent wasm code.
|
||||
pub struct Executor;
|
||||
// Declare an instance of the native executor named `ExecutorDispatch`. Include the wasm binary as
|
||||
// the equivalent wasm code.
|
||||
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>> {
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
use codec::{Decode, Encode};
|
||||
use frame_support::Hashable;
|
||||
use frame_system::offchain::AppCrypto;
|
||||
use sc_executor::{error::Result, NativeExecutor, WasmExecutionMethod};
|
||||
use sc_executor::{error::Result, NativeElseWasmExecutor, WasmExecutionMethod};
|
||||
use sp_consensus_babe::{
|
||||
digests::{PreDigest, SecondaryPlainPreDigest},
|
||||
Slot, BABE_ENGINE_ID,
|
||||
@@ -35,7 +35,7 @@ use sp_runtime::{
|
||||
};
|
||||
use sp_state_machine::TestExternalities as CoreTestExternalities;
|
||||
|
||||
use node_executor::Executor;
|
||||
use node_executor::ExecutorDispatch;
|
||||
use node_primitives::{BlockNumber, Hash};
|
||||
use node_runtime::{
|
||||
constants::currency::*, Block, BuildStorage, CheckedExtrinsic, Header, Runtime,
|
||||
@@ -95,8 +95,8 @@ pub fn from_block_number(n: u32) -> Header {
|
||||
Header::new(n, Default::default(), Default::default(), [69; 32].into(), Default::default())
|
||||
}
|
||||
|
||||
pub fn executor() -> NativeExecutor<Executor> {
|
||||
NativeExecutor::new(WasmExecutionMethod::Interpreted, None, 8)
|
||||
pub fn executor() -> NativeElseWasmExecutor<ExecutorDispatch> {
|
||||
NativeElseWasmExecutor::new(WasmExecutionMethod::Interpreted, None, 8)
|
||||
}
|
||||
|
||||
pub fn executor_call<
|
||||
|
||||
@@ -15,6 +15,7 @@ codec = { package = "parity-scale-codec", version = "2.0.0" }
|
||||
derive_more = "0.99"
|
||||
sc-cli = { version = "0.10.0-dev", path = "../../../client/cli" }
|
||||
sc-client-api = { version = "4.0.0-dev", path = "../../../client/api" }
|
||||
sc-executor = { version = "0.10.0-dev", path = "../../../client/executor" }
|
||||
sc-service = { version = "0.10.0-dev", default-features = false, path = "../../../client/service" }
|
||||
sp-blockchain = { version = "4.0.0-dev", path = "../../../primitives/blockchain" }
|
||||
sp-core = { version = "4.0.0-dev", path = "../../../primitives/core" }
|
||||
|
||||
@@ -23,6 +23,7 @@ use crate::{
|
||||
Inspector,
|
||||
};
|
||||
use sc_cli::{CliConfiguration, ImportParams, Result, SharedParams};
|
||||
use sc_executor::NativeElseWasmExecutor;
|
||||
use sc_service::{new_full_client, Configuration, NativeExecutionDispatch};
|
||||
use sp_runtime::traits::Block;
|
||||
use std::str::FromStr;
|
||||
@@ -36,7 +37,13 @@ impl InspectCmd {
|
||||
RA: Send + Sync + 'static,
|
||||
EX: NativeExecutionDispatch + 'static,
|
||||
{
|
||||
let client = new_full_client::<B, RA, EX>(&config, None)?;
|
||||
let executor = NativeElseWasmExecutor::<EX>::new(
|
||||
config.wasm_method,
|
||||
config.default_heap_pages,
|
||||
config.max_runtime_instances,
|
||||
);
|
||||
|
||||
let client = new_full_client::<B, RA, _>(&config, None, executor)?;
|
||||
let inspect = Inspector::<B>::new(client);
|
||||
|
||||
match &self.command {
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
use grandpa::GrandpaBlockImport;
|
||||
use sc_consensus_babe::BabeBlockImport;
|
||||
use sc_consensus_manual_seal::consensus::babe::SlotTimestampProvider;
|
||||
use sc_executor::NativeElseWasmExecutor;
|
||||
use sc_service::{TFullBackend, TFullClient};
|
||||
use sp_runtime::generic::Era;
|
||||
use test_runner::{ChainInfo, SignatureVerificationOverride};
|
||||
@@ -30,9 +31,9 @@ type BlockImport<B, BE, C, SC> = BabeBlockImport<B, C, GrandpaBlockImport<BE, B,
|
||||
|
||||
/// A unit struct which implements `NativeExecutionDispatch` feeding in the
|
||||
/// hard-coded runtime.
|
||||
pub struct Executor;
|
||||
pub struct ExecutorDispatch;
|
||||
|
||||
impl sc_executor::NativeExecutionDispatch for Executor {
|
||||
impl sc_executor::NativeExecutionDispatch for ExecutorDispatch {
|
||||
type ExtendHostFunctions =
|
||||
(frame_benchmarking::benchmarking::HostFunctions, SignatureVerificationOverride);
|
||||
|
||||
@@ -50,14 +51,14 @@ struct NodeTemplateChainInfo;
|
||||
|
||||
impl ChainInfo for NodeTemplateChainInfo {
|
||||
type Block = node_primitives::Block;
|
||||
type Executor = Executor;
|
||||
type ExecutorDispatch = ExecutorDispatch;
|
||||
type Runtime = node_runtime::Runtime;
|
||||
type RuntimeApi = node_runtime::RuntimeApi;
|
||||
type SelectChain = sc_consensus::LongestChain<TFullBackend<Self::Block>, Self::Block>;
|
||||
type BlockImport = BlockImport<
|
||||
Self::Block,
|
||||
TFullBackend<Self::Block>,
|
||||
TFullClient<Self::Block, Self::RuntimeApi, Self::Executor>,
|
||||
TFullClient<Self::Block, Self::RuntimeApi, NativeElseWasmExecutor<Self::ExecutorDispatch>>,
|
||||
Self::SelectChain,
|
||||
>;
|
||||
type SignedExtras = node_runtime::SignedExtra;
|
||||
|
||||
@@ -46,7 +46,7 @@ use sc_client_api::{
|
||||
};
|
||||
use sc_client_db::PruningMode;
|
||||
use sc_consensus::{BlockImport, BlockImportParams, ForkChoiceStrategy, ImportResult, ImportedAux};
|
||||
use sc_executor::{NativeExecutor, WasmExecutionMethod};
|
||||
use sc_executor::{NativeElseWasmExecutor, WasmExecutionMethod};
|
||||
use sp_api::ProvideRuntimeApi;
|
||||
use sp_block_builder::BlockBuilder;
|
||||
use sp_consensus::BlockOrigin;
|
||||
@@ -390,7 +390,7 @@ impl BenchDb {
|
||||
let backend = sc_service::new_db_backend(db_config).expect("Should not fail");
|
||||
let client = sc_service::new_client(
|
||||
backend.clone(),
|
||||
NativeExecutor::new(WasmExecutionMethod::Compiled, None, 8),
|
||||
NativeElseWasmExecutor::new(WasmExecutionMethod::Compiled, None, 8),
|
||||
&keyring.generate_genesis(),
|
||||
None,
|
||||
None,
|
||||
|
||||
@@ -24,7 +24,7 @@ use sp_runtime::BuildStorage;
|
||||
pub use substrate_test_client::*;
|
||||
|
||||
/// Call executor for `node-runtime` `TestClient`.
|
||||
pub type Executor = sc_executor::NativeExecutor<node_executor::Executor>;
|
||||
pub type ExecutorDispatch = sc_executor::NativeElseWasmExecutor<node_executor::ExecutorDispatch>;
|
||||
|
||||
/// Default backend type.
|
||||
pub type Backend = sc_client_db::Backend<node_primitives::Block>;
|
||||
@@ -32,7 +32,7 @@ pub type Backend = sc_client_db::Backend<node_primitives::Block>;
|
||||
/// Test client type.
|
||||
pub type Client = client::Client<
|
||||
Backend,
|
||||
client::LocalCallExecutor<node_primitives::Block, Backend, Executor>,
|
||||
client::LocalCallExecutor<node_primitives::Block, Backend, ExecutorDispatch>,
|
||||
node_primitives::Block,
|
||||
node_runtime::RuntimeApi,
|
||||
>;
|
||||
@@ -64,7 +64,7 @@ pub trait TestClientBuilderExt: Sized {
|
||||
impl TestClientBuilderExt
|
||||
for substrate_test_client::TestClientBuilder<
|
||||
node_primitives::Block,
|
||||
client::LocalCallExecutor<node_primitives::Block, Backend, Executor>,
|
||||
client::LocalCallExecutor<node_primitives::Block, Backend, ExecutorDispatch>,
|
||||
Backend,
|
||||
GenesisParameters,
|
||||
>
|
||||
|
||||
@@ -55,7 +55,7 @@ type Error = sp_blockchain::Error;
|
||||
|
||||
type TestClient = substrate_test_runtime_client::client::Client<
|
||||
substrate_test_runtime_client::Backend,
|
||||
substrate_test_runtime_client::Executor,
|
||||
substrate_test_runtime_client::ExecutorDispatch,
|
||||
TestBlock,
|
||||
substrate_test_runtime_client::runtime::RuntimeApi,
|
||||
>;
|
||||
|
||||
@@ -39,7 +39,7 @@ mod wasm_runtime;
|
||||
|
||||
pub use codec::Codec;
|
||||
pub use native_executor::{
|
||||
with_externalities_safe, NativeExecutionDispatch, NativeExecutor, WasmExecutor,
|
||||
with_externalities_safe, NativeElseWasmExecutor, NativeExecutionDispatch, WasmExecutor,
|
||||
};
|
||||
#[doc(hidden)]
|
||||
pub use sp_core::traits::Externalities;
|
||||
|
||||
@@ -311,7 +311,7 @@ impl RuntimeVersionOf for WasmExecutor {
|
||||
|
||||
/// A generic `CodeExecutor` implementation that uses a delegate to determine wasm code equivalence
|
||||
/// and dispatch to native code when possible, falling back on `WasmExecutor` when not.
|
||||
pub struct NativeExecutor<D> {
|
||||
pub struct NativeElseWasmExecutor<D> {
|
||||
/// Dummy field to avoid the compiler complaining about us not using `D`.
|
||||
_dummy: std::marker::PhantomData<D>,
|
||||
/// Native runtime version info.
|
||||
@@ -320,7 +320,7 @@ pub struct NativeExecutor<D> {
|
||||
wasm: WasmExecutor,
|
||||
}
|
||||
|
||||
impl<D: NativeExecutionDispatch> NativeExecutor<D> {
|
||||
impl<D: NativeExecutionDispatch> NativeElseWasmExecutor<D> {
|
||||
/// Create new instance.
|
||||
///
|
||||
/// # Parameters
|
||||
@@ -356,7 +356,7 @@ impl<D: NativeExecutionDispatch> NativeExecutor<D> {
|
||||
None,
|
||||
);
|
||||
|
||||
NativeExecutor {
|
||||
NativeElseWasmExecutor {
|
||||
_dummy: Default::default(),
|
||||
native_version: D::native_version(),
|
||||
wasm: wasm_executor,
|
||||
@@ -364,7 +364,7 @@ impl<D: NativeExecutionDispatch> NativeExecutor<D> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<D: NativeExecutionDispatch> RuntimeVersionOf for NativeExecutor<D> {
|
||||
impl<D: NativeExecutionDispatch> RuntimeVersionOf for NativeElseWasmExecutor<D> {
|
||||
fn runtime_version(
|
||||
&self,
|
||||
ext: &mut dyn Externalities,
|
||||
@@ -377,7 +377,7 @@ impl<D: NativeExecutionDispatch> RuntimeVersionOf for NativeExecutor<D> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<D: NativeExecutionDispatch> GetNativeVersion for NativeExecutor<D> {
|
||||
impl<D: NativeExecutionDispatch> GetNativeVersion for NativeElseWasmExecutor<D> {
|
||||
fn native_version(&self) -> &NativeVersion {
|
||||
&self.native_version
|
||||
}
|
||||
@@ -508,7 +508,7 @@ fn preregister_builtin_ext(module: Arc<dyn WasmModule>) {
|
||||
});
|
||||
}
|
||||
|
||||
impl<D: NativeExecutionDispatch + 'static> CodeExecutor for NativeExecutor<D> {
|
||||
impl<D: NativeExecutionDispatch + 'static> CodeExecutor for NativeElseWasmExecutor<D> {
|
||||
type Error = Error;
|
||||
|
||||
fn call<
|
||||
@@ -586,9 +586,9 @@ impl<D: NativeExecutionDispatch + 'static> CodeExecutor for NativeExecutor<D> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<D: NativeExecutionDispatch> Clone for NativeExecutor<D> {
|
||||
impl<D: NativeExecutionDispatch> Clone for NativeElseWasmExecutor<D> {
|
||||
fn clone(&self) -> Self {
|
||||
NativeExecutor {
|
||||
NativeElseWasmExecutor {
|
||||
_dummy: Default::default(),
|
||||
native_version: D::native_version(),
|
||||
wasm: self.wasm.clone(),
|
||||
@@ -596,7 +596,7 @@ impl<D: NativeExecutionDispatch> Clone for NativeExecutor<D> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<D: NativeExecutionDispatch> sp_core::traits::ReadRuntimeVersion for NativeExecutor<D> {
|
||||
impl<D: NativeExecutionDispatch> sp_core::traits::ReadRuntimeVersion for NativeElseWasmExecutor<D> {
|
||||
fn read_runtime_version(
|
||||
&self,
|
||||
wasm_code: &[u8],
|
||||
@@ -618,9 +618,9 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct MyExecutor;
|
||||
pub struct MyExecutorDispatch;
|
||||
|
||||
impl NativeExecutionDispatch for MyExecutor {
|
||||
impl NativeExecutionDispatch for MyExecutorDispatch {
|
||||
type ExtendHostFunctions = (my_interface::HostFunctions, my_interface::HostFunctions);
|
||||
|
||||
fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
|
||||
@@ -634,7 +634,11 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn native_executor_registers_custom_interface() {
|
||||
let executor = NativeExecutor::<MyExecutor>::new(WasmExecutionMethod::Interpreted, None, 8);
|
||||
let executor = NativeElseWasmExecutor::<MyExecutorDispatch>::new(
|
||||
WasmExecutionMethod::Interpreted,
|
||||
None,
|
||||
8,
|
||||
);
|
||||
my_interface::HostFunctions::host_functions().iter().for_each(|function| {
|
||||
assert_eq!(executor.wasm.host_functions.iter().filter(|f| f == &function).count(), 2);
|
||||
});
|
||||
|
||||
@@ -126,7 +126,7 @@ impl<B: BlockT> Verifier<B> for PassThroughVerifier {
|
||||
|
||||
pub type PeersFullClient = Client<
|
||||
substrate_test_runtime_client::Backend,
|
||||
substrate_test_runtime_client::Executor,
|
||||
substrate_test_runtime_client::ExecutorDispatch,
|
||||
Block,
|
||||
substrate_test_runtime_client::runtime::RuntimeApi,
|
||||
>;
|
||||
|
||||
@@ -37,7 +37,7 @@ use sc_client_api::{
|
||||
};
|
||||
use sc_client_db::{Backend, DatabaseSettings};
|
||||
use sc_consensus::import_queue::ImportQueue;
|
||||
use sc_executor::{NativeExecutionDispatch, NativeExecutor, RuntimeVersionOf};
|
||||
use sc_executor::RuntimeVersionOf;
|
||||
use sc_keystore::LocalKeystore;
|
||||
use sc_network::{
|
||||
block_request_handler::{self, BlockRequestHandler},
|
||||
@@ -128,39 +128,39 @@ where
|
||||
}
|
||||
|
||||
/// Full client type.
|
||||
pub type TFullClient<TBl, TRtApi, TExecDisp> =
|
||||
Client<TFullBackend<TBl>, TFullCallExecutor<TBl, TExecDisp>, TBl, TRtApi>;
|
||||
pub type TFullClient<TBl, TRtApi, TExec> =
|
||||
Client<TFullBackend<TBl>, TFullCallExecutor<TBl, TExec>, TBl, TRtApi>;
|
||||
|
||||
/// Full client backend type.
|
||||
pub type TFullBackend<TBl> = sc_client_db::Backend<TBl>;
|
||||
|
||||
/// Full client call executor type.
|
||||
pub type TFullCallExecutor<TBl, TExecDisp> =
|
||||
crate::client::LocalCallExecutor<TBl, sc_client_db::Backend<TBl>, NativeExecutor<TExecDisp>>;
|
||||
pub type TFullCallExecutor<TBl, TExec> =
|
||||
crate::client::LocalCallExecutor<TBl, sc_client_db::Backend<TBl>, TExec>;
|
||||
|
||||
/// Light client type.
|
||||
pub type TLightClient<TBl, TRtApi, TExecDisp> =
|
||||
TLightClientWithBackend<TBl, TRtApi, TExecDisp, TLightBackend<TBl>>;
|
||||
pub type TLightClient<TBl, TRtApi, TExec> =
|
||||
TLightClientWithBackend<TBl, TRtApi, TExec, TLightBackend<TBl>>;
|
||||
|
||||
/// Light client backend type.
|
||||
pub type TLightBackend<TBl> =
|
||||
sc_light::Backend<sc_client_db::light::LightStorage<TBl>, HashFor<TBl>>;
|
||||
|
||||
/// Light call executor type.
|
||||
pub type TLightCallExecutor<TBl, TExecDisp> = sc_light::GenesisCallExecutor<
|
||||
pub type TLightCallExecutor<TBl, TExec> = sc_light::GenesisCallExecutor<
|
||||
sc_light::Backend<sc_client_db::light::LightStorage<TBl>, HashFor<TBl>>,
|
||||
crate::client::LocalCallExecutor<
|
||||
TBl,
|
||||
sc_light::Backend<sc_client_db::light::LightStorage<TBl>, HashFor<TBl>>,
|
||||
NativeExecutor<TExecDisp>,
|
||||
TExec,
|
||||
>,
|
||||
>;
|
||||
|
||||
type TFullParts<TBl, TRtApi, TExecDisp> =
|
||||
(TFullClient<TBl, TRtApi, TExecDisp>, Arc<TFullBackend<TBl>>, KeystoreContainer, TaskManager);
|
||||
type TFullParts<TBl, TRtApi, TExec> =
|
||||
(TFullClient<TBl, TRtApi, TExec>, Arc<TFullBackend<TBl>>, KeystoreContainer, TaskManager);
|
||||
|
||||
type TLightParts<TBl, TRtApi, TExecDisp> = (
|
||||
Arc<TLightClient<TBl, TRtApi, TExecDisp>>,
|
||||
type TLightParts<TBl, TRtApi, TExec> = (
|
||||
Arc<TLightClient<TBl, TRtApi, TExec>>,
|
||||
Arc<TLightBackend<TBl>>,
|
||||
KeystoreContainer,
|
||||
TaskManager,
|
||||
@@ -172,12 +172,9 @@ pub type TLightBackendWithHash<TBl, THash> =
|
||||
sc_light::Backend<sc_client_db::light::LightStorage<TBl>, THash>;
|
||||
|
||||
/// Light client type with a specific backend.
|
||||
pub type TLightClientWithBackend<TBl, TRtApi, TExecDisp, TBackend> = Client<
|
||||
pub type TLightClientWithBackend<TBl, TRtApi, TExec, TBackend> = Client<
|
||||
TBackend,
|
||||
sc_light::GenesisCallExecutor<
|
||||
TBackend,
|
||||
crate::client::LocalCallExecutor<TBl, TBackend, NativeExecutor<TExecDisp>>,
|
||||
>,
|
||||
sc_light::GenesisCallExecutor<TBackend, crate::client::LocalCallExecutor<TBl, TBackend, TExec>>,
|
||||
TBl,
|
||||
TRtApi,
|
||||
>;
|
||||
@@ -262,26 +259,28 @@ impl KeystoreContainer {
|
||||
}
|
||||
|
||||
/// Creates a new full client for the given config.
|
||||
pub fn new_full_client<TBl, TRtApi, TExecDisp>(
|
||||
pub fn new_full_client<TBl, TRtApi, TExec>(
|
||||
config: &Configuration,
|
||||
telemetry: Option<TelemetryHandle>,
|
||||
) -> Result<TFullClient<TBl, TRtApi, TExecDisp>, Error>
|
||||
executor: TExec,
|
||||
) -> Result<TFullClient<TBl, TRtApi, TExec>, Error>
|
||||
where
|
||||
TBl: BlockT,
|
||||
TExecDisp: NativeExecutionDispatch + 'static,
|
||||
TExec: CodeExecutor + RuntimeVersionOf + Clone,
|
||||
TBl::Hash: FromStr,
|
||||
{
|
||||
new_full_parts(config, telemetry).map(|parts| parts.0)
|
||||
new_full_parts(config, telemetry, executor).map(|parts| parts.0)
|
||||
}
|
||||
|
||||
/// Create the initial parts of a full node.
|
||||
pub fn new_full_parts<TBl, TRtApi, TExecDisp>(
|
||||
pub fn new_full_parts<TBl, TRtApi, TExec>(
|
||||
config: &Configuration,
|
||||
telemetry: Option<TelemetryHandle>,
|
||||
) -> Result<TFullParts<TBl, TRtApi, TExecDisp>, Error>
|
||||
executor: TExec,
|
||||
) -> Result<TFullParts<TBl, TRtApi, TExec>, Error>
|
||||
where
|
||||
TBl: BlockT,
|
||||
TExecDisp: NativeExecutionDispatch + 'static,
|
||||
TExec: CodeExecutor + RuntimeVersionOf + Clone,
|
||||
TBl::Hash: FromStr,
|
||||
{
|
||||
let keystore_container = KeystoreContainer::new(&config.keystore)?;
|
||||
@@ -291,12 +290,6 @@ where
|
||||
TaskManager::new(config.task_executor.clone(), registry)?
|
||||
};
|
||||
|
||||
let executor = NativeExecutor::<TExecDisp>::new(
|
||||
config.wasm_method,
|
||||
config.default_heap_pages,
|
||||
config.max_runtime_instances,
|
||||
);
|
||||
|
||||
let chain_spec = &config.chain_spec;
|
||||
let fork_blocks = get_extension::<ForkBlocks<TBl>>(chain_spec.extensions())
|
||||
.cloned()
|
||||
@@ -368,13 +361,14 @@ where
|
||||
}
|
||||
|
||||
/// Create the initial parts of a light node.
|
||||
pub fn new_light_parts<TBl, TRtApi, TExecDisp>(
|
||||
pub fn new_light_parts<TBl, TRtApi, TExec>(
|
||||
config: &Configuration,
|
||||
telemetry: Option<TelemetryHandle>,
|
||||
) -> Result<TLightParts<TBl, TRtApi, TExecDisp>, Error>
|
||||
executor: TExec,
|
||||
) -> Result<TLightParts<TBl, TRtApi, TExec>, Error>
|
||||
where
|
||||
TBl: BlockT,
|
||||
TExecDisp: NativeExecutionDispatch + 'static,
|
||||
TExec: CodeExecutor + RuntimeVersionOf + Clone,
|
||||
{
|
||||
let keystore_container = KeystoreContainer::new(&config.keystore)?;
|
||||
let task_manager = {
|
||||
@@ -382,12 +376,6 @@ where
|
||||
TaskManager::new(config.task_executor.clone(), registry)?
|
||||
};
|
||||
|
||||
let executor = NativeExecutor::<TExecDisp>::new(
|
||||
config.wasm_method,
|
||||
config.default_heap_pages,
|
||||
config.max_runtime_instances,
|
||||
);
|
||||
|
||||
let db_storage = {
|
||||
let db_settings = sc_client_db::DatabaseSettings {
|
||||
state_cache_size: config.state_cache_size,
|
||||
|
||||
@@ -360,17 +360,20 @@ where
|
||||
mod tests {
|
||||
use super::*;
|
||||
use sc_client_api::in_mem;
|
||||
use sc_executor::{NativeExecutor, WasmExecutionMethod};
|
||||
use sc_executor::{NativeElseWasmExecutor, WasmExecutionMethod};
|
||||
use sp_core::{
|
||||
testing::TaskExecutor,
|
||||
traits::{FetchRuntimeCode, WrappedRuntimeCode},
|
||||
};
|
||||
use substrate_test_runtime_client::{runtime, GenesisInit, LocalExecutor};
|
||||
use substrate_test_runtime_client::{runtime, GenesisInit, LocalExecutorDispatch};
|
||||
|
||||
#[test]
|
||||
fn should_get_override_if_exists() {
|
||||
let executor =
|
||||
NativeExecutor::<LocalExecutor>::new(WasmExecutionMethod::Interpreted, Some(128), 1);
|
||||
let executor = NativeElseWasmExecutor::<LocalExecutorDispatch>::new(
|
||||
WasmExecutionMethod::Interpreted,
|
||||
Some(128),
|
||||
1,
|
||||
);
|
||||
|
||||
let overrides = crate::client::wasm_override::dummy_overrides(&executor);
|
||||
let onchain_code = WrappedRuntimeCode(substrate_test_runtime::wasm_binary_unwrap().into());
|
||||
|
||||
@@ -204,19 +204,20 @@ where
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use sc_executor::{NativeExecutor, WasmExecutionMethod};
|
||||
use sc_executor::{NativeElseWasmExecutor, WasmExecutionMethod};
|
||||
use std::fs::{self, File};
|
||||
use substrate_test_runtime_client::LocalExecutor;
|
||||
use substrate_test_runtime_client::LocalExecutorDispatch;
|
||||
|
||||
fn wasm_test<F>(fun: F)
|
||||
where
|
||||
F: Fn(&Path, &[u8], &NativeExecutor<LocalExecutor>),
|
||||
F: Fn(&Path, &[u8], &NativeElseWasmExecutor<LocalExecutorDispatch>),
|
||||
{
|
||||
let exec = NativeExecutor::<substrate_test_runtime_client::LocalExecutor>::new(
|
||||
WasmExecutionMethod::Interpreted,
|
||||
Some(128),
|
||||
1,
|
||||
);
|
||||
let exec =
|
||||
NativeElseWasmExecutor::<substrate_test_runtime_client::LocalExecutorDispatch>::new(
|
||||
WasmExecutionMethod::Interpreted,
|
||||
Some(128),
|
||||
1,
|
||||
);
|
||||
let bytes = substrate_test_runtime::wasm_binary_unwrap();
|
||||
let dir = tempfile::tempdir().expect("Create a temporary directory");
|
||||
fun(dir.path(), bytes, &exec);
|
||||
@@ -226,8 +227,11 @@ mod tests {
|
||||
#[test]
|
||||
fn should_get_runtime_version() {
|
||||
let wasm = WasmBlob::new(substrate_test_runtime::wasm_binary_unwrap().to_vec());
|
||||
let executor =
|
||||
NativeExecutor::<LocalExecutor>::new(WasmExecutionMethod::Interpreted, Some(128), 1);
|
||||
let executor = NativeElseWasmExecutor::<LocalExecutorDispatch>::new(
|
||||
WasmExecutionMethod::Interpreted,
|
||||
Some(128),
|
||||
1,
|
||||
);
|
||||
|
||||
let version = WasmOverride::runtime_version(&executor, &wasm, Some(128))
|
||||
.expect("should get the `RuntimeVersion` of the test-runtime wasm blob");
|
||||
|
||||
@@ -30,7 +30,7 @@ use sc_client_api::{
|
||||
RemoteBodyRequest, RemoteCallRequest, RemoteChangesRequest, RemoteHeaderRequest,
|
||||
RemoteReadChildRequest, RemoteReadRequest, Storage, StorageProof, StorageProvider,
|
||||
};
|
||||
use sc_executor::{NativeExecutor, RuntimeVersion, WasmExecutionMethod};
|
||||
use sc_executor::{NativeElseWasmExecutor, RuntimeVersion, WasmExecutionMethod};
|
||||
use sc_light::{
|
||||
backend::{Backend, GenesisOrUnavailableState},
|
||||
blockchain::{Blockchain, BlockchainCache},
|
||||
@@ -258,8 +258,9 @@ impl CallExecutor<Block> for DummyCallExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
fn local_executor() -> NativeExecutor<substrate_test_runtime_client::LocalExecutor> {
|
||||
NativeExecutor::new(WasmExecutionMethod::Interpreted, None, 8)
|
||||
fn local_executor() -> NativeElseWasmExecutor<substrate_test_runtime_client::LocalExecutorDispatch>
|
||||
{
|
||||
NativeElseWasmExecutor::new(WasmExecutionMethod::Interpreted, None, 8)
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -446,7 +447,7 @@ fn code_is_executed_at_genesis_only() {
|
||||
}
|
||||
|
||||
type TestChecker = LightDataChecker<
|
||||
NativeExecutor<substrate_test_runtime_client::LocalExecutor>,
|
||||
NativeElseWasmExecutor<substrate_test_runtime_client::LocalExecutorDispatch>,
|
||||
Block,
|
||||
DummyStorage,
|
||||
>;
|
||||
|
||||
@@ -62,9 +62,9 @@ mod light;
|
||||
|
||||
const TEST_ENGINE_ID: ConsensusEngineId = *b"TEST";
|
||||
|
||||
pub struct Executor;
|
||||
pub struct ExecutorDispatch;
|
||||
|
||||
impl sc_executor::NativeExecutionDispatch for Executor {
|
||||
impl sc_executor::NativeExecutionDispatch for ExecutorDispatch {
|
||||
type ExtendHostFunctions = ();
|
||||
|
||||
fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
|
||||
@@ -76,14 +76,14 @@ impl sc_executor::NativeExecutionDispatch for Executor {
|
||||
}
|
||||
}
|
||||
|
||||
fn executor() -> sc_executor::NativeExecutor<Executor> {
|
||||
sc_executor::NativeExecutor::new(sc_executor::WasmExecutionMethod::Interpreted, None, 8)
|
||||
fn executor() -> sc_executor::NativeElseWasmExecutor<ExecutorDispatch> {
|
||||
sc_executor::NativeElseWasmExecutor::new(sc_executor::WasmExecutionMethod::Interpreted, None, 8)
|
||||
}
|
||||
|
||||
pub fn prepare_client_with_key_changes() -> (
|
||||
client::Client<
|
||||
substrate_test_runtime_client::Backend,
|
||||
substrate_test_runtime_client::Executor,
|
||||
substrate_test_runtime_client::ExecutorDispatch,
|
||||
Block,
|
||||
RuntimeApi,
|
||||
>,
|
||||
@@ -2106,7 +2106,7 @@ fn cleans_up_closed_notification_sinks_on_block_import() {
|
||||
LocalCallExecutor<
|
||||
Block,
|
||||
in_mem::Backend<Block>,
|
||||
sc_executor::NativeExecutor<LocalExecutor>,
|
||||
sc_executor::NativeElseWasmExecutor<LocalExecutorDispatch>,
|
||||
>,
|
||||
substrate_test_runtime_client::runtime::Block,
|
||||
substrate_test_runtime_client::runtime::RuntimeApi,
|
||||
|
||||
@@ -136,7 +136,7 @@ mock_impl_runtime_apis! {
|
||||
|
||||
type TestClient = substrate_test_runtime_client::client::Client<
|
||||
substrate_test_runtime_client::Backend,
|
||||
substrate_test_runtime_client::Executor,
|
||||
substrate_test_runtime_client::ExecutorDispatch,
|
||||
Block,
|
||||
RuntimeApi,
|
||||
>;
|
||||
|
||||
@@ -206,7 +206,11 @@ fn record_proof_works() {
|
||||
|
||||
// Use the proof backend to execute `execute_block`.
|
||||
let mut overlay = Default::default();
|
||||
let executor = NativeExecutor::<LocalExecutor>::new(WasmExecutionMethod::Interpreted, None, 8);
|
||||
let executor = NativeElseWasmExecutor::<LocalExecutorDispatch>::new(
|
||||
WasmExecutionMethod::Interpreted,
|
||||
None,
|
||||
8,
|
||||
);
|
||||
execution_proof_check_on_trie_backend::<_, u64, _, _>(
|
||||
&backend,
|
||||
&mut overlay,
|
||||
|
||||
@@ -27,7 +27,7 @@ pub use sc_client_api::{
|
||||
BadBlocks, ForkBlocks,
|
||||
};
|
||||
pub use sc_client_db::{self, Backend};
|
||||
pub use sc_executor::{self, NativeExecutor, WasmExecutionMethod};
|
||||
pub use sc_executor::{self, NativeElseWasmExecutor, WasmExecutionMethod};
|
||||
pub use sc_service::{client, RpcHandlers, RpcSession};
|
||||
pub use sp_consensus;
|
||||
pub use sp_keyring::{
|
||||
@@ -73,14 +73,14 @@ impl GenesisInit for () {
|
||||
}
|
||||
|
||||
/// A builder for creating a test client instance.
|
||||
pub struct TestClientBuilder<Block: BlockT, Executor, Backend, G: GenesisInit> {
|
||||
pub struct TestClientBuilder<Block: BlockT, ExecutorDispatch, Backend, G: GenesisInit> {
|
||||
execution_strategies: ExecutionStrategies,
|
||||
genesis_init: G,
|
||||
/// The key is an unprefixed storage key, this only contains
|
||||
/// default child trie content.
|
||||
child_storage_extension: HashMap<Vec<u8>, StorageChild>,
|
||||
backend: Arc<Backend>,
|
||||
_executor: std::marker::PhantomData<Executor>,
|
||||
_executor: std::marker::PhantomData<ExecutorDispatch>,
|
||||
keystore: Option<SyncCryptoStorePtr>,
|
||||
fork_blocks: ForkBlocks<Block>,
|
||||
bad_blocks: BadBlocks<Block>,
|
||||
@@ -88,16 +88,16 @@ pub struct TestClientBuilder<Block: BlockT, Executor, Backend, G: GenesisInit> {
|
||||
no_genesis: bool,
|
||||
}
|
||||
|
||||
impl<Block: BlockT, Executor, G: GenesisInit> Default
|
||||
for TestClientBuilder<Block, Executor, Backend<Block>, G>
|
||||
impl<Block: BlockT, ExecutorDispatch, G: GenesisInit> Default
|
||||
for TestClientBuilder<Block, ExecutorDispatch, Backend<Block>, G>
|
||||
{
|
||||
fn default() -> Self {
|
||||
Self::with_default_backend()
|
||||
}
|
||||
}
|
||||
|
||||
impl<Block: BlockT, Executor, G: GenesisInit>
|
||||
TestClientBuilder<Block, Executor, Backend<Block>, G>
|
||||
impl<Block: BlockT, ExecutorDispatch, G: GenesisInit>
|
||||
TestClientBuilder<Block, ExecutorDispatch, Backend<Block>, G>
|
||||
{
|
||||
/// Create new `TestClientBuilder` with default backend.
|
||||
pub fn with_default_backend() -> Self {
|
||||
@@ -122,8 +122,8 @@ impl<Block: BlockT, Executor, G: GenesisInit>
|
||||
}
|
||||
}
|
||||
|
||||
impl<Block: BlockT, Executor, Backend, G: GenesisInit>
|
||||
TestClientBuilder<Block, Executor, Backend, G>
|
||||
impl<Block: BlockT, ExecutorDispatch, Backend, G: GenesisInit>
|
||||
TestClientBuilder<Block, ExecutorDispatch, Backend, G>
|
||||
{
|
||||
/// Create a new instance of the test client builder.
|
||||
pub fn with_backend(backend: Arc<Backend>) -> Self {
|
||||
@@ -210,13 +210,13 @@ impl<Block: BlockT, Executor, Backend, G: GenesisInit>
|
||||
/// Build the test client with the given native executor.
|
||||
pub fn build_with_executor<RuntimeApi>(
|
||||
self,
|
||||
executor: Executor,
|
||||
executor: ExecutorDispatch,
|
||||
) -> (
|
||||
client::Client<Backend, Executor, Block, RuntimeApi>,
|
||||
client::Client<Backend, ExecutorDispatch, Block, RuntimeApi>,
|
||||
sc_consensus::LongestChain<Backend, Block>,
|
||||
)
|
||||
where
|
||||
Executor: sc_client_api::CallExecutor<Block> + 'static,
|
||||
ExecutorDispatch: sc_client_api::CallExecutor<Block> + 'static,
|
||||
Backend: sc_client_api::backend::Backend<Block>,
|
||||
<Backend as sc_client_api::backend::Backend<Block>>::OffchainStorage: 'static,
|
||||
{
|
||||
@@ -264,8 +264,13 @@ impl<Block: BlockT, Executor, Backend, G: GenesisInit>
|
||||
}
|
||||
}
|
||||
|
||||
impl<Block: BlockT, E, Backend, G: GenesisInit>
|
||||
TestClientBuilder<Block, client::LocalCallExecutor<Block, Backend, NativeExecutor<E>>, Backend, G>
|
||||
impl<Block: BlockT, D, Backend, G: GenesisInit>
|
||||
TestClientBuilder<
|
||||
Block,
|
||||
client::LocalCallExecutor<Block, Backend, NativeElseWasmExecutor<D>>,
|
||||
Backend,
|
||||
G,
|
||||
>
|
||||
{
|
||||
/// Build the test client with the given native executor.
|
||||
pub fn build_with_native_executor<RuntimeApi, I>(
|
||||
@@ -274,20 +279,20 @@ impl<Block: BlockT, E, Backend, G: GenesisInit>
|
||||
) -> (
|
||||
client::Client<
|
||||
Backend,
|
||||
client::LocalCallExecutor<Block, Backend, NativeExecutor<E>>,
|
||||
client::LocalCallExecutor<Block, Backend, NativeElseWasmExecutor<D>>,
|
||||
Block,
|
||||
RuntimeApi,
|
||||
>,
|
||||
sc_consensus::LongestChain<Backend, Block>,
|
||||
)
|
||||
where
|
||||
I: Into<Option<NativeExecutor<E>>>,
|
||||
E: sc_executor::NativeExecutionDispatch + 'static,
|
||||
I: Into<Option<NativeElseWasmExecutor<D>>>,
|
||||
D: sc_executor::NativeExecutionDispatch + 'static,
|
||||
Backend: sc_client_api::backend::Backend<Block> + 'static,
|
||||
{
|
||||
let executor = executor
|
||||
.into()
|
||||
.unwrap_or_else(|| NativeExecutor::new(WasmExecutionMethod::Interpreted, None, 8));
|
||||
let executor = executor.into().unwrap_or_else(|| {
|
||||
NativeElseWasmExecutor::new(WasmExecutionMethod::Interpreted, None, 8)
|
||||
});
|
||||
let executor = LocalCallExecutor::new(
|
||||
self.backend.clone(),
|
||||
executor,
|
||||
|
||||
@@ -51,8 +51,8 @@ pub mod prelude {
|
||||
};
|
||||
// Client structs
|
||||
pub use super::{
|
||||
Backend, Executor, LightBackend, LightExecutor, LocalExecutor, NativeExecutor, TestClient,
|
||||
TestClientBuilder, WasmExecutionMethod,
|
||||
Backend, ExecutorDispatch, LightBackend, LightExecutor, LocalExecutorDispatch,
|
||||
NativeElseWasmExecutor, TestClient, TestClientBuilder, WasmExecutionMethod,
|
||||
};
|
||||
// Keyring
|
||||
pub use super::{AccountKeyring, Sr25519Keyring};
|
||||
@@ -60,9 +60,9 @@ pub mod prelude {
|
||||
|
||||
/// A unit struct which implements `NativeExecutionDispatch` feeding in the
|
||||
/// hard-coded runtime.
|
||||
pub struct LocalExecutor;
|
||||
pub struct LocalExecutorDispatch;
|
||||
|
||||
impl sc_executor::NativeExecutionDispatch for LocalExecutor {
|
||||
impl sc_executor::NativeExecutionDispatch for LocalExecutorDispatch {
|
||||
type ExtendHostFunctions = ();
|
||||
|
||||
fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
|
||||
@@ -78,10 +78,10 @@ impl sc_executor::NativeExecutionDispatch for LocalExecutor {
|
||||
pub type Backend = substrate_test_client::Backend<substrate_test_runtime::Block>;
|
||||
|
||||
/// Test client executor.
|
||||
pub type Executor = client::LocalCallExecutor<
|
||||
pub type ExecutorDispatch = client::LocalCallExecutor<
|
||||
substrate_test_runtime::Block,
|
||||
Backend,
|
||||
NativeExecutor<LocalExecutor>,
|
||||
NativeElseWasmExecutor<LocalExecutorDispatch>,
|
||||
>;
|
||||
|
||||
/// Test client light database backend.
|
||||
@@ -96,7 +96,7 @@ pub type LightExecutor = sc_light::GenesisCallExecutor<
|
||||
sc_client_db::light::LightStorage<substrate_test_runtime::Block>,
|
||||
HashFor<substrate_test_runtime::Block>,
|
||||
>,
|
||||
NativeExecutor<LocalExecutor>,
|
||||
NativeElseWasmExecutor<LocalExecutorDispatch>,
|
||||
>,
|
||||
>;
|
||||
|
||||
@@ -174,13 +174,13 @@ pub type TestClientBuilder<E, B> = substrate_test_client::TestClientBuilder<
|
||||
GenesisParameters,
|
||||
>;
|
||||
|
||||
/// Test client type with `LocalExecutor` and generic Backend.
|
||||
/// Test client type with `LocalExecutorDispatch` and generic Backend.
|
||||
pub type Client<B> = client::Client<
|
||||
B,
|
||||
client::LocalCallExecutor<
|
||||
substrate_test_runtime::Block,
|
||||
B,
|
||||
sc_executor::NativeExecutor<LocalExecutor>,
|
||||
sc_executor::NativeElseWasmExecutor<LocalExecutorDispatch>,
|
||||
>,
|
||||
substrate_test_runtime::Block,
|
||||
substrate_test_runtime::RuntimeApi,
|
||||
@@ -195,7 +195,7 @@ pub trait DefaultTestClientBuilderExt: Sized {
|
||||
fn new() -> Self;
|
||||
}
|
||||
|
||||
impl DefaultTestClientBuilderExt for TestClientBuilder<Executor, Backend> {
|
||||
impl DefaultTestClientBuilderExt for TestClientBuilder<ExecutorDispatch, Backend> {
|
||||
fn new() -> Self {
|
||||
Self::with_default_backend()
|
||||
}
|
||||
@@ -277,7 +277,7 @@ impl<B> TestClientBuilderExt<B>
|
||||
client::LocalCallExecutor<
|
||||
substrate_test_runtime::Block,
|
||||
B,
|
||||
sc_executor::NativeExecutor<LocalExecutor>,
|
||||
sc_executor::NativeElseWasmExecutor<LocalExecutorDispatch>,
|
||||
>,
|
||||
B,
|
||||
> where
|
||||
@@ -436,6 +436,6 @@ 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, 8)
|
||||
pub fn new_native_executor() -> sc_executor::NativeElseWasmExecutor<LocalExecutorDispatch> {
|
||||
sc_executor::NativeElseWasmExecutor::new(sc_executor::WasmExecutionMethod::Interpreted, None, 8)
|
||||
}
|
||||
|
||||
@@ -349,7 +349,7 @@ mod tests {
|
||||
use super::*;
|
||||
|
||||
use crate::{wasm_binary_unwrap, Header, Transfer};
|
||||
use sc_executor::{NativeExecutor, WasmExecutionMethod};
|
||||
use sc_executor::{NativeElseWasmExecutor, WasmExecutionMethod};
|
||||
use sp_core::{
|
||||
map,
|
||||
traits::{CodeExecutor, RuntimeCode},
|
||||
@@ -373,8 +373,8 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
fn executor() -> NativeExecutor<NativeDispatch> {
|
||||
NativeExecutor::new(WasmExecutionMethod::Interpreted, None, 8)
|
||||
fn executor() -> NativeElseWasmExecutor<NativeDispatch> {
|
||||
NativeElseWasmExecutor::new(WasmExecutionMethod::Interpreted, None, 8)
|
||||
}
|
||||
|
||||
fn new_test_ext() -> TestExternalities {
|
||||
|
||||
@@ -26,6 +26,7 @@ use manual_seal::{
|
||||
run_manual_seal, EngineCommand, ManualSealParams,
|
||||
};
|
||||
use sc_client_api::backend::Backend;
|
||||
use sc_executor::NativeElseWasmExecutor;
|
||||
use sc_service::{
|
||||
build_network, new_full_parts, spawn_tasks, BuildNetworkParams, ChainSpec, Configuration,
|
||||
SpawnTasksParams, TFullBackend, TFullClient, TaskExecutor, TaskManager,
|
||||
@@ -50,7 +51,7 @@ type ClientParts<T> = (
|
||||
TFullClient<
|
||||
<T as ChainInfo>::Block,
|
||||
<T as ChainInfo>::RuntimeApi,
|
||||
<T as ChainInfo>::Executor,
|
||||
NativeElseWasmExecutor<<T as ChainInfo>::ExecutorDispatch>,
|
||||
>,
|
||||
>,
|
||||
Arc<
|
||||
@@ -83,7 +84,7 @@ where
|
||||
T: ChainInfo + 'static,
|
||||
<T::RuntimeApi as ConstructRuntimeApi<
|
||||
T::Block,
|
||||
TFullClient<T::Block, T::RuntimeApi, T::Executor>,
|
||||
TFullClient<T::Block, T::RuntimeApi, NativeElseWasmExecutor<T::ExecutorDispatch>>,
|
||||
>>::RuntimeApi: Core<T::Block>
|
||||
+ Metadata<T::Block>
|
||||
+ OffchainWorkerApi<T::Block>
|
||||
@@ -106,8 +107,14 @@ where
|
||||
default_config(task_executor, chain_spec),
|
||||
};
|
||||
|
||||
let executor = NativeElseWasmExecutor::<T::ExecutorDispatch>::new(
|
||||
config.wasm_method,
|
||||
config.default_heap_pages,
|
||||
config.max_runtime_instances,
|
||||
);
|
||||
|
||||
let (client, backend, keystore, mut task_manager) =
|
||||
new_full_parts::<T::Block, T::RuntimeApi, T::Executor>(&config, None)?;
|
||||
new_full_parts::<T::Block, T::RuntimeApi, _>(&config, None, executor)?;
|
||||
let client = Arc::new(client);
|
||||
|
||||
let select_chain = sc_consensus::LongestChain::new(backend.clone());
|
||||
|
||||
@@ -62,9 +62,9 @@
|
||||
//!
|
||||
//! type BlockImport<B, BE, C, SC> = BabeBlockImport<B, C, GrandpaBlockImport<BE, B, C, SC>>;
|
||||
//!
|
||||
//! pub struct Executor;
|
||||
//! pub struct ExecutorDispatch;
|
||||
//!
|
||||
//! impl sc_executor::NativeExecutionDispatch for Executor {
|
||||
//! impl sc_executor::NativeExecutionDispatch for ExecutorDispatch {
|
||||
//! type ExtendHostFunctions = SignatureVerificationOverride;
|
||||
//!
|
||||
//! fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
|
||||
@@ -81,8 +81,8 @@
|
||||
//! impl ChainInfo for Requirements {
|
||||
//! /// Provide a Block type with an OpaqueExtrinsic
|
||||
//! type Block = node_primitives::Block;
|
||||
//! /// Provide an Executor type for the runtime
|
||||
//! type Executor = Executor;
|
||||
//! /// Provide an ExecutorDispatch type for the runtime
|
||||
//! type ExecutorDispatch = ExecutorDispatch;
|
||||
//! /// Provide the runtime itself
|
||||
//! type Runtime = node_runtime::Runtime;
|
||||
//! /// A touch of runtime api
|
||||
@@ -93,7 +93,7 @@
|
||||
//! type BlockImport = BlockImport<
|
||||
//! Self::Block,
|
||||
//! TFullBackend<Self::Block>,
|
||||
//! TFullClient<Self::Block, Self::RuntimeApi, Self::Executor>,
|
||||
//! TFullClient<Self::Block, Self::RuntimeApi, NativeElseWasmExecutor<Self::ExecutorDispatch>>,
|
||||
//! Self::SelectChain,
|
||||
//! >;
|
||||
//! /// and a dash of SignedExtensions
|
||||
@@ -119,7 +119,7 @@
|
||||
//! /// The function signature tells you all you need to know. ;)
|
||||
//! fn create_client_parts(config: &Configuration) -> Result<
|
||||
//! (
|
||||
//! Arc<TFullClient<Self::Block, Self::RuntimeApi, Self::Executor>>,
|
||||
//! Arc<TFullClient<Self::Block, Self::RuntimeApi, NativeElseWasmExecutor<Self::ExecutorDispatch>>>,
|
||||
//! Arc<TFullBackend<Self::Block>>,
|
||||
//! KeyStorePtr,
|
||||
//! TaskManager,
|
||||
@@ -128,7 +128,7 @@
|
||||
//! dyn ConsensusDataProvider<
|
||||
//! Self::Block,
|
||||
//! Transaction = TransactionFor<
|
||||
//! TFullClient<Self::Block, Self::RuntimeApi, Self::Executor>,
|
||||
//! TFullClient<Self::Block, Self::RuntimeApi, NativeElseWasmExecutor<Self::ExecutorDispatch>>,
|
||||
//! Self::Block
|
||||
//! >,
|
||||
//! >
|
||||
@@ -143,7 +143,7 @@
|
||||
//! backend,
|
||||
//! keystore,
|
||||
//! task_manager,
|
||||
//! ) = new_full_parts::<Self::Block, Self::RuntimeApi, Self::Executor>(config)?;
|
||||
//! ) = new_full_parts::<Self::Block, Self::RuntimeApi, NativeElseWasmExecutor<Self::ExecutorDispatch>>(config)?;
|
||||
//! let client = Arc::new(client);
|
||||
//!
|
||||
//! let inherent_providers = InherentDataProviders::new();
|
||||
@@ -235,7 +235,7 @@
|
||||
//! ```
|
||||
|
||||
use sc_consensus::BlockImport;
|
||||
use sc_executor::NativeExecutionDispatch;
|
||||
use sc_executor::{NativeElseWasmExecutor, NativeExecutionDispatch};
|
||||
use sc_service::TFullClient;
|
||||
use sp_api::{ConstructRuntimeApi, TransactionFor};
|
||||
use sp_consensus::SelectChain;
|
||||
@@ -257,8 +257,8 @@ pub trait ChainInfo: Sized {
|
||||
/// Opaque block type
|
||||
type Block: BlockT;
|
||||
|
||||
/// Executor type
|
||||
type Executor: NativeExecutionDispatch + 'static;
|
||||
/// ExecutorDispatch dispatch type
|
||||
type ExecutorDispatch: NativeExecutionDispatch + 'static;
|
||||
|
||||
/// Runtime
|
||||
type Runtime: frame_system::Config;
|
||||
@@ -267,7 +267,14 @@ pub trait ChainInfo: Sized {
|
||||
type RuntimeApi: Send
|
||||
+ Sync
|
||||
+ 'static
|
||||
+ ConstructRuntimeApi<Self::Block, TFullClient<Self::Block, Self::RuntimeApi, Self::Executor>>;
|
||||
+ ConstructRuntimeApi<
|
||||
Self::Block,
|
||||
TFullClient<
|
||||
Self::Block,
|
||||
Self::RuntimeApi,
|
||||
NativeElseWasmExecutor<Self::ExecutorDispatch>,
|
||||
>,
|
||||
>;
|
||||
|
||||
/// select chain type.
|
||||
type SelectChain: SelectChain<Self::Block> + 'static;
|
||||
@@ -280,7 +287,11 @@ pub trait ChainInfo: Sized {
|
||||
Self::Block,
|
||||
Error = sp_consensus::Error,
|
||||
Transaction = TransactionFor<
|
||||
TFullClient<Self::Block, Self::RuntimeApi, Self::Executor>,
|
||||
TFullClient<
|
||||
Self::Block,
|
||||
Self::RuntimeApi,
|
||||
NativeElseWasmExecutor<Self::ExecutorDispatch>,
|
||||
>,
|
||||
Self::Block,
|
||||
>,
|
||||
> + 'static;
|
||||
|
||||
@@ -29,6 +29,7 @@ use sc_client_api::{
|
||||
backend::{self, Backend},
|
||||
CallExecutor, ExecutorProvider,
|
||||
};
|
||||
use sc_executor::NativeElseWasmExecutor;
|
||||
use sc_service::{TFullBackend, TFullCallExecutor, TFullClient, TaskManager};
|
||||
use sc_transaction_pool_api::TransactionPool;
|
||||
use sp_api::{OverlayedChanges, StorageTransactionCache};
|
||||
@@ -51,7 +52,7 @@ pub struct Node<T: ChainInfo> {
|
||||
/// handle to the running node.
|
||||
task_manager: Option<TaskManager>,
|
||||
/// client instance
|
||||
client: Arc<TFullClient<T::Block, T::RuntimeApi, T::Executor>>,
|
||||
client: Arc<TFullClient<T::Block, T::RuntimeApi, NativeElseWasmExecutor<T::ExecutorDispatch>>>,
|
||||
/// transaction pool
|
||||
pool: Arc<
|
||||
dyn TransactionPool<
|
||||
@@ -86,7 +87,9 @@ where
|
||||
pub fn new(
|
||||
rpc_handler: Arc<MetaIoHandler<sc_rpc::Metadata, sc_rpc_server::RpcMiddleware>>,
|
||||
task_manager: TaskManager,
|
||||
client: Arc<TFullClient<T::Block, T::RuntimeApi, T::Executor>>,
|
||||
client: Arc<
|
||||
TFullClient<T::Block, T::RuntimeApi, NativeElseWasmExecutor<T::ExecutorDispatch>>,
|
||||
>,
|
||||
pool: Arc<
|
||||
dyn TransactionPool<
|
||||
Block = <T as ChainInfo>::Block,
|
||||
@@ -126,7 +129,9 @@ where
|
||||
}
|
||||
|
||||
/// Return a reference to the Client
|
||||
pub fn client(&self) -> Arc<TFullClient<T::Block, T::RuntimeApi, T::Executor>> {
|
||||
pub fn client(
|
||||
&self,
|
||||
) -> Arc<TFullClient<T::Block, T::RuntimeApi, NativeElseWasmExecutor<T::ExecutorDispatch>>> {
|
||||
self.client.clone()
|
||||
}
|
||||
|
||||
@@ -150,7 +155,7 @@ where
|
||||
/// Executes closure in an externalities provided environment.
|
||||
pub fn with_state<R>(&self, closure: impl FnOnce() -> R) -> R
|
||||
where
|
||||
<TFullCallExecutor<T::Block, T::Executor> as CallExecutor<T::Block>>::Error:
|
||||
<TFullCallExecutor<T::Block, NativeElseWasmExecutor<T::ExecutorDispatch>> as CallExecutor<T::Block>>::Error:
|
||||
std::fmt::Debug,
|
||||
{
|
||||
let id = BlockId::Hash(self.client.info().best_hash);
|
||||
|
||||
@@ -25,7 +25,7 @@ use frame_support::traits::StorageInfo;
|
||||
use linked_hash_map::LinkedHashMap;
|
||||
use sc_cli::{CliConfiguration, ExecutionStrategy, Result, SharedParams};
|
||||
use sc_client_db::BenchmarkingState;
|
||||
use sc_executor::NativeExecutor;
|
||||
use sc_executor::NativeElseWasmExecutor;
|
||||
use sc_service::{Configuration, NativeExecutionDispatch};
|
||||
use sp_core::offchain::{
|
||||
testing::{TestOffchainExt, TestTransactionPoolExt},
|
||||
@@ -133,7 +133,7 @@ impl BenchmarkCmd {
|
||||
)?;
|
||||
let state_without_tracking =
|
||||
BenchmarkingState::<BB>::new(genesis_storage, cache_size, self.record_proof, false)?;
|
||||
let executor = NativeExecutor::<ExecDispatch>::new(
|
||||
let executor = NativeElseWasmExecutor::<ExecDispatch>::new(
|
||||
wasm_method,
|
||||
self.heap_pages,
|
||||
2, // The runtime instances cache size.
|
||||
|
||||
@@ -21,7 +21,7 @@ use parity_scale_codec::{Decode, Encode};
|
||||
use remote_externalities::{rpc_api, Builder, Mode, OfflineConfig, OnlineConfig, SnapshotConfig};
|
||||
use sc_chain_spec::ChainSpec;
|
||||
use sc_cli::{CliConfiguration, ExecutionStrategy, WasmExecutionMethod};
|
||||
use sc_executor::NativeExecutor;
|
||||
use sc_executor::NativeElseWasmExecutor;
|
||||
use sc_service::{Configuration, NativeExecutionDispatch};
|
||||
use sp_core::{
|
||||
hashing::twox_128,
|
||||
@@ -192,8 +192,11 @@ where
|
||||
|
||||
let mut changes = Default::default();
|
||||
let max_runtime_instances = config.max_runtime_instances;
|
||||
let executor =
|
||||
NativeExecutor::<ExecDispatch>::new(wasm_method.into(), heap_pages, max_runtime_instances);
|
||||
let executor = NativeElseWasmExecutor::<ExecDispatch>::new(
|
||||
wasm_method.into(),
|
||||
heap_pages,
|
||||
max_runtime_instances,
|
||||
);
|
||||
|
||||
let ext = {
|
||||
let builder = match command.state {
|
||||
@@ -265,8 +268,11 @@ where
|
||||
|
||||
let mut changes = Default::default();
|
||||
let max_runtime_instances = config.max_runtime_instances;
|
||||
let executor =
|
||||
NativeExecutor::<ExecDispatch>::new(wasm_method.into(), heap_pages, max_runtime_instances);
|
||||
let executor = NativeElseWasmExecutor::<ExecDispatch>::new(
|
||||
wasm_method.into(),
|
||||
heap_pages,
|
||||
max_runtime_instances,
|
||||
);
|
||||
|
||||
let mode = match command.state {
|
||||
State::Live { snapshot_path, modules } => {
|
||||
@@ -346,8 +352,11 @@ where
|
||||
|
||||
let mut changes = Default::default();
|
||||
let max_runtime_instances = config.max_runtime_instances;
|
||||
let executor =
|
||||
NativeExecutor::<ExecDispatch>::new(wasm_method.into(), heap_pages, max_runtime_instances);
|
||||
let executor = NativeElseWasmExecutor::<ExecDispatch>::new(
|
||||
wasm_method.into(),
|
||||
heap_pages,
|
||||
max_runtime_instances,
|
||||
);
|
||||
|
||||
let block_hash = shared.block_at::<Block>()?;
|
||||
let block: Block = rpc_api::get_block::<Block, _>(shared.url.clone(), block_hash).await?;
|
||||
|
||||
Reference in New Issue
Block a user