sc_executor: Use new_with_wasm_executor instead of deprecated new method (#7055)

* node: Replace deprecated versions of sc_executor

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Update cargo.lock via `cargo update -p sc-executor`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Update Cargo.lock with latest substrate

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* node: Replace `new` with `new_with_wasm_executor`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Update substrate to latest

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
Alexandru Vasile
2023-04-13 14:53:25 +03:00
committed by GitHub
parent ecb6523b5c
commit f23f0ef8b9
2 changed files with 285 additions and 216 deletions
+269 -209
View File
File diff suppressed because it is too large Load Diff
+16 -7
View File
@@ -104,8 +104,10 @@ pub use polkadot_client::{
pub use polkadot_primitives::{Block, BlockId, BlockNumber, CollatorPair, Hash, Id as ParaId};
pub use sc_client_api::{Backend, CallExecutor, ExecutionStrategy};
pub use sc_consensus::{BlockImport, LongestChain};
use sc_executor::NativeElseWasmExecutor;
pub use sc_executor::NativeExecutionDispatch;
use sc_executor::{
HeapAllocStrategy, NativeElseWasmExecutor, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY,
};
pub use service::{
config::{DatabaseSource, PrometheusConfig},
ChainSpec, Configuration, Error as SubstrateServiceError, PruningMode, Role, RuntimeGenesis,
@@ -404,12 +406,19 @@ where
})
.transpose()?;
let executor = NativeElseWasmExecutor::<ExecutorDispatch>::new(
config.wasm_method,
config.default_heap_pages,
config.max_runtime_instances,
config.runtime_cache_size,
);
let heap_pages = config
.default_heap_pages
.map_or(DEFAULT_HEAP_ALLOC_STRATEGY, |h| HeapAllocStrategy::Static { extra_pages: h as _ });
let wasm = 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 = NativeElseWasmExecutor::<ExecutorDispatch>::new_with_wasm_executor(wasm);
let (client, backend, keystore_container, task_manager) =
service::new_full_parts::<Block, RuntimeApi, _>(