Unverified Commit 9315b624 authored by Fedor Sakharov's avatar Fedor Sakharov Committed by GitHub
Browse files

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
parent 82c13742
Pipeline #109287 passed with stages
in 18 minutes and 18 seconds
...@@ -25,6 +25,7 @@ pub mod crowdfund; ...@@ -25,6 +25,7 @@ pub mod crowdfund;
pub mod purchase; pub mod purchase;
pub mod impls; pub mod impls;
pub mod paras_sudo_wrapper; pub mod paras_sudo_wrapper;
pub mod paras_registrar;
use primitives::v1::{BlockNumber, ValidatorId}; use primitives::v1::{BlockNumber, ValidatorId};
use sp_runtime::{Perquintill, Perbill, FixedPointNumber, traits::Saturating}; use sp_runtime::{Perquintill, Perbill, FixedPointNumber, traits::Saturating};
......
This diff is collapsed.
...@@ -30,13 +30,16 @@ use frame_support::{ ...@@ -30,13 +30,16 @@ use frame_support::{
weights::Weight, traits::Randomness as RandomnessT, weights::Weight, traits::Randomness as RandomnessT,
}; };
use crate::inclusion; use crate::inclusion;
use crate::paras;
/// A test runtime struct. /// A test runtime struct.
#[derive(Clone, Eq, PartialEq)] #[derive(Clone, Eq, PartialEq)]
pub struct Test; pub struct Test;
impl_outer_origin! { impl_outer_origin! {
pub enum Origin for Test { } pub enum Origin for Test {
paras
}
} }
impl_outer_dispatch! { impl_outer_dispatch! {
...@@ -101,7 +104,9 @@ impl crate::initializer::Trait for Test { ...@@ -101,7 +104,9 @@ impl crate::initializer::Trait for Test {
impl crate::configuration::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 { } impl crate::router::Trait for Test { }
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
//! only occur at session boundaries. //! only occur at session boundaries.
use sp_std::prelude::*; use sp_std::prelude::*;
use sp_std::result;
#[cfg(feature = "std")] #[cfg(feature = "std")]
use sp_std::marker::PhantomData; use sp_std::marker::PhantomData;
use primitives::v1::{ use primitives::v1::{
...@@ -42,7 +43,14 @@ use sp_core::RuntimeDebug; ...@@ -42,7 +43,14 @@ use sp_core::RuntimeDebug;
#[cfg(feature = "std")] #[cfg(feature = "std")]
use serde::{Serialize, Deserialize}; 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. // the two key times necessary to track for every code replacement.
#[derive(Default, Encode, Decode)] #[derive(Default, Encode, Decode)]
...@@ -206,7 +214,7 @@ decl_storage! { ...@@ -206,7 +214,7 @@ decl_storage! {
/// Upcoming paras instantiation arguments. /// Upcoming paras instantiation arguments.
UpcomingParasGenesis: map hasher(twox_64_concat) ParaId => Option<ParaGenesisArgs>; UpcomingParasGenesis: map hasher(twox_64_concat) ParaId => Option<ParaGenesisArgs>;
/// Paras that are to be cleaned up at the end of the session. /// 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 { add_extra_genesis {
......
...@@ -62,6 +62,7 @@ use sp_staking::SessionIndex; ...@@ -62,6 +62,7 @@ use sp_staking::SessionIndex;
use pallet_session::historical as session_historical; use pallet_session::historical as session_historical;
use frame_system::EnsureRoot; use frame_system::EnsureRoot;
use runtime_common::paras_sudo_wrapper as paras_sudo_wrapper; use runtime_common::paras_sudo_wrapper as paras_sudo_wrapper;
use runtime_common::paras_registrar;
use runtime_parachains::origin as parachains_origin; use runtime_parachains::origin as parachains_origin;
use runtime_parachains::configuration as parachains_configuration; use runtime_parachains::configuration as parachains_configuration;
...@@ -376,6 +377,7 @@ construct_runtime! { ...@@ -376,6 +377,7 @@ construct_runtime! {
Initializer: parachains_initializer::{Module, Call, Storage}, Initializer: parachains_initializer::{Module, Call, Storage},
Router: parachains_router::{Module, Call, Storage}, Router: parachains_router::{Module, Call, Storage},
Registrar: paras_registrar::{Module, Call, Storage},
ParasSudoWrapper: paras_sudo_wrapper::{Module, Call}, ParasSudoWrapper: paras_sudo_wrapper::{Module, Call},
} }
} }
...@@ -728,7 +730,9 @@ impl parachains_inclusion::Trait for Runtime { ...@@ -728,7 +730,9 @@ impl parachains_inclusion::Trait for Runtime {
type Event = Event; type Event = Event;
} }
impl parachains_paras::Trait for Runtime { } impl parachains_paras::Trait for Runtime {
type Origin = Origin;
}
impl parachains_router::Trait for Runtime { } impl parachains_router::Trait for Runtime { }
...@@ -741,3 +745,9 @@ impl parachains_initializer::Trait for Runtime { ...@@ -741,3 +745,9 @@ impl parachains_initializer::Trait for Runtime {
} }
impl paras_sudo_wrapper::Trait for Runtime { } impl paras_sudo_wrapper::Trait for Runtime { }
impl paras_registrar::Trait for Runtime {
type Currency = Balances;
type ParathreadDeposit = ParathreadDeposit;
type Origin = Origin;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment