Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/pallet-subspace/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
5 changes: 2 additions & 3 deletions domains/client/block-builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 4 additions & 2 deletions domains/test/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
11 changes: 7 additions & 4 deletions substrate/substrate-test-runtime-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,24 +260,27 @@ impl<B> TestClientBuilderExt<B>
fn build_with_longest_chain(
self,
) -> (Client<B>, sc_consensus::LongestChain<B, substrate_test_runtime::Block>) {
self.build_with_native_executor(None)
self.build_with_native_executor(Some(new_native_executor()))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really want native though? I'd prefer to use compiled WASM instead, especially with native executor going away in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

fn build_with_backend(self) -> (Client<B>, Arc<B>) {
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<Backend> {
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<LocalExecutorDispatch> {
sc_executor::NativeElseWasmExecutor::new(
sc_executor::WasmExecutionMethod::Interpreted,
sc_executor::WasmExecutionMethod::Compiled {
instantiation_strategy: sc_executor::WasmtimeInstantiationStrategy::PoolingCopyOnWrite,
},
None,
8,
2,
Expand Down
11 changes: 9 additions & 2 deletions substrate/substrate-test-runtime/src/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand All @@ -337,7 +337,14 @@ mod tests {
}

fn executor() -> NativeElseWasmExecutor<NativeDispatch> {
NativeElseWasmExecutor::new(WasmExecutionMethod::Interpreted, None, 8, 2)
NativeElseWasmExecutor::new(
WasmExecutionMethod::Compiled {
instantiation_strategy: WasmtimeInstantiationStrategy::PoolingCopyOnWrite,
},
None,
8,
2,
)
}

fn new_test_ext() -> TestExternalities {
Expand Down
5 changes: 4 additions & 1 deletion test/subspace-test-service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand Down