Benchmark Im Online Pallet (#5318)

* Initial benchmarking setup

* Add keystore

* validate unsigned

* Update frame/im-online/src/benchmarking.rs

Co-Authored-By: Marcio Diaz <marcio.diaz@gmail.com>

* Fix verify_unsigned benchmark

* add variable for teting the external addresss length

* Update frame/im-online/src/benchmarking.rs

Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Update utils/frame/benchmarking-cli/src/lib.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>

Co-authored-by: Marcio Diaz <marcio.diaz@gmail.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Benjamin Kampmann <ben@gnunicorn.org>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Shawn Tabrizi
2020-03-20 12:42:00 +01:00
committed by GitHub
parent 7947cbf915
commit 400a62680f
9 changed files with 160 additions and 2 deletions
@@ -16,6 +16,7 @@ sc-cli = { version = "0.8.0-alpha.4", path = "../../../client/cli" }
sc-client = { version = "0.8.0-alpha.4", path = "../../../client" }
sc-client-db = { version = "0.8.0-alpha.4", path = "../../../client/db" }
sc-executor = { version = "0.8.0-alpha.4", path = "../../../client/executor" }
sp-externalities = { version = "0.8.0-alpha.4", path = "../../../primitives/externalities" }
sp-runtime = { version = "2.0.0-alpha.4", path = "../../../primitives/runtime" }
sp-state-machine = { version = "0.8.0-alpha.4", path = "../../../primitives/state-machine" }
structopt = "0.3.8"
@@ -23,7 +23,12 @@ use sc_service::{Configuration, ChainSpec};
use sc_executor::{NativeExecutor, NativeExecutionDispatch};
use codec::{Encode, Decode};
use frame_benchmarking::BenchmarkResults;
use sp_core::tasks;
use sp_core::{
tasks,
traits::KeystoreExt,
testing::KeyStore,
};
use sp_externalities::Extensions;
/// The `benchmark` command used to benchmark FRAME Pallets.
#[derive(Debug, structopt::StructOpt, Clone)]
@@ -106,6 +111,9 @@ impl BenchmarkCmd {
2, // The runtime instances cache size.
);
let mut extensions = Extensions::default();
extensions.register(KeystoreExt(KeyStore::new()));
let result = StateMachine::<_, _, NumberFor<BB>, _>::new(
&state,
None,
@@ -120,7 +128,7 @@ impl BenchmarkCmd {
self.steps.clone(),
self.repeat,
).encode(),
Default::default(),
extensions,
&sp_state_machine::backend::BackendRuntimeCode::new(&state).runtime_code()?,
tasks::executor(),
)