Migrate state-db, state-machine, telemetry, test-client and test-runtime to the 2018 edition (#1623)

This commit is contained in:
Stanislav Tkach
2019-01-30 16:51:59 +02:00
committed by Bastian Köcher
parent 2037c52fbe
commit f98f9ac58a
33 changed files with 158 additions and 200 deletions
+17 -16
View File
@@ -2,6 +2,7 @@
name = "substrate-test-runtime"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
[dependencies]
log = { version = "0.4", optional = true }
@@ -10,15 +11,15 @@ serde = { version = "1.0", optional = true }
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-keyring = { path = "../keyring", optional = true }
keyring = { package = "substrate-keyring", path = "../keyring", optional = true }
substrate-client = { path = "../client", default-features = false }
substrate-primitives = { path = "../primitives", default-features = false }
substrate-inherents = { path = "../inherents", default-features = false }
substrate-consensus-aura-primitives = { path = "../consensus/aura/primitives", default-features = false }
sr-std = { path = "../sr-std", default-features = false }
sr-io = { path = "../sr-io", default-features = false }
sr-primitives = { path = "../sr-primitives", default-features = false }
sr-version = { path = "../sr-version", default-features = false }
primitives = { package = "substrate-primitives", path = "../primitives", default-features = false }
inherents = { package = "substrate-inherents", path = "../inherents", default-features = false }
consensus_aura = { package = "substrate-consensus-aura-primitives", path = "../consensus/aura/primitives", default-features = false }
rstd = { package = "sr-std", path = "../sr-std", default-features = false }
runtime_io = { package = "sr-io", path = "../sr-io", default-features = false }
runtime_primitives = { package = "sr-primitives", path = "../sr-primitives", default-features = false }
runtime_version = { package = "sr-version", path = "../sr-version", default-features = false }
srml-support = { path = "../../srml/support", default-features = false }
[dev-dependencies]
@@ -32,14 +33,14 @@ std = [
"serde",
"serde_derive",
"substrate-client/std",
"substrate-keyring",
"keyring",
"parity-codec/std",
"sr-std/std",
"sr-io/std",
"rstd/std",
"runtime_io/std",
"srml-support/std",
"substrate-primitives/std",
"substrate-inherents/std",
"sr-primitives/std",
"sr-version/std",
"substrate-consensus-aura-primitives/std",
"primitives/std",
"inherents/std",
"runtime_primitives/std",
"runtime_version/std",
"consensus_aura/std",
]
@@ -18,8 +18,8 @@
use std::collections::HashMap;
use runtime_io::twox_128;
use codec::{Encode, KeyedVec, Joiner};
use primitives::{Ed25519AuthorityId, ChangesTrieConfiguration};
use parity_codec::{Encode, KeyedVec, Joiner};
use primitives::{Ed25519AuthorityId, ChangesTrieConfiguration, map};
use primitives::storage::well_known_keys;
use runtime_primitives::traits::Block;
@@ -68,7 +68,7 @@ impl GenesisConfig {
}
}
pub fn additional_storage_with_genesis(genesis_block: &::Block) -> HashMap<Vec<u8>, Vec<u8>> {
pub fn additional_storage_with_genesis(genesis_block: &crate::Block) -> HashMap<Vec<u8>, Vec<u8>> {
map![
twox_128(&b"latest"[..]).to_vec() => genesis_block.hash().as_fixed_bytes().to_vec()
]
+6 -29
View File
@@ -18,45 +18,22 @@
#![cfg_attr(not(feature = "std"), no_std)]
#[cfg(feature = "std")]
extern crate serde;
extern crate sr_std as rstd;
extern crate parity_codec as codec;
extern crate sr_primitives as runtime_primitives;
extern crate substrate_inherents as inherents;
extern crate substrate_consensus_aura_primitives as consensus_aura;
#[macro_use]
extern crate substrate_client as client;
#[macro_use]
extern crate srml_support as runtime_support;
#[macro_use]
extern crate parity_codec_derive;
extern crate sr_io as runtime_io;
#[macro_use]
extern crate sr_version as runtime_version;
#[cfg(test)]
#[macro_use]
extern crate hex_literal;
#[cfg(test)]
extern crate substrate_keyring as keyring;
#[cfg_attr(any(feature = "std", test), macro_use)]
extern crate substrate_primitives as primitives;
#[cfg(test)] extern crate substrate_executor;
#[cfg(feature = "std")] pub mod genesismap;
pub mod system;
use rstd::prelude::*;
use codec::{Encode, Decode};
use parity_codec::{Encode, Decode};
use parity_codec_derive::{Encode, Decode};
use client::{runtime_api as client_api, block_builder::api as block_builder_api};
use substrate_client::{runtime_api as client_api, block_builder::api as block_builder_api,
decl_runtime_apis, impl_runtime_apis,
};
use runtime_primitives::{
ApplyResult, Ed25519Signature, transaction_validity::TransactionValidity,
create_runtime_str,
traits::{
BlindCheckable, BlakeTwo256, Block as BlockT, Extrinsic as ExtrinsicT,
GetNodeBlockType, GetRuntimeBlockType
+5 -4
View File
@@ -23,7 +23,7 @@ use runtime_support::storage::{self, StorageValue, StorageMap};
use runtime_primitives::traits::{Hash as HashT, BlakeTwo256, Digest as DigestT};
use runtime_primitives::generic;
use runtime_primitives::{ApplyError, ApplyOutcome, ApplyResult, transaction_validity::TransactionValidity};
use codec::{KeyedVec, Encode};
use parity_codec::{KeyedVec, Encode};
use super::{AccountId, BlockNumber, Extrinsic, Transfer, H256 as Hash, Block, Header, Digest};
use primitives::{Ed25519AuthorityId, Blake2Hasher};
use primitives::storage::well_known_keys;
@@ -256,12 +256,13 @@ mod tests {
use super::*;
use runtime_io::{with_externalities, twox_128, TestExternalities};
use codec::{Joiner, KeyedVec};
use parity_codec::{Joiner, KeyedVec};
use keyring::Keyring;
use ::{Header, Digest, Extrinsic, Transfer};
use primitives::{Blake2Hasher};
use crate::{Header, Digest, Extrinsic, Transfer};
use primitives::{Blake2Hasher, map};
use primitives::storage::well_known_keys;
use substrate_executor::WasmExecutor;
use hex_literal::{hex, hex_impl};
const WASM_CODE: &'static [u8] =
include_bytes!("../wasm/target/wasm32-unknown-unknown/release/substrate_test_runtime.compact.wasm");
@@ -2,6 +2,7 @@
name = "substrate-test-runtime-wasm"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
[lib]
name = "substrate_test_runtime"
@@ -18,5 +18,4 @@
#![cfg_attr(not(feature = "std"), no_std)]
extern crate substrate_test_runtime;
pub use substrate_test_runtime::*;