Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Substrate update #120

Merged
merged 9 commits into from
Nov 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,249 changes: 681 additions & 568 deletions Cargo.lock

Large diffs are not rendered by default.

78 changes: 7 additions & 71 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,63 +1,3 @@
[dependencies]
cli = { package = "node-cli", path = "node/cli" }
futures = "0.1.29"
ctrlc = { version = "3.1.3", features = ["termination"] }
substrate-cli = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-client = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-client-db = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-consensus-aura = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-consensus-babe = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-consensus-common = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-consensus-rhd = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-consensus-slots = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-executor = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-finality-grandpa = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-finality-grandpa-primitives = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-inherents = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-keyring = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-keystore = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-network = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-panic-handler = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-primitives = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-rpc = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-rpc-servers = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-serializer = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-service = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-service-test = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
sr-api = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
sr-api-proc-macro = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
sr-io = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
sr-primitives = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
sr-sandbox = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
sr-std = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
sr-version = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-state-machine = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-telemetry = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-transaction-pool = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-transaction-graph = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-trie = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
fork-tree = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
#new
substrate-application-crypto = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-authority-discovery = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-basic-authorship = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-externalities = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-offchain = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-peerset = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-phragmen = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-session = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-wasm-interface = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }

[build-dependencies]
vergen = "3.0.4"

[profile.release]
panic = 'unwind'

[[bin]]
name = 'darwinia'
path = 'node/src/main.rs'

