mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 04:11:07 +00:00
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:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user