mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 12:51:02 +00:00
Registrar v1 follow-ups (#1786)
* parachains: use the root origin for mock * registrar: notify the router module about the cleanup * add missing call to schedule_para_cleanup
This commit is contained in:
@@ -33,6 +33,7 @@ use runtime_parachains::{
|
||||
self,
|
||||
ParaGenesisArgs,
|
||||
},
|
||||
router,
|
||||
ensure_parachain,
|
||||
Origin,
|
||||
};
|
||||
@@ -40,7 +41,7 @@ use runtime_parachains::{
|
||||
type BalanceOf<T> =
|
||||
<<T as Trait>::Currency as Currency<<T as frame_system::Trait>::AccountId>>::Balance;
|
||||
|
||||
pub trait Trait: paras::Trait {
|
||||
pub trait Trait: paras::Trait + router::Trait {
|
||||
/// The aggregated origin type must support the `parachains` origin. We require that we can
|
||||
/// infallibly convert between this origin and the system origin, but in reality, they're the
|
||||
/// same type, we just can't express that to the Rust type system without writing a `where`
|
||||
@@ -150,6 +151,7 @@ decl_module! {
|
||||
let _ = <T as Trait>::Currency::unreserve(&debtor, T::ParathreadDeposit::get());
|
||||
|
||||
<paras::Module<T>>::schedule_para_cleanup(id);
|
||||
<router::Module::<T>>::schedule_para_cleanup(id);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -241,6 +243,7 @@ impl<T: Trait> Module<T> {
|
||||
ensure!(is_parachain, Error::<T>::InvalidChainId);
|
||||
|
||||
<paras::Module<T>>::schedule_para_cleanup(id);
|
||||
<router::Module::<T>>::schedule_para_cleanup(id);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -269,7 +272,7 @@ mod tests {
|
||||
|
||||
impl_outer_origin! {
|
||||
pub enum Origin for Test {
|
||||
paras,
|
||||
runtime_parachains,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ use frame_support::{
|
||||
weights::Weight, traits::Randomness as RandomnessT,
|
||||
};
|
||||
use crate::inclusion;
|
||||
use crate::paras;
|
||||
use crate as parachains;
|
||||
|
||||
/// A test runtime struct.
|
||||
#[derive(Clone, Eq, PartialEq)]
|
||||
@@ -38,7 +38,7 @@ pub struct Test;
|
||||
|
||||
impl_outer_origin! {
|
||||
pub enum Origin for Test {
|
||||
paras
|
||||
parachains
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,8 +22,7 @@ use primitives::v1::Id as ParaId;
|
||||
use codec::{Decode, Encode};
|
||||
|
||||
/// Origin for the parachains.
|
||||
#[derive(PartialEq, Eq, Clone, Encode, Decode)]
|
||||
#[cfg_attr(feature = "std", derive(Debug))]
|
||||
#[derive(PartialEq, Eq, Clone, Encode, Decode, sp_core::RuntimeDebug)]
|
||||
pub enum Origin {
|
||||
/// It comes from a parachain.
|
||||
Parachain(ParaId),
|
||||
|
||||
@@ -43,7 +43,7 @@ use sp_core::RuntimeDebug;
|
||||
#[cfg(feature = "std")]
|
||||
use serde::{Serialize, Deserialize};
|
||||
|
||||
pub use crate::Origin;
|
||||
use crate::Origin;
|
||||
|
||||
pub trait Trait: frame_system::Trait + configuration::Trait {
|
||||
/// The outer origin type.
|
||||
|
||||
Reference in New Issue
Block a user