diff --git a/crates/pallet-subspace/src/mock.rs b/crates/pallet-subspace/src/mock.rs index 5a498ba642c..10203862e14 100644 --- a/crates/pallet-subspace/src/mock.rs +++ b/crates/pallet-subspace/src/mock.rs @@ -233,7 +233,7 @@ pub fn make_pre_digest( pub fn new_test_ext() -> sp_io::TestExternalities { static INITIALIZE_LOGGER: Once = Once::new(); INITIALIZE_LOGGER.call_once(|| { - env_logger::init_from_env(env_logger::Env::new().default_filter_or("error")); + let _ = env_logger::try_init_from_env(env_logger::Env::new().default_filter_or("error")); }); let mut t = frame_system::GenesisConfig::default() diff --git a/domains/client/block-builder/src/lib.rs b/domains/client/block-builder/src/lib.rs index 9c3be87e90a..d8d5a54917d 100644 --- a/domains/client/block-builder/src/lib.rs +++ b/domains/client/block-builder/src/lib.rs @@ -355,9 +355,8 @@ mod tests { #[test] fn block_building_storage_proof_does_not_include_runtime_by_default() { - let builder = substrate_test_runtime_client::TestClientBuilder::new(); - let backend = builder.backend(); - let client = builder.build(); + let (client, backend) = + substrate_test_runtime_client::TestClientBuilder::new().build_with_backend(); let block = BlockBuilder::new( &client, diff --git a/domains/test/service/src/lib.rs b/domains/test/service/src/lib.rs index 6900ace29ee..541490cba39 100644 --- a/domains/test/service/src/lib.rs +++ b/domains/test/service/src/lib.rs @@ -29,7 +29,7 @@ use sc_network::{multiaddr, NetworkService, NetworkStateInfo}; use sc_network_common::config::{NonReservedPeerMode, TransportConfig}; use sc_service::config::{ DatabaseSource, KeystoreConfig, MultiaddrWithPeerId, NetworkConfiguration, - OffchainWorkerConfig, PruningMode, WasmExecutionMethod, + OffchainWorkerConfig, PruningMode, WasmExecutionMethod, WasmtimeInstantiationStrategy, }; use sc_service::{ BasePath, BlocksPruning, Configuration as ServiceConfiguration, Error as ServiceError, @@ -466,7 +466,9 @@ pub fn node_config( state_pruning: Some(PruningMode::ArchiveAll), blocks_pruning: BlocksPruning::KeepAll, chain_spec: spec, - wasm_method: WasmExecutionMethod::Interpreted, + wasm_method: WasmExecutionMethod::Compiled { + instantiation_strategy: WasmtimeInstantiationStrategy::PoolingCopyOnWrite, + }, // NOTE: we enforce the use of the native runtime to make the errors more debuggable execution_strategies: ExecutionStrategies { syncing: sc_client_api::ExecutionStrategy::NativeWhenPossible, diff --git a/substrate/substrate-test-runtime-client/src/lib.rs b/substrate/substrate-test-runtime-client/src/lib.rs index a61275a55e9..a8d60ee0aa8 100644 --- a/substrate/substrate-test-runtime-client/src/lib.rs +++ b/substrate/substrate-test-runtime-client/src/lib.rs @@ -260,24 +260,27 @@ impl TestClientBuilderExt fn build_with_longest_chain( self, ) -> (Client, sc_consensus::LongestChain) { - self.build_with_native_executor(None) + self.build_with_native_executor(Some(new_native_executor())) } fn build_with_backend(self) -> (Client, Arc) { let backend = self.backend(); - (self.build_with_native_executor(None).0, backend) + (self.build_with_native_executor(Some(new_native_executor())).0, backend) } } /// Creates new client instance used for tests. pub fn new() -> Client { - TestClientBuilder::new().build() + let (client, _) = TestClientBuilder::new().build_with_native_executor(Some(new_native_executor())); + client } /// Create a new native executor. pub fn new_native_executor() -> sc_executor::NativeElseWasmExecutor { sc_executor::NativeElseWasmExecutor::new( - sc_executor::WasmExecutionMethod::Interpreted, + sc_executor::WasmExecutionMethod::Compiled { + instantiation_strategy: sc_executor::WasmtimeInstantiationStrategy::PoolingCopyOnWrite, + }, None, 8, 2, diff --git a/substrate/substrate-test-runtime/src/system.rs b/substrate/substrate-test-runtime/src/system.rs index b3d0ace9bf6..b24105209a8 100644 --- a/substrate/substrate-test-runtime/src/system.rs +++ b/substrate/substrate-test-runtime/src/system.rs @@ -313,7 +313,7 @@ mod tests { use super::*; use crate::{wasm_binary_unwrap, Header, Transfer}; - use sc_executor::{NativeElseWasmExecutor, WasmExecutionMethod}; + use sc_executor::{NativeElseWasmExecutor, WasmExecutionMethod, WasmtimeInstantiationStrategy}; use sp_core::{ map, traits::{CallContext, CodeExecutor, RuntimeCode}, @@ -337,7 +337,14 @@ mod tests { } fn executor() -> NativeElseWasmExecutor { - NativeElseWasmExecutor::new(WasmExecutionMethod::Interpreted, None, 8, 2) + NativeElseWasmExecutor::new( + WasmExecutionMethod::Compiled { + instantiation_strategy: WasmtimeInstantiationStrategy::PoolingCopyOnWrite, + }, + None, + 8, + 2, + ) } fn new_test_ext() -> TestExternalities { diff --git a/test/subspace-test-service/src/lib.rs b/test/subspace-test-service/src/lib.rs index 87f875d163e..1d3dcb345f4 100644 --- a/test/subspace-test-service/src/lib.rs +++ b/test/subspace-test-service/src/lib.rs @@ -27,6 +27,7 @@ use sc_network::{multiaddr, NetworkStateInfo}; use sc_network_common::config::TransportConfig; use sc_service::config::{ DatabaseSource, KeystoreConfig, MultiaddrWithPeerId, WasmExecutionMethod, + WasmtimeInstantiationStrategy, }; use sc_service::{ BasePath, BlocksPruning, Configuration, NetworkStarter, Role, RpcHandlers, TaskManager, @@ -113,7 +114,9 @@ pub fn node_config( state_pruning: Default::default(), blocks_pruning: BlocksPruning::KeepAll, chain_spec: Box::new(spec), - wasm_method: WasmExecutionMethod::Interpreted, + wasm_method: WasmExecutionMethod::Compiled { + instantiation_strategy: WasmtimeInstantiationStrategy::PoolingCopyOnWrite, + }, wasm_runtime_overrides: Default::default(), // NOTE: we enforce the use of the native runtime to make the errors more debuggable execution_strategies: ExecutionStrategies {