mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 22:11:02 +00:00
Parachains: Introduce a dummy module to include the Origin. (#1749)
That's because `construct_runtime` doesn't support a free-standing Origin. See the comment in parachains/src/origin.rs
This commit is contained in:
@@ -22,11 +22,6 @@
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
use sp_std::result;
|
||||
use sp_runtime::traits::BadOrigin;
|
||||
use primitives::v1::Id as ParaId;
|
||||
use codec::{Decode, Encode};
|
||||
|
||||
pub mod configuration;
|
||||
pub mod inclusion;
|
||||
pub mod inclusion_inherent;
|
||||
@@ -35,6 +30,7 @@ pub mod paras;
|
||||
pub mod router;
|
||||
pub mod scheduler;
|
||||
pub mod validity;
|
||||
pub mod origin;
|
||||
|
||||
pub mod runtime_api_impl;
|
||||
|
||||
@@ -43,21 +39,4 @@ mod util;
|
||||
#[cfg(test)]
|
||||
mod mock;
|
||||
|
||||
/// Origin for the parachains.
|
||||
#[derive(PartialEq, Eq, Clone, Encode, Decode)]
|
||||
#[cfg_attr(feature = "std", derive(Debug))]
|
||||
pub enum Origin {
|
||||
/// It comes from a parachain.
|
||||
Parachain(ParaId),
|
||||
}
|
||||
|
||||
/// Ensure that the origin `o` represents a parachain.
|
||||
/// Returns `Ok` with the parachain ID that effected the extrinsic or an `Err` otherwise.
|
||||
pub fn ensure_parachain<OuterOrigin>(o: OuterOrigin) -> result::Result<ParaId, BadOrigin>
|
||||
where OuterOrigin: Into<result::Result<Origin, OuterOrigin>>
|
||||
{
|
||||
match o.into() {
|
||||
Ok(Origin::Parachain(id)) => Ok(id),
|
||||
_ => Err(BadOrigin),
|
||||
}
|
||||
}
|
||||
pub use origin::{Origin, ensure_parachain};
|
||||
|
||||
Reference in New Issue
Block a user