mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 18:31:05 +00:00
BREAKING: Rename Origin (#12258)
* BREAKING: Rename Origin * more renaming * a bit more renaming * fix * more fixing * fix in frame_support * even more fixes * fix * small fix * ... * update .stderr * docs * update docs * update docs * docs
This commit is contained in:
@@ -241,12 +241,12 @@ impl<T: Config<I>, I: 'static> GetMaxVoters for Pallet<T, I> {
|
||||
/// Guard to ensure that the given origin is a member of the collective. The rank of the member is
|
||||
/// the `Success` value.
|
||||
pub struct EnsureRanked<T, I, const MIN_RANK: u16>(PhantomData<(T, I)>);
|
||||
impl<T: Config<I>, I: 'static, const MIN_RANK: u16> EnsureOrigin<T::Origin>
|
||||
impl<T: Config<I>, I: 'static, const MIN_RANK: u16> EnsureOrigin<T::RuntimeOrigin>
|
||||
for EnsureRanked<T, I, MIN_RANK>
|
||||
{
|
||||
type Success = Rank;
|
||||
|
||||
fn try_origin(o: T::Origin) -> Result<Self::Success, T::Origin> {
|
||||
fn try_origin(o: T::RuntimeOrigin) -> Result<Self::Success, T::RuntimeOrigin> {
|
||||
let who = frame_system::EnsureSigned::try_origin(o)?;
|
||||
match Members::<T, I>::get(&who) {
|
||||
Some(MemberRecord { rank, .. }) if rank >= MIN_RANK => Ok(rank),
|
||||
@@ -255,13 +255,13 @@ impl<T: Config<I>, I: 'static, const MIN_RANK: u16> EnsureOrigin<T::Origin>
|
||||
}
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
fn try_successful_origin() -> Result<T::Origin, ()> {
|
||||
fn try_successful_origin() -> Result<T::RuntimeOrigin, ()> {
|
||||
let who = IndexToId::<T, I>::get(MIN_RANK, 0).ok_or(())?;
|
||||
Ok(frame_system::RawOrigin::Signed(who).into())
|
||||
}
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
fn successful_origin() -> T::Origin {
|
||||
fn successful_origin() -> T::RuntimeOrigin {
|
||||
match Self::try_successful_origin() {
|
||||
Ok(o) => o,
|
||||
Err(()) => {
|
||||
@@ -277,12 +277,12 @@ impl<T: Config<I>, I: 'static, const MIN_RANK: u16> EnsureOrigin<T::Origin>
|
||||
/// Guard to ensure that the given origin is a member of the collective. The account ID of the
|
||||
/// member is the `Success` value.
|
||||
pub struct EnsureMember<T, I, const MIN_RANK: u16>(PhantomData<(T, I)>);
|
||||
impl<T: Config<I>, I: 'static, const MIN_RANK: u16> EnsureOrigin<T::Origin>
|
||||
impl<T: Config<I>, I: 'static, const MIN_RANK: u16> EnsureOrigin<T::RuntimeOrigin>
|
||||
for EnsureMember<T, I, MIN_RANK>
|
||||
{
|
||||
type Success = T::AccountId;
|
||||
|
||||
fn try_origin(o: T::Origin) -> Result<Self::Success, T::Origin> {
|
||||
fn try_origin(o: T::RuntimeOrigin) -> Result<Self::Success, T::RuntimeOrigin> {
|
||||
let who = frame_system::EnsureSigned::try_origin(o)?;
|
||||
match Members::<T, I>::get(&who) {
|
||||
Some(MemberRecord { rank, .. }) if rank >= MIN_RANK => Ok(who),
|
||||
@@ -291,13 +291,13 @@ impl<T: Config<I>, I: 'static, const MIN_RANK: u16> EnsureOrigin<T::Origin>
|
||||
}
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
fn try_successful_origin() -> Result<T::Origin, ()> {
|
||||
fn try_successful_origin() -> Result<T::RuntimeOrigin, ()> {
|
||||
let who = IndexToId::<T, I>::get(MIN_RANK, 0).ok_or(())?;
|
||||
Ok(frame_system::RawOrigin::Signed(who).into())
|
||||
}
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
fn successful_origin() -> T::Origin {
|
||||
fn successful_origin() -> T::RuntimeOrigin {
|
||||
match Self::try_successful_origin() {
|
||||
Ok(o) => o,
|
||||
Err(()) => {
|
||||
@@ -313,12 +313,12 @@ impl<T: Config<I>, I: 'static, const MIN_RANK: u16> EnsureOrigin<T::Origin>
|
||||
/// Guard to ensure that the given origin is a member of the collective. The pair of including both
|
||||
/// the account ID and the rank of the member is the `Success` value.
|
||||
pub struct EnsureRankedMember<T, I, const MIN_RANK: u16>(PhantomData<(T, I)>);
|
||||
impl<T: Config<I>, I: 'static, const MIN_RANK: u16> EnsureOrigin<T::Origin>
|
||||
impl<T: Config<I>, I: 'static, const MIN_RANK: u16> EnsureOrigin<T::RuntimeOrigin>
|
||||
for EnsureRankedMember<T, I, MIN_RANK>
|
||||
{
|
||||
type Success = (T::AccountId, Rank);
|
||||
|
||||
fn try_origin(o: T::Origin) -> Result<Self::Success, T::Origin> {
|
||||
fn try_origin(o: T::RuntimeOrigin) -> Result<Self::Success, T::RuntimeOrigin> {
|
||||
let who = frame_system::EnsureSigned::try_origin(o)?;
|
||||
match Members::<T, I>::get(&who) {
|
||||
Some(MemberRecord { rank, .. }) if rank >= MIN_RANK => Ok((who, rank)),
|
||||
@@ -327,13 +327,13 @@ impl<T: Config<I>, I: 'static, const MIN_RANK: u16> EnsureOrigin<T::Origin>
|
||||
}
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
fn try_successful_origin() -> Result<T::Origin, ()> {
|
||||
fn try_successful_origin() -> Result<T::RuntimeOrigin, ()> {
|
||||
let who = IndexToId::<T, I>::get(MIN_RANK, 0).ok_or(())?;
|
||||
Ok(frame_system::RawOrigin::Signed(who).into())
|
||||
}
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
fn successful_origin() -> T::Origin {
|
||||
fn successful_origin() -> T::RuntimeOrigin {
|
||||
match Self::try_successful_origin() {
|
||||
Ok(o) => o,
|
||||
Err(()) => {
|
||||
@@ -367,11 +367,11 @@ pub mod pallet {
|
||||
|
||||
/// The origin required to add or promote a mmember. The success value indicates the
|
||||
/// maximum rank *to which* the promotion may be.
|
||||
type PromoteOrigin: EnsureOrigin<Self::Origin, Success = Rank>;
|
||||
type PromoteOrigin: EnsureOrigin<Self::RuntimeOrigin, Success = Rank>;
|
||||
|
||||
/// The origin required to demote or remove a member. The success value indicates the
|
||||
/// maximum rank *from which* the demotion/removal may be.
|
||||
type DemoteOrigin: EnsureOrigin<Self::Origin, Success = Rank>;
|
||||
type DemoteOrigin: EnsureOrigin<Self::RuntimeOrigin, Success = Rank>;
|
||||
|
||||
/// The polling system used for our voting.
|
||||
type Polls: Polling<TallyOf<Self, I>, Votes = Votes, Moment = Self::BlockNumber>;
|
||||
|
||||
Reference in New Issue
Block a user