diff --git a/substrate/Cargo.lock b/substrate/Cargo.lock index 2509a54917..24234565d2 100644 --- a/substrate/Cargo.lock +++ b/substrate/Cargo.lock @@ -827,8 +827,8 @@ version = "0.1.0" dependencies = [ "hex-literal 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "polkadot-codec 0.1.0", "polkadot-primitives 0.1.0", - "polkadot-runtime-codec 0.1.0", "polkadot-runtime-std 0.1.0", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1003,14 +1003,18 @@ dependencies = [ "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "native-runtime 0.1.0", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "polkadot-codec 0.1.0", "polkadot-executor 0.1.0", "polkadot-primitives 0.1.0", - "polkadot-runtime-codec 0.1.0", "polkadot-serializer 0.1.0", "polkadot-state-machine 0.1.0", "triehash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "polkadot-codec" +version = "0.1.0" + [[package]] name = "polkadot-collator" version = "0.1.0" @@ -1031,8 +1035,8 @@ 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-codec 0.1.0", "polkadot-primitives 0.1.0", - "polkadot-runtime-codec 0.1.0", "polkadot-runtime-std 0.1.0", "polkadot-serializer 0.1.0", "polkadot-state-machine 0.1.0", @@ -1075,7 +1079,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", "polkadot-serializer 0.1.0", "pretty_assertions 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.0 (git+https://github.com/rphmeier/rustc-hex.git)", @@ -1108,18 +1112,14 @@ dependencies = [ "polkadot-rpc 0.1.0", ] -[[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", diff --git a/substrate/Cargo.toml b/substrate/Cargo.toml index 2c4d8703e9..04b654bfce 100644 --- a/substrate/Cargo.toml +++ b/substrate/Cargo.toml @@ -20,7 +20,7 @@ members = [ "primitives", "rpc-servers", "rpc", - "runtime-codec", + "codec", "runtime-std", "serializer", "state-machine", diff --git a/substrate/client/Cargo.toml b/substrate/client/Cargo.toml index f8221bef8e..7fe9621de7 100644 --- a/substrate/client/Cargo.toml +++ b/substrate/client/Cargo.toml @@ -11,7 +11,7 @@ polkadot-primitives = { path = "../primitives", version = "0.1" } polkadot-state-machine = { path = "../state-machine", version = "0.1" } polkadot-serializer = { path = "../serializer" } polkadot-executor = { path = "../executor" } -polkadot-runtime-codec = { path = "../runtime-codec", version = "0.1" } +polkadot-codec = { path = "../codec", version = "0.1" } native-runtime = { path = "../native-runtime" } triehash = "0.1" hex-literal = "0.1" diff --git a/substrate/client/src/genesis.rs b/substrate/client/src/genesis.rs index b2781668dd..a288bec4e5 100644 --- a/substrate/client/src/genesis.rs +++ b/substrate/client/src/genesis.rs @@ -46,8 +46,8 @@ mod tests { use state_machine::OverlayedChanges; use state_machine::backend::InMemory; use polkadot_executor::executor; - use primitives::{AccountId, Hash}; - use primitives::relay::{BlockNumber, Header, Digest, UncheckedTransaction, Transaction, Function}; + use primitives::relay::{AccountId, Hash, BlockNumber, Header, Digest, UncheckedTransaction, + Transaction, Function}; use primitives::contract::CallData; use ed25519::Pair; diff --git a/substrate/client/src/lib.rs b/substrate/client/src/lib.rs index 591c216145..e97c93dd39 100644 --- a/substrate/client/src/lib.rs +++ b/substrate/client/src/lib.rs @@ -21,7 +21,7 @@ extern crate polkadot_primitives as primitives; extern crate polkadot_state_machine as state_machine; extern crate polkadot_serializer as ser; -extern crate polkadot_runtime_codec as codec; +extern crate polkadot_codec as codec; extern crate polkadot_executor; extern crate native_runtime; extern crate ed25519; diff --git a/substrate/runtime-codec/Cargo.toml b/substrate/codec/Cargo.toml similarity index 86% rename from substrate/runtime-codec/Cargo.toml rename to substrate/codec/Cargo.toml index c85c9c0631..0cf0083d5f 100644 --- a/substrate/runtime-codec/Cargo.toml +++ b/substrate/codec/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "polkadot-runtime-codec" +name = "polkadot-codec" description = "Serialization and deserialization codec for runtime values" version = "0.1.0" authors = ["Parity Technologies "] diff --git a/substrate/runtime-codec/src/endiansensitive.rs b/substrate/codec/src/endiansensitive.rs similarity index 100% rename from substrate/runtime-codec/src/endiansensitive.rs rename to substrate/codec/src/endiansensitive.rs diff --git a/substrate/runtime-codec/src/joiner.rs b/substrate/codec/src/joiner.rs similarity index 100% rename from substrate/runtime-codec/src/joiner.rs rename to substrate/codec/src/joiner.rs diff --git a/substrate/runtime-codec/src/keyedvec.rs b/substrate/codec/src/keyedvec.rs similarity index 100% rename from substrate/runtime-codec/src/keyedvec.rs rename to substrate/codec/src/keyedvec.rs diff --git a/substrate/runtime-codec/src/lib.rs b/substrate/codec/src/lib.rs similarity index 100% rename from substrate/runtime-codec/src/lib.rs rename to substrate/codec/src/lib.rs diff --git a/substrate/runtime-codec/src/slicable.rs b/substrate/codec/src/slicable.rs similarity index 100% rename from substrate/runtime-codec/src/slicable.rs rename to substrate/codec/src/slicable.rs diff --git a/substrate/collator/src/lib.rs b/substrate/collator/src/lib.rs index 1752ecdb7e..044050e79b 100644 --- a/substrate/collator/src/lib.rs +++ b/substrate/collator/src/lib.rs @@ -60,7 +60,7 @@ pub trait ParachainContext { fn produce_candidate>( &self, ingress: I, - ) -> (parachain::BlockData, primitives::Signature); + ) -> (parachain::BlockData, primitives::relay::Signature); } /// Relay chain context needed to collate. diff --git a/substrate/ed25519/src/lib.rs b/substrate/ed25519/src/lib.rs index 9658b46d97..7f0bfae0ff 100644 --- a/substrate/ed25519/src/lib.rs +++ b/substrate/ed25519/src/lib.rs @@ -22,9 +22,12 @@ extern crate untrusted; extern crate rustc_hex; use ring::{rand, signature}; -use primitives::Signature; +use primitives::hash::H512; use rustc_hex::FromHex; +/// Alias to 520-bit hash when used in the context of a signature on the relay chain. +pub type Signature = H512; + /// Verify a message without type checking the parameters' types for the right size. pub fn verify(sig: &[u8], message: &[u8], public: &[u8]) -> bool { let public_key = untrusted::Input::from(public); diff --git a/substrate/executor/Cargo.toml b/substrate/executor/Cargo.toml index eb6e46e6e2..d51522c568 100644 --- a/substrate/executor/Cargo.toml +++ b/substrate/executor/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Parity Technologies "] [dependencies] error-chain = "0.11" -polkadot-runtime-codec = { path = "../runtime-codec", version = "0.1" } +polkadot-codec = { path = "../codec", version = "0.1" } polkadot-runtime-std = { path = "../runtime-std", version = "0.1" } polkadot-primitives = { path = "../primitives", version = "0.1" } polkadot-serializer = { path = "../serializer", version = "0.1" } diff --git a/substrate/executor/src/lib.rs b/substrate/executor/src/lib.rs index 27d26f7adb..1bd7a1db25 100644 --- a/substrate/executor/src/lib.rs +++ b/substrate/executor/src/lib.rs @@ -27,7 +27,7 @@ #![warn(missing_docs)] -extern crate polkadot_runtime_codec as codec; +extern crate polkadot_codec as codec; extern crate polkadot_runtime_std as runtime_std; extern crate polkadot_primitives as primitives; extern crate polkadot_serializer as serializer; diff --git a/substrate/executor/src/native_executor.rs b/substrate/executor/src/native_executor.rs index d2ea75413a..ea13ac6593 100644 --- a/substrate/executor/src/native_executor.rs +++ b/substrate/executor/src/native_executor.rs @@ -63,8 +63,9 @@ mod tests { use native_runtime::support::{one, two, Hashable}; use native_runtime::runtime::staking::balance; use state_machine::TestExternalities; - use primitives::{twox_128, Hash}; - use primitives::relay::{Header, BlockNumber, Block, Digest, Transaction, UncheckedTransaction, Function}; + use primitives::twox_128; + use primitives::relay::{Hash, Header, BlockNumber, Block, Digest, Transaction, + UncheckedTransaction, Function, AccountId}; use ed25519::Pair; const BLOATY_CODE: &[u8] = include_bytes!("../../wasm-runtime/target/wasm32-unknown-unknown/release/runtime_polkadot.wasm"); @@ -164,7 +165,7 @@ mod tests { ], } } - fn secret_for(who: &::primitives::AccountId) -> Option { + fn secret_for(who: &AccountId) -> Option { match who { x if *x == one() => Some(Pair::from_seed(b"12345678901234567890123456789012")), x if *x == two() => Some("9d61b19deffd5a60ba844af492ec2cc44449c5697b326919703bac031cae7f60".into()), diff --git a/substrate/executor/src/wasm_executor.rs b/substrate/executor/src/wasm_executor.rs index d8912c1703..6269675dad 100644 --- a/substrate/executor/src/wasm_executor.rs +++ b/substrate/executor/src/wasm_executor.rs @@ -293,8 +293,8 @@ mod tests { use native_runtime::support::{one, two}; use native_runtime::runtime::staking::balance; use state_machine::TestExternalities; - use primitives::{twox_128, AccountId}; - use primitives::relay::{Header, Transaction, UncheckedTransaction, Function}; + use primitives::twox_128; + use primitives::relay::{Header, Transaction, UncheckedTransaction, Function, AccountId}; use runtime_std; use ed25519::Pair; diff --git a/substrate/native-runtime/Cargo.toml b/substrate/native-runtime/Cargo.toml index a4052bf8de..e46823bbb0 100644 --- a/substrate/native-runtime/Cargo.toml +++ b/substrate/native-runtime/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Parity Technologies "] [dependencies] -polkadot-runtime-codec = { path = "../runtime-codec", version = "0.1" } +polkadot-codec = { path = "../codec", version = "0.1" } polkadot-runtime-std = { path = "../runtime-std", version = "0.1" } polkadot-primitives = { path = "../primitives", version = "0.1" } rustc-hex = "1.0" @@ -13,4 +13,4 @@ log = { version = "0.3", optional = true } [features] default = ["std"] -std = ["polkadot-runtime-codec/std", "polkadot-runtime-std/std", "polkadot-primitives/std", "log"] +std = ["polkadot-codec/std", "polkadot-runtime-std/std", "polkadot-primitives/std", "log"] diff --git a/substrate/network/src/message.rs b/substrate/network/src/message.rs index daa6b5520a..e3dce5b0f2 100644 --- a/substrate/network/src/message.rs +++ b/substrate/network/src/message.rs @@ -18,8 +18,7 @@ use std::borrow::Borrow; use primitives::parachain::Id as ParachainId; -use primitives::AccountId; -use primitives::relay::{BlockNumber, HeaderHash, Header, Body}; +use primitives::relay::{AccountId, BlockNumber, HeaderHash, Header, Body}; use service::Role as RoleFlags; pub type RequestId = u64; diff --git a/substrate/primitives/Cargo.toml b/substrate/primitives/Cargo.toml index 6e5a4bd0c4..d3ba1eec0f 100644 --- a/substrate/primitives/Cargo.toml +++ b/substrate/primitives/Cargo.toml @@ -13,7 +13,7 @@ uint = { git = "https://github.com/rphmeier/primitives.git", branch = "compile-f twox-hash = { version = "1.1.0", optional = true } byteorder = { version = "1.1", default_features = false } blake2-rfc = { version = "0.2.18", optional = true } -polkadot-runtime-codec = { path = "../runtime-codec", version = "0.1", default_features = false } +polkadot-codec = { path = "../codec", version = "0.1", default_features = false } [dev-dependencies] polkadot-serializer = { path = "../serializer", version = "0.1" } @@ -24,7 +24,7 @@ default = ["std"] std = [ "uint/std", "fixed-hash/std", - "polkadot-runtime-codec/std", + "polkadot-codec/std", "serde/std", "rustc-hex/std", "twox-hash", diff --git a/substrate/primitives/src/lib.rs b/substrate/primitives/src/lib.rs index e16aa8ef50..59728fb43c 100644 --- a/substrate/primitives/src/lib.rs +++ b/substrate/primitives/src/lib.rs @@ -43,7 +43,7 @@ extern crate uint as uint_crate; #[cfg(feature = "std")] extern crate core; -extern crate polkadot_runtime_codec as codec; +extern crate polkadot_codec as codec; #[cfg(test)] extern crate polkadot_serializer; #[cfg(test)] @@ -80,38 +80,7 @@ mod tests; pub mod hashing; pub use self::hash::{H160, H256}; -pub use self::relay::BlockNumber; pub use self::uint::{U256, U512}; #[cfg(feature = "std")] pub use hashing::{blake2_256, twox_128, twox_256}; - -/// Virtual account ID that represents the idea of a dispatch/statement being signed by everybody -/// (who matters). Essentially this means that a majority of validators have decided it is -/// "correct". -pub const EVERYBODY: AccountId = [255u8; 32]; - -/// Alias to Ed25519 pubkey that identifies an account. -pub type AccountId = [u8; 32]; - -/// The Ed25519 pub key of an session that belongs to an authority. This is used as what the -/// external environment/consensus algorithm calls an "authority". -pub type SessionKey = AccountId; - -/// Indentifier for a chain. -pub type ChainID = u64; - -/// Index of a transaction. -pub type TxOrder = u64; - -/// A hash of some data. -pub type Hash = hash::H256; - -/// Alias to 520-bit hash when used in the context of a signature. -pub type Signature = hash::H512; - -/// A balance in the staking subsystem. -pub type Balance = u64; - -/// A timestamp. -pub type Timestamp = u64; diff --git a/substrate/primitives/src/parachain.rs b/substrate/primitives/src/parachain.rs index 4b3f308a70..f7dac2fec0 100644 --- a/substrate/primitives/src/parachain.rs +++ b/substrate/primitives/src/parachain.rs @@ -54,7 +54,7 @@ pub struct Candidate { /// The ID of the parachain this is a proposal for. pub parachain_index: Id, /// Collator's signature - pub collator_signature: ::Signature, + pub collator_signature: ::relay::Signature, /// Unprocessed ingress queue. /// /// Ordered by parachain ID and block number. @@ -71,12 +71,12 @@ pub struct Candidate { pub struct CandidateReceipt { /// The ID of the parachain this is a candidate for. pub parachain_index: Id, - /// The collator's account ID - pub collator: ::AccountId, + /// The collator's relay-chain account ID + pub collator: ::relay::AccountId, /// The head-data pub head_data: HeadData, /// Balance uploads to the relay chain. - pub balance_uploads: Vec<(::AccountId, ::uint::U256)>, + pub balance_uploads: Vec<(::relay::AccountId, ::uint::U256)>, /// Egress queue roots. pub egress_queue_roots: Vec<(Id, ::hash::H256)>, /// Fees paid from the chain to the relay chain validators diff --git a/substrate/primitives/src/relay/mod.rs b/substrate/primitives/src/relay/mod.rs index c4f22ac55f..a7a5f3cff9 100644 --- a/substrate/primitives/src/relay/mod.rs +++ b/substrate/primitives/src/relay/mod.rs @@ -7,3 +7,27 @@ pub use self::block::*; pub use self::transaction::*; pub use self::block::Number as BlockNumber; + +/// Virtual account ID that represents the idea of a dispatch/statement being signed by everybody +/// (who matters). Essentially this means that a majority of validators have decided it is +/// "correct". +pub const EVERYBODY: AccountId = [255u8; 32]; + +/// Alias to Ed25519 pubkey that identifies an account on the relay chain. +pub type AccountId = [u8; 32]; + +/// The Ed25519 pub key of an session that belongs to an authority of the relay chain. This is +/// used as what the external environment/consensus algorithm calls an "authority". +pub type SessionKey = AccountId; + +/// Indentifier for a chain. +pub type ChainID = u64; + +/// Index of a transaction in the relay chain. +pub type TxOrder = u64; + +/// A hash of some data used by the relay chain. +pub type Hash = ::hash::H256; + +/// Alias to 520-bit hash when used in the context of a signature on the relay chain. +pub type Signature = ::hash::H512; diff --git a/substrate/primitives/src/relay/transaction.rs b/substrate/primitives/src/relay/transaction.rs index 1432693e6e..fc7216737e 100644 --- a/substrate/primitives/src/relay/transaction.rs +++ b/substrate/primitives/src/relay/transaction.rs @@ -205,15 +205,15 @@ impl FunctionId { #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] pub enum Function { /// Set the timestamp. - TimestampSet(::Timestamp), + TimestampSet(u64), /// Set temporary session key as a validator. - SessionSetKey(::SessionKey), + SessionSetKey(::relay::SessionKey), /// Staking subsystem: begin staking. StakingStake, /// Staking subsystem: stop staking. StakingUnstake, /// Staking subsystem: transfer stake. - StakingTransfer(::AccountId, ::Balance), + StakingTransfer(::relay::AccountId, u64), /// Make a proposal for the governance system. GovernancePropose(Proposal), /// Approve a proposal for the governance system. @@ -288,9 +288,9 @@ impl Slicable for Function { #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] pub struct Transaction { /// Who signed it (note this is not a signature). - pub signed: ::AccountId, + pub signed: super::AccountId, /// The number of transactions have come before from the same signer. - pub nonce: ::TxOrder, + pub nonce: super::TxOrder, /// The function that should be called. pub function: Function, } @@ -326,7 +326,7 @@ pub struct UncheckedTransaction { /// The actual transaction information. pub transaction: Transaction, /// The signature; should be an Ed25519 signature applied to the serialised `transaction` field. - pub signature: ::Signature, + pub signature: super::Signature, } impl Slicable for UncheckedTransaction { diff --git a/substrate/primitives/src/tests.rs b/substrate/primitives/src/tests.rs index 88710c4412..1dd8f4d3f8 100644 --- a/substrate/primitives/src/tests.rs +++ b/substrate/primitives/src/tests.rs @@ -17,10 +17,7 @@ //! Tests. use codec::Slicable; - -use ::AccountId; -use relay::block::{Block, Header, Digest, Log}; -use relay::transaction::{UncheckedTransaction, Transaction, Function}; +use relay::{AccountId, Block, Header, Digest, Log, UncheckedTransaction, Transaction, Function}; #[test] fn serialise_transaction_works() { diff --git a/substrate/runtime-std/Cargo.toml b/substrate/runtime-std/Cargo.toml index 7ecafc73ce..1822161c39 100644 --- a/substrate/runtime-std/Cargo.toml +++ b/substrate/runtime-std/Cargo.toml @@ -13,7 +13,7 @@ pwasm-libc = { path = "../wasm-runtime/pwasm-libc", version = "0.1" } environmental = { path = "../environmental", version = "0.1", optional = true } polkadot-state-machine = { path = "../state-machine", version = "0.1", optional = true } polkadot-primitives = { path = "../primitives", version = "0.1", default_features = false } -polkadot-runtime-codec = { path = "../runtime-codec", version = "0.1", default_features = false } +polkadot-codec = { path = "../codec", version = "0.1", default_features = false } triehash = { version = "0.1", optional = true } ed25519 = { path = "../ed25519", version = "0.1", optional = true } @@ -24,7 +24,7 @@ std = [ "polkadot-state-machine", "triehash", "polkadot-primitives/std", - "polkadot-runtime-codec/std", + "polkadot-codec/std", "ed25519", ] nightly = [] diff --git a/substrate/runtime-std/src/lib.rs b/substrate/runtime-std/src/lib.rs index 6cee2e3326..9fb2148b76 100644 --- a/substrate/runtime-std/src/lib.rs +++ b/substrate/runtime-std/src/lib.rs @@ -14,6 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Polkadot. If not, see . +//! This is part of the Polkadot runtime. + #![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(not(feature = "std"), feature(lang_items))] #![cfg_attr(not(feature = "std"), feature(core_intrinsics))] @@ -22,7 +24,7 @@ #![cfg_attr(feature = "std", doc = "Polkadot runtime standard library as compiled when linked with Rust's standard library.")] #![cfg_attr(not(feature = "std"), doc = "Polkadot's runtime standard library as compiled without Rust's standard library.")] -extern crate polkadot_runtime_codec as codec; +extern crate polkadot_codec as codec; #[cfg(feature = "std")] include!("../with_std.rs"); @@ -41,7 +43,7 @@ pub mod prelude { /// Type definitions and helpers for transactions. pub mod transaction { pub use primitives::relay::{Transaction, UncheckedTransaction}; - use primitives::Signature; + use primitives::relay::Signature; #[cfg(feature = "std")] use std::ops; @@ -81,4 +83,3 @@ pub mod transaction { } } } - diff --git a/substrate/wasm-runtime/Cargo.lock b/substrate/wasm-runtime/Cargo.lock index 287249192e..97c9736c3f 100644 --- a/substrate/wasm-runtime/Cargo.lock +++ b/substrate/wasm-runtime/Cargo.lock @@ -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", ] diff --git a/substrate/wasm-runtime/polkadot/Cargo.toml b/substrate/wasm-runtime/polkadot/Cargo.toml index b0bc7a480b..fcf280ca8c 100644 --- a/substrate/wasm-runtime/polkadot/Cargo.toml +++ b/substrate/wasm-runtime/polkadot/Cargo.toml @@ -7,10 +7,10 @@ authors = ["Parity Technologies "] 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"] diff --git a/substrate/wasm-runtime/polkadot/src/lib.rs b/substrate/wasm-runtime/polkadot/src/lib.rs index a6cd2c1f69..36e03e4e68 100644 --- a/substrate/wasm-runtime/polkadot/src/lib.rs +++ b/substrate/wasm-runtime/polkadot/src/lib.rs @@ -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)] diff --git a/substrate/wasm-runtime/polkadot/src/runtime/consensus.rs b/substrate/wasm-runtime/polkadot/src/runtime/consensus.rs index 83e59d0684..6f0552368b 100644 --- a/substrate/wasm-runtime/polkadot/src/runtime/consensus.rs +++ b/substrate/wasm-runtime/polkadot/src/runtime/consensus.rs @@ -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 { diff --git a/substrate/wasm-runtime/polkadot/src/runtime/genesismap.rs b/substrate/wasm-runtime/polkadot/src/runtime/genesismap.rs index 38099f22f3..5fa27d1a8f 100644 --- a/substrate/wasm-runtime/polkadot/src/runtime/genesismap.rs +++ b/substrate/wasm-runtime/polkadot/src/runtime/genesismap.rs @@ -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. diff --git a/substrate/wasm-runtime/polkadot/src/runtime/governance.rs b/substrate/wasm-runtime/polkadot/src/runtime/governance.rs index 298add1c40..8e830b7e14 100644 --- a/substrate/wasm-runtime/polkadot/src/runtime/governance.rs +++ b/substrate/wasm-runtime/polkadot/src/runtime/governance.rs @@ -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 { diff --git a/substrate/wasm-runtime/polkadot/src/runtime/session.rs b/substrate/wasm-runtime/polkadot/src/runtime/session.rs index 6710e8854a..7e94eaf308 100644 --- a/substrate/wasm-runtime/polkadot/src/runtime/session.rs +++ b/substrate/wasm-runtime/polkadot/src/runtime/session.rs @@ -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 { diff --git a/substrate/wasm-runtime/polkadot/src/runtime/staking.rs b/substrate/wasm-runtime/polkadot/src/runtime/staking.rs index f503ee7363..d3577b9f6b 100644 --- a/substrate/wasm-runtime/polkadot/src/runtime/staking.rs +++ b/substrate/wasm-runtime/polkadot/src/runtime/staking.rs @@ -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] diff --git a/substrate/wasm-runtime/polkadot/src/runtime/system.rs b/substrate/wasm-runtime/polkadot/src/runtime/system.rs index aa96548aa3..9f8edbb92e 100644 --- a/substrate/wasm-runtime/polkadot/src/runtime/system.rs +++ b/substrate/wasm-runtime/polkadot/src/runtime/system.rs @@ -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:"; diff --git a/substrate/wasm-runtime/polkadot/src/runtime/timestamp.rs b/substrate/wasm-runtime/polkadot/src/runtime/timestamp.rs index de62dd03b8..2b316f17af 100644 --- a/substrate/wasm-runtime/polkadot/src/runtime/timestamp.rs +++ b/substrate/wasm-runtime/polkadot/src/runtime/timestamp.rs @@ -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"; diff --git a/substrate/wasm-runtime/polkadot/src/support/environment.rs b/substrate/wasm-runtime/polkadot/src/support/environment.rs index b2ab7e8798..b2d0e737e1 100644 --- a/substrate/wasm-runtime/polkadot/src/support/environment.rs +++ b/substrate/wasm-runtime/polkadot/src/support/environment.rs @@ -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. diff --git a/substrate/wasm-runtime/polkadot/src/support/testing.rs b/substrate/wasm-runtime/polkadot/src/support/testing.rs index 06420668c6..89510e0212 100644 --- a/substrate/wasm-runtime/polkadot/src/support/testing.rs +++ b/substrate/wasm-runtime/polkadot/src/support/testing.rs @@ -16,7 +16,7 @@ //! Testing helpers. -use primitives::AccountId; +use primitives::relay::AccountId; use super::statichex::StaticHexInto; #[macro_export]