diff --git a/substrate/Cargo.lock b/substrate/Cargo.lock index ff4f995a8c..ae0492f52f 100644 --- a/substrate/Cargo.lock +++ b/substrate/Cargo.lock @@ -1804,6 +1804,7 @@ dependencies = [ "sr-io 0.1.0", "sr-primitives 0.1.0", "structopt 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", + "substrate-basic-authorship 0.1.0", "substrate-cli 0.3.0", "substrate-client 0.1.0", "substrate-consensus-aura 0.1.0", @@ -3297,6 +3298,20 @@ dependencies = [ "vergen 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "substrate-basic-authorship" +version = "0.1.0" +dependencies = [ + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-primitives 0.1.0", + "substrate-client 0.1.0", + "substrate-consensus-aura-primitives 0.1.0", + "substrate-consensus-common 0.1.0", + "substrate-primitives 0.1.0", + "substrate-transaction-pool 0.1.0", +] + [[package]] name = "substrate-cli" version = "0.3.0" diff --git a/substrate/core/basic-authorship/Cargo.toml b/substrate/core/basic-authorship/Cargo.toml new file mode 100644 index 0000000000..00c50781fd --- /dev/null +++ b/substrate/core/basic-authorship/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "substrate-basic-authorship" +version = "0.1.0" +authors = ["Parity Technologies "] + +[dependencies] +log = "0.4" +parity-codec = "2.1" +sr-primitives = { path = "../../core/sr-primitives" } +substrate-client = { path = "../../core/client" } +substrate-consensus-aura-primitives = { path = "../../core/consensus/aura/primitives" } +substrate-consensus-common = { path = "../../core/consensus/common" } +substrate-primitives = { path = "../../core/primitives" } +substrate-transaction-pool = { path = "../../core/transaction-pool" } diff --git a/substrate/core/service/src/consensus.rs b/substrate/core/basic-authorship/src/basic_authorship.rs similarity index 100% rename from substrate/core/service/src/consensus.rs rename to substrate/core/basic-authorship/src/basic_authorship.rs diff --git a/substrate/core/basic-authorship/src/lib.rs b/substrate/core/basic-authorship/src/lib.rs new file mode 100644 index 0000000000..44caadea3c --- /dev/null +++ b/substrate/core/basic-authorship/src/lib.rs @@ -0,0 +1,34 @@ +// Copyright 2017-2018 Parity Technologies (UK) Ltd. +// This file is part of Substrate. + +// Substrate is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Substrate is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Substrate. If not, see . + +//! Basic implementation of block-authoring logic. + +#![warn(unused_extern_crates)] + +extern crate substrate_consensus_aura_primitives as aura_primitives; +extern crate substrate_primitives as primitives; +extern crate sr_primitives as runtime_primitives; +extern crate substrate_consensus_common as consensus_common; +extern crate substrate_client as client; +extern crate parity_codec as codec; +extern crate substrate_transaction_pool as transaction_pool; + +#[macro_use] +extern crate log; + +mod basic_authorship; + +pub use basic_authorship::ProposerFactory; diff --git a/substrate/core/service/src/lib.rs b/substrate/core/service/src/lib.rs index f316b49250..f782f917ed 100644 --- a/substrate/core/service/src/lib.rs +++ b/substrate/core/service/src/lib.rs @@ -58,7 +58,6 @@ mod error; mod chain_spec; pub mod config; pub mod chain_ops; -pub mod consensus; use std::io; use std::net::SocketAddr; @@ -82,7 +81,6 @@ pub use chain_spec::{ChainSpec, Properties}; pub use transaction_pool::txpool::{self, Pool as TransactionPool, Options as TransactionPoolOptions, ChainApi, IntoPoolError}; pub use client::ExecutionStrategy; -pub use consensus::ProposerFactory; pub use components::{ServiceFactory, FullBackend, FullExecutor, LightBackend, LightExecutor, Components, PoolApi, ComponentClient, ComponentBlock, FullClient, LightClient, FullComponents, LightComponents, diff --git a/substrate/node/cli/Cargo.toml b/substrate/node/cli/Cargo.toml index 438d72173d..8a1888d936 100644 --- a/substrate/node/cli/Cargo.toml +++ b/substrate/node/cli/Cargo.toml @@ -19,6 +19,7 @@ substrate-primitives = { path = "../../core/primitives" } node-runtime = { path = "../runtime" } node-primitives = { path = "../primitives" } hex-literal = "0.1" +substrate-basic-authorship = { path = "../../core/basic-authorship" } substrate-service = { path = "../../core/service" } substrate-transaction-pool = { path = "../../core/transaction-pool" } substrate-network = { path = "../../core/network" } diff --git a/substrate/node/cli/src/service.rs b/substrate/node/cli/src/service.rs index d173c7419e..89dbd02319 100644 --- a/substrate/node/cli/src/service.rs +++ b/substrate/node/cli/src/service.rs @@ -77,7 +77,7 @@ construct_service_factory! { if let Some(ref key) = local_key { info!("Using authority key {}", key.public()); - let proposer = Arc::new(substrate_service::ProposerFactory { + let proposer = Arc::new(substrate_basic_authorship::ProposerFactory { client: service.client(), transaction_pool: service.transaction_pool(), });