Sudo wrapper for paras (#1517)

* Sudo wrapper for paras

* Move to separate module

* Add some docs
This commit is contained in:
Fedor Sakharov
2020-08-03 22:32:57 +03:00
committed by GitHub
parent 2afa2b035f
commit a9e3a1b11d
6 changed files with 75 additions and 5 deletions
+4 -5
View File
@@ -36,6 +36,7 @@ use frame_support::{
};
use codec::{Encode, Decode};
use crate::{configuration, initializer::SessionChangeNotification};
use sp_core::RuntimeDebug;
#[cfg(feature = "std")]
use serde::{Serialize, Deserialize};
@@ -155,7 +156,7 @@ impl<N: Ord + Copy> ParaPastCodeMeta<N> {
}
/// Arguments for initializing a para.
#[derive(Encode, Decode)]
#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct ParaGenesisArgs {
/// The initial head data to use.
@@ -387,8 +388,7 @@ impl<T: Trait> Module<T> {
}
/// Schedule a para to be initialized at the start of the next session.
#[allow(unused)]
pub(crate) fn schedule_para_initialize(id: ParaId, genesis: ParaGenesisArgs) -> Weight {
pub fn schedule_para_initialize(id: ParaId, genesis: ParaGenesisArgs) -> Weight {
let dup = UpcomingParas::mutate(|v| {
match v.binary_search(&id) {
Ok(_) => true,
@@ -410,8 +410,7 @@ impl<T: Trait> Module<T> {
}
/// Schedule a para to be cleaned up at the start of the next session.
#[allow(unused)]
pub(crate) fn schedule_para_cleanup(id: ParaId) -> Weight {
pub fn schedule_para_cleanup(id: ParaId) -> Weight {
OutgoingParas::mutate(|v| {
match v.binary_search(&id) {
Ok(_) => T::DbWeight::get().reads_writes(1, 0),