[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:
Tomasz Drwięga
2019-12-16 13:36:49 +01:00
committed by Gavin Wood
parent f14d98a439
commit 8778ca7dc8
485 changed files with 4023 additions and 4005 deletions
+32 -33
View File
@@ -25,9 +25,8 @@ pub mod system;
use sp_std::{prelude::*, marker::PhantomData};
use codec::{Encode, Decode, Input, Error};
use primitives::{Blake2Hasher, OpaqueMetadata, RuntimeDebug};
use app_crypto::{ed25519, sr25519, RuntimeAppPublic};
pub use app_crypto;
use sp_core::{Blake2Hasher, OpaqueMetadata, RuntimeDebug};
use sp_application_crypto::{ed25519, sr25519, RuntimeAppPublic};
use trie_db::{TrieMut, Trie};
use sp_trie::PrefixedMemoryDB;
use sp_trie::trie_types::{TrieDB, TrieDBMut};
@@ -43,18 +42,18 @@ use sp_runtime::{
GetNodeBlockType, GetRuntimeBlockType, Verify, IdentityLookup,
},
};
use runtime_version::RuntimeVersion;
pub use primitives::{hash::H256};
use sp_version::RuntimeVersion;
pub use sp_core::{hash::H256};
#[cfg(any(feature = "std", test))]
use runtime_version::NativeVersion;
use runtime_support::{impl_outer_origin, parameter_types, weights::Weight};
use inherents::{CheckInherentsResult, InherentData};
use sp_version::NativeVersion;
use frame_support::{impl_outer_origin, parameter_types, weights::Weight};
use sp_inherents::{CheckInherentsResult, InherentData};
use cfg_if::cfg_if;
use primitives::storage::ChildType;
use sp_core::storage::ChildType;
// Ensure Babe and Aura use the same crypto to simplify things a bit.
pub use babe_primitives::AuthorityId;
pub type AuraId = aura_primitives::sr25519::AuthorityId;
pub use sp_consensus_babe::AuthorityId;
pub type AuraId = sp_consensus_aura::sr25519::AuthorityId;
// Inlucde the WASM binary
#[cfg(feature = "std")]
@@ -96,7 +95,7 @@ impl Transfer {
/// Convert into a signed extrinsic.
#[cfg(feature = "std")]
pub fn into_signed_tx(self) -> Extrinsic {
let signature = keyring::AccountKeyring::from_public(&self.from)
let signature = sp_keyring::AccountKeyring::from_public(&self.from)
.expect("Creates keyring from public key.").sign(&self.encode()).into();
Extrinsic::Transfer(self, signature)
}
@@ -195,8 +194,8 @@ pub fn run_tests(mut input: &[u8]) -> Vec<u8> {
}
/// Changes trie configuration (optionally) used in tests.
pub fn changes_trie_config() -> primitives::ChangesTrieConfiguration {
primitives::ChangesTrieConfiguration {
pub fn changes_trie_config() -> sp_core::ChangesTrieConfiguration {
sp_core::ChangesTrieConfiguration {
digest_interval: 4,
digest_levels: 2,
}
@@ -406,8 +405,8 @@ fn benchmark_add_one(i: u64) -> u64 {
/// The `benchmark_add_one` function as function pointer.
#[cfg(not(feature = "std"))]
static BENCHMARK_ADD_ONE: runtime_interface::wasm::ExchangeableFunction<fn(u64) -> u64> =
runtime_interface::wasm::ExchangeableFunction::new(benchmark_add_one);
static BENCHMARK_ADD_ONE: sp_runtime_interface::wasm::ExchangeableFunction<fn(u64) -> u64> =
sp_runtime_interface::wasm::ExchangeableFunction::new(benchmark_add_one);
fn code_using_trie() -> u64 {
let pairs = [
@@ -494,7 +493,7 @@ cfg_if! {
}
}
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 {
system::execute_transaction(extrinsic)
}
@@ -598,7 +597,7 @@ cfg_if! {
}
}
impl aura_primitives::AuraApi<Block, AuraId> for Runtime {
impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
fn slot_duration() -> u64 { 1000 }
fn authorities() -> Vec<AuraId> {
system::authorities().into_iter().map(|a| {
@@ -608,9 +607,9 @@ cfg_if! {
}
}
impl babe_primitives::BabeApi<Block> for Runtime {
fn configuration() -> babe_primitives::BabeConfiguration {
babe_primitives::BabeConfiguration {
impl sp_consensus_babe::BabeApi<Block> for Runtime {
fn configuration() -> sp_consensus_babe::BabeConfiguration {
sp_consensus_babe::BabeConfiguration {
slot_duration: 1000,
epoch_length: EpochDuration::get(),
c: (3, 10),
@@ -622,14 +621,14 @@ cfg_if! {
}
}
impl offchain_primitives::OffchainWorkerApi<Block> for Runtime {
impl sp_offchain::OffchainWorkerApi<Block> for Runtime {
fn offchain_worker(block: u64) {
let ex = Extrinsic::IncludeData(block.encode());
sp_io::offchain::submit_transaction(ex.encode()).unwrap();
}
}
impl session::SessionKeys<Block> for Runtime {
impl sp_session::SessionKeys<Block> for Runtime {
fn generate_session_keys(_: Option<Vec<u8>>) -> Vec<u8> {
SessionKeys::generate(None)
}
@@ -679,7 +678,7 @@ cfg_if! {
}
}
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 {
system::execute_transaction(extrinsic)
}
@@ -814,7 +813,7 @@ cfg_if! {
}
}
impl aura_primitives::AuraApi<Block, AuraId> for Runtime {
impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
fn slot_duration() -> u64 { 1000 }
fn authorities() -> Vec<AuraId> {
system::authorities().into_iter().map(|a| {
@@ -824,9 +823,9 @@ cfg_if! {
}
}
impl babe_primitives::BabeApi<Block> for Runtime {
fn configuration() -> babe_primitives::BabeConfiguration {
babe_primitives::BabeConfiguration {
impl sp_consensus_babe::BabeApi<Block> for Runtime {
fn configuration() -> sp_consensus_babe::BabeConfiguration {
sp_consensus_babe::BabeConfiguration {
slot_duration: 1000,
epoch_length: EpochDuration::get(),
c: (3, 10),
@@ -838,14 +837,14 @@ cfg_if! {
}
}
impl offchain_primitives::OffchainWorkerApi<Block> for Runtime {
impl sp_offchain::OffchainWorkerApi<Block> for Runtime {
fn offchain_worker(block: u64) {
let ex = Extrinsic::IncludeData(block.encode());
sp_io::offchain::submit_transaction(ex.encode()).unwrap()
}
}
impl session::SessionKeys<Block> for Runtime {
impl sp_session::SessionKeys<Block> for Runtime {
fn generate_session_keys(_: Option<Vec<u8>>) -> Vec<u8> {
SessionKeys::generate(None)
}
@@ -950,7 +949,7 @@ fn test_read_child_storage() {
mod tests {
use substrate_test_runtime_client::{
prelude::*,
consensus::BlockOrigin,
sp_consensus::BlockOrigin,
DefaultTestClientBuilderExt, TestClientBuilder,
runtime::TestAPI,
};
@@ -958,8 +957,8 @@ mod tests {
generic::BlockId,
traits::ProvideRuntimeApi,
};
use primitives::storage::well_known_keys::HEAP_PAGES;
use state_machine::ExecutionStrategy;
use sp_core::storage::well_known_keys::HEAP_PAGES;
use sp_state_machine::ExecutionStrategy;
use codec::Encode;
#[test]