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
+2 -2
View File
@@ -17,7 +17,7 @@
//! Blockchain access trait
use client::Client as SubstrateClient;
use client_api::error::Error;
use sp_blockchain::Error;
use client_api::{ChangesProof, StorageProof, ClientInfo, CallExecutor};
use consensus::{BlockImport, BlockStatus, Error as ConsensusError};
use sr_primitives::traits::{Block as BlockT, Header as HeaderT};
@@ -162,7 +162,7 @@ impl<B, E, Block, RA> Client<Block> for SubstrateClient<B, E, Block, RA> where
return Ok(false);
}
let ancestor = header_metadata::lowest_common_ancestor(self, *block, *base)?;
let ancestor = sp_blockchain::lowest_common_ancestor(self, *block, *base)?;
Ok(ancestor.hash == *base)
}
+1 -3
View File
@@ -16,8 +16,6 @@
//! Substrate network possible errors.
use client_api;
use libp2p::{PeerId, Multiaddr};
use std::fmt;
@@ -31,7 +29,7 @@ pub enum Error {
/// Io error
Io(std::io::Error),
/// Client error
Client(client_api::error::Error),
Client(sp_blockchain::Error),
/// The same bootnode (based on address) is registered with two different peer ids.
#[display(
fmt = "The same bootnode (`{}`) is registered with two different peer ids: `{}` and `{}`",
@@ -22,7 +22,7 @@ use std::sync::Arc;
use futures::{prelude::*, sync::mpsc, sync::oneshot};
use futures03::compat::{Compat01As03, Future01CompatExt as _};
use parking_lot::Mutex;
use client_api::error::Error as ClientError;
use sp_blockchain::Error as ClientError;
use client_api::{Fetcher, FetchChecker, RemoteHeaderRequest,
RemoteCallRequest, RemoteReadRequest, RemoteChangesRequest,
RemoteReadChildRequest, RemoteBodyRequest};
@@ -25,7 +25,7 @@ use std::time::{Instant, Duration};
use log::{trace, info};
use futures::sync::oneshot::{Sender as OneShotSender};
use linked_hash_map::{Entry, LinkedHashMap};
use client_api::error::Error as ClientError;
use sp_blockchain::Error as ClientError;
use client_api::{FetchChecker, RemoteHeaderRequest,
RemoteCallRequest, RemoteReadRequest, RemoteChangesRequest, ChangesProof,
RemoteReadChildRequest, RemoteBodyRequest, StorageProof};
@@ -677,7 +677,7 @@ pub mod tests {
use std::time::Instant;
use futures::{Future, sync::oneshot};
use sr_primitives::traits::{Block as BlockT, NumberFor, Header as HeaderT};
use client_api::{error::{Error as ClientError, Result as ClientResult}};
use sp_blockchain::{Error as ClientError, Result as ClientResult};
use client_api::{FetchChecker, RemoteHeaderRequest,
ChangesProof, RemoteCallRequest, RemoteReadRequest,
RemoteReadChildRequest, RemoteChangesRequest, RemoteBodyRequest};
@@ -28,7 +28,8 @@
//!
use blocks::BlockCollection;
use client_api::{ClientInfo, error::Error as ClientError};
use client_api::ClientInfo;
use sp_blockchain::Error as ClientError;
use consensus::{BlockOrigin, BlockStatus,
block_validation::{BlockAnnounceValidator, Validation},
import_queue::{IncomingBlock, BlockImportResult, BlockImportError}
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
use client_api::error::Error as ClientError;
use sp_blockchain::Error as ClientError;
use crate::protocol::sync::{PeerSync, PeerSyncState};
use fork_tree::ForkTree;
use libp2p::PeerId;
@@ -283,7 +283,7 @@ impl<'a, B: BlockT> Matcher<'a, B> {
#[cfg(test)]
mod tests {
use crate::protocol::sync::PeerSync;
use client_api::error::Error as ClientError;
use sp_blockchain::Error as ClientError;
use quickcheck::{Arbitrary, Gen, QuickCheck, StdThreadGen};
use rand::Rng;
use std::collections::{HashMap, HashSet};
+3 -2
View File
@@ -27,12 +27,13 @@ use std::sync::Arc;
use crate::config::build_multiaddr;
use log::trace;
use crate::chain::FinalityProofProvider;
use sp_blockchain::{
Result as ClientResult, well_known_cache_keys::{self, Id as CacheKeyId},
};
use client_api::{
ClientInfo, BlockchainEvents, BlockImportNotification,
FinalityNotifications, ImportNotifications,
FinalityNotification,
error::Result as ClientResult,
well_known_cache_keys::{self, Id as CacheKeyId},
backend::{AuxStore, Backend, Finalizer}
};
use block_builder::BlockBuilder;