From c163d8702b27e542caebd0df585d45ec761edc2a Mon Sep 17 00:00:00 2001 From: Peter Goodspeed-Niklaus Date: Fri, 8 May 2020 00:27:33 +0200 Subject: [PATCH] fix test collator compilation failure (#89) * fix test collator compilation failure Closes #88. * copy method instead of using feature Using a feature gate like "test-features" is problematic because it is leaky: depending on situational considitons such as the current working directory when compilation is attempted, the feature may or may not be applied, which makes success inconsistent. It's simpler in this case to copy a dozen lines of code than to work out all the issues with test features. --- test/parachain/src/command.rs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/test/parachain/src/command.rs b/test/parachain/src/command.rs index 2ed0522684..59955074a8 100644 --- a/test/parachain/src/command.rs +++ b/test/parachain/src/command.rs @@ -23,12 +23,11 @@ use sc_cli::{ CliConfiguration, Error, ImportParams, KeystoreParams, NetworkParams, Result, SharedParams, SubstrateCli, }; -use sc_service::client::genesis; use sc_network::config::TransportConfig; use sc_service::config::{NetworkConfiguration, NodeKeyConfig, PrometheusConfig}; use sp_core::hexdisplay::HexDisplay; use sp_runtime::{ - traits::{Block as BlockT, Hash as HashT, Header as HeaderT}, + traits::{Block as BlockT, Hash as HashT, Header as HeaderT, Zero}, BuildStorage, }; use std::net::SocketAddr; @@ -137,7 +136,22 @@ pub fn run() -> Result<()> { let state_root = <<::Header as HeaderT>::Hashing as HashT>::trie_root( storage.top.clone().into_iter().chain(child_roots).collect(), ); - let block: Block = genesis::construct_genesis_block(state_root); + let block = { + let extrinsics_root = <<::Header as HeaderT>::Hashing as HashT>::trie_root( + Vec::new(), + ); + + Block::new( + <::Header as HeaderT>::new( + Zero::zero(), + extrinsics_root, + state_root, + Default::default(), + Default::default(), + ), + Default::default(), + ) + }; let header_hex = format!("0x{:?}", HexDisplay::from(&block.header().encode()));