mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 00:01:09 +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
@@ -18,14 +18,14 @@ use crate::{Service, NetworkStatus, NetworkState, error::Error, DEFAULT_PROTOCOL
|
||||
use crate::{SpawnTaskHandle, start_rpc_servers, build_network_future, TransactionPoolAdapter};
|
||||
use crate::status_sinks;
|
||||
use crate::config::{Configuration, DatabaseConfig};
|
||||
use client_api::{
|
||||
use sc_client_api::{
|
||||
self,
|
||||
BlockchainEvents,
|
||||
backend::RemoteBackend, light::RemoteBlockchain,
|
||||
};
|
||||
use client::Client;
|
||||
use chain_spec::{RuntimeGenesis, Extension};
|
||||
use consensus_common::import_queue::ImportQueue;
|
||||
use sc_client::Client;
|
||||
use sc_chain_spec::{RuntimeGenesis, Extension};
|
||||
use sp_consensus::import_queue::ImportQueue;
|
||||
use futures::{prelude::*, sync::mpsc};
|
||||
use futures03::{
|
||||
compat::Compat,
|
||||
@@ -33,13 +33,13 @@ use futures03::{
|
||||
StreamExt as _, TryStreamExt as _,
|
||||
future::{select, Either}
|
||||
};
|
||||
use keystore::{Store as Keystore};
|
||||
use sc_keystore::{Store as Keystore};
|
||||
use log::{info, warn, error};
|
||||
use network::{FinalityProofProvider, OnDemand, NetworkService, NetworkStateInfo, DhtEvent};
|
||||
use network::{config::BoxFinalityProofRequestBuilder, specialization::NetworkSpecialization};
|
||||
use sc_network::{FinalityProofProvider, OnDemand, NetworkService, NetworkStateInfo, DhtEvent};
|
||||
use sc_network::{config::BoxFinalityProofRequestBuilder, specialization::NetworkSpecialization};
|
||||
use parking_lot::{Mutex, RwLock};
|
||||
use primitives::{Blake2Hasher, H256, Hasher};
|
||||
use rpc;
|
||||
use sp_core::{Blake2Hasher, H256, Hasher};
|
||||
use sc_rpc;
|
||||
use sp_api::ConstructRuntimeApi;
|
||||
use sp_runtime::generic::BlockId;
|
||||
use sp_runtime::traits::{
|
||||
@@ -51,7 +51,7 @@ use std::{
|
||||
marker::PhantomData, sync::Arc, time::SystemTime
|
||||
};
|
||||
use sysinfo::{get_current_pid, ProcessExt, System, SystemExt};
|
||||
use tel::{telemetry, SUBSTRATE_INFO};
|
||||
use sc_telemetry::{telemetry, SUBSTRATE_INFO};
|
||||
use sp_transaction_pool::{TransactionPool, TransactionPoolMaintainer};
|
||||
use sp_blockchain;
|
||||
use grafana_data_source::{self, record_metrics};
|
||||
@@ -103,11 +103,11 @@ type TFullClient<TBl, TRtApi, TExecDisp> = Client<
|
||||
>;
|
||||
|
||||
/// Full client backend type.
|
||||
type TFullBackend<TBl> = client_db::Backend<TBl>;
|
||||
type TFullBackend<TBl> = sc_client_db::Backend<TBl>;
|
||||
|
||||
/// Full client call executor type.
|
||||
type TFullCallExecutor<TBl, TExecDisp> = client::LocalCallExecutor<
|
||||
client_db::Backend<TBl>,
|
||||
type TFullCallExecutor<TBl, TExecDisp> = sc_client::LocalCallExecutor<
|
||||
sc_client_db::Backend<TBl>,
|
||||
NativeExecutor<TExecDisp>,
|
||||
>;
|
||||
|
||||
@@ -120,20 +120,20 @@ type TLightClient<TBl, TRtApi, TExecDisp> = Client<
|
||||
>;
|
||||
|
||||
/// Light client backend type.
|
||||
type TLightBackend<TBl> = client::light::backend::Backend<
|
||||
client_db::light::LightStorage<TBl>,
|
||||
type TLightBackend<TBl> = sc_client::light::backend::Backend<
|
||||
sc_client_db::light::LightStorage<TBl>,
|
||||
Blake2Hasher,
|
||||
>;
|
||||
|
||||
/// Light call executor type.
|
||||
type TLightCallExecutor<TBl, TExecDisp> = client::light::call_executor::GenesisCallExecutor<
|
||||
client::light::backend::Backend<
|
||||
client_db::light::LightStorage<TBl>,
|
||||
type TLightCallExecutor<TBl, TExecDisp> = sc_client::light::call_executor::GenesisCallExecutor<
|
||||
sc_client::light::backend::Backend<
|
||||
sc_client_db::light::LightStorage<TBl>,
|
||||
Blake2Hasher
|
||||
>,
|
||||
client::LocalCallExecutor<
|
||||
client::light::backend::Backend<
|
||||
client_db::light::LightStorage<TBl>,
|
||||
sc_client::LocalCallExecutor<
|
||||
sc_client::light::backend::Backend<
|
||||
sc_client_db::light::LightStorage<TBl>,
|
||||
Blake2Hasher
|
||||
>,
|
||||
NativeExecutor<TExecDisp>
|
||||
@@ -174,33 +174,33 @@ where TGen: RuntimeGenesis, TCSExt: Extension {
|
||||
|
||||
let fork_blocks = config.chain_spec
|
||||
.extensions()
|
||||
.get::<client::ForkBlocks<TBl>>()
|
||||
.get::<sc_client::ForkBlocks<TBl>>()
|
||||
.cloned()
|
||||
.unwrap_or_default();
|
||||
|
||||
let (client, backend) = {
|
||||
let db_config = client_db::DatabaseSettings {
|
||||
let db_config = sc_client_db::DatabaseSettings {
|
||||
state_cache_size: config.state_cache_size,
|
||||
state_cache_child_ratio:
|
||||
config.state_cache_child_ratio.map(|v| (v, 100)),
|
||||
pruning: config.pruning.clone(),
|
||||
source: match &config.database {
|
||||
DatabaseConfig::Path { path, cache_size } =>
|
||||
client_db::DatabaseSettingsSrc::Path {
|
||||
sc_client_db::DatabaseSettingsSrc::Path {
|
||||
path: path.clone(),
|
||||
cache_size: cache_size.clone().map(|u| u as usize),
|
||||
},
|
||||
DatabaseConfig::Custom(db) =>
|
||||
client_db::DatabaseSettingsSrc::Custom(db.clone()),
|
||||
sc_client_db::DatabaseSettingsSrc::Custom(db.clone()),
|
||||
},
|
||||
};
|
||||
|
||||
let extensions = client_api::execution_extensions::ExecutionExtensions::new(
|
||||
let extensions = sc_client_api::execution_extensions::ExecutionExtensions::new(
|
||||
config.execution_strategies.clone(),
|
||||
Some(keystore.clone()),
|
||||
);
|
||||
|
||||
client_db::new_client(
|
||||
sc_client_db::new_client(
|
||||
db_config,
|
||||
executor,
|
||||
&config.chain_spec,
|
||||
@@ -261,29 +261,29 @@ where TGen: RuntimeGenesis, TCSExt: Extension {
|
||||
);
|
||||
|
||||
let db_storage = {
|
||||
let db_settings = client_db::DatabaseSettings {
|
||||
let db_settings = sc_client_db::DatabaseSettings {
|
||||
state_cache_size: config.state_cache_size,
|
||||
state_cache_child_ratio:
|
||||
config.state_cache_child_ratio.map(|v| (v, 100)),
|
||||
pruning: config.pruning.clone(),
|
||||
source: match &config.database {
|
||||
DatabaseConfig::Path { path, cache_size } =>
|
||||
client_db::DatabaseSettingsSrc::Path {
|
||||
sc_client_db::DatabaseSettingsSrc::Path {
|
||||
path: path.clone(),
|
||||
cache_size: cache_size.clone().map(|u| u as usize),
|
||||
},
|
||||
DatabaseConfig::Custom(db) =>
|
||||
client_db::DatabaseSettingsSrc::Custom(db.clone()),
|
||||
sc_client_db::DatabaseSettingsSrc::Custom(db.clone()),
|
||||
},
|
||||
};
|
||||
client_db::light::LightStorage::new(db_settings)?
|
||||
sc_client_db::light::LightStorage::new(db_settings)?
|
||||
};
|
||||
let light_blockchain = client::light::new_light_blockchain(db_storage);
|
||||
let fetch_checker = Arc::new(client::light::new_fetch_checker(light_blockchain.clone(), executor.clone()));
|
||||
let fetcher = Arc::new(network::OnDemand::new(fetch_checker));
|
||||
let backend = client::light::new_light_backend(light_blockchain);
|
||||
let light_blockchain = sc_client::light::new_light_blockchain(db_storage);
|
||||
let fetch_checker = Arc::new(sc_client::light::new_fetch_checker(light_blockchain.clone(), executor.clone()));
|
||||
let fetcher = Arc::new(sc_network::OnDemand::new(fetch_checker));
|
||||
let backend = sc_client::light::new_light_backend(light_blockchain);
|
||||
let remote_blockchain = backend.remote_blockchain();
|
||||
let client = Arc::new(client::light::new_light(
|
||||
let client = Arc::new(sc_client::light::new_light(
|
||||
backend.clone(),
|
||||
&config.chain_spec,
|
||||
executor,
|
||||
@@ -559,7 +559,7 @@ impl<TBl, TRtApi, TCfg, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TNet
|
||||
pub fn with_transaction_pool<UExPool>(
|
||||
self,
|
||||
transaction_pool_builder: impl FnOnce(
|
||||
txpool::txpool::Options,
|
||||
sc_transaction_pool::txpool::Options,
|
||||
Arc<TCl>,
|
||||
Option<TFchr>,
|
||||
) -> Result<UExPool, Error>
|
||||
@@ -713,24 +713,24 @@ ServiceBuilder<
|
||||
Client<TBackend, TExec, TBl, TRtApi>: ProvideRuntimeApi,
|
||||
<Client<TBackend, TExec, TBl, TRtApi> as ProvideRuntimeApi>::Api:
|
||||
sp_api::Metadata<TBl> +
|
||||
offchain::OffchainWorkerApi<TBl> +
|
||||
sc_offchain::OffchainWorkerApi<TBl> +
|
||||
sp_transaction_pool::runtime_api::TaggedTransactionQueue<TBl> +
|
||||
session::SessionKeys<TBl> +
|
||||
sp_session::SessionKeys<TBl> +
|
||||
sp_api::ApiExt<TBl, Error = sp_blockchain::Error>,
|
||||
TBl: BlockT<Hash = <Blake2Hasher as Hasher>::Out>,
|
||||
TRtApi: ConstructRuntimeApi<TBl, Client<TBackend, TExec, TBl, TRtApi>> + 'static + Send + Sync,
|
||||
TCfg: Default,
|
||||
TGen: RuntimeGenesis,
|
||||
TCSExt: Extension,
|
||||
TBackend: 'static + client_api::backend::Backend<TBl, Blake2Hasher> + Send,
|
||||
TExec: 'static + client::CallExecutor<TBl, Blake2Hasher> + Send + Sync + Clone,
|
||||
TBackend: 'static + sc_client_api::backend::Backend<TBl, Blake2Hasher> + Send,
|
||||
TExec: 'static + sc_client::CallExecutor<TBl, Blake2Hasher> + Send + Sync + Clone,
|
||||
TSc: Clone,
|
||||
TImpQu: 'static + ImportQueue<TBl>,
|
||||
TNetP: NetworkSpecialization<TBl>,
|
||||
TExPool: 'static
|
||||
+ TransactionPool<Block=TBl, Hash = <TBl as BlockT>::Hash>
|
||||
+ TransactionPoolMaintainer<Block=TBl, Hash = <TBl as BlockT>::Hash>,
|
||||
TRpc: rpc::RpcExtension<rpc::Metadata> + Clone,
|
||||
TRpc: sc_rpc::RpcExtension<sc_rpc::Metadata> + Clone,
|
||||
{
|
||||
/// Builds the service.
|
||||
pub fn build(self) -> Result<Service<
|
||||
@@ -740,7 +740,7 @@ ServiceBuilder<
|
||||
NetworkStatus<TBl>,
|
||||
NetworkService<TBl, TNetP, <TBl as BlockT>::Hash>,
|
||||
TExPool,
|
||||
offchain::OffchainWorkers<
|
||||
sc_offchain::OffchainWorkers<
|
||||
Client<TBackend, TExec, TBl, TRtApi>,
|
||||
TBackend::OffchainStorage,
|
||||
TBl
|
||||
@@ -764,7 +764,7 @@ ServiceBuilder<
|
||||
dht_event_tx,
|
||||
} = self;
|
||||
|
||||
session::generate_initial_session_keys(
|
||||
sp_session::generate_initial_session_keys(
|
||||
client.clone(),
|
||||
&BlockId::Hash(client.info().chain.best_hash),
|
||||
config.dev_key_seed.clone().map(|s| vec![s]).unwrap_or_default(),
|
||||
@@ -812,13 +812,13 @@ ServiceBuilder<
|
||||
DEFAULT_PROTOCOL_ID
|
||||
}
|
||||
}.as_bytes();
|
||||
network::config::ProtocolId::from(protocol_id_full)
|
||||
sc_network::config::ProtocolId::from(protocol_id_full)
|
||||
};
|
||||
|
||||
let block_announce_validator =
|
||||
Box::new(consensus_common::block_validation::DefaultBlockAnnounceValidator::new(client.clone()));
|
||||
Box::new(sp_consensus::block_validation::DefaultBlockAnnounceValidator::new(client.clone()));
|
||||
|
||||
let network_params = network::config::Params {
|
||||
let network_params = sc_network::config::Params {
|
||||
roles: config.roles,
|
||||
network_config: config.network.clone(),
|
||||
chain: client.clone(),
|
||||
@@ -833,14 +833,14 @@ ServiceBuilder<
|
||||
};
|
||||
|
||||
let has_bootnodes = !network_params.network_config.boot_nodes.is_empty();
|
||||
let network_mut = network::NetworkWorker::new(network_params)?;
|
||||
let network_mut = sc_network::NetworkWorker::new(network_params)?;
|
||||
let network = network_mut.service().clone();
|
||||
let network_status_sinks = Arc::new(Mutex::new(status_sinks::StatusSinks::new()));
|
||||
|
||||
let offchain_storage = backend.offchain_storage();
|
||||
let offchain_workers = match (config.offchain_worker, offchain_storage) {
|
||||
(true, Some(db)) => {
|
||||
Some(Arc::new(offchain::OffchainWorkers::new(client.clone(), db)))
|
||||
Some(Arc::new(sc_offchain::OffchainWorkers::new(client.clone(), db)))
|
||||
},
|
||||
(true, None) => {
|
||||
log::warn!("Offchain workers disabled, due to lack of offchain storage support in backend.");
|
||||
@@ -986,16 +986,16 @@ ServiceBuilder<
|
||||
// RPC
|
||||
let (system_rpc_tx, system_rpc_rx) = futures03::channel::mpsc::unbounded();
|
||||
let gen_handler = || {
|
||||
use rpc::{chain, state, author, system};
|
||||
use sc_rpc::{chain, state, author, system};
|
||||
|
||||
let system_info = rpc::system::SystemInfo {
|
||||
let system_info = sc_rpc::system::SystemInfo {
|
||||
chain_name: config.chain_spec.name().into(),
|
||||
impl_name: config.impl_name.into(),
|
||||
impl_version: config.impl_version.into(),
|
||||
properties: config.chain_spec.properties().clone(),
|
||||
};
|
||||
|
||||
let subscriptions = rpc::Subscriptions::new(Arc::new(SpawnTaskHandle {
|
||||
let subscriptions = sc_rpc::Subscriptions::new(Arc::new(SpawnTaskHandle {
|
||||
sender: to_spawn_tx.clone(),
|
||||
on_exit: exit.clone()
|
||||
}));
|
||||
@@ -1003,13 +1003,13 @@ ServiceBuilder<
|
||||
let (chain, state) = if let (Some(remote_backend), Some(on_demand)) =
|
||||
(remote_backend.as_ref(), on_demand.as_ref()) {
|
||||
// Light clients
|
||||
let chain = rpc::chain::new_light(
|
||||
let chain = sc_rpc::chain::new_light(
|
||||
client.clone(),
|
||||
subscriptions.clone(),
|
||||
remote_backend.clone(),
|
||||
on_demand.clone()
|
||||
);
|
||||
let state = rpc::state::new_light(
|
||||
let state = sc_rpc::state::new_light(
|
||||
client.clone(),
|
||||
subscriptions.clone(),
|
||||
remote_backend.clone(),
|
||||
@@ -1019,12 +1019,12 @@ ServiceBuilder<
|
||||
|
||||
} else {
|
||||
// Full nodes
|
||||
let chain = rpc::chain::new_full(client.clone(), subscriptions.clone());
|
||||
let state = rpc::state::new_full(client.clone(), subscriptions.clone());
|
||||
let chain = sc_rpc::chain::new_full(client.clone(), subscriptions.clone());
|
||||
let state = sc_rpc::state::new_full(client.clone(), subscriptions.clone());
|
||||
(chain, state)
|
||||
};
|
||||
|
||||
let author = rpc::author::Author::new(
|
||||
let author = sc_rpc::author::Author::new(
|
||||
client.clone(),
|
||||
transaction_pool.clone(),
|
||||
subscriptions,
|
||||
@@ -1032,7 +1032,7 @@ ServiceBuilder<
|
||||
);
|
||||
let system = system::System::new(system_info, system_rpc_tx.clone());
|
||||
|
||||
rpc_servers::rpc_handler((
|
||||
sc_rpc_server::rpc_handler((
|
||||
state::StateApi::to_delegate(state),
|
||||
chain::ChainApi::to_delegate(chain),
|
||||
author::AuthorApi::to_delegate(author),
|
||||
@@ -1068,7 +1068,7 @@ ServiceBuilder<
|
||||
let version = version.clone();
|
||||
let chain_name = config.chain_spec.name().to_owned();
|
||||
let telemetry_connection_sinks_ = telemetry_connection_sinks.clone();
|
||||
let telemetry = tel::init_telemetry(tel::TelemetryConfig {
|
||||
let telemetry = sc_telemetry::init_telemetry(sc_telemetry::TelemetryConfig {
|
||||
endpoints,
|
||||
wasm_external_transport: config.telemetry_external_transport.take(),
|
||||
});
|
||||
@@ -1080,7 +1080,7 @@ ServiceBuilder<
|
||||
.compat()
|
||||
.for_each(move |event| {
|
||||
// Safe-guard in case we add more events in the future.
|
||||
let tel::TelemetryEvent::Connected = event;
|
||||
let sc_telemetry::TelemetryEvent::Connected = event;
|
||||
|
||||
telemetry!(SUBSTRATE_INFO; "system.connected";
|
||||
"name" => name.clone(),
|
||||
|
||||
Reference in New Issue
Block a user