mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 13:31:10 +00:00
refactor(sc-executor): use wasm executor builder instead of old apis (#13740)
* refactor: use builder api for all executors * improve a lot * remove unused args * cleanup deps * fix inconsistency about heap alloc * add `heap_pages` back to try-runtime * fix * chore: reduce duplicated code for sc-service-test * cleanup code * fmt * improve test executor * improve * use #[deprecated] * set runtime_cache_size: 4 * fix and improve * refactor builder * fix * fix bench * fix tests * fix warnings * fix warnings * fix * fix * update by suggestions * update name
This commit is contained in:
@@ -27,7 +27,7 @@ pub use sc_client_api::{
|
||||
BadBlocks, ForkBlocks,
|
||||
};
|
||||
pub use sc_client_db::{self, Backend, BlocksPruning};
|
||||
pub use sc_executor::{self, NativeElseWasmExecutor, WasmExecutionMethod};
|
||||
pub use sc_executor::{self, NativeElseWasmExecutor, WasmExecutionMethod, WasmExecutor};
|
||||
pub use sc_service::{client, RpcHandlers};
|
||||
pub use sp_consensus;
|
||||
pub use sp_keyring::{
|
||||
@@ -286,7 +286,7 @@ impl<Block: BlockT, D, Backend, G: GenesisInit>
|
||||
Backend: sc_client_api::backend::Backend<Block> + 'static,
|
||||
{
|
||||
let executor = executor.into().unwrap_or_else(|| {
|
||||
NativeElseWasmExecutor::new(WasmExecutionMethod::Interpreted, None, 8, 2)
|
||||
NativeElseWasmExecutor::new_with_wasm_executor(WasmExecutor::builder().build())
|
||||
});
|
||||
let executor = LocalCallExecutor::new(
|
||||
self.backend.clone(),
|
||||
|
||||
@@ -38,6 +38,7 @@ use sp_core::{
|
||||
Pair,
|
||||
};
|
||||
use sp_runtime::traits::{Block as BlockT, Hash as HashT, Header as HeaderT};
|
||||
use substrate_test_client::sc_executor::WasmExecutor;
|
||||
use substrate_test_runtime::genesismap::{additional_storage_with_genesis, GenesisConfig};
|
||||
|
||||
/// A prelude to import in tests.
|
||||
@@ -171,7 +172,7 @@ pub type Client<B> = client::Client<
|
||||
client::LocalCallExecutor<
|
||||
substrate_test_runtime::Block,
|
||||
B,
|
||||
sc_executor::NativeElseWasmExecutor<LocalExecutorDispatch>,
|
||||
NativeElseWasmExecutor<LocalExecutorDispatch>,
|
||||
>,
|
||||
substrate_test_runtime::Block,
|
||||
substrate_test_runtime::RuntimeApi,
|
||||
@@ -290,6 +291,6 @@ pub fn new() -> Client<Backend> {
|
||||
}
|
||||
|
||||
/// Create a new native executor.
|
||||
pub fn new_native_executor() -> NativeElseWasmExecutor<LocalExecutorDispatch> {
|
||||
NativeElseWasmExecutor::new(sc_executor::WasmExecutionMethod::Interpreted, None, 8, 2)
|
||||
pub fn new_native_or_wasm_executor() -> NativeElseWasmExecutor<LocalExecutorDispatch> {
|
||||
NativeElseWasmExecutor::new_with_wasm_executor(WasmExecutor::builder().build())
|
||||
}
|
||||
|
||||
@@ -376,7 +376,7 @@ mod tests {
|
||||
use super::*;
|
||||
|
||||
use crate::{wasm_binary_unwrap, Header, Transfer};
|
||||
use sc_executor::{NativeElseWasmExecutor, WasmExecutionMethod};
|
||||
use sc_executor::{NativeElseWasmExecutor, WasmExecutor};
|
||||
use sp_core::{
|
||||
map,
|
||||
traits::{CallContext, CodeExecutor, RuntimeCode},
|
||||
@@ -400,7 +400,7 @@ mod tests {
|
||||
}
|
||||
|
||||
fn executor() -> NativeElseWasmExecutor<NativeDispatch> {
|
||||
NativeElseWasmExecutor::new(WasmExecutionMethod::Interpreted, None, 8, 2)
|
||||
NativeElseWasmExecutor::new_with_wasm_executor(WasmExecutor::builder().build())
|
||||
}
|
||||
|
||||
fn new_test_ext() -> TestExternalities {
|
||||
|
||||
Reference in New Issue
Block a user