mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 08:51: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
@@ -20,22 +20,22 @@ codec = { package = "parity-scale-codec", version = "1.0.0" }
|
||||
trie-root = "0.15.2"
|
||||
sp-io = { path = "../../primitives/io" }
|
||||
sc-cli = { path = "../../client/cli" }
|
||||
primitives = { package = "sp-core", path = "../../primitives/core" }
|
||||
sp-core = { path = "../../primitives/core" }
|
||||
sc-executor = { path = "../../client/executor" }
|
||||
sc-service = { path = "../../client/service" }
|
||||
inherents = { package = "sp-inherents", path = "../../primitives/inherents" }
|
||||
txpool = { package = "sc-transaction-pool", path = "../../client/transaction-pool" }
|
||||
txpool-api = { package = "sp-transaction-pool", path = "../../primitives/transaction-pool" }
|
||||
network = { package = "sc-network", path = "../../client/network" }
|
||||
aura = { package = "sc-consensus-aura", path = "../../client/consensus/aura" }
|
||||
aura-primitives = { package = "sp-consensus-aura", path = "../../primitives/consensus/aura" }
|
||||
consensus-common = { package = "sp-consensus", path = "../../primitives/consensus/common" }
|
||||
sp-inherents = { path = "../../primitives/inherents" }
|
||||
sc-transaction-pool = { path = "../../client/transaction-pool" }
|
||||
sp-transaction-pool = { path = "../../primitives/transaction-pool" }
|
||||
sc-network = { path = "../../client/network" }
|
||||
sc-consensus-aura = { path = "../../client/consensus/aura" }
|
||||
sp-consensus-aura = { path = "../../primitives/consensus/aura" }
|
||||
sp-consensus = { path = "../../primitives/consensus/common" }
|
||||
grandpa = { package = "sc-finality-grandpa", path = "../../client/finality-grandpa" }
|
||||
grandpa-primitives = { package = "sp-finality-grandpa", path = "../../primitives/finality-grandpa" }
|
||||
sc-client = { path = "../../client/" }
|
||||
runtime = { package = "node-template-runtime", path = "runtime" }
|
||||
node-template-runtime = { path = "runtime" }
|
||||
sp-runtime = { path = "../../primitives/runtime" }
|
||||
basic-authorship = { package = "sc-basic-authority", path = "../../client/basic-authorship"}
|
||||
sc-basic-authority = { path = "../../client/basic-authorship"}
|
||||
|
||||
[build-dependencies]
|
||||
vergen = "3.0.4"
|
||||
|
||||
@@ -6,31 +6,32 @@ edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
aura = { package = "pallet-aura", path = "../../../frame/aura", default-features = false }
|
||||
aura-primitives = { package = "sp-consensus-aura", path = "../../../primitives/consensus/aura", default-features = false }
|
||||
balances = { package = "pallet-balances", path = "../../../frame/balances", default-features = false }
|
||||
block-builder-api = { package = "sp-block-builder", path = "../../../primitives/block-builder", default-features = false}
|
||||
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
|
||||
executive = { package = "frame-executive", path = "../../../frame/executive", default-features = false }
|
||||
frame-support = { path = "../../../frame/support", default-features = false }
|
||||
grandpa = { package = "pallet-grandpa", path = "../../../frame/grandpa", default-features = false }
|
||||
indices = { package = "pallet-indices", path = "../../../frame/indices", default-features = false }
|
||||
inherents = { package = "sp-inherents", path = "../../../primitives/inherents", default-features = false}
|
||||
offchain-primitives = { package = "sp-offchain", path = "../../../primitives/offchain", default-features = false }
|
||||
primitives = { package = "sp-core", path = "../../../primitives/core", default-features = false }
|
||||
randomness-collective-flip = { package = "pallet-randomness-collective-flip", path = "../../../frame/randomness-collective-flip", default-features = false }
|
||||
sp-std = { path = "../../../primitives/std", default-features = false }
|
||||
sp-io = { path = "../../../primitives/io", default-features = false }
|
||||
safe-mix = { version = "1.0.0", default-features = false }
|
||||
serde = { version = "1.0.101", optional = true, features = ["derive"] }
|
||||
sp-api = { path = "../../../primitives/api", default-features = false }
|
||||
sp-runtime = { path = "../../../primitives/runtime", default-features = false }
|
||||
sp-session = { path = "../../../primitives/session", default-features = false }
|
||||
sudo = { package = "pallet-sudo", path = "../../../frame/sudo", default-features = false }
|
||||
support = { package = "frame-support", path = "../../../frame/support", default-features = false }
|
||||
system = { package = "frame-system", path = "../../../frame/system", default-features = false }
|
||||
timestamp = { package = "pallet-timestamp", path = "../../../frame/timestamp", default-features = false }
|
||||
transaction-payment = { package = "pallet-transaction-payment", path = "../../../frame/transaction-payment", default-features = false }
|
||||
sp-transaction-pool = { package = "sp-transaction-pool", path = "../../../primitives/transaction-pool", default-features = false }
|
||||
version = { package = "sp-version", path = "../../../primitives/version", default-features = false }
|
||||
|
||||
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
|
||||
frame-executive = { path = "../../../frame/executive", default-features = false }
|
||||
safe-mix = { version = "1.0.0", default-features = false }
|
||||
serde = { version = "1.0.101", optional = true, features = ["derive"] }
|
||||
sp-api = { path = "../../../primitives/api", default-features = false }
|
||||
sp-block-builder = { path = "../../../primitives/block-builder", default-features = false}
|
||||
sp-consensus-aura = { path = "../../../primitives/consensus/aura", default-features = false }
|
||||
sp-core = { path = "../../../primitives/core", default-features = false }
|
||||
sp-inherents = { path = "../../../primitives/inherents", default-features = false}
|
||||
sp-io = { path = "../../../primitives/io", default-features = false }
|
||||
sp-offchain = { path = "../../../primitives/offchain", default-features = false }
|
||||
sp-runtime = { path = "../../../primitives/runtime", default-features = false }
|
||||
sp-session = { path = "../../../primitives/session", default-features = false }
|
||||
sp-std = { path = "../../../primitives/std", default-features = false }
|
||||
sp-transaction-pool = { path = "../../../primitives/transaction-pool", default-features = false }
|
||||
sp-version = { path = "../../../primitives/version", default-features = false }
|
||||
|
||||
[build-dependencies]
|
||||
wasm-builder-runner = { package = "substrate-wasm-builder-runner", path = "../../../utils/wasm-builder-runner", version = "1.0.4" }
|
||||
@@ -38,30 +39,30 @@ wasm-builder-runner = { package = "substrate-wasm-builder-runner", path = "../..
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"aura-primitives/std",
|
||||
"aura/std",
|
||||
"balances/std",
|
||||
"block-builder-api/std",
|
||||
"codec/std",
|
||||
"executive/std",
|
||||
"frame-executive/std",
|
||||
"frame-support/std",
|
||||
"grandpa/std",
|
||||
"indices/std",
|
||||
"inherents/std",
|
||||
"offchain-primitives/std",
|
||||
"primitives/std",
|
||||
"randomness-collective-flip/std",
|
||||
"sp-std/std",
|
||||
"sp-io/std",
|
||||
"safe-mix/std",
|
||||
"serde",
|
||||
"sp-api/std",
|
||||
"sp-block-builder/std",
|
||||
"sp-consensus-aura/std",
|
||||
"sp-core/std",
|
||||
"sp-inherents/std",
|
||||
"sp-io/std",
|
||||
"sp-offchain/std",
|
||||
"sp-runtime/std",
|
||||
"sp-session/std",
|
||||
"sp-std/std",
|
||||
"sp-transaction-pool/std",
|
||||
"sp-version/std",
|
||||
"sudo/std",
|
||||
"support/std",
|
||||
"system/std",
|
||||
"timestamp/std",
|
||||
"transaction-payment/std",
|
||||
"sp-transaction-pool/std",
|
||||
"version/std",
|
||||
]
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
|
||||
|
||||
use sp_std::prelude::*;
|
||||
use primitives::OpaqueMetadata;
|
||||
use sp_core::OpaqueMetadata;
|
||||
use sp_runtime::{
|
||||
ApplyExtrinsicResult, transaction_validity::TransactionValidity, generic, create_runtime_str,
|
||||
impl_opaque_keys, MultiSignature
|
||||
@@ -18,12 +18,12 @@ use sp_runtime::traits::{
|
||||
NumberFor, BlakeTwo256, Block as BlockT, StaticLookup, Verify, ConvertInto, IdentifyAccount
|
||||
};
|
||||
use sp_api::impl_runtime_apis;
|
||||
use aura_primitives::sr25519::AuthorityId as AuraId;
|
||||
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
|
||||
use grandpa::AuthorityList as GrandpaAuthorityList;
|
||||
use grandpa::fg_primitives;
|
||||
use version::RuntimeVersion;
|
||||
use sp_version::RuntimeVersion;
|
||||
#[cfg(feature = "std")]
|
||||
use version::NativeVersion;
|
||||
use sp_version::NativeVersion;
|
||||
|
||||
// A few exports that help ease life for downstream crates.
|
||||
#[cfg(any(feature = "std", test))]
|
||||
@@ -31,7 +31,7 @@ pub use sp_runtime::BuildStorage;
|
||||
pub use timestamp::Call as TimestampCall;
|
||||
pub use balances::Call as BalancesCall;
|
||||
pub use sp_runtime::{Permill, Perbill};
|
||||
pub use support::{
|
||||
pub use frame_support::{
|
||||
StorageValue, construct_runtime, parameter_types,
|
||||
traits::Randomness,
|
||||
weights::Weight,
|
||||
@@ -58,7 +58,7 @@ pub type Balance = u128;
|
||||
pub type Index = u32;
|
||||
|
||||
/// A hash of some data used by the chain.
|
||||
pub type Hash = primitives::H256;
|
||||
pub type Hash = sp_core::H256;
|
||||
|
||||
/// Digest item type.
|
||||
pub type DigestItem = generic::DigestItem<Hash>;
|
||||
@@ -280,7 +280,7 @@ pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signatu
|
||||
/// Extrinsic type that has already been checked.
|
||||
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Call, SignedExtra>;
|
||||
/// Executive: handles dispatch to the various modules.
|
||||
pub type Executive = executive::Executive<Runtime, Block, system::ChainContext<Runtime>, Runtime, AllModules>;
|
||||
pub type Executive = frame_executive::Executive<Runtime, Block, system::ChainContext<Runtime>, Runtime, AllModules>;
|
||||
|
||||
impl_runtime_apis! {
|
||||
impl sp_api::Core<Block> for Runtime {
|
||||
@@ -303,7 +303,7 @@ impl_runtime_apis! {
|
||||
}
|
||||
}
|
||||
|
||||
impl block_builder_api::BlockBuilder<Block> for Runtime {
|
||||
impl sp_block_builder::BlockBuilder<Block> for Runtime {
|
||||
fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {
|
||||
Executive::apply_extrinsic(extrinsic)
|
||||
}
|
||||
@@ -312,14 +312,14 @@ impl_runtime_apis! {
|
||||
Executive::finalize_block()
|
||||
}
|
||||
|
||||
fn inherent_extrinsics(data: inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
|
||||
fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
|
||||
data.create_extrinsics()
|
||||
}
|
||||
|
||||
fn check_inherents(
|
||||
block: Block,
|
||||
data: inherents::InherentData,
|
||||
) -> inherents::CheckInherentsResult {
|
||||
data: sp_inherents::InherentData,
|
||||
) -> sp_inherents::CheckInherentsResult {
|
||||
data.check_extrinsics(&block)
|
||||
}
|
||||
|
||||
@@ -334,13 +334,13 @@ impl_runtime_apis! {
|
||||
}
|
||||
}
|
||||
|
||||
impl offchain_primitives::OffchainWorkerApi<Block> for Runtime {
|
||||
impl sp_offchain::OffchainWorkerApi<Block> for Runtime {
|
||||
fn offchain_worker(number: NumberFor<Block>) {
|
||||
Executive::offchain_worker(number)
|
||||
}
|
||||
}
|
||||
|
||||
impl aura_primitives::AuraApi<Block, AuraId> for Runtime {
|
||||
impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
|
||||
fn slot_duration() -> u64 {
|
||||
Aura::slot_duration()
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
/// For more guidance on Substrate modules, see the example module
|
||||
/// https://github.com/paritytech/substrate/blob/master/frame/example/src/lib.rs
|
||||
|
||||
use support::{decl_module, decl_storage, decl_event, dispatch};
|
||||
use frame_support::{decl_module, decl_storage, decl_event, dispatch};
|
||||
use system::ensure_signed;
|
||||
|
||||
/// The module's configuration trait.
|
||||
@@ -69,8 +69,8 @@ decl_event!(
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
use primitives::H256;
|
||||
use support::{impl_outer_origin, assert_ok, parameter_types, weights::Weight};
|
||||
use sp_core::H256;
|
||||
use frame_support::{impl_outer_origin, assert_ok, parameter_types, weights::Weight};
|
||||
use sp_runtime::{
|
||||
traits::{BlakeTwo256, IdentityLookup}, testing::Header, Perbill,
|
||||
};
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use primitives::{Pair, Public, sr25519};
|
||||
use runtime::{
|
||||
use sp_core::{Pair, Public, sr25519};
|
||||
use node_template_runtime::{
|
||||
AccountId, AuraConfig, BalancesConfig, GenesisConfig, GrandpaConfig,
|
||||
SudoConfig, IndicesConfig, SystemConfig, WASM_BINARY, Signature
|
||||
};
|
||||
use aura_primitives::sr25519::{AuthorityId as AuraId};
|
||||
use sp_consensus_aura::sr25519::{AuthorityId as AuraId};
|
||||
use grandpa_primitives::{AuthorityId as GrandpaId};
|
||||
use sc_service;
|
||||
use sp_runtime::traits::{Verify, IdentifyAccount};
|
||||
|
||||
@@ -5,7 +5,7 @@ use tokio::runtime::Runtime;
|
||||
pub use sc_cli::{VersionInfo, IntoExit, error};
|
||||
use sc_cli::{display_role, informant, parse_and_prepare, ParseAndPrepare, NoCustom};
|
||||
use sc_service::{AbstractService, Roles as ServiceRoles, Configuration};
|
||||
use aura_primitives::sr25519::{AuthorityPair as AuraPair};
|
||||
use sp_consensus_aura::sr25519::{AuthorityPair as AuraPair};
|
||||
use crate::chain_spec;
|
||||
use log::info;
|
||||
|
||||
|
||||
@@ -3,21 +3,21 @@
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use sc_client::LongestChain;
|
||||
use runtime::{self, GenesisConfig, opaque::Block, RuntimeApi};
|
||||
use node_template_runtime::{self, GenesisConfig, opaque::Block, RuntimeApi};
|
||||
use sc_service::{error::{Error as ServiceError}, AbstractService, Configuration, ServiceBuilder};
|
||||
use inherents::InherentDataProviders;
|
||||
use network::{construct_simple_protocol};
|
||||
use sp_inherents::InherentDataProviders;
|
||||
use sc_network::{construct_simple_protocol};
|
||||
use sc_executor::native_executor_instance;
|
||||
pub use sc_executor::NativeExecutor;
|
||||
use aura_primitives::sr25519::{AuthorityPair as AuraPair};
|
||||
use sp_consensus_aura::sr25519::{AuthorityPair as AuraPair};
|
||||
use grandpa::{self, FinalityProofProvider as GrandpaFinalityProofProvider};
|
||||
use basic_authorship;
|
||||
use sc_basic_authority;
|
||||
|
||||
// Our native executor instance.
|
||||
native_executor_instance!(
|
||||
pub Executor,
|
||||
runtime::api::dispatch,
|
||||
runtime::native_version,
|
||||
node_template_runtime::api::dispatch,
|
||||
node_template_runtime::native_version,
|
||||
);
|
||||
|
||||
construct_simple_protocol! {
|
||||
@@ -32,19 +32,19 @@ construct_simple_protocol! {
|
||||
macro_rules! new_full_start {
|
||||
($config:expr) => {{
|
||||
let mut import_setup = None;
|
||||
let inherent_data_providers = inherents::InherentDataProviders::new();
|
||||
let inherent_data_providers = sp_inherents::InherentDataProviders::new();
|
||||
|
||||
let builder = sc_service::ServiceBuilder::new_full::<
|
||||
runtime::opaque::Block, runtime::RuntimeApi, crate::service::Executor
|
||||
node_template_runtime::opaque::Block, node_template_runtime::RuntimeApi, crate::service::Executor
|
||||
>($config)?
|
||||
.with_select_chain(|_config, backend| {
|
||||
Ok(sc_client::LongestChain::new(backend.clone()))
|
||||
})?
|
||||
.with_transaction_pool(|config, client, _fetcher| {
|
||||
let pool_api = txpool::FullChainApi::new(client.clone());
|
||||
let pool = txpool::BasicPool::new(config, pool_api);
|
||||
let maintainer = txpool::FullBasicPoolMaintainer::new(pool.pool().clone(), client);
|
||||
let maintainable_pool = txpool_api::MaintainableTransactionPool::new(pool, maintainer);
|
||||
let pool_api = sc_transaction_pool::FullChainApi::new(client.clone());
|
||||
let pool = sc_transaction_pool::BasicPool::new(config, pool_api);
|
||||
let maintainer = sc_transaction_pool::FullBasicPoolMaintainer::new(pool.pool().clone(), client);
|
||||
let maintainable_pool = sp_transaction_pool::MaintainableTransactionPool::new(pool, maintainer);
|
||||
Ok(maintainable_pool)
|
||||
})?
|
||||
.with_import_queue(|_config, client, mut select_chain, transaction_pool| {
|
||||
@@ -52,12 +52,12 @@ macro_rules! new_full_start {
|
||||
.ok_or_else(|| sc_service::Error::SelectChainRequired)?;
|
||||
|
||||
let (grandpa_block_import, grandpa_link) =
|
||||
grandpa::block_import::<_, _, _, runtime::RuntimeApi, _>(
|
||||
grandpa::block_import::<_, _, _, node_template_runtime::RuntimeApi, _>(
|
||||
client.clone(), &*client, select_chain
|
||||
)?;
|
||||
|
||||
let import_queue = aura::import_queue::<_, _, AuraPair, _>(
|
||||
aura::SlotDuration::get_or_compute(&*client)?,
|
||||
let import_queue = sc_consensus_aura::import_queue::<_, _, AuraPair, _>(
|
||||
sc_consensus_aura::SlotDuration::get_or_compute(&*client)?,
|
||||
Box::new(grandpa_block_import.clone()),
|
||||
Some(Box::new(grandpa_block_import.clone())),
|
||||
None,
|
||||
@@ -102,7 +102,7 @@ pub fn new_full<C: Send + Default + 'static>(config: Configuration<C, GenesisCon
|
||||
.build()?;
|
||||
|
||||
if participates_in_consensus {
|
||||
let proposer = basic_authorship::ProposerFactory {
|
||||
let proposer = sc_basic_authority::ProposerFactory {
|
||||
client: service.client(),
|
||||
transaction_pool: service.transaction_pool(),
|
||||
};
|
||||
@@ -112,10 +112,10 @@ pub fn new_full<C: Send + Default + 'static>(config: Configuration<C, GenesisCon
|
||||
.ok_or(ServiceError::SelectChainRequired)?;
|
||||
|
||||
let can_author_with =
|
||||
consensus_common::CanAuthorWithNativeVersion::new(client.executor().clone());
|
||||
sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone());
|
||||
|
||||
let aura = aura::start_aura::<_, _, _, _, _, AuraPair, _, _, _, _>(
|
||||
aura::SlotDuration::get_or_compute(&*client)?,
|
||||
let aura = sc_consensus_aura::start_aura::<_, _, _, _, _, AuraPair, _, _, _, _>(
|
||||
sc_consensus_aura::SlotDuration::get_or_compute(&*client)?,
|
||||
client,
|
||||
select_chain,
|
||||
block_import,
|
||||
@@ -203,10 +203,10 @@ pub fn new_light<C: Send + Default + 'static>(config: Configuration<C, GenesisCo
|
||||
.with_transaction_pool(|config, client, fetcher| {
|
||||
let fetcher = fetcher
|
||||
.ok_or_else(|| "Trying to start light transaction pool without active fetcher")?;
|
||||
let pool_api = txpool::LightChainApi::new(client.clone(), fetcher.clone());
|
||||
let pool = txpool::BasicPool::new(config, pool_api);
|
||||
let maintainer = txpool::LightBasicPoolMaintainer::with_defaults(pool.pool().clone(), client, fetcher);
|
||||
let maintainable_pool = txpool_api::MaintainableTransactionPool::new(pool, maintainer);
|
||||
let pool_api = sc_transaction_pool::LightChainApi::new(client.clone(), fetcher.clone());
|
||||
let pool = sc_transaction_pool::BasicPool::new(config, pool_api);
|
||||
let maintainer = sc_transaction_pool::LightBasicPoolMaintainer::with_defaults(pool.pool().clone(), client, fetcher);
|
||||
let maintainable_pool = sp_transaction_pool::MaintainableTransactionPool::new(pool, maintainer);
|
||||
Ok(maintainable_pool)
|
||||
})?
|
||||
.with_import_queue_and_fprb(|_config, client, backend, fetcher, _select_chain, _tx_pool| {
|
||||
@@ -220,8 +220,8 @@ pub fn new_light<C: Send + Default + 'static>(config: Configuration<C, GenesisCo
|
||||
let finality_proof_request_builder =
|
||||
finality_proof_import.create_finality_proof_request_builder();
|
||||
|
||||
let import_queue = aura::import_queue::<_, _, AuraPair, ()>(
|
||||
aura::SlotDuration::get_or_compute(&*client)?,
|
||||
let import_queue = sc_consensus_aura::import_queue::<_, _, AuraPair, ()>(
|
||||
sc_consensus_aura::SlotDuration::get_or_compute(&*client)?,
|
||||
Box::new(grandpa_block_import),
|
||||
None,
|
||||
Some(Box::new(finality_proof_import)),
|
||||
|
||||
Reference in New Issue
Block a user