@@ -20,7 +20,7 @@ use sc_chain_spec::{ChainSpec, ChainType};
2020use std:: { borrow:: Cow , str:: FromStr } ;
2121
2222/// Collects all supported Coretime configurations.
23- #[ derive( Debug , PartialEq , Clone ) ]
23+ #[ derive( Debug , PartialEq , Clone , Copy ) ]
2424pub enum CoretimeRuntimeType {
2525 // Live
2626 Rococo ,
@@ -85,13 +85,13 @@ impl CoretimeRuntimeType {
8585 & include_bytes ! ( "../../../parachains/chain-specs/coretime-rococo.json" ) [ ..] ,
8686 ) ?) ) ,
8787 CoretimeRuntimeType :: RococoLocal =>
88- Ok ( Box :: new ( rococo:: local_config ( self , "rococo-local" ) ) ) ,
88+ Ok ( Box :: new ( rococo:: local_config ( * self , "rococo-local" ) ) ) ,
8989 CoretimeRuntimeType :: RococoDevelopment =>
90- Ok ( Box :: new ( rococo:: local_config ( self , "rococo-dev" ) ) ) ,
90+ Ok ( Box :: new ( rococo:: local_config ( * self , "rococo-dev" ) ) ) ,
9191 CoretimeRuntimeType :: WestendLocal =>
92- Ok ( Box :: new ( westend:: local_config ( self , "westend-local" ) ) ) ,
92+ Ok ( Box :: new ( westend:: local_config ( * self , "westend-local" ) ) ) ,
9393 CoretimeRuntimeType :: WestendDevelopment =>
94- Ok ( Box :: new ( westend:: local_config ( self , "westend-dev" ) ) ) ,
94+ Ok ( Box :: new ( westend:: local_config ( * self , "westend-dev" ) ) ) ,
9595 }
9696 }
9797}
@@ -114,31 +114,39 @@ pub mod rococo {
114114 get_account_id_from_seed, get_collator_keys_from_seed, Extensions , SAFE_XCM_VERSION ,
115115 } ;
116116 use parachains_common:: { AccountId , AuraId , Balance } ;
117+ use sc_chain_spec:: ChainType ;
117118 use sp_core:: sr25519;
118119
119120 pub ( crate ) const CORETIME_ROCOCO : & str = "coretime-rococo" ;
120121 pub ( crate ) const CORETIME_ROCOCO_LOCAL : & str = "coretime-rococo-local" ;
121122 pub ( crate ) const CORETIME_ROCOCO_DEVELOPMENT : & str = "coretime-rococo-dev" ;
122123 const CORETIME_ROCOCO_ED : Balance = parachains_common:: rococo:: currency:: EXISTENTIAL_DEPOSIT ;
123124
124- pub fn local_config ( runtime_type : & CoretimeRuntimeType , relay_chain : & str ) -> GenericChainSpec {
125+ pub fn local_config ( runtime_type : CoretimeRuntimeType , relay_chain : & str ) -> GenericChainSpec {
125126 // Rococo defaults
126127 let mut properties = sc_chain_spec:: Properties :: new ( ) ;
127128 properties. insert ( "ss58Format" . into ( ) , 42 . into ( ) ) ;
128129 properties. insert ( "tokenSymbol" . into ( ) , "ROC" . into ( ) ) ;
129130 properties. insert ( "tokenDecimals" . into ( ) , 12 . into ( ) ) ;
130131
131- let chain_type = runtime_type. clone ( ) . into ( ) ;
132+ let chain_type = runtime_type. into ( ) ;
132133 let chain_name = format ! ( "Coretime Rococo {}" , chain_type_name( & chain_type) ) ;
133134 let para_id = super :: CORETIME_PARA_ID ;
134135
135- GenericChainSpec :: builder (
136+ let wasm_binary = if matches ! ( chain_type, ChainType :: Local | ChainType :: Development ) {
137+ coretime_rococo_runtime:: fast_runtime_binary:: WASM_BINARY
138+ . expect ( "WASM binary was not built, please build it!" )
139+ } else {
136140 coretime_rococo_runtime:: WASM_BINARY
137- . expect ( "WASM binary was not built, please build it!" ) ,
141+ . expect ( "WASM binary was not built, please build it!" )
142+ } ;
143+
144+ GenericChainSpec :: builder (
145+ wasm_binary,
138146 Extensions { relay_chain : relay_chain. to_string ( ) , para_id : para_id. into ( ) } ,
139147 )
140148 . with_name ( & chain_name)
141- . with_id ( runtime_type. clone ( ) . into ( ) )
149+ . with_id ( runtime_type. into ( ) )
142150 . with_chain_type ( chain_type)
143151 . with_genesis_config_patch ( genesis (
144152 // initial collators.
@@ -209,14 +217,14 @@ pub mod westend {
209217 pub ( crate ) const CORETIME_WESTEND_DEVELOPMENT : & str = "coretime-westend-dev" ;
210218 const CORETIME_WESTEND_ED : Balance = parachains_common:: westend:: currency:: EXISTENTIAL_DEPOSIT ;
211219
212- pub fn local_config ( runtime_type : & CoretimeRuntimeType , relay_chain : & str ) -> GenericChainSpec {
220+ pub fn local_config ( runtime_type : CoretimeRuntimeType , relay_chain : & str ) -> GenericChainSpec {
213221 // westend defaults
214222 let mut properties = sc_chain_spec:: Properties :: new ( ) ;
215223 properties. insert ( "ss58Format" . into ( ) , 42 . into ( ) ) ;
216224 properties. insert ( "tokenSymbol" . into ( ) , "WND" . into ( ) ) ;
217225 properties. insert ( "tokenDecimals" . into ( ) , 12 . into ( ) ) ;
218226
219- let chain_type = runtime_type. clone ( ) . into ( ) ;
227+ let chain_type = runtime_type. into ( ) ;
220228 let chain_name = format ! ( "Coretime Westend {}" , chain_type_name( & chain_type) ) ;
221229 let para_id = super :: CORETIME_PARA_ID ;
222230
@@ -226,7 +234,7 @@ pub mod westend {
226234 Extensions { relay_chain : relay_chain. to_string ( ) , para_id : para_id. into ( ) } ,
227235 )
228236 . with_name ( & chain_name)
229- . with_id ( runtime_type. clone ( ) . into ( ) )
237+ . with_id ( runtime_type. into ( ) )
230238 . with_chain_type ( chain_type)
231239 . with_genesis_config_patch ( genesis (
232240 // initial collators.
0 commit comments