@@ -34,12 +34,6 @@ pub use polkadot_performance_test::PerfCheckError;
3434#[ cfg( feature = "pyroscope" ) ]
3535use pyroscope_pprofrs:: { pprof_backend, PprofConfig } ;
3636
37- impl From < String > for Error {
38- fn from ( s : String ) -> Self {
39- Self :: Other ( s)
40- }
41- }
42-
4337type Result < T > = std:: result:: Result < T , Error > ;
4438
4539fn get_exec_name ( ) -> Option < String > {
@@ -92,29 +86,20 @@ impl SubstrateCli for Cli {
9286 } ;
9387 Ok ( match id {
9488 "kusama" => Box :: new ( service:: chain_spec:: kusama_config ( ) ?) ,
95- #[ cfg( feature = "kusama-native" ) ]
96- "kusama-dev" => Box :: new ( service:: chain_spec:: kusama_development_config ( ) ?) ,
97- #[ cfg( feature = "kusama-native" ) ]
98- "kusama-local" => Box :: new ( service:: chain_spec:: kusama_local_testnet_config ( ) ?) ,
99- #[ cfg( feature = "kusama-native" ) ]
100- "kusama-staging" => Box :: new ( service:: chain_spec:: kusama_staging_testnet_config ( ) ?) ,
101- #[ cfg( not( feature = "kusama-native" ) ) ]
10289 name if name. starts_with ( "kusama-" ) && !name. ends_with ( ".json" ) =>
103- Err ( format ! ( "`{}` only supported with ` kusama- native` feature enabled." , name ) ) ?,
90+ Err ( format ! ( "`{name }` is not supported anymore as the kusama native runtime no longer part of the node." ) ) ?,
10491 "polkadot" => Box :: new ( service:: chain_spec:: polkadot_config ( ) ?) ,
105- #[ cfg( feature = "polkadot-native" ) ]
106- "polkadot-dev" | "dev" => Box :: new ( service:: chain_spec:: polkadot_development_config ( ) ?) ,
107- #[ cfg( feature = "polkadot-native" ) ]
108- "polkadot-local" => Box :: new ( service:: chain_spec:: polkadot_local_testnet_config ( ) ?) ,
92+ name if name. starts_with ( "polkadot-" ) && !name. ends_with ( ".json" ) =>
93+ Err ( format ! ( "`{name}` is not supported anymore as the polkadot native runtime no longer part of the node." ) ) ?,
10994 "rococo" => Box :: new ( service:: chain_spec:: rococo_config ( ) ?) ,
11095 #[ cfg( feature = "rococo-native" ) ]
111- "rococo-dev" => Box :: new ( service:: chain_spec:: rococo_development_config ( ) ?) ,
96+ "dev" | " rococo-dev" => Box :: new ( service:: chain_spec:: rococo_development_config ( ) ?) ,
11297 #[ cfg( feature = "rococo-native" ) ]
11398 "rococo-local" => Box :: new ( service:: chain_spec:: rococo_local_testnet_config ( ) ?) ,
11499 #[ cfg( feature = "rococo-native" ) ]
115100 "rococo-staging" => Box :: new ( service:: chain_spec:: rococo_staging_testnet_config ( ) ?) ,
116101 #[ cfg( not( feature = "rococo-native" ) ) ]
117- name if name. starts_with ( "rococo-" ) && !name. ends_with ( ".json" ) =>
102+ name if name. starts_with ( "rococo-" ) && !name. ends_with ( ".json" ) || name == "dev" =>
118103 Err ( format ! ( "`{}` only supported with `rococo-native` feature enabled." , name) ) ?,
119104 "westend" => Box :: new ( service:: chain_spec:: westend_config ( ) ?) ,
120105 #[ cfg( feature = "westend-native" ) ]
@@ -146,7 +131,7 @@ impl SubstrateCli for Cli {
146131 path => {
147132 let path = std:: path:: PathBuf :: from ( path) ;
148133
149- let chain_spec = Box :: new ( service:: PolkadotChainSpec :: from_json_file ( path. clone ( ) ) ?)
134+ let chain_spec = Box :: new ( service:: GenericChainSpec :: from_json_file ( path. clone ( ) ) ?)
150135 as Box < dyn service:: ChainSpec > ;
151136
152137 // When `force_*` is given or the file name starts with the name of one of the known
@@ -158,7 +143,7 @@ impl SubstrateCli for Cli {
158143 {
159144 Box :: new ( service:: RococoChainSpec :: from_json_file ( path) ?)
160145 } else if self . run . force_kusama || chain_spec. is_kusama ( ) {
161- Box :: new ( service:: KusamaChainSpec :: from_json_file ( path) ?)
146+ Box :: new ( service:: GenericChainSpec :: from_json_file ( path) ?)
162147 } else if self . run . force_westend || chain_spec. is_westend ( ) {
163148 Box :: new ( service:: WestendChainSpec :: from_json_file ( path) ?)
164149 } else {
@@ -182,17 +167,6 @@ fn set_default_ss58_version(spec: &Box<dyn service::ChainSpec>) {
182167 sp_core:: crypto:: set_default_ss58_version ( ss58_version) ;
183168}
184169
185- const DEV_ONLY_ERROR_PATTERN : & ' static str =
186- "can only use subcommand with --chain [polkadot-dev, kusama-dev, westend-dev, rococo-dev, wococo-dev], got " ;
187-
188- fn ensure_dev ( spec : & Box < dyn service:: ChainSpec > ) -> std:: result:: Result < ( ) , String > {
189- if spec. is_dev ( ) {
190- Ok ( ( ) )
191- } else {
192- Err ( format ! ( "{}{}" , DEV_ONLY_ERROR_PATTERN , spec. id( ) ) )
193- }
194- }
195-
196170/// Runs performance checks.
197171/// Should only be used in release build since the check would take too much time otherwise.
198172fn host_perf_check ( ) -> Result < ( ) > {
@@ -471,8 +445,7 @@ pub fn run() -> Result<()> {
471445 cmd. run ( client. clone ( ) ) . map_err ( Error :: SubstrateCli )
472446 } ) ,
473447 // These commands are very similar and can be handled in nearly the same way.
474- BenchmarkCmd :: Extrinsic ( _) | BenchmarkCmd :: Overhead ( _) => {
475- ensure_dev ( chain_spec) . map_err ( Error :: Other ) ?;
448+ BenchmarkCmd :: Extrinsic ( _) | BenchmarkCmd :: Overhead ( _) =>
476449 runner. sync_run ( |mut config| {
477450 let ( client, _, _, _) = service:: new_chain_ops ( & mut config, None ) ?;
478451 let header = client. header ( client. info ( ) . genesis_hash ) . unwrap ( ) . unwrap ( ) ;
@@ -508,11 +481,9 @@ pub fn run() -> Result<()> {
508481 . map_err ( Error :: SubstrateCli ) ,
509482 _ => unreachable ! ( "Ensured by the outside match; qed" ) ,
510483 }
511- } )
512- } ,
484+ } ) ,
513485 BenchmarkCmd :: Pallet ( cmd) => {
514486 set_default_ss58_version ( chain_spec) ;
515- ensure_dev ( chain_spec) . map_err ( Error :: Other ) ?;
516487
517488 if cfg ! ( feature = "runtime-benchmarks" ) {
518489 runner. sync_run ( |config| {
0 commit comments