@@ -6,7 +6,7 @@ use frame_benchmarking_cli::PalletCmd;
66use sc_chain_spec:: GenesisConfigBuilderRuntimeCaller ;
77use sp_runtime:: traits:: BlakeTwo256 ;
88use std:: {
9- collections:: HashMap ,
9+ collections:: BTreeMap ,
1010 fmt:: Display ,
1111 fs:: { self , File } ,
1212 io:: Read ,
@@ -32,7 +32,7 @@ type HostFunctions = (
3232
3333/// Type alias for records where the key is the pallet name and the value is an array of its
3434/// extrinsics.
35- pub type PalletExtrinsicsRegistry = HashMap < String , Vec < String > > ;
35+ pub type PalletExtrinsicsRegistry = BTreeMap < String , Vec < String > > ;
3636
3737/// How the genesis state for benchmarking should be built.
3838#[ derive( clap:: ValueEnum , Debug , Eq , PartialEq , Clone , Copy , EnumIter , EnumMessageDerive ) ]
@@ -179,6 +179,11 @@ fn process_pallet_extrinsics(output_file: PathBuf) -> anyhow::Result<PalletExtri
179179 let extrinsic = record[ 1 ] . trim ( ) . to_string ( ) ;
180180 registry. entry ( pallet) . or_default ( ) . push ( extrinsic) ;
181181 }
182+
183+ // Sort the extrinsics by alphabetical order for each pallet.
184+ for extrinsics in registry. values_mut ( ) {
185+ extrinsics. sort ( ) ;
186+ }
182187 Ok ( registry)
183188}
184189
@@ -253,6 +258,21 @@ mod tests {
253258 binary. source ( false , & ( ) , true ) . await ?;
254259
255260 let registry = load_pallet_extrinsics ( & runtime_path, & binary. path ( ) ) . await ?;
261+ let pallets: Vec < String > = registry. keys ( ) . map ( |k| k. clone ( ) ) . collect ( ) ;
262+ assert_eq ! (
263+ pallets,
264+ vec![
265+ "cumulus_pallet_parachain_system" ,
266+ "cumulus_pallet_xcmp_queue" ,
267+ "frame_system" ,
268+ "pallet_balances" ,
269+ "pallet_collator_selection" ,
270+ "pallet_message_queue" ,
271+ "pallet_session" ,
272+ "pallet_sudo" ,
273+ "pallet_timestamp"
274+ ]
275+ ) ;
256276 assert_eq ! (
257277 registry. get( "pallet_timestamp" ) . cloned( ) . unwrap_or_default( ) ,
258278 [ "on_finalize" , "set" ]
0 commit comments