@@ -780,6 +780,26 @@ impl frame_support::traits::OnRuntimeUpgrade for RemoveCollectiveFlip {
780
780
}
781
781
}
782
782
783
+ #[ cfg( feature = "runtime-benchmarks" ) ]
784
+ #[ macro_use]
785
+ extern crate frame_benchmarking;
786
+
787
+ #[ cfg( feature = "runtime-benchmarks" ) ]
788
+ mod benches {
789
+ define_benchmarks ! (
790
+ [ frame_system, SystemBench :: <Runtime >]
791
+ [ pallet_assets, Assets ]
792
+ [ pallet_balances, Balances ]
793
+ [ pallet_multisig, Multisig ]
794
+ [ pallet_proxy, Proxy ]
795
+ [ pallet_session, SessionBench :: <Runtime >]
796
+ [ pallet_uniques, Uniques ]
797
+ [ pallet_utility, Utility ]
798
+ [ pallet_timestamp, Timestamp ]
799
+ [ pallet_collator_selection, CollatorSelection ]
800
+ ) ;
801
+ }
802
+
783
803
impl_runtime_apis ! {
784
804
impl sp_consensus_aura:: AuraApi <Block , AuraId > for Runtime {
785
805
fn slot_duration( ) -> sp_consensus_aura:: SlotDuration {
@@ -906,33 +926,22 @@ impl_runtime_apis! {
906
926
Vec <frame_benchmarking:: BenchmarkList >,
907
927
Vec <frame_support:: traits:: StorageInfo >,
908
928
) {
909
- use frame_benchmarking:: { list_benchmark , Benchmarking , BenchmarkList } ;
929
+ use frame_benchmarking:: { Benchmarking , BenchmarkList } ;
910
930
use frame_support:: traits:: StorageInfoTrait ;
911
931
use frame_system_benchmarking:: Pallet as SystemBench ;
912
932
use cumulus_pallet_session_benchmarking:: Pallet as SessionBench ;
913
933
914
934
let mut list = Vec :: <BenchmarkList >:: new( ) ;
915
-
916
- list_benchmark!( list, extra, frame_system, SystemBench :: <Runtime >) ;
917
- list_benchmark!( list, extra, pallet_assets, Assets ) ;
918
- list_benchmark!( list, extra, pallet_balances, Balances ) ;
919
- list_benchmark!( list, extra, pallet_multisig, Multisig ) ;
920
- list_benchmark!( list, extra, pallet_proxy, Proxy ) ;
921
- list_benchmark!( list, extra, pallet_session, SessionBench :: <Runtime >) ;
922
- list_benchmark!( list, extra, pallet_uniques, Uniques ) ;
923
- list_benchmark!( list, extra, pallet_utility, Utility ) ;
924
- list_benchmark!( list, extra, pallet_timestamp, Timestamp ) ;
925
- list_benchmark!( list, extra, pallet_collator_selection, CollatorSelection ) ;
935
+ list_benchmarks!( list, extra) ;
926
936
927
937
let storage_info = AllPalletsWithSystem :: storage_info( ) ;
928
-
929
938
return ( list, storage_info)
930
939
}
931
940
932
941
fn dispatch_benchmark(
933
942
config: frame_benchmarking:: BenchmarkConfig
934
943
) -> Result <Vec <frame_benchmarking:: BenchmarkBatch >, sp_runtime:: RuntimeString > {
935
- use frame_benchmarking:: { Benchmarking , BenchmarkBatch , add_benchmark , TrackedStorageKey } ;
944
+ use frame_benchmarking:: { Benchmarking , BenchmarkBatch , TrackedStorageKey } ;
936
945
937
946
use frame_system_benchmarking:: Pallet as SystemBench ;
938
947
impl frame_system_benchmarking:: Config for Runtime { }
@@ -955,17 +964,7 @@ impl_runtime_apis! {
955
964
956
965
let mut batches = Vec :: <BenchmarkBatch >:: new( ) ;
957
966
let params = ( & config, & whitelist) ;
958
-
959
- add_benchmark!( params, batches, frame_system, SystemBench :: <Runtime >) ;
960
- add_benchmark!( params, batches, pallet_assets, Assets ) ;
961
- add_benchmark!( params, batches, pallet_balances, Balances ) ;
962
- add_benchmark!( params, batches, pallet_multisig, Multisig ) ;
963
- add_benchmark!( params, batches, pallet_proxy, Proxy ) ;
964
- add_benchmark!( params, batches, pallet_session, SessionBench :: <Runtime >) ;
965
- add_benchmark!( params, batches, pallet_uniques, Uniques ) ;
966
- add_benchmark!( params, batches, pallet_utility, Utility ) ;
967
- add_benchmark!( params, batches, pallet_timestamp, Timestamp ) ;
968
- add_benchmark!( params, batches, pallet_collator_selection, CollatorSelection ) ;
967
+ add_benchmarks!( params, batches) ;
969
968
970
969
if batches. is_empty( ) { return Err ( "Benchmark not found for this pallet." . into( ) ) }
971
970
Ok ( batches)
0 commit comments