mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 07:01:03 +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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user