Fix warning and directory restructure.

This commit is contained in:
Gav
2018-02-08 14:29:30 +01:00
parent ac5a750f45
commit 4582038b3d
145 changed files with 129 additions and 123 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
/target/ /target/
**/*.rs.bk **/*.rs.bk
*.swp *.swp
polkadot-runtime/wasm/target/ polkadot/runtime/wasm/target/
executor/wasm/target/ substrate/executor/wasm/target/
**/._* **/._*
+29 -25
View File
@@ -1,3 +1,7 @@
[[bin]]
name = "polkadot"
path = "polkadot/src/main.rs"
[package] [package]
name = "polkadot" name = "polkadot"
version = "0.1.0" version = "0.1.0"
@@ -5,34 +9,34 @@ authors = ["Parity Technologies <admin@parity.io>"]
[dependencies] [dependencies]
error-chain = "0.11" error-chain = "0.11"
polkadot-cli = { path = "polkadot-cli", version = "0.1" } polkadot-cli = { path = "polkadot/cli" }
polkadot-network = { path = "network" } polkadot-network = { path = "polkadot/network" }
[workspace] [workspace]
members = [ members = [
"client", "substrate/client",
"codec", "substrate/codec",
"environmental", "substrate/environmental",
"executor", "substrate/executor",
"network", "polkadot/network",
"polkadot-candidate-agreement", "polkadot/candidate-agreement",
"polkadot-cli", "polkadot/cli",
"polkadot-collator", "polkadot/collator",
"polkadot-executor", "polkadot/executor",
"polkadot-runtime", "polkadot/runtime",
"polkadot-primitives", "polkadot/primitives",
"polkadot-validator", "polkadot/validator",
"primitives", "substrate/primitives",
"rpc", "substrate/rpc",
"rpc-servers", "substrate/rpc-servers",
"runtime-io", "substrate/runtime-io",
"runtime-std", "substrate/runtime-std",
"serializer", "substrate/serializer",
"state-machine", "substrate/state-machine",
] ]
exclude = [ exclude = [
"executor/wasm", "substrate/executor/wasm",
"polkadot-runtime/wasm", "polkadot/runtime/wasm",
"pwasm-alloc", "substrate/pwasm-alloc",
"pwasm-libc", "substrate/pwasm-libc",
] ]
-24
View File
@@ -1,24 +0,0 @@
[package]
name = "polkadot-cli"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Polkadot node implementation in Rust."
[dependencies]
clap = { version = "2.27", features = ["yaml"] }
env_logger = "0.4"
error-chain = "0.11"
log = "0.3"
hex-literal = "0.1"
ed25519 = { path = "../ed25519" }
triehash = { version = "0.1" }
substrate-client = { path = "../client" }
substrate-codec = { path = "../codec" }
substrate-runtime-io = { path = "../runtime-io" }
substrate-state-machine = { path = "../state-machine" }
substrate-executor = { path = "../executor" }
substrate-primitives = { path = "../primitives" }
substrate-rpc-servers = { path = "../rpc-servers" }
polkadot-primitives = { path = "../polkadot-primitives" }
polkadot-executor = { path = "../polkadot-executor" }
polkadot-runtime = { path = "../polkadot-runtime" }
-17
View File
@@ -1,17 +0,0 @@
[package]
name = "polkadot-executor"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Polkadot node implementation in Rust."
[dependencies]
hex-literal = "0.1"
ed25519 = { path = "../ed25519" }
triehash = { version = "0.1" }
substrate-codec = { path = "../codec" }
substrate-runtime-io = { path = "../runtime-io" }
substrate-state-machine = { path = "../state-machine" }
substrate-executor = { path = "../executor" }
substrate-primitives = { path = "../primitives" }
polkadot-primitives = { path = "../polkadot-primitives", version = "0.1" }
polkadot-runtime = { path = "../polkadot-runtime" }
-18
View File
@@ -1,18 +0,0 @@
[package]
name = "polkadot-runtime"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
[dependencies]
substrate-codec = { path = "../codec", version = "0.1" }
substrate-runtime-std = { path = "../runtime-std", version = "0.1" }
substrate-runtime-io = { path = "../runtime-io", version = "0.1" }
substrate-primitives = { path = "../primitives", version = "0.1" }
polkadot-primitives = { path = "../polkadot-primitives", version = "0.1" }
rustc-hex = "1.0"
hex-literal = "0.1.0"
log = { version = "0.3", optional = true }
[features]
default = ["std"]
std = ["substrate-codec/std", "substrate-runtime-std/std", "substrate-runtime-io/std", "substrate-primitives/std", "polkadot-primitives/std", "log"]
-11
View File
@@ -1,11 +0,0 @@
[package]
name = "polkadot-validator"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
[dependencies]
error-chain = "0.11"
substrate-primitives = { path = "../primitives" }
polkadot-primitives = { path = "../polkadot-primitives" }
substrate-serializer = { path = "../serializer" }
serde = "1.0"
+24
View File
@@ -0,0 +1,24 @@
[package]
name = "polkadot-cli"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Polkadot node implementation in Rust."
[dependencies]
clap = { version = "2.27", features = ["yaml"] }
env_logger = "0.4"
error-chain = "0.11"
log = "0.3"
hex-literal = "0.1"
triehash = "0.1"
ed25519 = { path = "../../substrate/ed25519" }
substrate-client = { path = "../../substrate/client" }
substrate-codec = { path = "../../substrate/codec" }
substrate-runtime-io = { path = "../../substrate/runtime-io" }
substrate-state-machine = { path = "../../substrate/state-machine" }
substrate-executor = { path = "../../substrate/executor" }
substrate-primitives = { path = "../../substrate/primitives" }
substrate-rpc-servers = { path = "../../substrate/rpc-servers" }
polkadot-primitives = { path = "../primitives" }
polkadot-executor = { path = "../executor" }
polkadot-runtime = { path = "../runtime" }
@@ -5,6 +5,6 @@ authors = ["Parity Technologies <rphmeier@gmail.com>"]
description = "Abstract collation logic" description = "Abstract collation logic"
[dependencies] [dependencies]
substrate-primitives = { path = "../primitives", version = "0.1" }
polkadot-primitives = { path = "../polkadot-primitives", version = "0.1" }
futures = "0.1.17" futures = "0.1.17"
substrate-primitives = { path = "../../substrate/primitives", version = "0.1" }
polkadot-primitives = { path = "../primitives", version = "0.1" }
+17
View File
@@ -0,0 +1,17 @@
[package]
name = "polkadot-executor"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Polkadot node implementation in Rust."
[dependencies]
hex-literal = "0.1"
triehash = { version = "0.1" }
ed25519 = { path = "../../substrate/ed25519" }
substrate-codec = { path = "../../substrate/codec" }
substrate-runtime-io = { path = "../../substrate/runtime-io" }
substrate-state-machine = { path = "../../substrate/state-machine" }
substrate-executor = { path = "../../substrate/executor" }
substrate-primitives = { path = "../../substrate/primitives" }
polkadot-primitives = { path = "../primitives" }
polkadot-runtime = { path = "../runtime" }
@@ -40,7 +40,7 @@ impl NativeExecutionDispatch for LocalNativeExecutionDispatch {
fn native_equivalent() -> &'static [u8] { fn native_equivalent() -> &'static [u8] {
// WARNING!!! This assumes that the runtime was built *before* the main project. Until we // WARNING!!! This assumes that the runtime was built *before* the main project. Until we
// get a proper build script, this must be strictly adhered to or things will go wrong. // get a proper build script, this must be strictly adhered to or things will go wrong.
include_bytes!("../../polkadot-runtime/wasm/target/wasm32-unknown-unknown/release/polkadot_runtime.compact.wasm") include_bytes!("../../runtime/wasm/target/wasm32-unknown-unknown/release/polkadot_runtime.compact.wasm")
} }
fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> { fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
@@ -67,8 +67,8 @@ mod tests {
UncheckedTransaction, Function, AccountId}; UncheckedTransaction, Function, AccountId};
use ed25519::Pair; use ed25519::Pair;
const BLOATY_CODE: &[u8] = include_bytes!("../../polkadot-runtime/wasm/target/wasm32-unknown-unknown/release/polkadot_runtime.wasm"); const BLOATY_CODE: &[u8] = include_bytes!("../../runtime/wasm/target/wasm32-unknown-unknown/release/polkadot_runtime.wasm");
const COMPACT_CODE: &[u8] = include_bytes!("../../polkadot-runtime/wasm/target/wasm32-unknown-unknown/release/polkadot_runtime.compact.wasm"); const COMPACT_CODE: &[u8] = include_bytes!("../../runtime/wasm/target/wasm32-unknown-unknown/release/polkadot_runtime.compact.wasm");
// TODO: move into own crate. // TODO: move into own crate.
macro_rules! map { macro_rules! map {
@@ -289,7 +289,7 @@ mod tests {
twox_128(&one.to_keyed_vec(b"sta:bal:")).to_vec() => vec![68u8, 0, 0, 0, 0, 0, 0, 0] twox_128(&one.to_keyed_vec(b"sta:bal:")).to_vec() => vec![68u8, 0, 0, 0, 0, 0, 0, 0]
], }; ], };
let foreign_code = include_bytes!("../../polkadot-runtime/wasm/target/wasm32-unknown-unknown/release/polkadot_runtime.wasm"); let foreign_code = include_bytes!("../../runtime/wasm/target/wasm32-unknown-unknown/release/polkadot_runtime.wasm");
let r = WasmExecutor.call(&mut t, &foreign_code[..], "execute_transaction", &vec![].join(&Header::from_block_number(1u64)).join(&tx())); let r = WasmExecutor.call(&mut t, &foreign_code[..], "execute_transaction", &vec![].join(&Header::from_block_number(1u64)).join(&tx()));
assert!(r.is_err()); assert!(r.is_err());
} }
@@ -303,7 +303,7 @@ mod tests {
twox_128(&one.to_keyed_vec(b"sta:bal:")).to_vec() => vec![111u8, 0, 0, 0, 0, 0, 0, 0] twox_128(&one.to_keyed_vec(b"sta:bal:")).to_vec() => vec![111u8, 0, 0, 0, 0, 0, 0, 0]
], }; ], };
let foreign_code = include_bytes!("../../polkadot-runtime/wasm/target/wasm32-unknown-unknown/release/polkadot_runtime.compact.wasm"); let foreign_code = include_bytes!("../../runtime/wasm/target/wasm32-unknown-unknown/release/polkadot_runtime.compact.wasm");
let r = WasmExecutor.call(&mut t, &foreign_code[..], "execute_transaction", &vec![].join(&Header::from_block_number(1u64)).join(&tx())); let r = WasmExecutor.call(&mut t, &foreign_code[..], "execute_transaction", &vec![].join(&Header::from_block_number(1u64)).join(&tx()));
assert!(r.is_ok()); assert!(r.is_ok());
@@ -8,12 +8,6 @@ authors = ["Parity Technologies <admin@parity.io>"]
[lib] [lib]
[dependencies] [dependencies]
ethcore-network = { git = "https://github.com/paritytech/parity.git" }
ethcore-io = { git = "https://github.com/paritytech/parity.git" }
substrate-primitives = { path = "../primitives" }
substrate-client = { path = "../client" }
substrate-state-machine = { path = "../state-machine" }
substrate-serializer = { path = "../serializer" }
log = "0.3" log = "0.3"
env_logger = "0.4" env_logger = "0.4"
rand = "0.3" rand = "0.3"
@@ -27,4 +21,10 @@ bitflags = "1.0"
serde = "1.0" serde = "1.0"
serde_derive = "1.0" serde_derive = "1.0"
serde_json = "1.0" serde_json = "1.0"
polkadot-primitives = { path = "../polkadot-primitives" } ethcore-network = { git = "https://github.com/paritytech/parity.git" }
ethcore-io = { git = "https://github.com/paritytech/parity.git" }
substrate-primitives = { path = "../../substrate/primitives" }
substrate-client = { path = "../../substrate/client" }
substrate-state-machine = { path = "../../substrate/state-machine" }
substrate-serializer = { path = "../../substrate/serializer" }
polkadot-primitives = { path = "../primitives" }
@@ -6,12 +6,12 @@ authors = ["Parity Technologies <admin@parity.io>"]
[dependencies] [dependencies]
serde = { version = "1.0", default_features = false } serde = { version = "1.0", default_features = false }
serde_derive = { version = "1.0", optional = true } serde_derive = { version = "1.0", optional = true }
substrate-codec = { path = "../codec", default_features = false } substrate-codec = { path = "../../substrate/codec", default_features = false }
substrate-primitives = { path = "../primitives", default_features = false } substrate-primitives = { path = "../../substrate/primitives", default_features = false }
substrate-runtime-std = { path = "../runtime-std", default_features = false } substrate-runtime-std = { path = "../../substrate/runtime-std", default_features = false }
[dev-dependencies] [dev-dependencies]
substrate-serializer = { path = "../serializer" } substrate-serializer = { path = "../../substrate/serializer" }
pretty_assertions = "0.4" pretty_assertions = "0.4"
[features] [features]
+25
View File
@@ -0,0 +1,25 @@
[package]
name = "polkadot-runtime"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
[dependencies]
rustc-hex = "1.0"
hex-literal = "0.1.0"
log = { version = "0.3", optional = true }
substrate-codec = { path = "../../substrate/codec" }
substrate-runtime-std = { path = "../../substrate/runtime-std" }
substrate-runtime-io = { path = "../../substrate/runtime-io" }
substrate-primitives = { path = "../../substrate/primitives" }
polkadot-primitives = { path = "../primitives" }
[features]
default = ["std"]
std = [
"substrate-codec/std",
"substrate-runtime-std/std",
"substrate-runtime-io/std",
"substrate-primitives/std",
"polkadot-primitives/std",
"log"
]
+11
View File
@@ -0,0 +1,11 @@
[package]
name = "polkadot-validator"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
[dependencies]
error-chain = "0.11"
serde = "1.0"
substrate-primitives = { path = "../../substrate/primitives" }
substrate-serializer = { path = "../../substrate/serializer" }
polkadot-primitives = { path = "../primitives" }
@@ -41,10 +41,6 @@ extern crate rustc_hex;
extern crate triehash; extern crate triehash;
#[macro_use] extern crate log; #[macro_use] extern crate log;
#[cfg(test)]
#[macro_use]
extern crate hex_literal;
#[macro_use] #[macro_use]
extern crate error_chain; extern crate error_chain;
@@ -34,6 +34,7 @@ pub trait NativeExecutionDispatch {
/// A generic `CodeExecutor` implementation that uses a delegate to determine wasm code equivalence /// A generic `CodeExecutor` implementation that uses a delegate to determine wasm code equivalence
/// and dispatch to native code when possible, falling back on `WasmExecutor` when not. /// and dispatch to native code when possible, falling back on `WasmExecutor` when not.
pub struct NativeExecutor<D: NativeExecutionDispatch + Sync + Send> { pub struct NativeExecutor<D: NativeExecutionDispatch + Sync + Send> {
/// Dummy field to avoid the compiler complaining about us not using `D`.
pub _dummy: ::std::marker::PhantomData<D>, pub _dummy: ::std::marker::PhantomData<D>,
} }
@@ -330,11 +330,9 @@ impl CodeExecutor for WasmExecutor {
mod tests { mod tests {
use super::*; use super::*;
use rustc_hex::FromHex; use rustc_hex::FromHex;
use codec::{KeyedVec, Slicable, Joiner}; use codec::{Slicable, Joiner};
use state_machine::TestExternalities; use state_machine::TestExternalities;
use primitives::{twox_128, Header}; use primitives::Header;
use runtime_io;
use ed25519::Pair;
#[test] #[test]
fn returning_should_work() { fn returning_should_work() {

Some files were not shown because too many files have changed in this diff Show More