Refactor primitives.

This commit is contained in:
Gav
2018-02-07 11:03:43 +01:00
parent 959b129f8d
commit 1b7f34bef2
39 changed files with 99 additions and 108 deletions
+7 -7
View File
@@ -375,6 +375,10 @@ dependencies = [
"crunchy 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "polkadot-codec"
version = "0.1.0"
[[package]]
name = "polkadot-primitives"
version = "0.1.0"
@@ -383,7 +387,7 @@ dependencies = [
"byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"crunchy 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"fixed-hash 0.1.3 (git+https://github.com/rphmeier/primitives.git?branch=compile-for-wasm)",
"polkadot-runtime-codec 0.1.0",
"polkadot-codec 0.1.0",
"rustc-hex 2.0.0 (git+https://github.com/rphmeier/rustc-hex.git)",
"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)",
@@ -391,18 +395,14 @@ dependencies = [
"uint 0.1.2 (git+https://github.com/rphmeier/primitives.git?branch=compile-for-wasm)",
]
[[package]]
name = "polkadot-runtime-codec"
version = "0.1.0"
[[package]]
name = "polkadot-runtime-std"
version = "0.1.0"
dependencies = [
"ed25519 0.1.0",
"environmental 0.1.0",
"polkadot-codec 0.1.0",
"polkadot-primitives 0.1.0",
"polkadot-runtime-codec 0.1.0",
"polkadot-state-machine 0.1.0",
"pwasm-alloc 0.1.0",
"pwasm-libc 0.1.0",
@@ -551,8 +551,8 @@ dependencies = [
name = "runtime-polkadot"
version = "0.1.0"
dependencies = [
"polkadot-codec 0.1.0",
"polkadot-primitives 0.1.0",
"polkadot-runtime-codec 0.1.0",
"polkadot-runtime-std 0.1.0",
]
+2 -2
View File
@@ -7,10 +7,10 @@ authors = ["Parity Technologies <admin@parity.io>"]
crate-type = ["cdylib"]
[dependencies]
polkadot-runtime-codec = { path = "../../runtime-codec", version = "0.1", default-features = false }
polkadot-codec = { path = "../../codec", version = "0.1", default-features = false }
polkadot-runtime-std = { path = "../../runtime-std", version = "0.1", default-features = false }
polkadot-primitives = { path = "../../primitives", version = "0.1", default-features = false }
[features]
default = []
std = ["polkadot-runtime-codec/std", "polkadot-runtime-std/std", "polkadot-primitives/std"]
std = ["polkadot-codec/std", "polkadot-runtime-std/std", "polkadot-primitives/std"]
+1 -1
View File
@@ -27,7 +27,7 @@ extern crate rustc_hex;
#[macro_use]
extern crate log;
extern crate polkadot_runtime_codec as codec;
extern crate polkadot_codec as codec;
extern crate polkadot_primitives as primitives;
#[cfg(test)]
@@ -18,7 +18,7 @@
use runtime_std::prelude::*;
use support::storage::unhashed::StorageVec;
use primitives::SessionKey;
use primitives::relay::SessionKey;
struct AuthorityStorageVec {}
impl StorageVec for AuthorityStorageVec {
@@ -20,8 +20,7 @@ use std::collections::HashMap;
use runtime_std::twox_128;
use codec::{KeyedVec, Joiner};
use support::Hashable;
use primitives::relay::{Number as BlockNumber, Block};
use primitives::AccountId;
use primitives::relay::{Number as BlockNumber, Block, AccountId};
use runtime::staking::Balance;
/// Configuration of a general Polkadot genesis block.
@@ -28,8 +28,7 @@
use runtime_std::prelude::*;
use codec::KeyedVec;
use support::storage;
use primitives::{AccountId, Hash, BlockNumber};
use primitives::relay::Proposal;
use primitives::relay::{Proposal, AccountId, Hash, BlockNumber};
use runtime::{staking, system, session};
const APPROVALS_REQUIRED: &[u8] = b"gov:apr";
@@ -149,8 +148,7 @@ mod tests {
use runtime_std::{with_externalities, twox_128, TestExternalities};
use codec::{KeyedVec, Joiner};
use support::{one, two, with_env};
use primitives::AccountId;
use primitives::relay::InternalFunction;
use primitives::relay::{AccountId, InternalFunction};
use runtime::{staking, session};
fn new_test_ext() -> TestExternalities {
@@ -20,7 +20,7 @@
use runtime_std::prelude::*;
use codec::KeyedVec;
use support::{storage, StorageVec};
use primitives::{AccountId, SessionKey, BlockNumber};
use primitives::relay::{AccountId, SessionKey, BlockNumber};
use runtime::{system, staking, consensus};
const SESSION_LENGTH: &[u8] = b"ses:len";
@@ -140,7 +140,7 @@ mod tests {
use runtime_std::{with_externalities, twox_128, TestExternalities};
use codec::{KeyedVec, Joiner};
use support::{one, two, with_env};
use primitives::AccountId;
use primitives::relay::AccountId;
use runtime::{consensus, session};
fn simple_setup() -> TestExternalities {
@@ -21,7 +21,7 @@ use runtime_std::cell::RefCell;
use runtime_std::print;
use codec::KeyedVec;
use support::{storage, StorageVec};
use primitives::{BlockNumber, AccountId};
use primitives::relay::{BlockNumber, AccountId};
use runtime::{system, session, governance};
/// The balance of an account.
@@ -216,7 +216,7 @@ mod tests {
use runtime_std::{with_externalities, twox_128, TestExternalities};
use codec::{KeyedVec, Joiner};
use support::{one, two, with_env};
use primitives::AccountId;
use primitives::relay::AccountId;
use runtime::{staking, session};
#[test]
@@ -21,8 +21,8 @@ use runtime_std::prelude::*;
use runtime_std::{mem, storage_root, enumerated_trie_root};
use codec::{KeyedVec, Slicable};
use support::{Hashable, storage, with_env};
use primitives::{AccountId, Hash, TxOrder, BlockNumber};
use primitives::relay::{Block, Header, UncheckedTransaction, Function, Log};
use primitives::relay::{AccountId, Hash, TxOrder, BlockNumber, Block, Header, UncheckedTransaction,
Function, Log};
use runtime::{staking, session};
const NONCE_OF: &[u8] = b"sys:non:";
@@ -17,7 +17,8 @@
//! Timestamp manager: just handles the current timestamp.
use support::storage;
use primitives::Timestamp;
pub type Timestamp = u64;
const CURRENT_TIMESTAMP: &[u8] = b"tim:val";
@@ -21,8 +21,7 @@ use runtime_std::mem;
use runtime_std::cell::RefCell;
use runtime_std::rc::Rc;
use primitives::relay::{BlockNumber, Digest};
use primitives::Hash;
use primitives::relay::{BlockNumber, Digest, Hash};
#[derive(Default)]
/// The information that can be accessed globally.
@@ -16,7 +16,7 @@
//! Testing helpers.
use primitives::AccountId;
use primitives::relay::AccountId;
use super::statichex::StaticHexInto;
#[macro_export]