mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 04:11:07 +00:00
EnsureOrigin is a frame abstraction - it should be in frame_support (#5521)
* EnsureOrigin is a frame abstraction - it should be in frame_support * Fixes
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
//! Primitives for the runtime modules.
|
||||
|
||||
use sp_std::prelude::*;
|
||||
use sp_std::{self, result, marker::PhantomData, convert::{TryFrom, TryInto}, fmt::Debug};
|
||||
use sp_std::{self, marker::PhantomData, convert::{TryFrom, TryInto}, fmt::Debug};
|
||||
use sp_io;
|
||||
#[cfg(feature = "std")]
|
||||
use std::fmt::Display;
|
||||
@@ -147,24 +147,6 @@ impl From<BadOrigin> for &'static str {
|
||||
}
|
||||
}
|
||||
|
||||
/// Some sort of check on the origin is performed by this object.
|
||||
pub trait EnsureOrigin<OuterOrigin> {
|
||||
/// A return type.
|
||||
type Success;
|
||||
/// Perform the origin check.
|
||||
fn ensure_origin(o: OuterOrigin) -> result::Result<Self::Success, BadOrigin> {
|
||||
Self::try_origin(o).map_err(|_| BadOrigin)
|
||||
}
|
||||
/// Perform the origin check.
|
||||
fn try_origin(o: OuterOrigin) -> result::Result<Self::Success, OuterOrigin>;
|
||||
|
||||
/// Returns an outer origin capable of passing `try_origin` check.
|
||||
///
|
||||
/// ** Should be used for benchmarking only!!! **
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
fn successful_origin() -> OuterOrigin;
|
||||
}
|
||||
|
||||
/// An error that indicates that a lookup failed.
|
||||
#[derive(Encode, Decode, RuntimeDebug)]
|
||||
pub struct LookupError;
|
||||
|
||||
Reference in New Issue
Block a user