@@ -35,33 +35,16 @@ use std::net::SocketAddr;
3535const UNSUPPORTED_CHAIN_MESSAGE : & str = "Unsupported chain spec, please use litentry*" ;
3636
3737trait IdentifyChain {
38- fn is_litentry ( & self ) -> bool ;
39- fn is_paseo ( & self ) -> bool ;
4038 fn is_standalone ( & self ) -> bool ;
4139}
4240
4341impl IdentifyChain for dyn sc_service:: ChainSpec {
44- fn is_litentry ( & self ) -> bool {
45- // we need the combined condition as the id in our paseo spec starts with `litentry-paseo`
46- // simply renaming `litentry-paseo` to `paseo` everywhere would have an impact on the
47- // existing litentry-paseo chain
48- self . id ( ) . starts_with ( "litentry" ) && !self . id ( ) . starts_with ( "litentry-paseo" )
49- }
50- fn is_paseo ( & self ) -> bool {
51- self . id ( ) . starts_with ( "litentry-paseo" )
52- }
5342 fn is_standalone ( & self ) -> bool {
5443 self . id ( ) . eq ( "standalone" ) || self . id ( ) . eq ( "dev" )
5544 }
5645}
5746
5847impl < T : sc_service:: ChainSpec + ' static > IdentifyChain for T {
59- fn is_litentry ( & self ) -> bool {
60- <dyn sc_service:: ChainSpec >:: is_litentry ( self )
61- }
62- fn is_paseo ( & self ) -> bool {
63- <dyn sc_service:: ChainSpec >:: is_paseo ( self )
64- }
6548 fn is_standalone ( & self ) -> bool {
6649 <dyn sc_service:: ChainSpec >:: is_standalone ( self )
6750 }
@@ -89,12 +72,7 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, St
8972 "generate-paseo" => Box :: new ( chain_specs:: paseo:: get_chain_spec_prod ( ) ) ,
9073 path => {
9174 let chain_spec = chain_specs:: ChainSpec :: from_json_file ( path. into ( ) ) ?;
92- if chain_spec. is_paseo ( ) {
93- Box :: new ( chain_specs:: ChainSpec :: from_json_file ( path. into ( ) ) ?)
94- } else {
95- // Fallback: use Litentry chain spec
96- Box :: new ( chain_spec)
97- }
75+ Box :: new ( chain_spec)
9876 } ,
9977 } )
10078}
@@ -170,14 +148,11 @@ impl SubstrateCli for RelayChainCli {
170148/// Creates partial components for the runtimes that are supported by the benchmarks.
171149macro_rules! construct_benchmark_partials {
172150 ( $config: expr, |$partials: ident| $code: expr) => {
173- if $config. chain_spec. is_litentry( ) {
174- let $partials = new_partial:: <_>( & $config, build_import_queue, false , true ) ?;
175- $code
176- } else if $config. chain_spec. is_paseo( ) {
151+ if $config. chain_spec. is_standalone( ) {
152+ panic!( "{}" , UNSUPPORTED_CHAIN_MESSAGE )
153+ } else {
177154 let $partials = new_partial:: <_>( & $config, build_import_queue, false , true ) ?;
178155 $code
179- } else {
180- panic!( "{}" , UNSUPPORTED_CHAIN_MESSAGE )
181156 }
182157 } ;
183158}
@@ -186,20 +161,9 @@ macro_rules! construct_async_run {
186161 ( |$components: ident, $cli: ident, $cmd: ident, $config: ident| $( $code: tt ) * ) => { {
187162 let runner = $cli. create_runner( $cmd) ?;
188163
189- if runner. config( ) . chain_spec. is_litentry( ) {
190- runner. async_run( |$config| {
191- let $components = new_partial:: <
192- _
193- >(
194- & $config,
195- build_import_queue,
196- false ,
197- $cli. delayed_best_block,
198- ) ?;
199- let task_manager = $components. task_manager;
200- { $( $code ) * } . map( |v| ( v, task_manager) )
201- } )
202- } else if runner. config( ) . chain_spec. is_paseo( ) {
164+ if runner. config( ) . chain_spec. is_standalone( ) {
165+ panic!( "{}" , UNSUPPORTED_CHAIN_MESSAGE )
166+ } else {
203167 runner. async_run( |$config| {
204168 let $components = new_partial:: <
205169 _
@@ -213,9 +177,6 @@ macro_rules! construct_async_run {
213177 { $( $code ) * } . map( |v| ( v, task_manager) )
214178 } )
215179 }
216- else {
217- panic!( "{}" , UNSUPPORTED_CHAIN_MESSAGE )
218- }
219180 } }
220181}
221182
@@ -272,17 +233,9 @@ pub fn run() -> Result<()> {
272233
273234 Some ( Subcommand :: ExportGenesisHead ( cmd) ) => {
274235 let runner = cli. create_runner ( cmd) ?;
275- if runner. config ( ) . chain_spec . is_litentry ( ) {
276- runner. sync_run ( |config| {
277- let sc_service:: PartialComponents { client, .. } = new_partial :: < _ > (
278- & config,
279- build_import_queue,
280- false ,
281- cli. delayed_best_block ,
282- ) ?;
283- cmd. run ( client)
284- } )
285- } else if runner. config ( ) . chain_spec . is_paseo ( ) {
236+ if runner. config ( ) . chain_spec . is_standalone ( ) {
237+ panic ! ( "{}" , UNSUPPORTED_CHAIN_MESSAGE )
238+ } else {
286239 runner. sync_run ( |config| {
287240 let sc_service:: PartialComponents { client, .. } = new_partial :: < _ > (
288241 & config,
@@ -292,8 +245,6 @@ pub fn run() -> Result<()> {
292245 ) ?;
293246 cmd. run ( client)
294247 } )
295- } else {
296- panic ! ( "{}" , UNSUPPORTED_CHAIN_MESSAGE )
297248 }
298249 } ,
299250 Some ( Subcommand :: ExportGenesisWasm ( cmd) ) => {
@@ -411,20 +362,9 @@ pub fn run() -> Result<()> {
411362 let additional_config =
412363 AdditionalConfig { evm_tracing_config, enable_evm_rpc : cli. enable_evm_rpc } ;
413364
414- if config. chain_spec . is_litentry ( ) {
415- start_node (
416- config,
417- polkadot_config,
418- collator_options,
419- para_id,
420- hwbench,
421- additional_config,
422- cli. delayed_best_block ,
423- )
424- . await
425- . map ( |r| r. 0 )
426- . map_err ( Into :: into)
427- } else if config. chain_spec . is_paseo ( ) {
365+ if config. chain_spec . is_standalone ( ) {
366+ Err ( UNSUPPORTED_CHAIN_MESSAGE . into ( ) )
367+ } else {
428368 start_node (
429369 config,
430370 polkadot_config,
@@ -437,8 +377,6 @@ pub fn run() -> Result<()> {
437377 . await
438378 . map ( |r| r. 0 )
439379 . map_err ( Into :: into)
440- } else {
441- Err ( UNSUPPORTED_CHAIN_MESSAGE . into ( ) )
442380 }
443381 } )
444382 } ,
0 commit comments