File tree Expand file tree Collapse file tree 4 files changed +20
-8
lines changed Expand file tree Collapse file tree 4 files changed +20
-8
lines changed Original file line number Diff line number Diff line change @@ -1068,7 +1068,7 @@ fn rococo_local_testnet_genesis() -> serde_json::Value {
10681068#[ cfg( feature = "rococo-native" ) ]
10691069pub fn rococo_local_testnet_config ( ) -> Result < RococoChainSpec , String > {
10701070 Ok ( RococoChainSpec :: builder (
1071- rococo:: WASM_BINARY . ok_or ( "Rococo development wasm not available" ) ?,
1071+ rococo:: fast_runtime_binary :: WASM_BINARY . ok_or ( "Rococo development wasm not available" ) ?,
10721072 Default :: default ( ) ,
10731073 )
10741074 . with_name ( "Rococo Local Testnet" )
Original file line number Diff line number Diff line change 1616
1717#[ cfg( feature = "std" ) ]
1818fn main ( ) {
19- // note: needs to be synced with rococo-runtime-constants::time hard-coded string literal
20- const ROCOCO_EPOCH_DURATION_ENV : & str = "ROCOCO_EPOCH_DURATION" ;
21-
2219 substrate_wasm_builder:: WasmBuilder :: new ( )
2320 . with_current_project ( )
2421 . import_memory ( )
2522 . export_heap_base ( )
2623 . build ( ) ;
2724
28- println ! ( "cargo:rerun-if-env-changed={}" , ROCOCO_EPOCH_DURATION_ENV ) ;
25+ substrate_wasm_builder:: WasmBuilder :: new ( )
26+ . with_current_project ( )
27+ . set_file_name ( "fast_runtime_binary.rs" )
28+ . enable_feature ( "fast-runtime" )
29+ . import_memory ( )
30+ . export_heap_base ( )
31+ . build ( ) ;
2932}
3033
3134#[ cfg( not( feature = "std" ) ) ]
Original file line number Diff line number Diff line change @@ -37,14 +37,15 @@ pub mod currency {
3737
3838/// Time and blocks.
3939pub mod time {
40+ use runtime_common:: prod_or_fast;
41+
4042 use primitives:: { BlockNumber , Moment } ;
4143 pub const MILLISECS_PER_BLOCK : Moment = 6000 ;
4244 pub const SLOT_DURATION : Moment = MILLISECS_PER_BLOCK ;
4345
4446 frame_support:: parameter_types! {
45- pub storage EpochDurationInBlocks : BlockNumber = option_env!( "ROCOCO_EPOCH_DURATION" )
46- . map( |s| s. parse( ) . expect( "`ROCOCO_EPOCH_DURATION` is not a valid `BlockNumber`" ) )
47- . unwrap_or( 1 * MINUTES ) ;
47+ pub EpochDurationInBlocks : BlockNumber =
48+ prod_or_fast!( 1 * HOURS , 1 * MINUTES , "ROCOCO_EPOCH_DURATION" ) ;
4849 }
4950
5051 // These time units are defined in number of blocks.
Original file line number Diff line number Diff line change @@ -131,6 +131,14 @@ impl_runtime_weights!(rococo_runtime_constants);
131131#[ cfg( feature = "std" ) ]
132132include ! ( concat!( env!( "OUT_DIR" ) , "/wasm_binary.rs" ) ) ;
133133
134+ /// Provides the `WASM_BINARY` build with `fast-runtime` feature enabled.
135+ ///
136+ /// This is for example useful for local test chains.
137+ #[ cfg( feature = "std" ) ]
138+ pub mod fast_runtime_binary {
139+ include ! ( concat!( env!( "OUT_DIR" ) , "/fast_runtime_binary.rs" ) ) ;
140+ }
141+
134142/// Runtime version (Rococo).
135143#[ sp_version:: runtime_version]
136144pub const VERSION : RuntimeVersion = RuntimeVersion {
You can’t perform that action at this time.
0 commit comments