Migrate srml crates to the 2018 edition (#1755)

This commit is contained in:
Stanislav Tkach
2019-02-11 12:42:36 +02:00
committed by Gav Wood
parent b28f7328ac
commit c860787db7
37 changed files with 220 additions and 422 deletions
+2 -3
View File
@@ -3149,6 +3149,7 @@ dependencies = [
"parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
"sr-io 0.1.0",
"sr-primitives 0.1.0",
"sr-std 0.1.0",
@@ -3164,11 +3165,9 @@ version = "0.1.0"
dependencies = [
"hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
"sr-io 0.1.0",
"sr-primitives 0.1.0",
"sr-std 0.1.0",
"srml-balances 0.1.0",
"srml-support 0.1.0",
"srml-system 0.1.0",
@@ -3197,7 +3196,6 @@ dependencies = [
name = "srml-grandpa"
version = "0.1.0"
dependencies = [
"hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3360,6 +3358,7 @@ dependencies = [
"parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
"sr-io 0.1.0",
"sr-primitives 0.1.0",
"sr-std 0.1.0",
+1 -12
View File
@@ -1177,9 +1177,7 @@ dependencies = [
name = "srml-executive"
version = "0.1.0"
dependencies = [
"hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
"sr-io 0.1.0",
"sr-primitives 0.1.0",
@@ -1227,14 +1225,12 @@ dependencies = [
"parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
"sr-io 0.1.0",
"sr-primitives 0.1.0",
"sr-std 0.1.0",
"srml-consensus 0.1.0",
"srml-support 0.1.0",
"srml-system 0.1.0",
"srml-timestamp 0.1.0",
"substrate-primitives 0.1.0",
]
[[package]]
@@ -1246,17 +1242,13 @@ dependencies = [
"parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
"sr-io 0.1.0",
"sr-primitives 0.1.0",
"sr-std 0.1.0",
"srml-balances 0.1.0",
"srml-consensus 0.1.0",
"srml-session 0.1.0",
"srml-support 0.1.0",
"srml-system 0.1.0",
"srml-timestamp 0.1.0",
"substrate-keyring 0.1.0",
"substrate-primitives 0.1.0",
]
[[package]]
@@ -1267,13 +1259,11 @@ dependencies = [
"parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
"sr-io 0.1.0",
"sr-primitives 0.1.0",
"sr-std 0.1.0",
"srml-support 0.1.0",
"srml-support-procedural 0.1.0",
"srml-system 0.1.0",
"substrate-primitives 0.1.0",
]
[[package]]
@@ -1334,6 +1324,7 @@ dependencies = [
"parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
"sr-io 0.1.0",
"sr-primitives 0.1.0",
"sr-std 0.1.0",
@@ -1349,14 +1340,12 @@ dependencies = [
"parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
"sr-io 0.1.0",
"sr-primitives 0.1.0",
"sr-std 0.1.0",
"srml-consensus 0.1.0",
"srml-support 0.1.0",
"srml-system 0.1.0",
"substrate-inherents 0.1.0",
"substrate-primitives 0.1.0",
]
[[package]]
+2 -18
View File
@@ -1212,7 +1212,6 @@ dependencies = [
name = "srml-council"
version = "0.1.0"
dependencies = [
"hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1220,7 +1219,6 @@ dependencies = [
"sr-io 0.1.0",
"sr-primitives 0.1.0",
"sr-std 0.1.0",
"srml-balances 0.1.0",
"srml-democracy 0.1.0",
"srml-support 0.1.0",
"srml-system 0.1.0",
@@ -1236,22 +1234,19 @@ dependencies = [
"parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)",
"sr-io 0.1.0",
"sr-primitives 0.1.0",
"sr-std 0.1.0",
"srml-balances 0.1.0",
"srml-support 0.1.0",
"srml-system 0.1.0",
"substrate-primitives 0.1.0",
]
[[package]]
name = "srml-executive"
version = "0.1.0"
dependencies = [
"hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)",
"sr-io 0.1.0",
"sr-primitives 0.1.0",
@@ -1264,12 +1259,10 @@ dependencies = [
name = "srml-grandpa"
version = "0.1.0"
dependencies = [
"hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)",
"sr-io 0.1.0",
"sr-primitives 0.1.0",
"sr-std 0.1.0",
"srml-session 0.1.0",
@@ -1318,14 +1311,12 @@ dependencies = [
"parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)",
"sr-io 0.1.0",
"sr-primitives 0.1.0",
"sr-std 0.1.0",
"srml-consensus 0.1.0",
"srml-support 0.1.0",
"srml-system 0.1.0",
"srml-timestamp 0.1.0",
"substrate-primitives 0.1.0",
]
[[package]]
@@ -1337,17 +1328,13 @@ dependencies = [
"parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)",
"sr-io 0.1.0",
"sr-primitives 0.1.0",
"sr-std 0.1.0",
"srml-balances 0.1.0",
"srml-consensus 0.1.0",
"srml-session 0.1.0",
"srml-support 0.1.0",
"srml-system 0.1.0",
"srml-timestamp 0.1.0",
"substrate-keyring 0.1.0",
"substrate-primitives 0.1.0",
]
[[package]]
@@ -1358,13 +1345,11 @@ dependencies = [
"parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)",
"sr-io 0.1.0",
"sr-primitives 0.1.0",
"sr-std 0.1.0",
"srml-support 0.1.0",
"srml-support-procedural 0.1.0",
"srml-system 0.1.0",
"substrate-primitives 0.1.0",
]
[[package]]
@@ -1425,6 +1410,7 @@ dependencies = [
"parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)",
"sr-io 0.1.0",
"sr-primitives 0.1.0",
"sr-std 0.1.0",
@@ -1440,14 +1426,12 @@ dependencies = [
"parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)",
"sr-io 0.1.0",
"sr-primitives 0.1.0",
"sr-std 0.1.0",
"srml-consensus 0.1.0",
"srml-support 0.1.0",
"srml-system 0.1.0",
"substrate-inherents 0.1.0",
"substrate-primitives 0.1.0",
]
[[package]]
+15 -14
View File
@@ -2,35 +2,36 @@
name = "srml-council"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
[dependencies]
hex-literal = "0.1.0"
serde = { version = "1.0", default-features = false }
safe-mix = { version = "1.0", default-features = false}
parity-codec = { version = "3.0", default-features = false }
parity-codec-derive = { version = "3.0", default-features = false }
substrate-primitives = { path = "../../core/primitives", default-features = false }
sr-std = { path = "../../core/sr-std", default-features = false }
sr-io = { path = "../../core/sr-io", default-features = false }
sr-primitives = { path = "../../core/sr-primitives", default-features = false }
rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false }
runtime_io = { package = "sr-io", path = "../../core/sr-io", default-features = false }
primitives = { package = "sr-primitives", path = "../../core/sr-primitives", default-features = false }
srml-support = { path = "../support", default-features = false }
srml-balances = { path = "../balances", default-features = false }
srml-democracy = { path = "../democracy", default-features = false }
srml-system = { path = "../system", default-features = false }
democracy = { package = "srml-democracy", path = "../democracy", default-features = false }
system = { package = "srml-system", path = "../system", default-features = false }
[dev-dependencies]
hex-literal = "0.1.0"
balances = { package = "srml-balances", path = "../balances", default-features = false }
[features]
default = ["std"]
std = [
"serde/std",
"safe-mix/std",
"parity-codec/std",
"parity-codec-derive/std",
"substrate-primitives/std",
"sr-std/std",
"sr-io/std",
"rstd/std",
"runtime_io/std",
"srml-support/std",
"sr-primitives/std",
"srml-balances/std",
"srml-democracy/std",
"srml-system/std",
"primitives/std",
"democracy/std",
"system/std",
]
+2 -20
View File
@@ -18,36 +18,18 @@
#![cfg_attr(not(feature = "std"), no_std)]
#[cfg(feature = "std")]
extern crate serde;
#[cfg(test)]
#[macro_use]
extern crate hex_literal;
#[cfg(test)]
extern crate srml_balances as balances;
extern crate parity_codec as codec;
extern crate parity_codec_derive;
extern crate substrate_primitives;
extern crate sr_std as rstd;
extern crate sr_io as runtime_io;
#[macro_use] extern crate srml_support;
extern crate sr_primitives as primitives;
extern crate srml_democracy as democracy;
extern crate srml_system as system;
pub mod voting;
pub mod motions;
pub mod seats;
pub use seats::{Trait, Module, RawEvent, Event, VoteIndex};
pub use crate::seats::{Trait, Module, RawEvent, Event, VoteIndex};
#[cfg(test)]
mod tests {
// These re-exports are here for a reason, edit with care
pub use super::*;
pub use runtime_io::with_externalities;
use srml_support::{impl_outer_origin, impl_outer_event, impl_outer_dispatch};
pub use substrate_primitives::H256;
pub use primitives::BuildStorage;
pub use primitives::traits::{BlakeTwo256, IdentityLookup};
+5 -4
View File
@@ -21,7 +21,7 @@ use rstd::result;
use substrate_primitives::u32_trait::Value as U32;
use primitives::traits::{Hash, EnsureOrigin};
use srml_support::dispatch::{Dispatchable, Parameter};
use srml_support::{StorageValue, StorageMap};
use srml_support::{StorageValue, StorageMap, decl_module, decl_event, decl_storage, ensure};
use super::{Trait as CouncilTrait, Module as Council};
use system::{self, ensure_signed};
@@ -202,10 +202,11 @@ impl<O, N: U32> EnsureOrigin<O> for EnsureMembers<N>
mod tests {
use super::*;
use super::RawEvent;
use ::tests::*;
use ::tests::{Call, Origin, Event as OuterEvent};
use srml_support::Hashable;
use crate::tests::*;
use crate::tests::{Call, Origin, Event as OuterEvent};
use srml_support::{Hashable, assert_ok, assert_noop};
use system::{EventRecord, Phase};
use hex_literal::{hex, hex_impl};
#[test]
fn motions_basic_environment_works() {
+5 -2
View File
@@ -19,7 +19,7 @@
use rstd::prelude::*;
use primitives::traits::{Zero, One, As, StaticLookup};
use runtime_io::print;
use srml_support::{StorageValue, StorageMap, dispatch::Result, traits::Currency};
use srml_support::{StorageValue, StorageMap, dispatch::Result, traits::Currency, decl_storage, decl_event, ensure};
use democracy;
use system::{self, ensure_signed};
@@ -77,6 +77,8 @@ use system::{self, ensure_signed};
// after each vote as all but K entries are cleared. newly registering candidates must use cleared
// entries before they increase the capacity.
use srml_support::decl_module;
pub type VoteIndex = u32;
type BalanceOf<T> = <<T as democracy::Trait>::Currency as Currency<<T as system::Trait>::AccountId>>::Balance;
@@ -547,7 +549,8 @@ impl<T: Trait> Module<T> {
#[cfg(test)]
mod tests {
use super::*;
use ::tests::*;
use crate::tests::*;
use srml_support::{assert_ok, assert_noop, assert_err};
#[test]
fn params_should_work() {
+4 -4
View File
@@ -21,7 +21,7 @@ use rstd::borrow::Borrow;
use primitives::traits::{Hash, As, Zero};
use runtime_io::print;
use srml_support::dispatch::Result;
use srml_support::{StorageValue, StorageMap, IsSubType};
use srml_support::{StorageValue, StorageMap, IsSubType, decl_module, decl_storage, decl_event, ensure};
use {system, democracy};
use super::{Trait as CouncilTrait, Module as Council};
use system::ensure_signed;
@@ -232,9 +232,9 @@ impl<T: Trait> Module<T> {
#[cfg(test)]
mod tests {
use super::*;
use ::tests::*;
use ::tests::{Call, Origin};
use srml_support::Hashable;
use crate::tests::*;
use crate::tests::{Call, Origin};
use srml_support::{Hashable, assert_ok, assert_noop};
use democracy::{ReferendumInfo, VoteThreshold};
#[test]
+15 -12
View File
@@ -2,32 +2,35 @@
name = "srml-democracy"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
[dependencies]
hex-literal = "0.1.0"
serde = { version = "1.0", default-features = false }
serde_derive = { version = "1.0", optional = true }
safe-mix = { version = "1.0", default-features = false}
parity-codec = { version = "3.0", default-features = false }
parity-codec-derive = { version = "3.0", default-features = false }
substrate-primitives = { path = "../../core/primitives", default-features = false }
sr-std = { path = "../../core/sr-std", default-features = false }
sr-io = { path = "../../core/sr-io", default-features = false }
sr-primitives = { path = "../../core/sr-primitives", default-features = false }
rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false }
runtime_io = { package = "sr-io", path = "../../core/sr-io", default-features = false }
primitives = { package = "sr-primitives", path = "../../core/sr-primitives", default-features = false }
srml-support = { path = "../support", default-features = false }
srml-balances = { path = "../balances", default-features = false }
srml-system = { path = "../system", default-features = false }
system = { package = "srml-system", path = "../system", default-features = false }
[dev-dependencies]
substrate-primitives = { path = "../../core/primitives", default-features = false }
balances = { package = "srml-balances", path = "../balances", default-features = false }
[features]
default = ["std"]
std = [
"serde/std",
"serde_derive",
"safe-mix/std",
"parity-codec/std",
"substrate-primitives/std",
"sr-std/std",
"sr-io/std",
"rstd/std",
"runtime_io/std",
"srml-support/std",
"sr-primitives/std",
"srml-balances/std",
"srml-system/std",
"primitives/std",
"system/std",
]
+3 -16
View File
@@ -18,26 +18,12 @@
#![cfg_attr(not(feature = "std"), no_std)]
#[cfg(test)]
extern crate substrate_primitives;
#[cfg(test)]
extern crate srml_balances as balances;
#[macro_use]
extern crate parity_codec_derive;
extern crate sr_std as rstd;
#[macro_use]
extern crate srml_support;
extern crate parity_codec as codec;
extern crate sr_io as runtime_io;
extern crate sr_primitives as primitives;
extern crate srml_system as system;
use rstd::prelude::*;
use rstd::result;
use primitives::traits::{Zero, As};
use parity_codec_derive::{Encode, Decode};
use srml_support::{StorageValue, StorageMap, Parameter, Dispatchable, IsSubType};
use srml_support::{decl_module, decl_storage, decl_event, ensure};
use srml_support::traits::{Currency, OnFreeBalanceZero, EnsureAccountLiquid};
use srml_support::dispatch::Result;
use system::ensure_signed;
@@ -440,6 +426,7 @@ impl<T: Trait> EnsureAccountLiquid<T::AccountId> for Module<T> {
mod tests {
use super::*;
use runtime_io::with_externalities;
use srml_support::{impl_outer_origin, impl_outer_dispatch, assert_noop, assert_ok};
use substrate_primitives::{H256, Blake2Hasher};
use primitives::BuildStorage;
use primitives::traits::{BlakeTwo256, IdentityLookup};
@@ -16,6 +16,9 @@
//! Voting thresholds.
#[cfg(feature = "std")]
use serde_derive::{Serialize, Deserialize};
use parity_codec_derive::{Encode, Decode};
use primitives::traits::{Zero, IntegerSquareRoot};
use rstd::ops::{Add, Mul, Div, Rem};
+10 -13
View File
@@ -2,31 +2,28 @@
name = "srml-example"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
[dependencies]
hex-literal = "0.1.0"
serde = { version = "1.0", default-features = false }
parity-codec = { version = "3.0", default-features = false }
parity-codec-derive = { version = "3.0", default-features = false }
substrate-primitives = { path = "../../core/primitives", default-features = false }
sr-std = { path = "../../core/sr-std", default-features = false }
sr-io = { path = "../../core/sr-io", default-features = false }
sr-primitives = { path = "../../core/sr-primitives", default-features = false }
srml-support = { path = "../support", default-features = false }
srml-system = { path = "../system", default-features = false }
srml-balances = { path = "../balances", default-features = false }
system = { package = "srml-system", path = "../system", default-features = false }
balances = { package = "srml-balances", path = "../balances", default-features = false }
[dev-dependencies]
sr-io = { path = "../../core/sr-io", default-features = false }
substrate-primitives = { path = "../../core/primitives", default-features = false }
sr-primitives = { path = "../../core/sr-primitives", default-features = false }
[features]
default = ["std"]
std = [
"serde/std",
"parity-codec/std",
"parity-codec-derive/std",
"sr-std/std",
"sr-io/std",
"sr-primitives/std",
"substrate-primitives/std",
"srml-support/std",
"srml-system/std",
"srml-balances/std",
"system/std",
"balances/std",
]
+2 -31
View File
@@ -20,37 +20,7 @@
// Ensure we're `no_std` when compiling for Wasm.
#![cfg_attr(not(feature = "std"), no_std)]
// Assert macros used in tests.
extern crate sr_std;
// Needed for tests (`with_externalities`).
#[cfg(test)]
extern crate sr_io;
// Needed for the set of mock primitives used in our tests.
#[cfg(test)]
extern crate substrate_primitives;
// Needed for various traits. In our case, `OnInitialise` and `OnFinalise` in our
// tests.
extern crate sr_primitives;
// Needed for deriving `Encode` and `Decode` for `RawEvent`.
extern crate parity_codec_derive;
extern crate parity_codec as codec;
// Needed for type-safe access to storage DB.
#[macro_use]
extern crate srml_support as support;
// `system` module provides us with all sorts of useful stuff and macros
// depend on it being around.
extern crate srml_system as system;
// `balances` module is needed for our little example. It's not required in
// general (though if you want your module to be able to work with tokens, then you
// might find it useful).
extern crate srml_balances as balances;
use support::{StorageValue, dispatch::Result};
use srml_support::{StorageValue, dispatch::Result, decl_module, decl_storage, decl_event};
use system::ensure_signed;
/// Our module's configuration trait. All our types and consts go in here. If the
@@ -270,6 +240,7 @@ impl<T: Trait> Module<T> {
mod tests {
use super::*;
use srml_support::{impl_outer_origin, assert_ok};
use sr_io::with_externalities;
use substrate_primitives::{H256, Blake2Hasher};
// The testing primitives are very useful for avoiding having to work with signatures
+12 -12
View File
@@ -2,32 +2,32 @@
name = "srml-executive"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
[dependencies]
hex-literal = "0.1.0"
serde = { version = "1.0", default-features = false }
parity-codec = { version = "3.0", default-features = false }
parity-codec-derive = { version = "3.0", default-features = false }
sr-std = { path = "../../core/sr-std", default-features = false }
sr-io = { path = "../../core/sr-io", default-features = false }
sr-primitives = { path = "../../core/sr-primitives", default-features = false }
rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false }
runtime_io = { package = "sr-io", path = "../../core/sr-io", default-features = false }
primitives = { package = "sr-primitives", path = "../../core/sr-primitives", default-features = false }
srml-support = { path = "../support", default-features = false }
srml-system = { path = "../system", default-features = false }
system = { package = "srml-system", path = "../system", default-features = false }
[dev-dependencies]
hex-literal = "0.1.0"
substrate-primitives = { path = "../../core/primitives" }
srml-indices = { path = "../indices" }
srml-balances = { path = "../balances" }
balances = { package = "srml-balances", path = "../balances" }
parity-codec-derive = { version = "3.0", default-features = false }
[features]
default = ["std"]
std = [
"sr-std/std",
"rstd/std",
"srml-support/std",
"serde/std",
"parity-codec/std",
"parity-codec-derive/std",
"sr-primitives/std",
"sr-io/std",
"srml-system/std",
"primitives/std",
"runtime_io/std",
"system/std",
]
+4 -25
View File
@@ -18,35 +18,13 @@
#![cfg_attr(not(feature = "std"), no_std)]
#[cfg(test)]
extern crate parity_codec_derive;
#[cfg_attr(test, macro_use)]
extern crate srml_support as runtime_support;
extern crate sr_std as rstd;
extern crate sr_io as runtime_io;
extern crate parity_codec as codec;
extern crate sr_primitives as primitives;
extern crate srml_system as system;
#[cfg(test)]
#[macro_use]
extern crate hex_literal;
#[cfg(test)]
extern crate substrate_primitives;
#[cfg(test)]
extern crate srml_balances as balances;
use rstd::prelude::*;
use rstd::marker::PhantomData;
use rstd::result;
use primitives::traits::{self, Header, Zero, One, Checkable, Applyable, CheckEqual, OnFinalise,
OnInitialise, MakePayment, Hash, As, Digest};
use runtime_support::Dispatchable;
use codec::{Codec, Encode};
use srml_support::Dispatchable;
use parity_codec::{Codec, Encode};
use system::extrinsics_root;
use primitives::{ApplyOutcome, ApplyError};
use primitives::transaction_validity::{TransactionValidity, TransactionPriority, TransactionLongevity};
@@ -304,8 +282,9 @@ mod tests {
use primitives::BuildStorage;
use primitives::traits::{Header as HeaderT, BlakeTwo256, IdentityLookup};
use primitives::testing::{Digest, DigestItem, Header, Block};
use runtime_support::traits::Currency;
use srml_support::{traits::Currency, impl_outer_origin, impl_outer_event};
use system;
use hex_literal::{hex, hex_impl};
impl_outer_origin! {
pub enum Origin for Runtime {
+13 -11
View File
@@ -2,21 +2,24 @@
name = "srml-grandpa"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
[dependencies]
hex-literal = "0.1.0"
#hex-literal = "0.1.0"
serde = { version = "1.0", default-features = false }
serde_derive = { version = "1.0", optional = true }
parity-codec = { version = "3.0", default-features = false }
parity-codec-derive = { version = "3.0", default-features = false }
substrate-primitives = { path = "../../core/primitives", default-features = false }
substrate-finality-grandpa-primitives = { path = "../../core/finality-grandpa/primitives", default-features = false }
sr-std = { path = "../../core/sr-std", default-features = false }
sr-io = { path = "../../core/sr-io", default-features = false }
sr-primitives = { path = "../../core/sr-primitives", default-features = false }
rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false }
primitives = { package = "sr-primitives", path = "../../core/sr-primitives", default-features = false }
srml-support = { path = "../support", default-features = false }
srml-system = { path = "../system", default-features = false }
srml-session = { path = "../session", default-features = false }
system = { package = "srml-system", path = "../system", default-features = false }
session = { package = "srml-session", path = "../session", default-features = false }
[dev-dependencies]
runtime_io = { package = "sr-io", path = "../../core/sr-io", default-features = false }
[features]
default = ["std"]
@@ -26,10 +29,9 @@ std = [
"parity-codec/std",
"substrate-primitives/std",
"substrate-finality-grandpa-primitives/std",
"sr-std/std",
"sr-io/std",
"rstd/std",
"srml-support/std",
"sr-primitives/std",
"srml-system/std",
"srml-session/std",
"primitives/std",
"system/std",
"session/std",
]
+12 -32
View File
@@ -27,39 +27,19 @@
#![cfg_attr(not(feature = "std"), no_std)]
#[allow(unused_imports)]
#[macro_use]
extern crate sr_std as rstd;
#[macro_use]
extern crate srml_support as runtime_support;
// re-export since this is necessary for `impl_apis` in runtime.
pub use substrate_finality_grandpa_primitives as fg_primitives;
#[cfg(feature = "std")]
#[macro_use]
extern crate serde_derive;
extern crate parity_codec;
#[macro_use]
extern crate parity_codec_derive;
extern crate sr_primitives as primitives;
extern crate parity_codec as codec;
extern crate srml_system as system;
extern crate srml_session as session;
extern crate substrate_primitives;
#[cfg(test)]
extern crate sr_io as runtime_io;
// re-export since this is necessary for `impl_apis` in runtime.
pub extern crate substrate_finality_grandpa_primitives as fg_primitives;
use serde_derive::Serialize;
use rstd::prelude::*;
use parity_codec as codec;
use parity_codec_derive::{Encode, Decode};
use fg_primitives::ScheduledChange;
use runtime_support::Parameter;
use runtime_support::dispatch::Result;
use runtime_support::storage::StorageValue;
use runtime_support::storage::unhashed::StorageVec;
use srml_support::{Parameter, decl_event, decl_storage, decl_module};
use srml_support::dispatch::Result;
use srml_support::storage::StorageValue;
use srml_support::storage::unhashed::StorageVec;
use primitives::traits::{CurrentHeight, Convert};
use substrate_primitives::Ed25519AuthorityId;
use system::ensure_signed;
@@ -71,7 +51,7 @@ mod tests;
struct AuthorityStorageVec<S: codec::Codec + Default>(rstd::marker::PhantomData<S>);
impl<S: codec::Codec + Default> StorageVec for AuthorityStorageVec<S> {
type Item = (S, u64);
const PREFIX: &'static [u8] = ::fg_primitives::well_known_keys::AUTHORITY_PREFIX;
const PREFIX: &'static [u8] = crate::fg_primitives::well_known_keys::AUTHORITY_PREFIX;
}
/// The log type of this crate, projected from module trait type.
@@ -162,12 +142,12 @@ decl_storage! {
let auth_count = config.authorities.len() as u32;
config.authorities.iter().enumerate().for_each(|(i, v)| {
storage.insert((i as u32).to_keyed_vec(
::fg_primitives::well_known_keys::AUTHORITY_PREFIX),
crate::fg_primitives::well_known_keys::AUTHORITY_PREFIX),
v.encode()
);
});
storage.insert(
::fg_primitives::well_known_keys::AUTHORITY_COUNT.to_vec(),
crate::fg_primitives::well_known_keys::AUTHORITY_COUNT.to_vec(),
auth_count.encode(),
);
});
+4 -2
View File
@@ -21,9 +21,11 @@
use primitives::{BuildStorage, traits::IdentityLookup, testing::{Digest, DigestItem, Header}};
use primitives::generic::DigestItem as GenDigestItem;
use runtime_io;
use srml_support::{impl_outer_origin, impl_outer_event};
use substrate_primitives::{H256, Blake2Hasher};
use parity_codec::Encode;
use {system, GenesisConfig, Trait, Module, RawLog};
use parity_codec_derive::{Encode, Decode};
use crate::{GenesisConfig, Trait, Module, RawLog};
impl_outer_origin!{
pub enum Origin for Test {}
@@ -58,7 +60,7 @@ impl system::Trait for Test {
}
mod grandpa {
pub use ::Event;
pub use crate::Event;
}
impl_outer_event!{
+2 -2
View File
@@ -21,9 +21,9 @@
use primitives::{testing, traits::OnFinalise};
use primitives::traits::Header;
use runtime_io::with_externalities;
use mock::{Grandpa, System, new_test_ext};
use crate::mock::{Grandpa, System, new_test_ext};
use system::{EventRecord, Phase};
use {RawLog, RawEvent};
use crate::{RawLog, RawEvent};
#[test]
fn authorities_change_logged() {
+2 -9
View File
@@ -19,16 +19,9 @@
#![cfg_attr(not(feature = "std"), no_std)]
// We need these `extern crate` to be placed here otherwise there will be errors.
// TODO: https://github.com/paritytech/substrate/issues/1509
#[macro_use]
extern crate srml_support as runtime_support;
extern crate parity_codec_derive;
extern crate parity_codec as codec;
use rstd::{prelude::*, result, marker::PhantomData};
use codec::{Encode, Decode, Codec, Input, Output};
use runtime_support::{StorageValue, StorageMap, Parameter};
use parity_codec::{Encode, Decode, Codec, Input, Output};
use srml_support::{StorageValue, StorageMap, Parameter, decl_module, decl_event, decl_storage};
use primitives::traits::{One, SimpleArithmetic, As, StaticLookup, Member};
use system::{IsDeadAccount, OnNewAccount};
+1
View File
@@ -23,6 +23,7 @@ use ref_thread_local::{ref_thread_local, RefThreadLocal};
use primitives::BuildStorage;
use primitives::testing::{Digest, DigestItem, Header};
use substrate_primitives::{H256, Blake2Hasher};
use srml_support::impl_outer_origin;
use {runtime_io, system};
use crate::{GenesisConfig, Module, Trait, IsDeadAccount, OnNewAccount, ResolveHint};
+5 -4
View File
@@ -2,22 +2,23 @@
name = "srml-metadata"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
[dependencies]
parity-codec = { version = "3.0", default-features = false }
parity-codec-derive = { version = "3.0", default-features = false }
serde = { version = "1.0", optional = true }
serde_derive = { version = "1.0", optional = true }
sr-std = { path = "../../core/sr-std", default-features = false }
substrate-primitives = { path = "../../core/primitives", default-features = false }
rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false }
primitives = { package = "substrate-primitives", path = "../../core/primitives", default-features = false }
[features]
default = ["std"]
std = [
"parity-codec/std",
"parity-codec-derive/std",
"sr-std/std",
"substrate-primitives/std",
"rstd/std",
"primitives/std",
"serde",
"serde_derive"
]
+5 -12
View File
@@ -22,21 +22,14 @@
#![cfg_attr(not(feature = "std"), no_std)]
#[macro_use]
extern crate parity_codec_derive;
extern crate parity_codec as codec;
extern crate sr_std as rstd;
extern crate substrate_primitives as primitives;
#[cfg(feature = "std")]
extern crate serde;
use serde_derive::Serialize;
#[cfg(feature = "std")]
#[macro_use]
extern crate serde_derive;
use codec::{Encode, Output};
use parity_codec::{Decode, Input};
#[cfg(feature = "std")]
use codec::{Decode, Input};
use parity_codec_derive::Decode;
use parity_codec::{Encode, Output};
use parity_codec_derive::Encode;
use rstd::vec::Vec;
#[cfg(feature = "std")]
+15 -14
View File
@@ -2,21 +2,24 @@
name = "srml-session"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
[dependencies]
hex-literal = "0.1.0"
serde = { version = "1.0", default-features = false }
safe-mix = { version = "1.0", default-features = false}
substrate-primitives = { path = "../../core/primitives", default-features = false }
parity-codec = { version = "3.0", default-features = false }
parity-codec-derive = { version = "3.0", default-features = false }
sr-std = { path = "../../core/sr-std", default-features = false }
sr-io = { path = "../../core/sr-io", default-features = false }
sr-primitives = { path = "../../core/sr-primitives", default-features = false }
rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false }
primitives = { package = "sr-primitives", path = "../../core/sr-primitives", default-features = false }
srml-support = { path = "../support", default-features = false }
srml-consensus = { path = "../consensus", default-features = false }
srml-system = { path = "../system", default-features = false }
srml-timestamp = { path = "../timestamp", default-features = false }
consensus = { package = "srml-consensus", path = "../consensus", default-features = false }
system = { package = "srml-system", path = "../system", default-features = false }
timestamp = { package = "srml-timestamp", path = "../timestamp", default-features = false }
[dev-dependencies]
substrate-primitives = { path = "../../core/primitives", default-features = false }
runtime_io = { package = "sr-io", path = "../../core/sr-io", default-features = false }
[features]
default = ["std"]
@@ -25,12 +28,10 @@ std = [
"safe-mix/std",
"parity-codec/std",
"parity-codec-derive/std",
"substrate-primitives/std",
"sr-std/std",
"sr-io/std",
"rstd/std",
"srml-support/std",
"sr-primitives/std",
"srml-consensus/std",
"srml-system/std",
"srml-timestamp/std"
"primitives/std",
"consensus/std",
"system/std",
"timestamp/std"
]
+3 -20
View File
@@ -19,28 +19,10 @@
#![cfg_attr(not(feature = "std"), no_std)]
extern crate sr_std as rstd;
#[macro_use]
extern crate srml_support as runtime_support;
extern crate parity_codec_derive;
#[cfg(test)]
extern crate substrate_primitives;
#[cfg(test)]
extern crate sr_io as runtime_io;
extern crate parity_codec as codec;
extern crate sr_primitives as primitives;
extern crate srml_consensus as consensus;
extern crate srml_system as system;
extern crate srml_timestamp as timestamp;
use rstd::prelude::*;
use primitives::traits::{As, Zero, One, Convert};
use runtime_support::{StorageValue, StorageMap};
use runtime_support::dispatch::Result;
use runtime_support::for_each_tuple;
use srml_support::{StorageValue, StorageMap, for_each_tuple, decl_module, decl_event, decl_storage};
use srml_support::dispatch::Result;
use system::ensure_signed;
use rstd::ops::Mul;
@@ -231,6 +213,7 @@ impl<T: Trait> Module<T> {
#[cfg(test)]
mod tests {
use super::*;
use srml_support::{impl_outer_origin, assert_ok};
use runtime_io::with_externalities;
use substrate_primitives::{H256, Blake2Hasher};
use primitives::BuildStorage;
+16 -17
View File
@@ -2,6 +2,7 @@
name = "srml-staking"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
[dependencies]
hex-literal = "0.1.0"
@@ -10,16 +11,18 @@ safe-mix = { version = "1.0", default-features = false}
parity-codec = { version = "3.0", default-features = false }
parity-codec-derive = { version = "3.0", default-features = false }
substrate-keyring = { path = "../../core/keyring", optional = true }
substrate-primitives = { path = "../../core/primitives", default-features = false }
sr-std = { path = "../../core/sr-std", default-features = false }
sr-io = { path = "../../core/sr-io", default-features = false }
sr-primitives = { path = "../../core/sr-primitives", default-features = false }
rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false }
primitives = { package = "sr-primitives", path = "../../core/sr-primitives", default-features = false }
srml-support = { path = "../support", default-features = false }
srml-balances = { path = "../balances", default-features = false }
srml-consensus = { path = "../consensus", default-features = false }
srml-system = { path = "../system", default-features = false }
srml-session = { path = "../session", default-features = false }
srml-timestamp = { path = "../timestamp", default-features = false }
consensus = { package = "srml-consensus", path = "../consensus", default-features = false }
system = { package = "srml-system", path = "../system", default-features = false }
session = { package = "srml-session", path = "../session", default-features = false }
[dev-dependencies]
substrate-primitives = { path = "../../core/primitives", default-features = false }
runtime_io = { package = "sr-io", path = "../../core/sr-io", default-features = false }
timestamp = { package = "srml-timestamp", path = "../timestamp", default-features = false }
balances = { package = "srml-balances", path = "../balances", default-features = false }
[features]
default = ["std"]
@@ -29,13 +32,9 @@ std = [
"substrate-keyring",
"parity-codec/std",
"parity-codec-derive/std",
"substrate-primitives/std",
"sr-std/std",
"sr-io/std",
"rstd/std",
"srml-support/std",
"sr-primitives/std",
"srml-balances/std",
"srml-session/std",
"srml-system/std",
"srml-timestamp/std"
"primitives/std",
"session/std",
"system/std",
]
+5 -29
View File
@@ -20,36 +20,12 @@
#![cfg_attr(not(feature = "std"), no_std)]
#[cfg(feature = "std")]
extern crate serde;
#[macro_use]
extern crate srml_support as runtime_support;
extern crate sr_std as rstd;
#[macro_use]
extern crate parity_codec_derive;
extern crate parity_codec as codec;
extern crate sr_primitives as primitives;
extern crate srml_consensus as consensus;
extern crate srml_session as session;
extern crate srml_system as system;
#[cfg(test)]
extern crate substrate_primitives;
#[cfg(test)]
extern crate sr_io as runtime_io;
#[cfg(test)]
extern crate srml_timestamp as timestamp;
#[cfg(test)]
extern crate srml_balances as balances;
use rstd::{prelude::*, cmp};
use codec::HasCompact;
use runtime_support::{Parameter, StorageValue, StorageMap, dispatch::Result};
use runtime_support::traits::{Currency, OnDilution, EnsureAccountLiquid, OnFreeBalanceZero};
use parity_codec::HasCompact;
use parity_codec_derive::{Encode, Decode};
use srml_support::{Parameter, StorageValue, StorageMap, dispatch::Result};
use srml_support::{decl_module, decl_event, decl_storage, ensure};
use srml_support::traits::{Currency, OnDilution, EnsureAccountLiquid, OnFreeBalanceZero};
use session::OnSessionChange;
use primitives::Perbill;
use primitives::traits::{Zero, One, Bounded, As, StaticLookup};
+2 -1
View File
@@ -22,7 +22,8 @@ use primitives::{traits::IdentityLookup, BuildStorage, Perbill};
use primitives::testing::{Digest, DigestItem, Header, UintAuthorityId, ConvertUintAuthorityId};
use substrate_primitives::{H256, Blake2Hasher};
use runtime_io;
use {GenesisConfig, Module, Trait, consensus, session, system, timestamp, balances};
use srml_support::impl_outer_origin;
use crate::{GenesisConfig, Module, Trait};
impl_outer_origin!{
pub enum Origin for Test {}
+2 -1
View File
@@ -20,8 +20,9 @@
use super::*;
use runtime_io::with_externalities;
use srml_support::{assert_ok, assert_noop};
use mock::{Balances, Session, Staking, System, Timestamp, Test, new_test_ext, Origin};
use runtime_support::traits::Currency;
use srml_support::traits::Currency;
#[test]
fn note_null_offline_should_work() {
+7 -6
View File
@@ -2,19 +2,22 @@
name = "srml-sudo"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
[dependencies]
hex-literal = "0.1.0"
serde = { version = "1.0", default-features = false }
parity-codec = { version = "3.0", default-features = false }
parity-codec-derive = { version = "3.0", default-features = false }
substrate-primitives = { path = "../../core/primitives", default-features = false }
sr-std = { path = "../../core/sr-std", default-features = false }
sr-io = { path = "../../core/sr-io", default-features = false }
sr-primitives = { path = "../../core/sr-primitives", default-features = false }
srml-support = { path = "../support", default-features = false }
srml-support-procedural = { path = "../support/procedural" }
srml-system = { path = "../system", default-features = false }
system = { package = "srml-system", path = "../system", default-features = false }
[dev-dependencies]
sr-io = { path = "../../core/sr-io", default-features = false }
substrate-primitives = { path = "../../core/primitives", default-features = false }
[features]
default = ["std"]
@@ -23,9 +26,7 @@ std = [
"parity-codec/std",
"parity-codec-derive/std",
"sr-std/std",
"sr-io/std",
"sr-primitives/std",
"substrate-primitives/std",
"srml-support/std",
"srml-system/std",
"system/std",
]
+1 -14
View File
@@ -19,22 +19,9 @@
#![cfg_attr(not(feature = "std"), no_std)]
extern crate sr_std;
#[cfg(test)]
extern crate sr_io;
#[cfg(test)]
extern crate substrate_primitives;
extern crate sr_primitives;
extern crate parity_codec_derive;
extern crate parity_codec as codec;
#[macro_use]
extern crate srml_support as support;
extern crate srml_system as system;
use sr_std::prelude::*;
use sr_primitives::traits::StaticLookup;
use support::{StorageValue, Parameter, Dispatchable};
use srml_support::{StorageValue, Parameter, Dispatchable, decl_module, decl_event, decl_storage, ensure};
use system::ensure_signed;
pub trait Trait: system::Trait {
+9 -6
View File
@@ -2,29 +2,32 @@
name = "srml-system"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
[dependencies]
hex-literal = "0.1.0"
serde = { version = "1.0", default-features = false }
serde_derive = { version = "1.0", optional = true }
safe-mix = { version = "1.0", default-features = false}
parity-codec = { version = "3.0", default-features = false }
parity-codec-derive = { version = "3.0", default-features = false }
substrate-primitives = { path = "../../core/primitives", default-features = false }
sr-std = { path = "../../core/sr-std", default-features = false }
sr-io = { path = "../../core/sr-io", default-features = false }
sr-primitives = { path = "../../core/sr-primitives", default-features = false }
rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false }
runtime_io = { package = "sr-io", path = "../../core/sr-io", default-features = false }
primitives = { package = "sr-primitives", path = "../../core/sr-primitives", default-features = false }
srml-support = { path = "../support", default-features = false }
[features]
default = ["std"]
std = [
"serde/std",
"serde_derive",
"safe-mix/std",
"parity-codec/std",
"parity-codec-derive/std",
"substrate-primitives/std",
"sr-std/std",
"sr-io/std",
"rstd/std",
"runtime_io/std",
"srml-support/std",
"sr-primitives/std",
"primitives/std",
]
+11 -21
View File
@@ -19,32 +19,21 @@
#![cfg_attr(not(feature = "std"), no_std)]
extern crate substrate_primitives;
#[cfg_attr(any(feature = "std", test), macro_use)]
extern crate sr_std as rstd;
#[macro_use]
extern crate srml_support as runtime_support;
#[macro_use]
extern crate parity_codec_derive;
extern crate parity_codec as codec;
extern crate sr_io as runtime_io;
extern crate sr_primitives as primitives;
extern crate safe_mix;
#[cfg(feature = "std")]
use serde_derive::Serialize;
use rstd::prelude::*;
#[cfg(any(feature = "std", test))]
use rstd::map;
use primitives::traits::{self, CheckEqual, SimpleArithmetic, SimpleBitOps, Zero, One, Bounded, Lookup,
Hash, Member, MaybeDisplay, EnsureOrigin, Digest as DigestT, As, CurrentHeight, BlockNumberToHash,
MaybeSerializeDebugButNotDeserialize, MaybeSerializeDebug, StaticLookup};
use substrate_primitives::storage::well_known_keys;
use runtime_support::{storage, StorageValue, StorageMap, Parameter};
use srml_support::{storage, StorageValue, StorageMap, Parameter, decl_module, decl_event, decl_storage};
use safe_mix::TripletMix;
use parity_codec_derive::{Encode, Decode};
#[cfg(any(feature = "std", test))]
use codec::Encode;
use parity_codec::Encode;
#[cfg(any(feature = "std", test))]
use runtime_io::{twox_128, TestExternalities, Blake2Hasher};
@@ -75,8 +64,8 @@ impl<AccountId> IsDeadAccount<AccountId> for () {
}
/// Compute the extrinsics root of a list of extrinsics.
pub fn extrinsics_root<H: Hash, E: codec::Encode>(extrinsics: &[E]) -> H::Output {
extrinsics_data_root::<H>(extrinsics.iter().map(codec::Encode::encode).collect())
pub fn extrinsics_root<H: Hash, E: parity_codec::Encode>(extrinsics: &[E]) -> H::Output {
extrinsics_data_root::<H>(extrinsics.iter().map(parity_codec::Encode::encode).collect())
}
/// Compute the extrinsics root of a list of extrinsics.
@@ -226,7 +215,7 @@ decl_storage! {
config(changes_trie_config): Option<ChangesTrieConfiguration>;
build(|storage: &mut primitives::StorageMap, _: &mut primitives::ChildrenStorageMap, config: &GenesisConfig<T>| {
use codec::Encode;
use parity_codec::Encode;
storage.insert(well_known_keys::EXTRINSIC_INDEX.to_vec(), 0u32.encode());
@@ -466,6 +455,7 @@ mod tests {
use primitives::BuildStorage;
use primitives::traits::{BlakeTwo256, IdentityLookup};
use primitives::testing::{Digest, DigestItem, Header};
use srml_support::impl_outer_origin;
impl_outer_origin!{
pub enum Origin for Test where system = super {}
+13 -15
View File
@@ -2,36 +2,34 @@
name = "srml-timestamp"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
[dependencies]
hex-literal = "0.1.0"
serde = { version = "1.0", default-features = false }
parity-codec = { version = "3.0", default-features = false }
parity-codec-derive = { version = "3.0", default-features = false }
substrate-primitives = { path = "../../core/primitives", default-features = false }
sr-std = { path = "../../core/sr-std", default-features = false }
sr-io = { path = "../../core/sr-io", default-features = false }
sr-primitives = { path = "../../core/sr-primitives", default-features = false }
substrate-inherents = { path = "../../core/inherents", default-features = false }
rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false }
runtime_primitives = { package = "sr-primitives", path = "../../core/sr-primitives", default-features = false }
inherents = { package = "substrate-inherents", path = "../../core/inherents", default-features = false }
srml-support = { path = "../support", default-features = false }
srml-system = { path = "../system", default-features = false }
srml-consensus = { path = "../consensus", default-features = false }
system = { package = "srml-system", path = "../system", default-features = false }
consensus = { package = "srml-consensus", path = "../consensus", default-features = false }
[dev-dependencies]
sr-io = { path = "../../core/sr-io", default-features = true }
runtime_io = { package = "sr-io", path = "../../core/sr-io", default-features = true }
substrate-primitives = { path = "../../core/primitives", default-features = false }
[features]
default = ["std"]
std = [
"sr-std/std",
"sr-io/std",
"rstd/std",
"srml-support/std",
"sr-primitives/std",
"srml-consensus/std",
"runtime_primitives/std",
"consensus/std",
"serde/std",
"parity-codec/std",
"parity-codec-derive/std",
"substrate-primitives/std",
"srml-system/std",
"substrate-inherents/std",
"system/std",
"inherents/std",
]
+7 -20
View File
@@ -32,28 +32,14 @@
#![cfg_attr(not(feature = "std"), no_std)]
extern crate sr_std as rstd;
#[macro_use]
extern crate srml_support as runtime_support;
#[cfg(test)]
extern crate substrate_primitives;
#[cfg(test)]
extern crate sr_io as runtime_io;
extern crate sr_primitives as runtime_primitives;
extern crate srml_system as system;
extern crate srml_consensus as consensus;
extern crate parity_codec as codec;
#[macro_use]
extern crate parity_codec_derive;
extern crate substrate_inherents as inherents;
use runtime_support::{StorageValue, Parameter};
#[cfg(feature = "std")]
use parity_codec_derive::Decode;
use parity_codec_derive::Encode;
use srml_support::{StorageValue, Parameter, decl_storage, decl_module};
use srml_support::for_each_tuple;
use runtime_primitives::traits::{As, SimpleArithmetic, Zero};
use system::ensure_inherent;
use rstd::{result, ops::{Mul, Div}, cmp};
use runtime_support::for_each_tuple;
use inherents::{RuntimeString, InherentIdentifier, ProvideInherent, IsFatalError, InherentData};
#[cfg(feature = "std")]
use inherents::ProvideInherentData;
@@ -88,7 +74,7 @@ impl InherentError {
#[cfg(feature = "std")]
pub fn try_from(id: &InherentIdentifier, data: &[u8]) -> Option<Self> {
if id == &INHERENT_IDENTIFIER {
<InherentError as codec::Decode>::decode(&mut &data[..])
<InherentError as parity_codec::Decode>::decode(&mut &data[..])
} else {
None
}
@@ -268,6 +254,7 @@ impl<T: Trait> ProvideInherent for Module<T> {
mod tests {
use super::*;
use srml_support::{impl_outer_origin, assert_ok};
use runtime_io::{with_externalities, TestExternalities};
use substrate_primitives::H256;
use runtime_primitives::BuildStorage;