[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
+17 -17
View File
@@ -22,18 +22,18 @@
use sp_std::{result, prelude::*};
use sp_std::collections::btree_set::BTreeSet;
use support::{decl_module, decl_storage, dispatch, ensure};
use support::traits::{FindAuthor, VerifySeal, Get};
use frame_support::{decl_module, decl_storage, dispatch, ensure};
use frame_support::traits::{FindAuthor, VerifySeal, Get};
use codec::{Encode, Decode};
use system::ensure_none;
use frame_system::ensure_none;
use sp_runtime::traits::{Header as HeaderT, One, Zero};
use support::weights::SimpleDispatchInfo;
use inherents::{InherentIdentifier, ProvideInherent, InherentData};
use frame_support::weights::SimpleDispatchInfo;
use sp_inherents::{InherentIdentifier, ProvideInherent, InherentData};
use sp_authorship::{INHERENT_IDENTIFIER, UnclesInherentData, InherentError};
const MAX_UNCLES: usize = 10;
pub trait Trait: system::Trait {
pub trait Trait: frame_system::Trait {
/// Find the author of a block.
type FindAuthor: FindAuthor<Self::AccountId>;
/// The number of blocks back we should accept uncles.
@@ -209,7 +209,7 @@ impl<T: Trait> Module<T> {
return author;
}
let digest = <system::Module<T>>::digest();
let digest = <frame_system::Module<T>>::digest();
let pre_runtime_digests = digest.logs.iter().filter_map(|d| d.as_pre_runtime());
if let Some(author) = T::FindAuthor::find_author(pre_runtime_digests) {
<Self as Store>::Author::put(&author);
@@ -220,7 +220,7 @@ impl<T: Trait> Module<T> {
}
fn verify_and_import_uncles(new_uncles: Vec<T::Header>) -> dispatch::Result {
let now = <system::Module<T>>::block_number();
let now = <frame_system::Module<T>>::block_number();
let mut uncles = <Self as Store>::Uncles::get();
uncles.push(UncleEntryItem::InclusionHeight(now));
@@ -253,7 +253,7 @@ impl<T: Trait> Module<T> {
accumulator: &mut <T::FilterUncle as FilterUncle<T::Header, T::AccountId>>::Accumulator,
) -> Result<Option<T::AccountId>, &'static str>
{
let now = <system::Module<T>>::block_number();
let now = <frame_system::Module<T>>::block_number();
let (minimum_height, maximum_height) = {
let uncle_generations = T::UncleGenerations::get();
@@ -278,7 +278,7 @@ impl<T: Trait> Module<T> {
{
let parent_number = uncle.number().clone() - One::one();
let parent_hash = <system::Module<T>>::block_hash(&parent_number);
let parent_hash = <frame_system::Module<T>>::block_hash(&parent_number);
if &parent_hash != uncle.parent_hash() {
return Err("uncle parent not in chain");
}
@@ -289,7 +289,7 @@ impl<T: Trait> Module<T> {
}
let duplicate = existing_uncles.into_iter().find(|h| **h == hash).is_some();
let in_chain = <system::Module<T>>::block_hash(uncle.number()) == hash;
let in_chain = <frame_system::Module<T>>::block_hash(uncle.number()) == hash;
if duplicate || in_chain {
return Err("uncle already included")
@@ -372,14 +372,14 @@ impl<T: Trait> ProvideInherent for Module<T> {
#[cfg(test)]
mod tests {
use super::*;
use primitives::H256;
use sp_core::H256;
use sp_runtime::{
traits::{BlakeTwo256, IdentityLookup}, testing::Header, generic::DigestItem, Perbill,
};
use support::{parameter_types, impl_outer_origin, ConsensusEngineId, weights::Weight};
use frame_support::{parameter_types, impl_outer_origin, ConsensusEngineId, weights::Weight};
impl_outer_origin!{
pub enum Origin for Test {}
pub enum Origin for Test where system = frame_system {}
}
#[derive(Clone, Eq, PartialEq)]
@@ -392,7 +392,7 @@ mod tests {
pub const AvailableBlockRatio: Perbill = Perbill::one();
}
impl system::Trait for Test {
impl frame_system::Trait for Test {
type Origin = Origin;
type Index = u64;
type BlockNumber = u64;
@@ -421,7 +421,7 @@ mod tests {
type EventHandler = ();
}
type System = system::Module<Test>;
type System = frame_system::Module<Test>;
type Authorship = Module<Test>;
const TEST_ID: ConsensusEngineId = [1, 2, 3, 4];
@@ -493,7 +493,7 @@ mod tests {
}
fn new_test_ext() -> sp_io::TestExternalities {
let t = system::GenesisConfig::default().build_storage::<Test>().unwrap();
let t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
t.into()
}