[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
@@ -1,4 +1,4 @@
use support::construct_runtime;
use frame_support::construct_runtime;
construct_runtime! {
pub enum Runtime where
@@ -1,4 +1,4 @@
use support::construct_runtime;
use frame_support::construct_runtime;
construct_runtime! {
pub enum Runtime where
@@ -1,4 +1,4 @@
use support::construct_runtime;
use frame_support::construct_runtime;
construct_runtime! {
pub enum Runtime where
@@ -1,4 +1,4 @@
use support::construct_runtime;
use frame_support::construct_runtime;
construct_runtime! {
pub enum Runtime where
@@ -1,4 +1,4 @@
use support::construct_runtime;
use frame_support::construct_runtime;
construct_runtime! {
pub enum Runtime where
@@ -1,4 +1,4 @@
use support::construct_runtime;
use frame_support::construct_runtime;
construct_runtime! {
pub enum Runtime where
@@ -1,4 +1,4 @@
use support::construct_runtime;
use frame_support::construct_runtime;
construct_runtime! {
pub enum Runtime where
@@ -1,4 +1,4 @@
use support::construct_runtime;
use frame_support::construct_runtime;
construct_runtime! {
pub enum Runtime where
@@ -1,4 +1,4 @@
use support::construct_runtime;
use frame_support::construct_runtime;
construct_runtime! {
pub enum Runtime where
@@ -1,4 +1,4 @@
use support::construct_runtime;
use frame_support::construct_runtime;
construct_runtime! {
pub enum Runtime where
@@ -1,4 +1,4 @@
use support::construct_runtime;
use frame_support::construct_runtime;
construct_runtime! {
pub enum Runtime where
@@ -1,4 +1,4 @@
use support::construct_runtime;
use frame_support::construct_runtime;
construct_runtime! {
pub enum Runtime where
@@ -1,4 +1,4 @@
use support::construct_runtime;
use frame_support::construct_runtime;
construct_runtime! {
pub enum Runtime where
@@ -1,4 +1,4 @@
use support::construct_runtime;
use frame_support::construct_runtime;
construct_runtime! {
pub enum Runtime {}
@@ -1,4 +1,4 @@
use support::construct_runtime;
use frame_support::construct_runtime;
construct_runtime! {
pub enum Runtime where
@@ -1,4 +1,4 @@
use support::construct_runtime;
use frame_support::construct_runtime;
construct_runtime! {
pub enum Runtime where
@@ -1,4 +1,4 @@
use support::construct_runtime;
use frame_support::construct_runtime;
construct_runtime! {
pub enum Runtime where
@@ -18,12 +18,12 @@
// Do not complain about unused `dispatch` and `dispatch_aux`.
#[allow(dead_code)]
mod tests {
use support::metadata::*;
use frame_support::metadata::*;
use sp_io::TestExternalities;
use std::marker::PhantomData;
use codec::{Encode, Decode, EncodeLike};
support::decl_module! {
frame_support::decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin {}
}
@@ -32,7 +32,7 @@ mod tests {
type BlockNumber;
}
support::decl_storage! {
frame_support::decl_storage! {
trait Store for Module<T: Trait> as TestStorage {
// non-getters: pub / $default
@@ -478,13 +478,13 @@ mod test2 {
type BlockNumber;
}
support::decl_module! {
frame_support::decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin {}
}
type PairOf<T> = (T, T);
support::decl_storage! {
frame_support::decl_storage! {
trait Store for Module<T: Trait> as TestStorage {
SingleDef : u32;
PairDef : PairOf<u32>;
@@ -513,10 +513,10 @@ mod test3 {
type Origin;
type BlockNumber;
}
support::decl_module! {
frame_support::decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin {}
}
support::decl_storage! {
frame_support::decl_storage! {
trait Store for Module<T: Trait> as Test {
Foo get(fn foo) config(initial_foo): u32;
}
@@ -543,14 +543,14 @@ mod test_append_and_len {
type BlockNumber;
}
support::decl_module! {
frame_support::decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin {}
}
#[derive(PartialEq, Eq, Clone, Encode, Decode)]
struct NoDef(u32);
support::decl_storage! {
frame_support::decl_storage! {
trait Store for Module<T: Trait> as Test {
NoDefault: Option<NoDef>;
@@ -19,11 +19,11 @@ pub trait Trait {
type BlockNumber: codec::Codec + codec::EncodeLike + Default + Clone;
}
support::decl_module! {
frame_support::decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin {}
}
support::decl_storage!{
frame_support::decl_storage!{
trait Store for Module<T: Trait> as FinalKeysNone {
pub Value config(value): u32;
pub Value2 config(value): u32;
@@ -19,11 +19,11 @@ pub trait Trait {
type BlockNumber: codec::Codec + codec::EncodeLike + Default + Clone;
}
support::decl_module! {
frame_support::decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin {}
}
support::decl_storage!{
frame_support::decl_storage!{
trait Store for Module<T: Trait> as FinalKeysNone {
pub Value get(fn value) config(): u32;
pub Value2 config(value): u32;
@@ -19,11 +19,11 @@ pub trait Trait {
type BlockNumber: codec::Codec + codec::EncodeLike + Default + Clone;
}
support::decl_module! {
frame_support::decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin {}
}
support::decl_storage!{
frame_support::decl_storage!{
trait Store for Module<T: Trait> as FinalKeysNone {
pub Value get(fn value) config(): u32;
pub Value2 get(fn value) config(): u32;
@@ -14,9 +14,9 @@
// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
use support::storage::unhashed;
use frame_support::storage::unhashed;
use codec::Encode;
use support::{StorageDoubleMap, StorageLinkedMap, StorageMap, StorageValue, StoragePrefixedMap};
use frame_support::{StorageDoubleMap, StorageLinkedMap, StorageMap, StorageValue, StoragePrefixedMap};
use sp_io::{TestExternalities, hashing::{twox_128, blake2_128, blake2_256}};
mod no_instance {
@@ -27,11 +27,11 @@ mod no_instance {
type BlockNumber: Encode + Decode + EncodeLike + Default + Clone;
}
support::decl_module! {
frame_support::decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin {}
}
support::decl_storage!{
frame_support::decl_storage!{
trait Store for Module<T: Trait> as FinalKeysNone {
pub Value config(value): u32;
@@ -54,12 +54,12 @@ mod no_instance {
mod instance {
pub trait Trait<I = DefaultInstance>: super::no_instance::Trait {}
support::decl_module! {
frame_support::decl_module! {
pub struct Module<T: Trait<I>, I: Instantiable = DefaultInstance>
for enum Call where origin: T::Origin {}
}
support::decl_storage!{
frame_support::decl_storage!{
trait Store for Module<T: Trait<I>, I: Instantiable = DefaultInstance>
as FinalKeysSome
{
@@ -19,11 +19,11 @@ pub trait Trait {
type Origin;
}
support::decl_module! {
frame_support::decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin {}
}
support::decl_storage! {
frame_support::decl_storage! {
trait Store for Module<T: Trait> as Example {
pub AppendableDM config(t): double_map u32, blake2_256(T::BlockNumber) => Vec<u32>;
}
+15 -15
View File
@@ -17,7 +17,7 @@
#![recursion_limit="128"]
use sp_runtime::{generic, BuildStorage, traits::{BlakeTwo256, Block as _, Verify}};
use support::{
use frame_support::{
Parameter, traits::Get, parameter_types,
metadata::{
DecodeDifferent, StorageMetadata, StorageEntryModifier, StorageEntryType, DefaultByteGetter,
@@ -25,8 +25,8 @@ use support::{
},
StorageValue, StorageMap, StorageLinkedMap, StorageDoubleMap,
};
use inherents::{ProvideInherent, InherentData, InherentIdentifier, MakeFatalError};
use primitives::{H256, sr25519};
use sp_inherents::{ProvideInherent, InherentData, InherentIdentifier, MakeFatalError};
use sp_core::{H256, sr25519};
mod system;
@@ -46,7 +46,7 @@ mod module1 {
type GenericType: Default + Clone + codec::Codec + codec::EncodeLike;
}
support::decl_module! {
frame_support::decl_module! {
pub struct Module<T: Trait<I>, I: InstantiableThing> for enum Call where
origin: <T as system::Trait>::Origin,
T::BlockNumber: From<u32>
@@ -62,7 +62,7 @@ mod module1 {
}
}
support::decl_storage! {
frame_support::decl_storage! {
trait Store for Module<T: Trait<I>, I: InstantiableThing> as Module1 where
T::BlockNumber: From<u32> + std::fmt::Display
{
@@ -79,7 +79,7 @@ mod module1 {
}
}
support::decl_event! {
frame_support::decl_event! {
pub enum Event<T, I> where Phantom = std::marker::PhantomData<T> {
_Phantom(Phantom),
AnotherVariant(u32),
@@ -98,7 +98,7 @@ mod module1 {
T::BlockNumber: From<u32>
{
type Call = Call<T, I>;
type Error = MakeFatalError<inherents::Error>;
type Error = MakeFatalError<sp_inherents::Error>;
const INHERENT_IDENTIFIER: InherentIdentifier = INHERENT_IDENTIFIER;
fn create_inherent(_data: &InherentData) -> Option<Self::Call> {
@@ -125,7 +125,7 @@ mod module2 {
impl<T: Trait<I>, I: Instance> Currency for Module<T, I> {}
support::decl_module! {
frame_support::decl_module! {
pub struct Module<T: Trait<I>, I: Instance=DefaultInstance> for enum Call where
origin: <T as system::Trait>::Origin
{
@@ -133,7 +133,7 @@ mod module2 {
}
}
support::decl_storage! {
frame_support::decl_storage! {
trait Store for Module<T: Trait<I>, I: Instance=DefaultInstance> as Module2 {
pub Value config(value): T::Amount;
pub Map config(map): map u64 => u64;
@@ -142,7 +142,7 @@ mod module2 {
}
}
support::decl_event! {
frame_support::decl_event! {
pub enum Event<T, I=DefaultInstance> where Amount = <T as Trait<I>>::Amount {
Variant(Amount),
}
@@ -158,7 +158,7 @@ mod module2 {
impl<T: Trait<I>, I: Instance> ProvideInherent for Module<T, I> {
type Call = Call<T, I>;
type Error = MakeFatalError<inherents::Error>;
type Error = MakeFatalError<sp_inherents::Error>;
const INHERENT_IDENTIFIER: InherentIdentifier = INHERENT_IDENTIFIER;
fn create_inherent(_data: &InherentData) -> Option<Self::Call> {
@@ -181,7 +181,7 @@ mod module3 {
type Currency2: Currency;
}
support::decl_module! {
frame_support::decl_module! {
pub struct Module<T: Trait> for enum Call where origin: <T as system::Trait>::Origin {}
}
}
@@ -240,7 +240,7 @@ impl system::Trait for Runtime {
type Event = Event;
}
support::construct_runtime!(
frame_support::construct_runtime!(
pub enum Runtime where
Block = Block,
NodeBlock = Block,
@@ -300,11 +300,11 @@ fn new_test_ext() -> sp_io::TestExternalities {
#[test]
fn storage_instance_independance() {
let mut storage = primitives::storage::Storage {
let mut storage = sp_core::storage::Storage {
top: std::collections::BTreeMap::new(),
children: std::collections::HashMap::new()
};
state_machine::BasicExternalities::execute_with_storage(&mut storage, || {
sp_state_machine::BasicExternalities::execute_with_storage(&mut storage, || {
module2::Value::<Runtime>::put(0);
module2::Value::<Runtime, module2::Instance1>::put(0);
module2::Value::<Runtime, module2::Instance2>::put(0);
@@ -14,10 +14,10 @@
// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
use support::sp_runtime::generic;
use support::sp_runtime::traits::{BlakeTwo256, Block as _, Verify};
use support::codec::{Encode, Decode};
use primitives::{H256, sr25519};
use frame_support::sp_runtime::generic;
use frame_support::sp_runtime::traits::{BlakeTwo256, Block as _, Verify};
use frame_support::codec::{Encode, Decode};
use sp_core::{H256, sr25519};
use serde::{Serialize, Deserialize};
mod system;
@@ -82,7 +82,7 @@ mod module {
pub trait Trait: system::Trait {}
support::decl_module! {
frame_support::decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin {}
}
@@ -99,7 +99,7 @@ mod module {
}
}
support::decl_storage! {
frame_support::decl_storage! {
trait Store for Module<T: Trait> as Actors {
/// requirements to enter and maintain status in roles
pub Parameters get(fn parameters) build(|config: &GenesisConfig| {
@@ -164,7 +164,7 @@ impl system::Trait for Runtime {
impl module::Trait for Runtime {}
support::construct_runtime!(
frame_support::construct_runtime!(
pub enum Runtime where
Block = Block,
NodeBlock = Block,
@@ -2,7 +2,7 @@ macro_rules! reserved {
($($reserved:ident)*) => {
$(
mod $reserved {
pub use support::dispatch;
pub use frame_support::dispatch;
pub trait Trait {
type Origin;
@@ -10,14 +10,14 @@ macro_rules! reserved {
}
pub mod system {
use support::dispatch;
use frame_support::dispatch;
pub fn ensure_root<R>(_: R) -> dispatch::Result {
Ok(())
}
}
support::decl_module! {
frame_support::decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
fn $reserved(_origin) -> dispatch::Result { unreachable!() }
}
+4 -4
View File
@@ -1,4 +1,4 @@
use support::codec::{Encode, Decode, EncodeLike};
use frame_support::codec::{Encode, Decode, EncodeLike};
pub trait Trait: 'static + Eq + Clone {
type Origin: Into<Result<RawOrigin<Self::AccountId>, Self::Origin>>
@@ -10,7 +10,7 @@ pub trait Trait: 'static + Eq + Clone {
type Event: From<Event>;
}
support::decl_module! {
frame_support::decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
}
}
@@ -20,14 +20,14 @@ impl<T: Trait> Module<T> {
}
}
support::decl_event!(
frame_support::decl_event!(
pub enum Event {
ExtrinsicSuccess,
ExtrinsicFailed,
}
);
support::decl_error! {
frame_support::decl_error! {
pub enum Error {
/// Test error documentation
TestError,