Parachains v1 registrar module. (#1559)

* Initial commit.

* Fix build

* Add comments, remove Event

* Dont expose calls

* Remove TODO and origins

* Fix merge

* Enable or disable parathread registration
This commit is contained in:
Fedor Sakharov
2020-10-02 02:00:59 +03:00
committed by GitHub
parent 5d8ae8d024
commit 07a3f73811
5 changed files with 737 additions and 5 deletions
+7 -2
View File
@@ -30,13 +30,16 @@ use frame_support::{
weights::Weight, traits::Randomness as RandomnessT,
};
use crate::inclusion;
use crate::paras;
/// A test runtime struct.
#[derive(Clone, Eq, PartialEq)]
pub struct Test;
impl_outer_origin! {
pub enum Origin for Test { }
pub enum Origin for Test {
paras
}
}
impl_outer_dispatch! {
@@ -101,7 +104,9 @@ impl crate::initializer::Trait for Test {
impl crate::configuration::Trait for Test { }
impl crate::paras::Trait for Test { }
impl crate::paras::Trait for Test {
type Origin = Origin;
}
impl crate::router::Trait for Test { }
+10 -2
View File
@@ -24,6 +24,7 @@
//! only occur at session boundaries.
use sp_std::prelude::*;
use sp_std::result;
#[cfg(feature = "std")]
use sp_std::marker::PhantomData;
use primitives::v1::{
@@ -42,7 +43,14 @@ use sp_core::RuntimeDebug;
#[cfg(feature = "std")]
use serde::{Serialize, Deserialize};
pub trait Trait: frame_system::Trait + configuration::Trait { }
pub use crate::Origin;
pub trait Trait: frame_system::Trait + configuration::Trait {
/// The outer origin type.
type Origin: From<Origin>
+ From<<Self as frame_system::Trait>::Origin>
+ Into<result::Result<Origin, <Self as Trait>::Origin>>;
}
// the two key times necessary to track for every code replacement.
#[derive(Default, Encode, Decode)]
@@ -206,7 +214,7 @@ decl_storage! {
/// Upcoming paras instantiation arguments.
UpcomingParasGenesis: map hasher(twox_64_concat) ParaId => Option<ParaGenesisArgs>;
/// Paras that are to be cleaned up at the end of the session.
OutgoingParas: Vec<ParaId>;
OutgoingParas get(fn outgoing_paras): Vec<ParaId>;
}
add_extra_genesis {