diff --git a/substrate/Cargo.lock b/substrate/Cargo.lock index 3b715cee8d..e04172230f 100644 --- a/substrate/Cargo.lock +++ b/substrate/Cargo.lock @@ -748,6 +748,7 @@ dependencies = [ "byteorder 1.1.0 (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.0 (git+https://github.com/paritytech/primitives.git)", + "polkadot-runtime-codec 0.1.0", "polkadot-serializer 0.1.0", "pretty_assertions 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/substrate/native-runtime/Cargo.toml b/substrate/native-runtime/Cargo.toml index 60dbbe19c6..6f446049f4 100644 --- a/substrate/native-runtime/Cargo.toml +++ b/substrate/native-runtime/Cargo.toml @@ -9,6 +9,5 @@ runtime-std = { path = "./std", version = "0.1" } rustc-hex = "1.0" [features] -default = ["with-std"] -with-std = [] -without-std = ["polkadot-runtime-codec/no-std"] +default = ["std"] +std = ["polkadot-runtime-codec/std"] diff --git a/substrate/native-runtime/std/src/lib.rs b/substrate/native-runtime/std/src/lib.rs index fb74093d18..7a46ce4615 100644 --- a/substrate/native-runtime/std/src/lib.rs +++ b/substrate/native-runtime/std/src/lib.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Polkadot. If not, see . -//! The with-std support functions for the runtime. +//! The std support functions for the runtime. #[macro_use] extern crate environmental; diff --git a/substrate/primitives/Cargo.toml b/substrate/primitives/Cargo.toml index 77eccdea88..8b3782e545 100644 --- a/substrate/primitives/Cargo.toml +++ b/substrate/primitives/Cargo.toml @@ -15,6 +15,7 @@ untrusted = "0.5" twox-hash = "1.1.0" byteorder = "1.1" blake2-rfc = "0.2.18" +polkadot-runtime-codec = { path = "../runtime-codec", version = "0.1" } [dev-dependencies] polkadot-serializer = { path = "../serializer", version = "0.1" } @@ -22,4 +23,4 @@ pretty_assertions = "0.4" [features] default = ["std"] -std = ["uint/std", "fixed-hash/std"] +std = ["uint/std", "fixed-hash/std", "polkadot-runtime-codec/std"] diff --git a/substrate/runtime-codec/Cargo.toml b/substrate/runtime-codec/Cargo.toml index 3221a55802..c85c9c0631 100644 --- a/substrate/runtime-codec/Cargo.toml +++ b/substrate/runtime-codec/Cargo.toml @@ -7,5 +7,5 @@ authors = ["Parity Technologies "] [dependencies] [features] -no-std = [] -default = [] +std = [] +default = ["std"] diff --git a/substrate/runtime-codec/src/lib.rs b/substrate/runtime-codec/src/lib.rs index 060df4e95c..f31fa3cf94 100644 --- a/substrate/runtime-codec/src/lib.rs +++ b/substrate/runtime-codec/src/lib.rs @@ -17,8 +17,8 @@ //! Implements the serialization and deserialization codec for polkadot runtime //! values. -#![cfg_attr(feature = "no-std", no_std)] -#![cfg_attr(feature = "no-std", feature(alloc))] +#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), feature(alloc))] mod endiansensitive; mod slicable; @@ -32,7 +32,7 @@ pub use self::streamreader::StreamReader; pub use self::joiner::Joiner; pub use self::keyedvec::KeyedVec; -#[cfg(feature = "no-std")] +#[cfg(not(feature = "std"))] mod std { extern crate alloc; diff --git a/substrate/wasm-runtime/polkadot/Cargo.toml b/substrate/wasm-runtime/polkadot/Cargo.toml index 5cc45d4c01..053e704803 100644 --- a/substrate/wasm-runtime/polkadot/Cargo.toml +++ b/substrate/wasm-runtime/polkadot/Cargo.toml @@ -7,10 +7,9 @@ authors = ["Parity Technologies "] crate-type = ["cdylib"] [dependencies] -polkadot-runtime-codec = { path = "../../runtime-codec", version = "0.1" } +polkadot-runtime-codec = { path = "../../runtime-codec", version = "0.1", default-features = false} runtime-std = { path = "../std", version = "0.1" } [features] -default = ["without-std"] -with-std = [] -without-std = ["polkadot-runtime-codec/no-std"] +default = [] +std = ["polkadot-runtime-codec/std"] diff --git a/substrate/wasm-runtime/polkadot/src/lib.rs b/substrate/wasm-runtime/polkadot/src/lib.rs index ceec42af21..23e441e114 100644 --- a/substrate/wasm-runtime/polkadot/src/lib.rs +++ b/substrate/wasm-runtime/polkadot/src/lib.rs @@ -16,12 +16,12 @@ //! The Polkadot runtime. This can be compiled with #[no_std], ready for Wasm. -#![cfg_attr(feature = "without-std", no_std)] +#![cfg_attr(not(feature = "std"), no_std)] #[macro_use] extern crate runtime_std; -#[cfg(feature = "with-std")] +#[cfg(feature = "std")] extern crate rustc_hex; extern crate polkadot_runtime_codec as codec; diff --git a/substrate/wasm-runtime/polkadot/src/primitives/block.rs b/substrate/wasm-runtime/polkadot/src/primitives/block.rs index a884bcccec..3512133e53 100644 --- a/substrate/wasm-runtime/polkadot/src/primitives/block.rs +++ b/substrate/wasm-runtime/polkadot/src/primitives/block.rs @@ -21,7 +21,7 @@ use codec::{StreamReader, Joiner, Slicable, NonTrivialSlicable}; use primitives::{Header, UncheckedTransaction}; /// A Polkadot relay chain block. -#[cfg_attr(feature = "with-std", derive(PartialEq, Debug))] +#[cfg_attr(feature = "std", derive(PartialEq, Debug))] pub struct Block { /// The header of the block. pub header: Header, diff --git a/substrate/wasm-runtime/polkadot/src/primitives/digest.rs b/substrate/wasm-runtime/polkadot/src/primitives/digest.rs index 18107460b0..10f36aef4f 100644 --- a/substrate/wasm-runtime/polkadot/src/primitives/digest.rs +++ b/substrate/wasm-runtime/polkadot/src/primitives/digest.rs @@ -19,7 +19,7 @@ use runtime_std::prelude::*; #[derive(Clone, Default)] -#[cfg_attr(feature = "with-std", derive(PartialEq, Debug))] +#[cfg_attr(feature = "std", derive(PartialEq, Debug))] /// The digest of a block, useful for light-clients. pub struct Digest { /// All logs that have happened in the block. diff --git a/substrate/wasm-runtime/polkadot/src/primitives/function.rs b/substrate/wasm-runtime/polkadot/src/primitives/function.rs index e906cdc718..8aafbb5231 100644 --- a/substrate/wasm-runtime/polkadot/src/primitives/function.rs +++ b/substrate/wasm-runtime/polkadot/src/primitives/function.rs @@ -22,7 +22,7 @@ use runtime::{staking, session, timestamp, governance}; /// Public functions that can be dispatched to. #[derive(Clone, Copy)] -#[cfg_attr(feature = "with-std", derive(PartialEq, Debug))] +#[cfg_attr(feature = "std", derive(PartialEq, Debug))] #[repr(u8)] pub enum Function { StakingStake = 0, diff --git a/substrate/wasm-runtime/polkadot/src/primitives/header.rs b/substrate/wasm-runtime/polkadot/src/primitives/header.rs index 4c1ec328ea..7143ae7580 100644 --- a/substrate/wasm-runtime/polkadot/src/primitives/header.rs +++ b/substrate/wasm-runtime/polkadot/src/primitives/header.rs @@ -22,7 +22,7 @@ use runtime_std::mem; use primitives::{BlockNumber, Hash, Digest}; #[derive(Clone)] -#[cfg_attr(feature = "with-std", derive(PartialEq, Debug))] +#[cfg_attr(feature = "std", derive(PartialEq, Debug))] /// The header for a block. pub struct Header { /// The parent block's "hash" (actually the Blake2-256 hash of its serialised header). diff --git a/substrate/wasm-runtime/polkadot/src/primitives/proposal.rs b/substrate/wasm-runtime/polkadot/src/primitives/proposal.rs index 8eb050cf67..a4c9b5f805 100644 --- a/substrate/wasm-runtime/polkadot/src/primitives/proposal.rs +++ b/substrate/wasm-runtime/polkadot/src/primitives/proposal.rs @@ -24,7 +24,7 @@ use runtime::{system, governance, staking, session}; /// Internal functions that can be dispatched to. #[derive(Clone, Copy)] -#[cfg_attr(feature = "with-std", derive(PartialEq, Debug))] +#[cfg_attr(feature = "std", derive(PartialEq, Debug))] #[repr(u8)] pub enum InternalFunction { SystemSetCode = 0, @@ -56,7 +56,7 @@ impl InternalFunction { } /// An internal function. -#[cfg_attr(feature = "with-std", derive(PartialEq, Debug))] +#[cfg_attr(feature = "std", derive(PartialEq, Debug))] pub struct Proposal { /// The priviledged function to call. pub function: InternalFunction, diff --git a/substrate/wasm-runtime/polkadot/src/primitives/transaction.rs b/substrate/wasm-runtime/polkadot/src/primitives/transaction.rs index 73ab9edd29..c31e63cfd9 100644 --- a/substrate/wasm-runtime/polkadot/src/primitives/transaction.rs +++ b/substrate/wasm-runtime/polkadot/src/primitives/transaction.rs @@ -22,7 +22,7 @@ use primitives::{AccountID, TxOrder, Function}; use runtime_std::mem; /// A vetted and verified transaction from the external world. -#[cfg_attr(feature = "with-std", derive(PartialEq, Debug))] +#[cfg_attr(feature = "std", derive(PartialEq, Debug))] pub struct Transaction { /// Who signed it (note this is not a signature). pub signed: AccountID, diff --git a/substrate/wasm-runtime/polkadot/src/primitives/uncheckedtransaction.rs b/substrate/wasm-runtime/polkadot/src/primitives/uncheckedtransaction.rs index 83984e08a4..1bbce40455 100644 --- a/substrate/wasm-runtime/polkadot/src/primitives/uncheckedtransaction.rs +++ b/substrate/wasm-runtime/polkadot/src/primitives/uncheckedtransaction.rs @@ -21,7 +21,7 @@ use runtime_std::prelude::*; use codec::{Slicable, NonTrivialSlicable, StreamReader, Joiner}; use primitives::Transaction; -#[cfg(feature = "with-std")] +#[cfg(feature = "std")] use std::fmt; /// A transactions right from the external world. Unchecked. @@ -40,14 +40,14 @@ impl UncheckedTransaction { } } -#[cfg(feature = "with-std")] +#[cfg(feature = "std")] impl PartialEq for UncheckedTransaction { fn eq(&self, other: &Self) -> bool { self.signature.iter().eq(other.signature.iter()) && self.transaction == other.transaction } } -#[cfg(feature = "with-std")] +#[cfg(feature = "std")] impl fmt::Debug for UncheckedTransaction { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "UncheckedTransaction({:?})", self.transaction) diff --git a/substrate/wasm-runtime/polkadot/src/support/mod.rs b/substrate/wasm-runtime/polkadot/src/support/mod.rs index 6bc60880a0..07c62c3a92 100644 --- a/substrate/wasm-runtime/polkadot/src/support/mod.rs +++ b/substrate/wasm-runtime/polkadot/src/support/mod.rs @@ -19,16 +19,16 @@ mod environment; pub mod storage; mod hashable; -#[cfg(feature = "with-std")] +#[cfg(feature = "std")] mod statichex; #[macro_use] -#[cfg(feature = "with-std")] +#[cfg(feature = "std")] mod testing; pub use self::environment::with_env; pub use self::storage::StorageVec; pub use self::hashable::Hashable; -#[cfg(feature = "with-std")] +#[cfg(feature = "std")] pub use self::statichex::{StaticHexConversion, StaticHexInto}; -#[cfg(feature = "with-std")] +#[cfg(feature = "std")] pub use self::testing::{AsBytesRef, HexDisplay, TestExternalities, one, two}; diff --git a/substrate/wasm-runtime/target/wasm32-unknown-unknown/release/runtime_polkadot.compact.wasm b/substrate/wasm-runtime/target/wasm32-unknown-unknown/release/runtime_polkadot.compact.wasm index 898f194e80..f6d352781b 100644 Binary files a/substrate/wasm-runtime/target/wasm32-unknown-unknown/release/runtime_polkadot.compact.wasm and b/substrate/wasm-runtime/target/wasm32-unknown-unknown/release/runtime_polkadot.compact.wasm differ diff --git a/substrate/wasm-runtime/target/wasm32-unknown-unknown/release/runtime_polkadot.wasm b/substrate/wasm-runtime/target/wasm32-unknown-unknown/release/runtime_polkadot.wasm index a4c416d6da..0d4c03e72a 100644 Binary files a/substrate/wasm-runtime/target/wasm32-unknown-unknown/release/runtime_polkadot.wasm and b/substrate/wasm-runtime/target/wasm32-unknown-unknown/release/runtime_polkadot.wasm differ