From ef059b81f178fb2692de7c9009e89299273ee5c4 Mon Sep 17 00:00:00 2001
From: Gav <gavin@parity.io>
Date: Wed, 7 Feb 2018 16:34:18 +0100
Subject: [PATCH] All tests compile. Most tests work.

---
 substrate/Cargo.lock                  | 2 ++
 substrate/client/src/genesis.rs       | 2 +-
 substrate/executor/Cargo.toml         | 4 +++-
 substrate/executor/src/lib.rs         | 5 ++++-
 substrate/network/src/blocks.rs       | 2 +-
 substrate/validator/Cargo.toml        | 1 +
 substrate/validator/src/lib.rs        | 1 +
 substrate/validator/src/parachains.rs | 2 +-
 substrate/validator/src/validator.rs  | 3 +--
 9 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/substrate/Cargo.lock b/substrate/Cargo.lock
index 1e31aea13eb..8f333b159e5 100644
--- a/substrate/Cargo.lock
+++ b/substrate/Cargo.lock
@@ -1090,6 +1090,7 @@ name = "polkadot-validator"
 version = "0.1.0"
 dependencies = [
  "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "polkadot-primitives 0.1.0",
  "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
  "substrate-primitives 0.1.0",
  "substrate-serializer 0.1.0",
@@ -1431,6 +1432,7 @@ dependencies = [
  "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
  "native-runtime 0.1.0",
  "parity-wasm 0.15.4 (registry+https://github.com/rust-lang/crates.io-index)",
+ "polkadot-primitives 0.1.0",
  "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/substrate/client/src/genesis.rs b/substrate/client/src/genesis.rs
index 5a48f947dd2..788513ffa64 100644
--- a/substrate/client/src/genesis.rs
+++ b/substrate/client/src/genesis.rs
@@ -17,7 +17,7 @@
 //! Tool for creating the genesis block.
 
 use std::collections::HashMap;
-use primitives::{Block, Header};
+use polkadot_primitives::{Block, Header};
 use triehash::trie_root;
 
 /// Create a genesis block, given the initial storage.
diff --git a/substrate/executor/Cargo.toml b/substrate/executor/Cargo.toml
index 577b2372407..8d2643d585c 100644
--- a/substrate/executor/Cargo.toml
+++ b/substrate/executor/Cargo.toml
@@ -10,7 +10,6 @@ substrate-runtime-io = { path = "../runtime-io" }
 substrate-primitives = { path = "../primitives" }
 substrate-serializer = { path = "../serializer" }
 substrate-state-machine = { path = "../state-machine"  }
-native-runtime = { path = "../native-runtime" }
 ed25519 = { path = "../ed25519" }
 serde = "1.0"
 serde_derive = "1.0"
@@ -20,6 +19,9 @@ rustc-hex = "1.0.0"
 triehash = "0.1.0"
 hex-literal = "0.1.0"
 log = "0.3"
+# TODO: Remove these and split out tests and a concrete executor.
+native-runtime = { path = "../native-runtime" }
+polkadot-primitives = { path = "../polkadot-primitives" }
 
 [dev-dependencies]
 assert_matches = "1.1"
diff --git a/substrate/executor/src/lib.rs b/substrate/executor/src/lib.rs
index e324bdf1119..88c52c9389f 100644
--- a/substrate/executor/src/lib.rs
+++ b/substrate/executor/src/lib.rs
@@ -38,10 +38,13 @@ extern crate serde;
 extern crate parity_wasm;
 extern crate byteorder;
 extern crate rustc_hex;
-extern crate native_runtime;
 extern crate triehash;
 #[macro_use] extern crate log;
 
+// TODO: Remove and split out into polkadot-specific crate.
+extern crate native_runtime;
+extern crate polkadot_primitives;
+
 #[cfg(test)]
 #[macro_use]
 extern crate hex_literal;
diff --git a/substrate/network/src/blocks.rs b/substrate/network/src/blocks.rs
index 5b9ca9f6a57..8d0118222be 100644
--- a/substrate/network/src/blocks.rs
+++ b/substrate/network/src/blocks.rs
@@ -190,7 +190,7 @@ impl BlockCollection {
 mod test {
 	use super::{BlockCollection, BlockData};
 	use message;
-	use primitives::HeaderHash;
+	use primitives::block::HeaderHash;
 
 	fn is_empty(bc: &BlockCollection) -> bool {
 		bc.blocks.is_empty() &&
diff --git a/substrate/validator/Cargo.toml b/substrate/validator/Cargo.toml
index 64bb00118a2..a95f6798ae0 100644
--- a/substrate/validator/Cargo.toml
+++ b/substrate/validator/Cargo.toml
@@ -6,5 +6,6 @@ authors = ["Parity Technologies <admin@parity.io>"]
 [dependencies]
 error-chain = "0.11"
 substrate-primitives = { path = "../primitives" }
+polkadot-primitives = { path = "../polkadot-primitives" }
 substrate-serializer = { path = "../serializer" }
 serde = "1.0"
diff --git a/substrate/validator/src/lib.rs b/substrate/validator/src/lib.rs
index 44192f93279..dc139e77d5b 100644
--- a/substrate/validator/src/lib.rs
+++ b/substrate/validator/src/lib.rs
@@ -20,6 +20,7 @@
 
 extern crate substrate_primitives as primitives;
 extern crate substrate_serializer as serializer;
+extern crate polkadot_primitives;
 extern crate serde;
 
 #[macro_use]
diff --git a/substrate/validator/src/parachains.rs b/substrate/validator/src/parachains.rs
index 5adfe704c7f..67ba56ed1f8 100644
--- a/substrate/validator/src/parachains.rs
+++ b/substrate/validator/src/parachains.rs
@@ -16,7 +16,7 @@
 
 use std::fmt;
 
-use primitives::validator;
+use polkadot_primitives::validator;
 use serde::de::DeserializeOwned;
 
 use error::Result;
diff --git a/substrate/validator/src/validator.rs b/substrate/validator/src/validator.rs
index c251e379183..354bbf73dce 100644
--- a/substrate/validator/src/validator.rs
+++ b/substrate/validator/src/validator.rs
@@ -16,7 +16,7 @@
 
 use std::fmt;
 
-use primitives::{validator, parachain};
+use polkadot_primitives::{validator, parachain};
 use serde::de::DeserializeOwned;
 use serializer;
 
@@ -99,4 +99,3 @@ impl<M, B, T, R> Code for T where
 		Ok(self.check(messages, downloads, block_data, head_data)?.into())
 	}
 }
-
-- 
GitLab