Don't panic if parameter can not be converted between node and native runtime (#1659)

* Don't panic if parameter can not be converted between node and native runtime

* FIxes after merge

* Use correct copyright year
This commit is contained in:
Bastian Köcher
2019-02-02 14:13:50 +01:00
committed by Gav Wood
parent 4983f113e6
commit ef4dc12a5d
21 changed files with 216 additions and 67 deletions
+19
View File
@@ -38,6 +38,8 @@ use runtime_primitives::StorageMap;
use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, Hash as HashT};
use runtime::genesismap::{GenesisConfig, additional_storage_with_genesis};
use keyring::Keyring;
use state_machine::ExecutionStrategy;
use client::LocalCallExecutor;
mod local_executor {
#![allow(missing_docs)]
@@ -69,6 +71,23 @@ pub fn new() -> client::Client<Backend, Executor, runtime::Block, runtime::Runti
new_with_backend(Arc::new(Backend::new()), false)
}
/// Creates new client instance used for tests with the given api execution strategy.
pub fn new_with_api_execution_strat(
api_execution_strategy: ExecutionStrategy
) -> client::Client<Backend, Executor, runtime::Block, runtime::RuntimeApi> {
let backend = Arc::new(Backend::new());
let executor = NativeExecutor::new();
let executor = LocalCallExecutor::new(backend.clone(), executor);
client::Client::new(
backend,
executor,
genesis_storage(false),
ExecutionStrategy::NativeWhenPossible,
api_execution_strategy
).expect("Creates new client")
}
/// Creates new test client instance that suports changes trie creation.
pub fn new_with_changes_trie()
-> client::Client<Backend, Executor, runtime::Block, runtime::RuntimeApi>