Browse Source

runtime: Add staking and balances benchmarking.

Shamil Gadelshin 4 years ago
parent
commit
9d3aeb0dc3
3 changed files with 10 additions and 1 deletions
  1. 1 1
      runtime-modules/forum/src/lib.rs
  2. 3 0
      runtime/src/runtime_api.rs
  3. 6 0
      scripts/generate-weights.sh

+ 1 - 1
runtime-modules/forum/src/lib.rs

@@ -1494,7 +1494,7 @@ impl<T: Trait> Module<T> {
             .posts
             .get(post_id)
             .cloned()
-            .ok_or_else(|| Error::<T>::PostDoesNotExist)
+            .ok_or(Error::<T>::PostDoesNotExist)
     }
 
     fn ensure_can_moderate_post(

+ 3 - 0
runtime/src/runtime_api.rs

@@ -296,6 +296,7 @@ impl_runtime_apis! {
             use crate::Referendum;
             use crate::Blog;
             use crate::JoystreamUtility;
+            use crate::Staking;
 
 
             // Trying to add benchmarks directly to the Session Pallet caused cyclic dependency issues.
@@ -373,6 +374,8 @@ impl_runtime_apis! {
             add_benchmark!(params, batches, pallet_timestamp, Timestamp);
             add_benchmark!(params, batches, pallet_session, SessionBench::<Runtime>);
             add_benchmark!(params, batches, pallet_im_online, ImOnline);
+            add_benchmark!(params, batches, pallet_balances, Balances);
+            add_benchmark!(params, batches, pallet_staking, Staking);
 
             // Joystream Benchmarks
             add_benchmark!(params, batches, proposals_discussion, ProposalsDiscussion);

+ 6 - 0
scripts/generate-weights.sh

@@ -40,6 +40,12 @@ benchmark substrate_utility
 benchmark pallet_session
 benchmark pallet_timestamp
 
+# Pallet staking benchmarking takes too long.
+# benchmark pallet_staking
+
+# Benchmark should be run on the reference machine because it affects the fee model (transfer fee).
+# benchmark pallet_balances
+
 # This benchmark takes too long with 50 steps and 20 repeats in a normal laptop.
 # Will have it commented out until we test it in the reference machine. If there
 # it still takes too long we will get rid of this benchmark for good and use always