Client::info() no longer returns a Result (#2776)

This commit is contained in:
Pierre Krieger
2019-06-04 16:09:46 +02:00
committed by Bastian Köcher
parent 53e8ad8728
commit 5df89a8a6f
33 changed files with 235 additions and 274 deletions
@@ -23,14 +23,14 @@ fn sr_api_benchmark(c: &mut Criterion) {
c.bench_function("add one with same runtime api", |b| {
let client = test_client::new();
let runtime_api = client.runtime_api();
let block_id = BlockId::Number(client.info().unwrap().chain.best_number);
let block_id = BlockId::Number(client.info().chain.best_number);
b.iter(|| runtime_api.benchmark_add_one(&block_id, &1))
});
c.bench_function("add one with recreating runtime api", |b| {
let client = test_client::new();
let block_id = BlockId::Number(client.info().unwrap().chain.best_number);
let block_id = BlockId::Number(client.info().chain.best_number);
b.iter(|| client.runtime_api().benchmark_add_one(&block_id, &1))
});
@@ -38,7 +38,7 @@ fn sr_api_benchmark(c: &mut Criterion) {
c.bench_function("vector add one with same runtime api", |b| {
let client = test_client::new();
let runtime_api = client.runtime_api();
let block_id = BlockId::Number(client.info().unwrap().chain.best_number);
let block_id = BlockId::Number(client.info().chain.best_number);
let data = vec![0; 1000];
b.iter_with_large_drop(|| runtime_api.benchmark_vector_add_one(&block_id, &data))
@@ -46,7 +46,7 @@ fn sr_api_benchmark(c: &mut Criterion) {
c.bench_function("vector add one with recreating runtime api", |b| {
let client = test_client::new();
let block_id = BlockId::Number(client.info().unwrap().chain.best_number);
let block_id = BlockId::Number(client.info().chain.best_number);
let data = vec![0; 1000];
b.iter_with_large_drop(|| client.runtime_api().benchmark_vector_add_one(&block_id, &data))
@@ -54,13 +54,13 @@ fn sr_api_benchmark(c: &mut Criterion) {
c.bench_function("calling function by function pointer in wasm", |b| {
let client = test_client::new_with_execution_strategy(ExecutionStrategy::AlwaysWasm);
let block_id = BlockId::Number(client.info().unwrap().chain.best_number);
let block_id = BlockId::Number(client.info().chain.best_number);
b.iter(|| client.runtime_api().benchmark_indirect_call(&block_id).unwrap())
});
c.bench_function("calling function in wasm", |b| {
let client = test_client::new_with_execution_strategy(ExecutionStrategy::AlwaysWasm);
let block_id = BlockId::Number(client.info().unwrap().chain.best_number);
let block_id = BlockId::Number(client.info().chain.best_number);
b.iter(|| client.runtime_api().benchmark_direct_call(&block_id).unwrap())
});
}