Unverified Commit 6a2092d6 authored by Gavin Wood's avatar Gavin Wood Committed by GitHub
Browse files

Bump Substrate (#816)



* Amalgamate pieces of balance module

* Fixes for vesting split

* Refactoring for vesting/balances split

* Build fixes

* Remove on_free_balance_zero and some docs.

* Indentation.

* Revert branch

* Fix.

* Update substrate: fixes after CLI refactoring

* Reverting removal of exit

* Removed too much again

* Update Cargo.lock

* Cargo.lock

* Update Substrate, ready for #4820

* Fixes

* Update to latest substrate master

* Fix network tests

* Update lock

* Fix tests

* Update futures to get bug fixes

* Fix tests for new balances/vesting logic

* Cargo fix

* Another fix

Co-authored-by: default avatarCecile Tonglet <cecile.tonglet@cecton.com>
Co-authored-by: asynchronous rob's avatarRobert Habermeier <rphmeier@gmail.com>
Co-authored-by: default avatarBastian Köcher <bkchr@users.noreply.github.com>
parent 4dcdf5f2
This diff is collapsed.
...@@ -11,8 +11,7 @@ edition = "2018" ...@@ -11,8 +11,7 @@ edition = "2018"
[dependencies] [dependencies]
cli = { package = "polkadot-cli", path = "cli" } cli = { package = "polkadot-cli", path = "cli" }
futures = "0.3.1" futures = "0.3.4"
ctrlc = { version = "3.1.3", features = ["termination"] }
service = { package = "polkadot-service", path = "service" } service = { package = "polkadot-service", path = "service" }
[build-dependencies] [build-dependencies]
......
...@@ -11,7 +11,7 @@ polkadot-erasure-coding = { path = "../erasure-coding" } ...@@ -11,7 +11,7 @@ polkadot-erasure-coding = { path = "../erasure-coding" }
parking_lot = "0.9.0" parking_lot = "0.9.0"
derive_more = "0.99" derive_more = "0.99"
log = "0.4.8" log = "0.4.8"
futures = "0.3.1" futures = "0.3.4"
tokio = { version = "0.2.10", features = ["rt-core"] } tokio = { version = "0.2.10", features = ["rt-core"] }
exit-future = "0.2.0" exit-future = "0.2.0"
codec = { package = "parity-scale-codec", version = "1.1.0", features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.1.0", features = ["derive"] }
......
...@@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] ...@@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"]
[dependencies] [dependencies]
log = "0.4.8" log = "0.4.8"
futures = { version = "0.3.1", features = ["compat"] } futures = { version = "0.3.4", features = ["compat"] }
structopt = "0.3.8" structopt = "0.3.8"
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master", optional = true } sc-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master", optional = true }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" } sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
......
...@@ -32,7 +32,8 @@ pub fn run(version: VersionInfo) -> error::Result<()> { ...@@ -32,7 +32,8 @@ pub fn run(version: VersionInfo) -> error::Result<()> {
match opt.subcommand { match opt.subcommand {
None => { None => {
sc_cli::init(&mut config, load_spec, &opt.run.shared_params, &version)?; sc_cli::init(&opt.run.shared_params, &version)?;
sc_cli::init_config(&mut config, &opt.run.shared_params, &version, load_spec)?;
let is_kusama = config.chain_spec.as_ref().map_or(false, |s| s.is_kusama()); let is_kusama = config.chain_spec.as_ref().map_or(false, |s| s.is_kusama());
...@@ -72,7 +73,8 @@ pub fn run(version: VersionInfo) -> error::Result<()> { ...@@ -72,7 +73,8 @@ pub fn run(version: VersionInfo) -> error::Result<()> {
} }
}, },
Some(Subcommand::Base(cmd)) => { Some(Subcommand::Base(cmd)) => {
sc_cli::init(&mut config, load_spec, cmd.get_shared_params(), &version)?; sc_cli::init(cmd.get_shared_params(), &version)?;
sc_cli::init_config(&mut config, &opt.run.shared_params, &version, load_spec)?;
let is_kusama = config.chain_spec.as_ref().map_or(false, |s| s.is_kusama()); let is_kusama = config.chain_spec.as_ref().map_or(false, |s| s.is_kusama());
......
...@@ -6,7 +6,7 @@ description = "Collator node implementation" ...@@ -6,7 +6,7 @@ description = "Collator node implementation"
edition = "2018" edition = "2018"
[dependencies] [dependencies]
futures = "0.3.1" futures = "0.3.4"
sc-client = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" } sc-client = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" } sc-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" } sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
......
...@@ -90,9 +90,8 @@ pub trait Network: Send + Sync { ...@@ -90,9 +90,8 @@ pub trait Network: Send + Sync {
fn checked_statements(&self, relay_parent: Hash) -> Box<dyn Stream<Item=SignedStatement>>; fn checked_statements(&self, relay_parent: Hash) -> Box<dyn Stream<Item=SignedStatement>>;
} }
impl<P, E, SP> Network for ValidationNetwork<P, E, SP> where impl<P, SP> Network for ValidationNetwork<P, SP> where
P: 'static + Send + Sync, P: 'static + Send + Sync,
E: 'static + Send + Sync,
SP: 'static + Spawn + Clone + Send + Sync, SP: 'static + Spawn + Clone + Send + Sync,
{ {
fn collator_id_to_peer_id(&self, collator_id: CollatorId) -> fn collator_id_to_peer_id(&self, collator_id: CollatorId) ->
...@@ -239,16 +238,15 @@ pub async fn collate<R, P>( ...@@ -239,16 +238,15 @@ pub async fn collate<R, P>(
} }
/// Polkadot-api context. /// Polkadot-api context.
struct ApiContext<P, E, SP> { struct ApiContext<P, SP> {
network: Arc<ValidationNetwork<P, E, SP>>, network: Arc<ValidationNetwork<P, SP>>,
parent_hash: Hash, parent_hash: Hash,
validators: Vec<ValidatorId>, validators: Vec<ValidatorId>,
} }
impl<P: 'static, E: 'static, SP: 'static> RelayChainContext for ApiContext<P, E, SP> where impl<P: 'static, SP: 'static> RelayChainContext for ApiContext<P, SP> where
P: ProvideRuntimeApi<Block> + Send + Sync, P: ProvideRuntimeApi<Block> + Send + Sync,
P::Api: ParachainHost<Block>, P::Api: ParachainHost<Block>,
E: futures::Future<Output=()> + Clone + Send + Sync + 'static,
SP: Spawn + Clone + Send + Sync SP: Spawn + Clone + Send + Sync
{ {
type Error = String; type Error = String;
...@@ -276,13 +274,12 @@ impl<P: 'static, E: 'static, SP: 'static> RelayChainContext for ApiContext<P, E, ...@@ -276,13 +274,12 @@ impl<P: 'static, E: 'static, SP: 'static> RelayChainContext for ApiContext<P, E,
} }
/// Run the collator node using the given `service`. /// Run the collator node using the given `service`.
fn run_collator_node<S, E, P, Extrinsic>( fn run_collator_node<S, P, Extrinsic>(
service: S, service: S,
exit: E,
para_id: ParaId, para_id: ParaId,
key: Arc<CollatorPair>, key: Arc<CollatorPair>,
build_parachain_context: P, build_parachain_context: P,
) -> polkadot_cli::error::Result<()> ) -> Result<S, polkadot_service::Error>
where where
S: AbstractService<Block = service::Block, NetworkSpecialization = service::PolkadotProtocol>, S: AbstractService<Block = service::Block, NetworkSpecialization = service::PolkadotProtocol>,
sc_client::Client<S::Backend, S::CallExecutor, service::Block, S::RuntimeApi>: ProvideRuntimeApi<Block>, sc_client::Client<S::Backend, S::CallExecutor, service::Block, S::RuntimeApi>: ProvideRuntimeApi<Block>,
...@@ -301,7 +298,6 @@ fn run_collator_node<S, E, P, Extrinsic>( ...@@ -301,7 +298,6 @@ fn run_collator_node<S, E, P, Extrinsic>(
S::CallExecutor: service::CallExecutor<service::Block>, S::CallExecutor: service::CallExecutor<service::Block>,
// Rust bug: https://github.com/rust-lang/rust/issues/24159 // Rust bug: https://github.com/rust-lang/rust/issues/24159
S::SelectChain: service::SelectChain<service::Block>, S::SelectChain: service::SelectChain<service::Block>,
E: futures::Future<Output=()> + Clone + Unpin + Send + Sync + 'static,
P: BuildParachainContext, P: BuildParachainContext,
P::ParachainContext: Send + 'static, P::ParachainContext: Send + 'static,
<P::ParachainContext as ParachainContext>::ProduceCandidate: Send, <P::ParachainContext as ParachainContext>::ProduceCandidate: Send,
...@@ -315,7 +311,7 @@ fn run_collator_node<S, E, P, Extrinsic>( ...@@ -315,7 +311,7 @@ fn run_collator_node<S, E, P, Extrinsic>(
let select_chain = if let Some(select_chain) = service.select_chain() { let select_chain = if let Some(select_chain) = service.select_chain() {
select_chain select_chain
} else { } else {
return Err(polkadot_cli::error::Error::Other("The node cannot work because it can't select chain.".into())) return Err("The node cannot work because it can't select chain.".into())
}; };
let is_known = move |block_hash: &Hash| { let is_known = move |block_hash: &Hash| {
...@@ -345,7 +341,6 @@ fn run_collator_node<S, E, P, Extrinsic>( ...@@ -345,7 +341,6 @@ fn run_collator_node<S, E, P, Extrinsic>(
let validation_network = Arc::new(ValidationNetwork::new( let validation_network = Arc::new(ValidationNetwork::new(
message_validator, message_validator,
exit.clone(),
client.clone(), client.clone(),
spawner.clone(), spawner.clone(),
)); ));
...@@ -357,11 +352,10 @@ fn run_collator_node<S, E, P, Extrinsic>( ...@@ -357,11 +352,10 @@ fn run_collator_node<S, E, P, Extrinsic>(
) { ) {
Ok(ctx) => ctx, Ok(ctx) => ctx,
Err(()) => { Err(()) => {
return Err(polkadot_cli::error::Error::Other("Could not build the parachain context!".into())) return Err("Could not build the parachain context!".into())
} }
}; };
let inner_exit = exit.clone();
let work = async move { let work = async move {
let mut notification_stream = client.import_notification_stream(); let mut notification_stream = client.import_notification_stream();
...@@ -385,7 +379,6 @@ fn run_collator_node<S, E, P, Extrinsic>( ...@@ -385,7 +379,6 @@ fn run_collator_node<S, E, P, Extrinsic>(
let key = key.clone(); let key = key.clone();
let parachain_context = parachain_context.clone(); let parachain_context = parachain_context.clone();
let validation_network = validation_network.clone(); let validation_network = validation_network.clone();
let inner_exit_2 = inner_exit.clone();
let work = future::lazy(move |_| async move { let work = future::lazy(move |_| async move {
let api = client.runtime_api(); let api = client.runtime_api();
...@@ -425,8 +418,7 @@ fn run_collator_node<S, E, P, Extrinsic>( ...@@ -425,8 +418,7 @@ fn run_collator_node<S, E, P, Extrinsic>(
outgoing, outgoing,
); );
let exit = inner_exit_2.clone(); tokio::spawn(res.boxed());
tokio::spawn(future::select(res.boxed(), exit));
}); });
} }
future::ok(()) future::ok(())
...@@ -444,10 +436,7 @@ fn run_collator_node<S, E, P, Extrinsic>( ...@@ -444,10 +436,7 @@ fn run_collator_node<S, E, P, Extrinsic>(
} }
}); });
let future = future::select( let future = silenced.map(drop);
silenced,
inner_exit.clone()
).map(drop);
tokio::spawn(future); tokio::spawn(future);
} }
...@@ -455,8 +444,7 @@ fn run_collator_node<S, E, P, Extrinsic>( ...@@ -455,8 +444,7 @@ fn run_collator_node<S, E, P, Extrinsic>(
service.spawn_essential_task("collation", work); service.spawn_essential_task("collation", work);
// NOTE: this is not ideal as we should only provide the service Ok(service)
sc_cli::run_service_until_exit(Configuration::default(), |_config| Ok(service))
} }
fn compute_targets(para_id: ParaId, session_keys: &[ValidatorId], roster: DutyRoster) -> HashSet<ValidatorId> { fn compute_targets(para_id: ParaId, session_keys: &[ValidatorId], roster: DutyRoster) -> HashSet<ValidatorId> {
...@@ -472,53 +460,54 @@ fn compute_targets(para_id: ParaId, session_keys: &[ValidatorId], roster: DutyRo ...@@ -472,53 +460,54 @@ fn compute_targets(para_id: ParaId, session_keys: &[ValidatorId], roster: DutyRo
/// Run a collator node with the given `RelayChainContext` and `ParachainContext` /// Run a collator node with the given `RelayChainContext` and `ParachainContext`
/// build by the given `BuildParachainContext` and arguments to the underlying polkadot node. /// build by the given `BuildParachainContext` and arguments to the underlying polkadot node.
/// ///
/// Provide a future which resolves when the node should exit.
/// This function blocks until done. /// This function blocks until done.
pub fn run_collator<P, E>( pub fn run_collator<P>(
build_parachain_context: P, build_parachain_context: P,
para_id: ParaId, para_id: ParaId,
exit: E,
key: Arc<CollatorPair>, key: Arc<CollatorPair>,
config: Configuration, config: Configuration,
) -> polkadot_cli::error::Result<()> where ) -> polkadot_cli::error::Result<()> where
P: BuildParachainContext, P: BuildParachainContext,
P::ParachainContext: Send + 'static, P::ParachainContext: Send + 'static,
<P::ParachainContext as ParachainContext>::ProduceCandidate: Send, <P::ParachainContext as ParachainContext>::ProduceCandidate: Send,
E: futures::Future<Output = ()> + Unpin + Send + Clone + Sync + 'static,
{ {
match (config.expect_chain_spec().is_kusama(), config.roles) { match (config.expect_chain_spec().is_kusama(), config.roles) {
(true, Roles::LIGHT) => (true, Roles::LIGHT) =>
run_collator_node( sc_cli::run_service_until_exit(config, |config| {
service::kusama_new_light(config, Some((key.public(), para_id)))?, run_collator_node(
exit, service::kusama_new_light(config, Some((key.public(), para_id)))?,
para_id, para_id,
key, key,
build_parachain_context, build_parachain_context,
), )
}),
(true, _) => (true, _) =>
run_collator_node( sc_cli::run_service_until_exit(config, |config| {
service::kusama_new_full(config, Some((key.public(), para_id)), None, false, 6000)?, run_collator_node(
exit, service::kusama_new_full(config, Some((key.public(), para_id)), None, false, 6000)?,
para_id, para_id,
key, key,
build_parachain_context, build_parachain_context,
), )
}),
(false, Roles::LIGHT) => (false, Roles::LIGHT) =>
run_collator_node( sc_cli::run_service_until_exit(config, |config| {
service::polkadot_new_light(config, Some((key.public(), para_id)))?, run_collator_node(
exit, service::polkadot_new_light(config, Some((key.public(), para_id)))?,
para_id, para_id,
key, key,
build_parachain_context, build_parachain_context,
), )
}),
(false, _) => (false, _) =>
run_collator_node( sc_cli::run_service_until_exit(config, |config| {
service::polkadot_new_full(config, Some((key.public(), para_id)), None, false, 6000)?, run_collator_node(
exit, service::polkadot_new_full(config, Some((key.public(), para_id)), None, false, 6000)?,
para_id, para_id,
key, key,
build_parachain_context, build_parachain_context,
), )
}),
} }
} }
......
...@@ -17,7 +17,7 @@ sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkad ...@@ -17,7 +17,7 @@ sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkad
sc-network-gossip = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" } sc-network-gossip = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" } sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
futures = "0.3.1" futures = "0.3.4"
log = "0.4.8" log = "0.4.8"
exit-future = "0.2.0" exit-future = "0.2.0"
sc-client = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" } sc-client = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
......
...@@ -35,7 +35,7 @@ use crate::gossip::{RegisteredMessageValidator, GossipMessage, GossipStatement, ...@@ -35,7 +35,7 @@ use crate::gossip::{RegisteredMessageValidator, GossipMessage, GossipStatement,
use sp_api::ProvideRuntimeApi; use sp_api::ProvideRuntimeApi;
use futures::prelude::*; use futures::prelude::*;
use futures::{task::SpawnExt, future::{ready, select}}; use futures::{task::SpawnExt, future::ready};
use parking_lot::Mutex; use parking_lot::Mutex;
use log::{debug, trace}; use log::{debug, trace};
...@@ -73,18 +73,18 @@ pub(crate) fn checked_statements<N: NetworkService>(network: &N, topic: Hash) -> ...@@ -73,18 +73,18 @@ pub(crate) fn checked_statements<N: NetworkService>(network: &N, topic: Hash) ->
} }
/// Table routing implementation. /// Table routing implementation.
pub struct Router<P, E, T> { pub struct Router<P, T> {
table: Arc<SharedTable>, table: Arc<SharedTable>,
attestation_topic: Hash, attestation_topic: Hash,
fetcher: LeafWorkDataFetcher<P, E, T>, fetcher: LeafWorkDataFetcher<P, T>,
deferred_statements: Arc<Mutex<DeferredStatements>>, deferred_statements: Arc<Mutex<DeferredStatements>>,
message_validator: RegisteredMessageValidator, message_validator: RegisteredMessageValidator,
} }
impl<P, E, T> Router<P, E, T> { impl<P, T> Router<P, T> {
pub(crate) fn new( pub(crate) fn new(
table: Arc<SharedTable>, table: Arc<SharedTable>,
fetcher: LeafWorkDataFetcher<P, E, T>, fetcher: LeafWorkDataFetcher<P, T>,
message_validator: RegisteredMessageValidator, message_validator: RegisteredMessageValidator,
) -> Self { ) -> Self {
let parent_hash = fetcher.parent_hash(); let parent_hash = fetcher.parent_hash();
...@@ -116,7 +116,7 @@ impl<P, E, T> Router<P, E, T> { ...@@ -116,7 +116,7 @@ impl<P, E, T> Router<P, E, T> {
} }
} }
impl<P, E: Clone, T: Clone> Clone for Router<P, E, T> { impl<P, T: Clone> Clone for Router<P, T> {
fn clone(&self) -> Self { fn clone(&self) -> Self {
Router { Router {
table: self.table.clone(), table: self.table.clone(),
...@@ -128,10 +128,9 @@ impl<P, E: Clone, T: Clone> Clone for Router<P, E, T> { ...@@ -128,10 +128,9 @@ impl<P, E: Clone, T: Clone> Clone for Router<P, E, T> {
} }
} }
impl<P: ProvideRuntimeApi<Block> + Send + Sync + 'static, E, T> Router<P, E, T> where impl<P: ProvideRuntimeApi<Block> + Send + Sync + 'static, T> Router<P, T> where
P::Api: ParachainHost<Block, Error = sp_blockchain::Error>, P::Api: ParachainHost<Block, Error = sp_blockchain::Error>,
T: Clone + Executor + Send + 'static, T: Clone + Executor + Send + 'static,
E: Future<Output=()> + Clone + Send + Unpin + 'static,
{ {
/// Import a statement whose signature has been checked already. /// Import a statement whose signature has been checked already.
pub(crate) fn import_statement(&self, statement: SignedStatement) { pub(crate) fn import_statement(&self, statement: SignedStatement) {
...@@ -176,8 +175,7 @@ impl<P: ProvideRuntimeApi<Block> + Send + Sync + 'static, E, T> Router<P, E, T> ...@@ -176,8 +175,7 @@ impl<P: ProvideRuntimeApi<Block> + Send + Sync + 'static, E, T> Router<P, E, T>
if let Some(work) = producer.map(|p| self.create_work(c_hash, p)) { if let Some(work) = producer.map(|p| self.create_work(c_hash, p)) {
trace!(target: "validation", "driving statement work to completion"); trace!(target: "validation", "driving statement work to completion");
let work = select(work.boxed(), self.fetcher.exit().clone()) let work = work.boxed().map(drop);
.map(drop);
let _ = self.fetcher.executor().spawn(work); let _ = self.fetcher.executor().spawn(work);
} }
} }
...@@ -226,10 +224,9 @@ impl<P: ProvideRuntimeApi<Block> + Send + Sync + 'static, E, T> Router<P, E, T> ...@@ -226,10 +224,9 @@ impl<P: ProvideRuntimeApi<Block> + Send + Sync + 'static, E, T> Router<P, E, T>
} }
} }
impl<P: ProvideRuntimeApi<Block> + Send, E, T> TableRouter for Router<P, E, T> where impl<P: ProvideRuntimeApi<Block> + Send, T> TableRouter for Router<P, T> where
P::Api: ParachainHost<Block>, P::Api: ParachainHost<Block>,
T: Clone + Executor + Send + 'static, T: Clone + Executor + Send + 'static,
E: Future<Output=()> + Clone + Send + 'static,
{ {
type Error = io::Error; type Error = io::Error;
type FetchValidationProof = Pin<Box<dyn Future<Output = Result<PoVBlock, io::Error>> + Send>>; type FetchValidationProof = Pin<Box<dyn Future<Output = Result<PoVBlock, io::Error>> + Send>>;
...@@ -283,7 +280,7 @@ impl<P: ProvideRuntimeApi<Block> + Send, E, T> TableRouter for Router<P, E, T> w ...@@ -283,7 +280,7 @@ impl<P: ProvideRuntimeApi<Block> + Send, E, T> TableRouter for Router<P, E, T> w
} }
} }
impl<P, E, T> Drop for Router<P, E, T> { impl<P, T> Drop for Router<P, T> {
fn drop(&mut self) { fn drop(&mut self) {
let parent_hash = self.parent_hash(); let parent_hash = self.parent_hash();
self.network().with_spec(move |spec, _| { spec.remove_validation_session(parent_hash); }); self.network().with_spec(move |spec, _| { spec.remove_validation_session(parent_hash); });
......
...@@ -319,11 +319,7 @@ impl ParachainHost<Block> for RuntimeApi { ...@@ -319,11 +319,7 @@ impl ParachainHost<Block> for RuntimeApi {
} }
} }
type TestValidationNetwork<SP> = crate::validation::ValidationNetwork< type TestValidationNetwork<SP> = crate::validation::ValidationNetwork<TestApi, SP>;
TestApi,
NeverExit,
SP,
>;
struct Built<SP> { struct Built<SP> {
gossip: Pin<Box<dyn Future<Output = ()>>>, gossip: Pin<Box<dyn Future<Output = ()>>>,
...@@ -349,7 +345,6 @@ fn build_network<SP: Spawn + Clone>(n: usize, spawner: SP) -> Built<SP> { ...@@ -349,7 +345,6 @@ fn build_network<SP: Spawn + Clone>(n: usize, spawner: SP) -> Built<SP> {
TestValidationNetwork::new( TestValidationNetwork::new(
message_val, message_val,
NeverExit,
runtime_api.clone(), runtime_api.clone(),
spawner.clone(), spawner.clone(),
) )
......
...@@ -62,40 +62,36 @@ pub struct LeafWorkParams { ...@@ -62,40 +62,36 @@ pub struct LeafWorkParams {
} }
/// Wrapper around the network service /// Wrapper around the network service
pub struct ValidationNetwork<P, E, T> { pub struct ValidationNetwork<P, T> {
api: Arc<P>, api: Arc<P>,
executor: T, executor: T,
network: RegisteredMessageValidator, network: RegisteredMessageValidator,
exit: E,
} }
impl<P, E, T> ValidationNetwork<P, E, T> { impl<P, T> ValidationNetwork<P, T> {
/// Create a new consensus networking object. /// Create a new consensus networking object.
pub fn new( pub fn new(
network: RegisteredMessageValidator, network: RegisteredMessageValidator,
exit: E,
api: Arc<P>, api: Arc<P>,
executor: T, executor: T,
) -> Self { ) -> Self {
ValidationNetwork { network, exit, api, executor } ValidationNetwork { network, api, executor }
} }
} }
impl<P, E: Clone, T: Clone> Clone for ValidationNetwork<P, E, T> { impl<P, T: Clone> Clone for ValidationNetwork<P, T> {
fn clone(&self) -> Self { fn clone(&self) -> Self {
ValidationNetwork { ValidationNetwork {
network: self.network.clone(), network: self.network.clone(),
exit: self.exit.clone(),
api: self.api.clone(), api: self.api.clone(),
executor: self.executor.clone(), executor: self.executor.clone(),
} }
} }
} }