Normalize Crate Names in SRML/Node Template (#3543)

* Fix some instances of `runtime-io`

* Patch a bunch

* More patches for consistancy

* more patch

* Fix various build issues

* Fix tests

* Patch `srml-support-*` crates

* Fix doc tests

* Revert "Fix doc tests"

This reverts commit ba2ec61da7acc36821a70e76a31a6a5bf13bbe95.

* Revert "Patch `srml-support-*` crates"

This reverts commit 9a6070450107dec17784ba34af4b871023f6dc81.

* Missed one

* Fix doc tests
This commit is contained in:
Shawn Tabrizi
2019-09-04 14:44:28 +02:00
committed by GitHub
parent 875fa73728
commit c284ca2138
84 changed files with 246 additions and 250 deletions
@@ -15,8 +15,8 @@
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
use runtime_io::{with_externalities, Blake2Hasher};
use srml_support::{StorageValue, StorageMap, StorageLinkedMap, StorageDoubleMap};
use srml_support::storage::unhashed;
use support::{StorageValue, StorageMap, StorageLinkedMap, StorageDoubleMap};
use support::storage::unhashed;
use codec::{Encode, Decode};
pub trait Trait {
@@ -24,11 +24,11 @@ pub trait Trait {
type BlockNumber: Encode + Decode + Default + Clone;
}
srml_support::decl_module! {
support::decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin {}
}
srml_support::decl_storage!{
support::decl_storage!{
trait Store for Module<T: Trait> as FinalKeys {
pub Value config(value): u32;
@@ -19,11 +19,11 @@ pub trait Trait {
type Origin;
}
srml_support::decl_module! {
support::decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin {}
}
srml_support::decl_storage! {
support::decl_storage! {
trait Store for Module<T: Trait> as Example {
pub AppendableDM config(t): double_map u32, blake2_256(T::BlockNumber) => Vec<u32>;
}
@@ -16,7 +16,7 @@
#![recursion_limit="128"]
use runtime_io::{with_externalities, Blake2Hasher};
use srml_support::{
use support::{
Parameter, traits::Get, parameter_types,
sr_primitives::{generic, BuildStorage, traits::{BlakeTwo256, Block as _, Verify}},
metadata::{
@@ -48,7 +48,7 @@ mod module1 {
type GenericType: Default + Clone + codec::Codec;
}
srml_support::decl_module! {
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>
@@ -64,7 +64,7 @@ mod module1 {
}
}
srml_support::decl_storage! {
support::decl_storage! {
trait Store for Module<T: Trait<I>, I: InstantiableThing> as Module1 where
T::BlockNumber: From<u32> + std::fmt::Display
{
@@ -81,7 +81,7 @@ mod module1 {
}
}
srml_support::decl_event! {
support::decl_event! {
pub enum Event<T, I> where Phantom = std::marker::PhantomData<T> {
_Phantom(Phantom),
AnotherVariant(u32),
@@ -128,7 +128,7 @@ mod module2 {
impl<T: Trait<I>, I: Instance> Currency for Module<T, I> {}
srml_support::decl_module! {
support::decl_module! {
pub struct Module<T: Trait<I>, I: Instance=DefaultInstance> for enum Call where
origin: <T as system::Trait>::Origin
{
@@ -136,7 +136,7 @@ mod module2 {
}
}
srml_support::decl_storage! {
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;
@@ -145,7 +145,7 @@ mod module2 {
}
}
srml_support::decl_event! {
support::decl_event! {
pub enum Event<T, I=DefaultInstance> where Amount = <T as Trait<I>>::Amount {
Variant(Amount),
}
@@ -185,7 +185,7 @@ mod module3 {
type Currency2: Currency;
}
srml_support::decl_module! {
support::decl_module! {
pub struct Module<T: Trait> for enum Call where origin: <T as system::Trait>::Origin {}
}
}
@@ -244,7 +244,7 @@ impl system::Trait for Runtime {
type Event = Event;
}
srml_support::construct_runtime!(
support::construct_runtime!(
pub enum Runtime where
Block = Block,
NodeBlock = Block,
@@ -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 srml_support::sr_primitives::generic;
use srml_support::sr_primitives::traits::{BlakeTwo256, Block as _, Verify};
use srml_support::codec::{Encode, Decode};
use support::sr_primitives::generic;
use support::sr_primitives::traits::{BlakeTwo256, Block as _, Verify};
use support::codec::{Encode, Decode};
use primitives::{H256, sr25519};
use serde::{Serialize, Deserialize};
@@ -82,7 +82,7 @@ mod module {
pub trait Trait: system::Trait {}
srml_support::decl_module! {
support::decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin {}
}
@@ -99,7 +99,7 @@ mod module {
}
}
srml_support::decl_storage! {
support::decl_storage! {
trait Store for Module<T: Trait> as Actors {
/// requirements to enter and maintain status in roles
pub Parameters get(parameters) build(|config: &GenesisConfig| {
@@ -164,7 +164,7 @@ impl system::Trait for Runtime {
impl module::Trait for Runtime {}
srml_support::construct_runtime!(
support::construct_runtime!(
pub enum Runtime where
Block = Block,
NodeBlock = Block,
@@ -2,7 +2,7 @@ macro_rules! reserved {
($($reserved:ident)*) => {
$(
mod $reserved {
pub use srml_support::dispatch::Result;
pub use support::dispatch::Result;
pub trait Trait {
type Origin;
@@ -10,14 +10,14 @@ macro_rules! reserved {
}
pub mod system {
use srml_support::dispatch::Result;
use support::dispatch::Result;
pub fn ensure_root<R>(_: R) -> Result {
Ok(())
}
}
srml_support::decl_module! {
support::decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
fn $reserved(_origin) -> Result { unreachable!() }
}
+3 -3
View File
@@ -1,4 +1,4 @@
use srml_support::codec::{Encode, Decode};
use support::codec::{Encode, Decode};
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>;
}
srml_support::decl_module! {
support::decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
}
}
@@ -20,7 +20,7 @@ impl<T: Trait> Module<T> {
}
}
srml_support::decl_event!(
support::decl_event!(
pub enum Event {
ExtrinsicSuccess,
ExtrinsicFailed,