WIP: Update Substrate & Polkadot (#496)

* WIP: Update Substrate

* Update Substrate & Polkadot

* fixes

* more fixes

* few missing origins

* use spawn_essential_handle

* bump polkadot dep

* remove newlines

* fix test

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
Sergei Shulepov
2021-06-17 08:37:03 +01:00
committed by GitHub
parent 7d6f46bbde
commit fe21865d12
20 changed files with 494 additions and 477 deletions
+22 -21
View File
@@ -72,6 +72,28 @@ pub mod pallet {
/// \[ id, outcome \]
ExecutedDownward([u8; 8], Outcome),
}
/// Origin for the parachains module.
#[derive(PartialEq, Eq, Clone, Encode, Decode)]
#[cfg_attr(feature = "std", derive(Debug))]
#[pallet::origin]
pub enum Origin {
/// It comes from the (parent) relay chain.
Relay,
/// It comes from a (sibling) parachain.
SiblingParachain(ParaId),
}
impl From<ParaId> for Origin {
fn from(id: ParaId) -> Origin {
Origin::SiblingParachain(id)
}
}
impl From<u32> for Origin {
fn from(id: u32) -> Origin {
Origin::SiblingParachain(id.into())
}
}
}
/// For an incoming downward message, this just adapts an XCM executor and executes DMP messages
@@ -137,27 +159,6 @@ impl<T: Config> DmpMessageHandler for LimitAndDropDmpExecution<T> {
}
}
/// Origin for the parachains module.
#[derive(PartialEq, Eq, Clone, Encode, Decode)]
#[cfg_attr(feature = "std", derive(Debug))]
pub enum Origin {
/// It comes from the (parent) relay chain.
Relay,
/// It comes from a (sibling) parachain.
SiblingParachain(ParaId),
}
impl From<ParaId> for Origin {
fn from(id: ParaId) -> Origin {
Origin::SiblingParachain(id)
}
}
impl From<u32> for Origin {
fn from(id: u32) -> Origin {
Origin::SiblingParachain(id.into())
}
}
/// Ensure that the origin `o` represents a sibling parachain.
/// Returns `Ok` with the parachain ID of the sibling or an `Err` otherwise.
pub fn ensure_sibling_para<OuterOrigin>(o: OuterOrigin) -> Result<ParaId, BadOrigin>