mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 03:01:07 +00:00
[big refactor] Remove crate aliasing. (#4395)
* Rename: Phase 1. * Unify codec. * Fixing: Phase 2 * Fixing: Phase 3. * Fixing: Phase 4. * Fixing: Phase 5. * Fixing: Phase 6. * Fixing: Phase 7. * Fixing: Phase 8. Tests * Fixing: Phase 9. Tests!!! * Fixing: Phase 10. Moar tests! * Finally done! * More fixes. * Rename primitives:: to sp_core:: * Apply renames in finality-grandpa. * Fix benches. * Fix benches 2. * Revert node-template. * Fix frame-system in our modules.
This commit is contained in:
committed by
Gavin Wood
parent
f14d98a439
commit
8778ca7dc8
@@ -16,17 +16,17 @@
|
||||
|
||||
//! Testing block import logic.
|
||||
|
||||
use consensus::ImportedAux;
|
||||
use consensus::import_queue::{
|
||||
use sp_consensus::ImportedAux;
|
||||
use sp_consensus::import_queue::{
|
||||
import_single_block, BasicQueue, BlockImportError, BlockImportResult, IncomingBlock,
|
||||
};
|
||||
use test_client::{self, prelude::*};
|
||||
use test_client::runtime::{Block, Hash};
|
||||
use substrate_test_runtime_client::{self, prelude::*};
|
||||
use substrate_test_runtime_client::runtime::{Block, Hash};
|
||||
use sp_runtime::generic::BlockId;
|
||||
use super::*;
|
||||
|
||||
fn prepare_good_block() -> (TestClient, Hash, u64, PeerId, IncomingBlock<Block>) {
|
||||
let client = test_client::new();
|
||||
let client = substrate_test_runtime_client::new();
|
||||
let block = client.new_block(Default::default()).unwrap().bake().unwrap();
|
||||
client.import(BlockOrigin::File, block).unwrap();
|
||||
|
||||
@@ -52,7 +52,7 @@ fn import_single_good_block_works() {
|
||||
let mut expected_aux = ImportedAux::default();
|
||||
expected_aux.is_new_best = true;
|
||||
|
||||
match import_single_block(&mut test_client::new(), BlockOrigin::File, block, &mut PassThroughVerifier(true)) {
|
||||
match import_single_block(&mut substrate_test_runtime_client::new(), BlockOrigin::File, block, &mut PassThroughVerifier(true)) {
|
||||
Ok(BlockImportResult::ImportedUnknown(ref num, ref aux, ref org))
|
||||
if *num == number && *aux == expected_aux && *org == Some(peer_id) => {}
|
||||
r @ _ => panic!("{:?}", r)
|
||||
@@ -72,7 +72,7 @@ fn import_single_good_known_block_is_ignored() {
|
||||
fn import_single_good_block_without_header_fails() {
|
||||
let (_, _, _, peer_id, mut block) = prepare_good_block();
|
||||
block.header = None;
|
||||
match import_single_block(&mut test_client::new(), BlockOrigin::File, block, &mut PassThroughVerifier(true)) {
|
||||
match import_single_block(&mut substrate_test_runtime_client::new(), BlockOrigin::File, block, &mut PassThroughVerifier(true)) {
|
||||
Err(BlockImportError::IncompleteHeader(ref org)) if *org == Some(peer_id) => {}
|
||||
_ => panic!()
|
||||
}
|
||||
@@ -83,7 +83,7 @@ fn async_import_queue_drops() {
|
||||
// Perform this test multiple times since it exhibits non-deterministic behavior.
|
||||
for _ in 0..100 {
|
||||
let verifier = PassThroughVerifier(true);
|
||||
let queue = BasicQueue::new(verifier, Box::new(test_client::new()), None, None);
|
||||
let queue = BasicQueue::new(verifier, Box::new(substrate_test_runtime_client::new()), None, None);
|
||||
drop(queue);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,42 +30,42 @@ use sc_network::FinalityProofProvider;
|
||||
use sp_blockchain::{
|
||||
Result as ClientResult, well_known_cache_keys::{self, Id as CacheKeyId},
|
||||
};
|
||||
use client_api::{
|
||||
use sc_client_api::{
|
||||
ClientInfo, BlockchainEvents, BlockImportNotification,
|
||||
FinalityNotifications, ImportNotifications,
|
||||
FinalityNotification,
|
||||
backend::{AuxStore, Backend, Finalizer}
|
||||
};
|
||||
use block_builder::BlockBuilder;
|
||||
use client::LongestChain;
|
||||
use sc_block_builder::BlockBuilder;
|
||||
use sc_client::LongestChain;
|
||||
use sc_network::config::Roles;
|
||||
use consensus::block_validation::DefaultBlockAnnounceValidator;
|
||||
use consensus::import_queue::BasicQueue;
|
||||
use consensus::import_queue::{
|
||||
use sp_consensus::block_validation::DefaultBlockAnnounceValidator;
|
||||
use sp_consensus::import_queue::BasicQueue;
|
||||
use sp_consensus::import_queue::{
|
||||
BoxBlockImport, BoxJustificationImport, Verifier, BoxFinalityProofImport,
|
||||
};
|
||||
use consensus::block_import::{BlockImport, ImportResult};
|
||||
use consensus::Error as ConsensusError;
|
||||
use consensus::{BlockOrigin, ForkChoiceStrategy, BlockImportParams, BlockCheckParams, JustificationImport};
|
||||
use sp_consensus::block_import::{BlockImport, ImportResult};
|
||||
use sp_consensus::Error as ConsensusError;
|
||||
use sp_consensus::{BlockOrigin, ForkChoiceStrategy, BlockImportParams, BlockCheckParams, JustificationImport};
|
||||
use futures::prelude::*;
|
||||
use futures03::{StreamExt as _, TryStreamExt as _};
|
||||
use sc_network::{NetworkWorker, NetworkService, ReportHandle, config::ProtocolId};
|
||||
use sc_network::config::{NetworkConfiguration, TransportConfig, BoxFinalityProofRequestBuilder};
|
||||
use libp2p::PeerId;
|
||||
use parking_lot::Mutex;
|
||||
use primitives::H256;
|
||||
use sp_core::H256;
|
||||
use sc_network::{Context, ProtocolConfig};
|
||||
use sp_runtime::generic::{BlockId, OpaqueDigestItemId};
|
||||
use sp_runtime::traits::{Block as BlockT, Header, NumberFor};
|
||||
use sp_runtime::Justification;
|
||||
use sc_network::TransactionPool;
|
||||
use sc_network::specialization::NetworkSpecialization;
|
||||
use test_client::{self, AccountKeyring};
|
||||
use substrate_test_runtime_client::{self, AccountKeyring};
|
||||
|
||||
pub use test_client::runtime::{Block, Extrinsic, Hash, Transfer};
|
||||
pub use test_client::{TestClient, TestClientBuilder, TestClientBuilderExt};
|
||||
pub use substrate_test_runtime_client::runtime::{Block, Extrinsic, Hash, Transfer};
|
||||
pub use substrate_test_runtime_client::{TestClient, TestClientBuilder, TestClientBuilderExt};
|
||||
|
||||
type AuthorityId = babe_primitives::AuthorityId;
|
||||
type AuthorityId = sp_consensus_babe::AuthorityId;
|
||||
|
||||
/// A Verifier that accepts all blocks and passes them on with the configured
|
||||
/// finality to be imported.
|
||||
@@ -129,14 +129,14 @@ impl NetworkSpecialization<Block> for DummySpecialization {
|
||||
}
|
||||
|
||||
pub type PeersFullClient =
|
||||
client::Client<test_client::Backend, test_client::Executor, Block, test_client::runtime::RuntimeApi>;
|
||||
sc_client::Client<substrate_test_runtime_client::Backend, substrate_test_runtime_client::Executor, Block, substrate_test_runtime_client::runtime::RuntimeApi>;
|
||||
pub type PeersLightClient =
|
||||
client::Client<test_client::LightBackend, test_client::LightExecutor, Block, test_client::runtime::RuntimeApi>;
|
||||
sc_client::Client<substrate_test_runtime_client::LightBackend, substrate_test_runtime_client::LightExecutor, Block, substrate_test_runtime_client::runtime::RuntimeApi>;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum PeersClient {
|
||||
Full(Arc<PeersFullClient>, Arc<test_client::Backend>),
|
||||
Light(Arc<PeersLightClient>, Arc<test_client::LightBackend>),
|
||||
Full(Arc<PeersFullClient>, Arc<substrate_test_runtime_client::Backend>),
|
||||
Light(Arc<PeersLightClient>, Arc<substrate_test_runtime_client::LightBackend>),
|
||||
}
|
||||
|
||||
impl PeersClient {
|
||||
@@ -218,8 +218,8 @@ pub struct Peer<D, S: NetworkSpecialization<Block>> {
|
||||
/// We keep a copy of the block_import so that we can invoke it for locally-generated blocks,
|
||||
/// instead of going through the import queue.
|
||||
block_import: Box<dyn BlockImport<Block, Error = ConsensusError>>,
|
||||
select_chain: Option<LongestChain<test_client::Backend, Block>>,
|
||||
backend: Option<Arc<test_client::Backend>>,
|
||||
select_chain: Option<LongestChain<substrate_test_runtime_client::Backend, Block>>,
|
||||
backend: Option<Arc<substrate_test_runtime_client::Backend>>,
|
||||
network: NetworkWorker<Block, S, <Block as BlockT>::Hash>,
|
||||
imported_blocks_stream: Box<dyn Stream<Item = BlockImportNotification<Block>, Error = ()> + Send>,
|
||||
finality_notification_stream: Box<dyn Stream<Item = FinalityNotification<Block>, Error = ()> + Send>,
|
||||
@@ -237,7 +237,7 @@ impl<D, S: NetworkSpecialization<Block>> Peer<D, S> {
|
||||
}
|
||||
|
||||
// Returns a clone of the local SelectChain, only available on full nodes
|
||||
pub fn select_chain(&self) -> Option<LongestChain<test_client::Backend, Block>> {
|
||||
pub fn select_chain(&self) -> Option<LongestChain<substrate_test_runtime_client::Backend, Block>> {
|
||||
self.select_chain.clone()
|
||||
}
|
||||
|
||||
@@ -608,7 +608,7 @@ pub trait TestNetFactory: Sized {
|
||||
let mut config = config.clone();
|
||||
config.roles = Roles::LIGHT;
|
||||
|
||||
let (c, backend) = test_client::new_light();
|
||||
let (c, backend) = substrate_test_runtime_client::new_light();
|
||||
let client = Arc::new(c);
|
||||
let (
|
||||
block_import,
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use sc_network::config::Roles;
|
||||
use consensus::BlockOrigin;
|
||||
use sp_consensus::BlockOrigin;
|
||||
use futures03::TryFutureExt as _;
|
||||
use std::time::Duration;
|
||||
use tokio::runtime::current_thread;
|
||||
|
||||
Reference in New Issue
Block a user