[workspace]
members = [
"core/merkle-mountain-range",
Expand All @@ -67,20 +7,16 @@ members = [
"node/cli",
"node/executor",
"node/primitives",
"node/runtime",
"node/rpc",
"node/rpc-client",
"srml/support",
"node/runtime",
"srml/balances",
"srml/ethereum-bridge",
"srml/kton",
"srml/staking",
"srml/ethereum-bridge",
"srml/support",
]

exclude = ["node/runtime/wasm"]

[package]
authors = ['Darwinia Network <hello@darwinia.network>']
build = 'build.rs'
edition = '2018'
name = 'darwinia'
version = '0.3.2'
[profile.release]
# Substrate runtime requires unwinding.
panic = "unwind"
8 changes: 0 additions & 8 deletions build.rs

This file was deleted.

141 changes: 100 additions & 41 deletions node/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,66 +5,125 @@ authors = ["Parity Technologies <admin@parity.io>"]
description = "Substrate node implementation in Rust."
build = "build.rs"
edition = "2018"
default-run = "darwinia"

[[bin]]
name = "darwinia"
path = "bin/main.rs"
required-features = ["cli"]

[lib]
crate-type = ["cdylib", "rlib"]

[dependencies]
log = "0.4.8"
tokio = "0.1.22"
# third-party dependencies
codec = { package = "parity-scale-codec", version = "1.0.6" }
serde = { version = "1.0.102", features = [ "derive" ] }
futures = "0.1.29"
exit-future = "0.1.4"
hex-literal = "0.2.1"
jsonrpc-core = "14.0.3"
cli = { package = "substrate-cli", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
codec = { package = "parity-scale-codec", version = "1.0.0" }
log = "0.4.8"
rand = "0.7.2"
structopt = "0.3.3"

# primitives
primitives = { package = "substrate-primitives", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
sr-primitives = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
babe-primitives = { package = "substrate-consensus-babe-primitives", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
grandpa_primitives = { package = "substrate-finality-grandpa-primitives", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }

# core dependencies
runtime-io = { package = "sr-io", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
client = { package = "substrate-client", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
primitives = { package = "substrate-primitives", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
inherents = { package = "substrate-inherents", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
node-primitives = { path = "../primitives" }
hex-literal = "0.2.1"
substrate-basic-authorship = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-service = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
chain-spec = { package = "substrate-chain-spec", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
transaction_pool = { package = "substrate-transaction-pool", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
network = { package = "substrate-network", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
consensus = { package = "substrate-consensus-aura", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
babe = { package = "substrate-consensus-babe", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
grandpa = { package = "substrate-finality-grandpa", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
sr-primitives = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
aura_primitives = { package = "substrate-consensus-aura-primitives", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
node-executor = { path = "../executor" }
substrate-keystore = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-telemetry = { package = "substrate-telemetry", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
structopt = "0.3.3"
transaction-factory = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
keyring = { package = "substrate-keyring", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
indices = { package = "srml-indices", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop"}
timestamp = { package = "srml-timestamp", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop", default-features = false }
rand = "0.7.2"
finality_tracker = { package = "srml-finality-tracker", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop", default-features = false }
srml-support = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop", default-features = false }
contracts = { package = "srml-contracts", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop", default-features = false }
backtrace = "0.3"
reqwest = "0.9.5"
serde = { version = "1.0.101", features = [ "derive" ] }
serde_json = "1.0"
#new
chain-spec = { package = "substrate-chain-spec", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
client_db = { package = "substrate-client-db", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
offchain = { package = "substrate-offchain", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-rpc = { package = "substrate-rpc", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-basic-authorship = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-service = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-telemetry = { package = "substrate-telemetry", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }

# srml dependencies
indices = { package = "srml-indices", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
timestamp = { package = "srml-timestamp", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
finality_tracker = { package = "srml-finality-tracker", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
contracts = { package = "srml-contracts", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
system = { package = "srml-system", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
transaction-payment = { package = "srml-transaction-payment", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
node-rpc = { path = "../rpc" }
substrate-rpc = { package = "substrate-rpc", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
client_db = { package = "substrate-client-db", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop", features = ["kvdb-rocksdb"] }
babe = { package = "substrate-consensus-babe", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
babe-primitives = { package = "substrate-consensus-babe-primitives", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
grandpa_primitives = { package = "substrate-finality-grandpa-primitives", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
im-online = { package = "srml-im-online", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop", default-features = false }
sr-authority-discovery = { package = "srml-authority-discovery", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop", default-features = false }
authority-discovery = { package = "substrate-authority-discovery", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
offchain = { package = "substrate-offchain", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
support = { package = "srml-support", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
im_online = { package = "srml-im-online", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }

balances = { package = "darwinia-balances", path = "../../srml/balances" }

# node-specific dependencies
node-runtime = { path = "../runtime" }
node-rpc = { path = "../rpc" }
node-primitives = { path = "../primitives" }
node-executor = { path = "../executor" }

# CLI-specific dependencies
tokio = { version = "0.1.22", optional = true }
exit-future = { version = "0.1.4", optional = true }
substrate-cli = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop", optional = true }
transaction-factory = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop", optional = true }
ctrlc = { version = "3.1.3", features = ["termination"], optional = true }

# WASM-specific dependencies
libp2p = { version = "0.13.0", default-features = false, optional = true }
clear_on_drop = { version = "0.2.3", features = ["no_cc"], optional = true } # Imported just for the `no_cc` feature
console_error_panic_hook = { version = "0.1.1", optional = true }
console_log = { version = "0.1.2", optional = true }
js-sys = { version = "0.3.22", optional = true }
wasm-bindgen = { version = "0.2.45", optional = true }
wasm-bindgen-futures = { version = "0.3.22", optional = true }
kvdb-memorydb = { git = "https://github.com/paritytech/parity-common", rev = "b0317f649ab2c665b7987b8475878fc4d2e1f81d", optional = true }
rand6 = { package = "rand", version = "0.6", features = ["wasm-bindgen"], optional = true } # Imported just for the `wasm-bindgen` feature

[dev-dependencies]
keystore = { package = "substrate-keystore", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
babe = { package = "substrate-consensus-babe", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop", features = ["test-helpers"] }
consensus-common = { package = "substrate-consensus-common", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
service-test = { package = "substrate-service-test", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
futures03 = { package = "futures-preview", version = "0.3.0-alpha.19" }
tempfile = "3.1.0"

[build-dependencies]
cli = { package = "substrate-cli", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
substrate-cli = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop", optional = true }
build-script-utils = { package = "substrate-build-script-utils", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop" }
structopt = "0.3.3"
vergen = "3.0.4"

[features]
default = ["cli"]
browser = [
"clear_on_drop",
"console_error_panic_hook",
"console_log",
"js-sys",
"libp2p",
"wasm-bindgen",
"wasm-bindgen-futures",
"kvdb-memorydb",
"rand/wasm-bindgen",
"rand6"
]
cli = [
"substrate-cli",
"transaction-factory",
"tokio",
"exit-future",
"ctrlc",
"substrate-service/rocksdb"
]
wasmtime = [
"cli",
"node-executor/wasmtime",
"substrate-cli/wasmtime",
"substrate-service/wasmtime",
]
15 changes: 6 additions & 9 deletions node/src/main.rs → node/cli/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@

#![warn(missing_docs)]

use cli::VersionInfo;
use std::cell::RefCell;

use futures::sync::oneshot;
use futures::{future, Future};

use std::cell::RefCell;
use substrate_cli::VersionInfo;

// handles ctrl-c
struct Exit;
impl cli::IntoExit for Exit {
impl substrate_cli::IntoExit for Exit {
type Exit = future::MapErr<oneshot::Receiver<()>, fn(oneshot::Canceled) -> ()>;
fn into_exit(self) -> Self::Exit {
// can't use signal directly here because CtrlC takes only `Fn`.
Expand All @@ -48,7 +48,7 @@ impl cli::IntoExit for Exit {
}
}

fn main() {
fn main() -> Result<(), substrate_cli::error::Error> {
let version = VersionInfo {
name: "Darwinia Crayfish Node",
commit: env!("VERGEN_SHA_SHORT"),
Expand All @@ -59,8 +59,5 @@ fn main() {
support_url: "https://github.com/darwinia-network/darwinia/issues/new",
};

if let Err(e) = cli::run(::std::env::args(), Exit, version) {
eprintln!("Error starting the node: {}\n\n{:?}", e, e);
std::process::exit(1)
}
node_cli::run(std::env::args(), Exit, version)
}
7 changes: 5 additions & 2 deletions node/cli/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,17 @@
// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.

use cli::{CoreParams, NoCustom};

use std::{env, fs, path::Path};

use structopt::{clap::Shell, StructOpt};
use substrate_cli::{CoreParams, NoCustom};
use vergen::{generate_cargo_keys, ConstantsFlags};

fn main() {
build_shell_completion();
generate_cargo_keys(ConstantsFlags::all()).expect("Failed to generate metadata files");

build_script_utils::rerun_if_git_head_changed();
}

/// Build shell completion scripts for all known shells
Expand Down
Loading