Remove all (non-dev) client references from frame, activate dependency enforcer (#4184)

* Move transaction pool to primitives

* move backend, errors into primitives

* remove unused client depencies

* Move rpc-api into primitives

* Move peerset back to client

* Move rpc/api back to client, move palette/support/rpc into utils

* move support-rpc into subfolder

* move system-rpc into utils

* move transaction-pool  and -graph back into client

* fix broken imports

* Clean up test primitives

* Make support test utils independent of frame

* remove unnecessary node dependencies from service

* Reactivate dependency script:
 - only enforce the now achieved status quo will remain
 - allow for primitives to depend on /client for now without failing
 - more discriptive error message so people understand, what it wants
 - minor fix to differentiative between ../client and /client (which may be a subfolder)
 - don't allow this to fail anylonger.

* fix doc comment

* 'Should not' rather than 'must not'.

* Revert unwanted dependency changes

* fix faulty import

* fixup derive_more version

* fix wrong import path
This commit is contained in:
Benjamin Kampmann
2019-11-26 21:38:28 +01:00
committed by GitHub
parent b2aab98e69
commit bd652793db
130 changed files with 836 additions and 816 deletions
@@ -19,7 +19,8 @@
// FIXME #1021 move this into substrate-consensus-common
use std::{time, sync::Arc};
use client_api::{error, CallExecutor};
use client_api::CallExecutor;
use sp_blockchain;
use client::Client as SubstrateClient;
use codec::Decode;
use consensus_common::{evaluation};
@@ -53,13 +54,13 @@ where
RA: Send + Sync + 'static,
SubstrateClient<B, E, Block, RA>: ProvideRuntimeApi,
<SubstrateClient<B, E, Block, RA> as ProvideRuntimeApi>::Api:
BlockBuilderApi<Block, Error = error::Error>,
BlockBuilderApi<Block, Error = sp_blockchain::Error>,
{
pub fn init_with_now(
&mut self,
parent_header: &<Block as BlockT>::Header,
now: Box<dyn Fn() -> time::Instant + Send + Sync>,
) -> Result<Proposer<Block, SubstrateClient<B, E, Block, RA>, A>, error::Error> {
) -> Result<Proposer<Block, SubstrateClient<B, E, Block, RA>, A>, sp_blockchain::Error> {
let parent_hash = parent_header.hash();
let id = BlockId::hash(parent_hash);
@@ -91,15 +92,15 @@ where
RA: Send + Sync + 'static,
SubstrateClient<B, E, Block, RA>: ProvideRuntimeApi,
<SubstrateClient<B, E, Block, RA> as ProvideRuntimeApi>::Api:
BlockBuilderApi<Block, Error = error::Error>,
BlockBuilderApi<Block, Error = sp_blockchain::Error>,
{
type Proposer = Proposer<Block, SubstrateClient<B, E, Block, RA>, A>;
type Error = error::Error;
type Error = sp_blockchain::Error;
fn init(
&mut self,
parent_header: &<Block as BlockT>::Header,
) -> Result<Self::Proposer, error::Error> {
) -> Result<Self::Proposer, sp_blockchain::Error> {
self.init_with_now(parent_header, Box::new(time::Instant::now))
}
}
@@ -129,10 +130,10 @@ where
RA: Send + Sync + 'static,
SubstrateClient<B, E, Block, RA>: ProvideRuntimeApi,
<SubstrateClient<B, E, Block, RA> as ProvideRuntimeApi>::Api:
BlockBuilderApi<Block, Error = error::Error>,
BlockBuilderApi<Block, Error = sp_blockchain::Error>,
{
type Create = tokio_executor::blocking::Blocking<Result<Block, error::Error>>;
type Error = error::Error;
type Create = tokio_executor::blocking::Blocking<Result<Block, sp_blockchain::Error>>;
type Error = sp_blockchain::Error;
fn propose(
&mut self,
@@ -157,14 +158,14 @@ impl<Block, B, E, RA, A> ProposerInner<Block, SubstrateClient<B, E, Block, RA>,
RA: Send + Sync + 'static,
SubstrateClient<B, E, Block, RA>: ProvideRuntimeApi,
<SubstrateClient<B, E, Block, RA> as ProvideRuntimeApi>::Api:
BlockBuilderApi<Block, Error = error::Error>,
BlockBuilderApi<Block, Error = sp_blockchain::Error>,
{
fn propose_with(
&self,
inherent_data: InherentData,
inherent_digests: DigestFor<Block>,
deadline: time::Instant,
) -> Result<Block, error::Error> {
) -> Result<Block, sp_blockchain::Error> {
/// If the block is full we will attempt to push at most
/// this number of transactions before quitting for real.
/// It allows us to increase block utilization.
@@ -202,7 +203,8 @@ impl<Block, B, E, RA, A> ProposerInner<Block, SubstrateClient<B, E, Block, RA>,
Ok(()) => {
debug!("[{:?}] Pushed to the block.", pending.hash);
}
Err(error::Error::ApplyExtrinsicFailed(e)) if e.exhausted_resources() => {
Err(sp_blockchain::Error::ApplyExtrinsicFailed(sp_blockchain::ApplyExtrinsicFailed::Validity(e)))
if e.exhausted_resources() => {
if is_first {
debug!("[{:?}] Invalid transaction: FullBlock on empty block", pending.hash);
unqueue_invalid.push(pending.hash.clone());