|
@@ -256,13 +256,23 @@ impl_runtime_apis! {
|
|
|
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
|
|
|
use sp_std::vec;
|
|
|
use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};
|
|
|
- use frame_system_benchmarking::Module as SystemBench;
|
|
|
- impl frame_system_benchmarking::Trait for Runtime {}
|
|
|
|
|
|
+ use pallet_session_benchmarking::Module as SessionBench;
|
|
|
+ use frame_system_benchmarking::Module as SystemBench;
|
|
|
use crate::ProposalsDiscussion;
|
|
|
use crate::ProposalsEngine;
|
|
|
use crate::Constitution;
|
|
|
use crate::ContentDirectoryWorkingGroup;
|
|
|
+ use crate::Utility;
|
|
|
+ use crate::Timestamp;
|
|
|
+ use crate::ImOnline;
|
|
|
+
|
|
|
+
|
|
|
+ // Trying to add benchmarks directly to the Session Pallet caused cyclic dependency issues.
|
|
|
+ // To get around that, we separated the Session benchmarks into its own crate, which is why
|
|
|
+ // we need these two lines below.
|
|
|
+ impl pallet_session_benchmarking::Trait for Runtime {}
|
|
|
+ impl frame_system_benchmarking::Trait for Runtime {}
|
|
|
|
|
|
let whitelist: Vec<TrackedStorageKey> = vec![
|
|
|
// Block Number
|
|
@@ -284,7 +294,21 @@ impl_runtime_apis! {
|
|
|
let mut batches = Vec::<BenchmarkBatch>::new();
|
|
|
let params = (&config, &whitelist);
|
|
|
|
|
|
- add_benchmark!(params, batches, system, SystemBench::<Runtime>);
|
|
|
+ // Note: For benchmarking Stake and Balances we need to change ExistentialDeposit to
|
|
|
+ // a non-zero value.
|
|
|
+ // For now, due to the complexity grandpa and babe aren't benchmarked automatically
|
|
|
+ // we should use the default manually created weights.
|
|
|
+ // Finally, pallet_offences have no `WeightInfo` so there's no need to benchmark it
|
|
|
+ // the benchmark is only for illustrative pourpuses.
|
|
|
+
|
|
|
+ // Frame benchmarks
|
|
|
+ add_benchmark!(params, batches, frame_system, SystemBench::<Runtime>);
|
|
|
+ add_benchmark!(params, batches, pallet_utility, Utility);
|
|
|
+ add_benchmark!(params, batches, pallet_timestamp, Timestamp);
|
|
|
+ add_benchmark!(params, batches, pallet_session, SessionBench::<Runtime>);
|
|
|
+ add_benchmark!(params, batches, pallet_im_online, ImOnline);
|
|
|
+
|
|
|
+ // Joystream Benchmarks
|
|
|
add_benchmark!(params, batches, proposals_discussion, ProposalsDiscussion);
|
|
|
add_benchmark!(params, batches, proposals_engine, ProposalsEngine);
|
|
|
add_benchmark!(params, batches, pallet_constitution, Constitution);
|