Skip to content

Commit

Permalink
Stop using the native runtime. (#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
bkchr authored Apr 18, 2024
1 parent 3dd6c1a commit 7ab93c6
Showing 1 changed file with 4 additions and 22 deletions.
26 changes: 4 additions & 22 deletions node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ use cumulus_relay_chain_interface::{OverseerHandle, RelayChainInterface};
use frame_benchmarking_cli::SUBSTRATE_REFERENCE_HARDWARE;
use sc_client_api::Backend;
use sc_consensus::ImportQueue;
use sc_executor::{
HeapAllocStrategy, NativeElseWasmExecutor, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY,
};
use sc_executor::{HeapAllocStrategy, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY};
use sc_network::NetworkBlock;
use sc_network_sync::SyncingService;
use sc_service::{Configuration, PartialComponents, TFullBackend, TFullClient, TaskManager};
Expand All @@ -34,22 +32,8 @@ use sc_transaction_pool_api::OffchainTransactionPoolFactory;
use sp_keystore::KeystorePtr;
use substrate_prometheus_endpoint::Registry;

/// Native executor type.
pub struct ParachainNativeExecutor;

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

fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
parachain_runtime::api::dispatch(method, data)
}

fn native_version() -> sc_executor::NativeVersion {
parachain_runtime::native_version()
}
}

type ParachainExecutor = NativeElseWasmExecutor<ParachainNativeExecutor>;
type ParachainExecutor =
WasmExecutor<(sp_io::SubstrateHostFunctions, frame_benchmarking::benchmarking::HostFunctions)>;

type ParachainClient = TFullClient<Block, RuntimeApi, ParachainExecutor>;

Expand Down Expand Up @@ -87,16 +71,14 @@ pub fn new_partial(config: &Configuration) -> Result<Service, sc_service::Error>
.default_heap_pages
.map_or(DEFAULT_HEAP_ALLOC_STRATEGY, |h| HeapAllocStrategy::Static { extra_pages: h as _ });

let wasm = WasmExecutor::builder()
let executor = WasmExecutor::builder()
.with_execution_method(config.wasm_method)
.with_onchain_heap_alloc_strategy(heap_pages)
.with_offchain_heap_alloc_strategy(heap_pages)
.with_max_runtime_instances(config.max_runtime_instances)
.with_runtime_cache_size(config.runtime_cache_size)
.build();

let executor = ParachainExecutor::new_with_wasm_executor(wasm);

let (client, backend, keystore_container, task_manager) =
sc_service::new_full_parts::<Block, RuntimeApi, _>(
config,
Expand Down

0 comments on commit 7ab93c6

Please sign in to comment.