mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 10:31:04 +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
@@ -12,13 +12,13 @@ frame-metadata = { path = "../metadata", default-features = false }
|
||||
sp-std = { path = "../../primitives/std", default-features = false }
|
||||
sp-io ={ path = "../../primitives/io", default-features = false }
|
||||
sp-runtime = { path = "../../primitives/runtime", default-features = false }
|
||||
primitives = { package = "sp-core", path = "../../primitives/core", default-features = false }
|
||||
sp-core = { path = "../../primitives/core", default-features = false }
|
||||
sp-arithmetic = { path = "../../primitives/arithmetic", default-features = false }
|
||||
inherents = { package = "sp-inherents", path = "../../primitives/inherents", default-features = false }
|
||||
frame-support-procedural = { package = "frame-support-procedural", path = "./procedural" }
|
||||
sp-inherents = { path = "../../primitives/inherents", default-features = false }
|
||||
frame-support-procedural = { path = "./procedural" }
|
||||
paste = "0.1.6"
|
||||
once_cell = { version = "0.2.4", default-features = false, optional = true }
|
||||
state-machine = { package = "sp-state-machine", path = "../../primitives/state-machine", optional = true }
|
||||
sp-state-machine = { path = "../../primitives/state-machine", optional = true }
|
||||
bitmask = { version = "0.5.0", default-features = false }
|
||||
impl-trait-for-tuples = "0.1.3"
|
||||
tracing = { version = "0.1.10", optional = true }
|
||||
@@ -40,8 +40,8 @@ std = [
|
||||
"sp-runtime/std",
|
||||
"sp-arithmetic/std",
|
||||
"frame-metadata/std",
|
||||
"inherents/std",
|
||||
"state-machine",
|
||||
"sp-inherents/std",
|
||||
"sp-state-machine",
|
||||
]
|
||||
nightly = []
|
||||
strict = []
|
||||
|
||||
@@ -8,7 +8,7 @@ edition = "2018"
|
||||
proc-macro = true
|
||||
|
||||
[dependencies]
|
||||
frame-support-procedural-tools = { package = "frame-support-procedural-tools", path = "./tools" }
|
||||
frame-support-procedural-tools = { path = "./tools" }
|
||||
|
||||
proc-macro2 = "1.0.6"
|
||||
quote = "1.0.2"
|
||||
|
||||
@@ -79,7 +79,7 @@ fn construct_runtime_parsed(definition: RuntimeDefinition) -> Result<TokenStream
|
||||
&scrate,
|
||||
DeclOuterKind::Origin,
|
||||
)?;
|
||||
let all_modules = decl_all_modules(&name, all_but_system_modules);
|
||||
let all_modules = decl_all_modules(&name, &system_module, all_but_system_modules);
|
||||
|
||||
let dispatch = decl_outer_dispatch(&name, modules.iter(), &scrate);
|
||||
let metadata = decl_runtime_metadata(&name, modules.iter(), &scrate);
|
||||
@@ -308,6 +308,7 @@ fn decl_outer_event_or_origin<'a>(
|
||||
|
||||
fn decl_all_modules<'a>(
|
||||
runtime: &'a Ident,
|
||||
system_name: &'a Ident,
|
||||
module_declarations: impl Iterator<Item = &'a ModuleDeclaration>,
|
||||
) -> TokenStream2 {
|
||||
let mut types = TokenStream2::new();
|
||||
@@ -335,7 +336,7 @@ fn decl_all_modules<'a>(
|
||||
);
|
||||
|
||||
quote!(
|
||||
pub type System = system::Module<#runtime>;
|
||||
pub type System = #system_name::Module<#runtime>;
|
||||
#types
|
||||
type AllModules = ( #all_modules );
|
||||
)
|
||||
|
||||
@@ -243,7 +243,7 @@ impl ModuleDeclaration {
|
||||
.collect();
|
||||
res.extend(
|
||||
["Event", "Config"]
|
||||
.into_iter()
|
||||
.iter()
|
||||
.map(|name| ModulePart::with_generics(name, span)),
|
||||
);
|
||||
res
|
||||
@@ -345,7 +345,7 @@ impl ModulePart {
|
||||
|
||||
pub fn is_included_in_default(&self) -> bool {
|
||||
["Module", "Call", "Storage", "Event", "Config"]
|
||||
.into_iter()
|
||||
.iter()
|
||||
.any(|name| self.name == name)
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
frame-support-procedural-tools-derive = { package = "frame-support-procedural-tools-derive", path = "./derive" }
|
||||
frame-support-procedural-tools-derive = { path = "./derive" }
|
||||
proc-macro2 = "1.0.6"
|
||||
quote = "1.0.2"
|
||||
syn = { version = "1.0.7", features = ["full", "visit"] }
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//! this that are described below.
|
||||
//!
|
||||
//! First component to utilize debug-printing and loggin is actually
|
||||
//! located in `primitives` crate: `primitives::RuntimeDebug`.
|
||||
//! located in `primitives` crate: `sp_core::RuntimeDebug`.
|
||||
//! This custom-derive generates `core::fmt::Debug` implementation,
|
||||
//! just like regular `derive(Debug)`, however it does not generate
|
||||
//! any code when the code is compiled to WASM. This means that
|
||||
@@ -37,7 +37,7 @@
|
||||
//! ```rust,no_run
|
||||
//! use frame_support::debug;
|
||||
//!
|
||||
//! #[derive(primitives::RuntimeDebug)]
|
||||
//! #[derive(sp_core::RuntimeDebug)]
|
||||
//! struct MyStruct {
|
||||
//! a: u64,
|
||||
//! }
|
||||
@@ -68,7 +68,7 @@
|
||||
//! ```rust,no_run
|
||||
//! use frame_support::debug::native;
|
||||
//!
|
||||
//! #[derive(primitives::RuntimeDebug)]
|
||||
//! #[derive(sp_core::RuntimeDebug)]
|
||||
//! struct MyStruct {
|
||||
//! a: u64,
|
||||
//! }
|
||||
|
||||
@@ -530,7 +530,7 @@ macro_rules! __impl_outer_event_json_metadata {
|
||||
$crate::event::OuterEventMetadata {
|
||||
name: $crate::event::DecodeDifferent::Encode(stringify!($event_name)),
|
||||
events: $crate::event::DecodeDifferent::Encode(&[
|
||||
("system", $crate::event::FnEncode(system::Event::metadata))
|
||||
("system", $crate::event::FnEncode($system::Event::metadata))
|
||||
$(
|
||||
, (
|
||||
stringify!($module_name),
|
||||
@@ -542,6 +542,7 @@ macro_rules! __impl_outer_event_json_metadata {
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn __module_events_system() -> &'static [$crate::event::EventMetadata] {
|
||||
system::Event::metadata()
|
||||
|
||||
@@ -19,7 +19,7 @@ pub use crate::sp_std::vec::Vec;
|
||||
#[doc(hidden)]
|
||||
pub use crate::sp_runtime::traits::{Block as BlockT, Extrinsic};
|
||||
#[doc(hidden)]
|
||||
pub use inherents::{InherentData, ProvideInherent, CheckInherentsResult, IsFatalError};
|
||||
pub use sp_inherents::{InherentData, ProvideInherent, CheckInherentsResult, IsFatalError};
|
||||
|
||||
|
||||
/// Implement the outer inherent.
|
||||
|
||||
@@ -39,7 +39,7 @@ pub use once_cell;
|
||||
pub use paste;
|
||||
#[cfg(feature = "std")]
|
||||
#[doc(hidden)]
|
||||
pub use state_machine::BasicExternalities;
|
||||
pub use sp_state_machine::BasicExternalities;
|
||||
#[doc(hidden)]
|
||||
pub use sp_io::storage::root as storage_root;
|
||||
#[doc(hidden)]
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
use crate::sp_std::prelude::*;
|
||||
use codec::{Codec, Encode, Decode};
|
||||
pub use primitives::storage::ChildInfo;
|
||||
pub use sp_core::storage::ChildInfo;
|
||||
|
||||
/// Return the value of the item in storage under `key`, or `None` if there is no explicit entry.
|
||||
pub fn get<T: Decode + Sized>(
|
||||
|
||||
@@ -423,7 +423,7 @@ pub trait StoragePrefixedMap<Value: FullCodec> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use primitives::hashing::twox_128;
|
||||
use sp_core::hashing::twox_128;
|
||||
use sp_io::TestExternalities;
|
||||
use crate::storage::{unhashed, StoragePrefixedMap};
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
use sp_std::{prelude::*, result, marker::PhantomData, ops::Div, fmt::Debug};
|
||||
use codec::{FullCodec, Codec, Encode, Decode};
|
||||
use primitives::u32_trait::Value as U32;
|
||||
use sp_core::u32_trait::Value as U32;
|
||||
use sp_runtime::{
|
||||
ConsensusEngineId,
|
||||
traits::{MaybeSerializeDeserialize, SimpleArithmetic, Saturating},
|
||||
|
||||
@@ -8,11 +8,11 @@ edition = "2018"
|
||||
serde = { version = "1.0.101", default-features = false, features = ["derive"] }
|
||||
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
|
||||
sp-io ={ path = "../../../primitives/io", default-features = false }
|
||||
state-machine ={ package = "sp-state-machine", path = "../../../primitives/state-machine", optional = true }
|
||||
support = { package = "frame-support", version = "2", path = "../", default-features = false }
|
||||
inherents = { package = "sp-inherents", path = "../../../primitives/inherents", default-features = false }
|
||||
sp-runtime = { package = "sp-runtime", path = "../../../primitives/runtime", default-features = false }
|
||||
primitives = { package = "sp-core", path = "../../../primitives/core", default-features = false }
|
||||
sp-state-machine = { path = "../../../primitives/state-machine", optional = true }
|
||||
frame-support = { version = "2", path = "../", default-features = false }
|
||||
sp-inherents = { path = "../../../primitives/inherents", default-features = false }
|
||||
sp-runtime = { path = "../../../primitives/runtime", default-features = false }
|
||||
sp-core = { path = "../../../primitives/core", default-features = false }
|
||||
trybuild = "1.0.17"
|
||||
pretty_assertions = "0.6.1"
|
||||
|
||||
@@ -22,9 +22,9 @@ std = [
|
||||
"serde/std",
|
||||
"codec/std",
|
||||
"sp-io/std",
|
||||
"support/std",
|
||||
"inherents/std",
|
||||
"primitives/std",
|
||||
"frame-support/std",
|
||||
"sp-inherents/std",
|
||||
"sp-core/std",
|
||||
"sp-runtime/std",
|
||||
"state-machine",
|
||||
"sp-state-machine",
|
||||
]
|
||||
|
||||
@@ -14,5 +14,5 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Test crate for frame_support. Allow to make use of `support::decl_storage`.
|
||||
//! Test crate for frame_support. Allow to make use of `frame_support::decl_storage`.
|
||||
//! See tests directory.
|
||||
|
||||
@@ -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
-1
@@ -1,4 +1,4 @@
|
||||
use support::construct_runtime;
|
||||
use frame_support::construct_runtime;
|
||||
|
||||
construct_runtime! {
|
||||
pub enum Runtime where
|
||||
|
||||
+1
-1
@@ -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
-1
@@ -1,4 +1,4 @@
|
||||
use support::construct_runtime;
|
||||
use frame_support::construct_runtime;
|
||||
|
||||
construct_runtime! {
|
||||
pub enum Runtime where
|
||||
|
||||
+1
-1
@@ -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
-1
@@ -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
-1
@@ -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>;
|
||||
}
|
||||
|
||||
@@ -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!() }
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user