|
@@ -244,4 +244,50 @@ impl_runtime_apis! {
|
|
|
SessionKeys::decode_into_raw_public_keys(&encoded)
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ #[cfg(feature = "runtime-benchmarks")]
|
|
|
+ impl frame_benchmarking::Benchmark<Block> for Runtime {
|
|
|
+ fn dispatch_benchmark(
|
|
|
+ config: frame_benchmarking::BenchmarkConfig
|
|
|
+ ) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
|
|
|
+ use sp_std::vec;
|
|
|
+ use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};
|
|
|
+
|
|
|
+ use crate::StorageV2;
|
|
|
+
|
|
|
+
|
|
|
+ // 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
|
|
|
+ hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),
|
|
|
+ // Total Issuance
|
|
|
+ hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),
|
|
|
+ // Execution Phase
|
|
|
+ hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),
|
|
|
+ // Event Count
|
|
|
+ hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),
|
|
|
+ // System Events
|
|
|
+ hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),
|
|
|
+ // Caller 0 Account
|
|
|
+ hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da946c154ffd9992e395af90b5b13cc6f295c77033fce8a9045824a6690bbf99c6db269502f0a8d1d2a008542d5690a0749").to_vec().into(),
|
|
|
+ // Treasury Account
|
|
|
+ hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da95ecffd7b6c0f78751baa9d281e0bfa3a6d6f646c70792f74727372790000000000000000000000000000000000000000").to_vec().into(),
|
|
|
+ ];
|
|
|
+
|
|
|
+ let mut batches = Vec::<BenchmarkBatch>::new();
|
|
|
+ let params = (&config, &whitelist);
|
|
|
+
|
|
|
+ // Joystream Benchmarks
|
|
|
+ add_benchmark!(params, batches, storage_v2, StorageV2);
|
|
|
+
|
|
|
+ if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
|
|
|
+ Ok(batches)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|