Adds new execution strategy nativeElseWasm (#1546)

* fix: adds new execution strategy nativeElseWasm and replace nativeWhenPossible with it

* feat: adds cmd line params for execution strategies

* fix: uses of cmd line execution strategies

* chore: remove white spaces

* chore: remove println

* chore: remove whitespace

* fix: generating functions with context

* feat: add function to generate with_context declarations

* fix: add implementation for with_context function calls

* fix: add execution context to call_api_at function

* fix: making use of context to select strategy for block_builder

* chore: cleaning up

* fix: merging issues

* fix tests

* add wasm files

* chore: small doc for context fields

* chore: delete redundant docs

* fix: use full path for ExecutionContext

* fix: add context functions from inside fold_item_impl

* chore: remove clone

* fix: moving generative function to utils, remove unused imports

* fix: add missing full path for ExecutionContext

* fix: merge issues

* update wasm files

* fix: update to keep up with changes in master

* chore: remove unused functions, clean up

* fix test

* fix grumbles

* fix: add more tests

* fix: some refactorings

* feat: add execution strategy to call

* chore: small improvements

* fix: add message to panic

* fix tests
This commit is contained in:
Marcio Diaz
2019-02-11 15:22:44 +01:00
committed by GitHub
parent f9975af020
commit b8bd49961a
31 changed files with 837 additions and 544 deletions
+11 -4
View File
@@ -25,6 +25,7 @@ mod block_builder_ext;
pub use client_ext::TestClient;
pub use block_builder_ext::BlockBuilderExt;
pub use client;
pub use client::ExecutionStrategies;
pub use client::blockchain;
pub use client::backend;
pub use executor::NativeExecutor;
@@ -72,19 +73,25 @@ pub fn new() -> client::Client<Backend, Executor, runtime::Block, runtime::Runti
}
/// Creates new client instance used for tests with the given api execution strategy.
pub fn new_with_api_execution_strat(
api_execution_strategy: ExecutionStrategy
pub fn new_with_execution_strategy(
execution_strategy: ExecutionStrategy
) -> client::Client<Backend, Executor, runtime::Block, runtime::RuntimeApi> {
let backend = Arc::new(Backend::new());
let executor = NativeExecutor::new(None);
let executor = LocalCallExecutor::new(backend.clone(), executor);
let execution_strategies = ExecutionStrategies {
syncing: execution_strategy,
importing: execution_strategy,
block_construction: execution_strategy,
other: execution_strategy,
};
client::Client::new(
backend,
executor,
genesis_storage(false),
ExecutionStrategy::NativeWhenPossible,
api_execution_strategy
execution_strategies
).expect("Creates new client")
}