mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 13:27:57 +00:00
Don't return misleading result with PostInfo in proxy-pallet (#9426)
also autoformatting two unrelated files fixes #9421
This commit is contained in:
committed by
GitHub
parent
4e653bfa3c
commit
b7dc3bc6f2
@@ -35,7 +35,7 @@ pub mod weights;
|
||||
|
||||
use codec::{Decode, Encode, MaxEncodedLen};
|
||||
use frame_support::{
|
||||
dispatch::{DispatchError, DispatchResultWithPostInfo, PostDispatchInfo},
|
||||
dispatch::DispatchError,
|
||||
ensure,
|
||||
traits::{Currency, Get, InstanceFilter, IsSubType, IsType, OriginTrait, ReservableCurrency},
|
||||
weights::GetDispatchInfo,
|
||||
@@ -102,7 +102,7 @@ pub mod pallet {
|
||||
|
||||
/// The overarching call type.
|
||||
type Call: Parameter
|
||||
+ Dispatchable<Origin = Self::Origin, PostInfo = PostDispatchInfo>
|
||||
+ Dispatchable<Origin = Self::Origin>
|
||||
+ GetDispatchInfo
|
||||
+ From<frame_system::Call<Self>>
|
||||
+ IsSubType<Call<Self>>
|
||||
@@ -196,7 +196,7 @@ pub mod pallet {
|
||||
real: T::AccountId,
|
||||
force_proxy_type: Option<T::ProxyType>,
|
||||
call: Box<<T as Config>::Call>,
|
||||
) -> DispatchResultWithPostInfo {
|
||||
) -> DispatchResult {
|
||||
let who = ensure_signed(origin)?;
|
||||
let def = Self::find_proxy(&real, &who, force_proxy_type)?;
|
||||
ensure!(def.delay.is_zero(), Error::<T>::Unannounced);
|
||||
@@ -225,7 +225,7 @@ pub mod pallet {
|
||||
delegate: T::AccountId,
|
||||
proxy_type: T::ProxyType,
|
||||
delay: T::BlockNumber,
|
||||
) -> DispatchResultWithPostInfo {
|
||||
) -> DispatchResult {
|
||||
let who = ensure_signed(origin)?;
|
||||
Self::add_proxy_delegate(&who, delegate, proxy_type, delay)
|
||||
}
|
||||
@@ -247,7 +247,7 @@ pub mod pallet {
|
||||
delegate: T::AccountId,
|
||||
proxy_type: T::ProxyType,
|
||||
delay: T::BlockNumber,
|
||||
) -> DispatchResultWithPostInfo {
|
||||
) -> DispatchResult {
|
||||
let who = ensure_signed(origin)?;
|
||||
Self::remove_proxy_delegate(&who, delegate, proxy_type, delay)
|
||||
}
|
||||
@@ -263,7 +263,7 @@ pub mod pallet {
|
||||
/// Weight is a function of the number of proxies the user has (P).
|
||||
/// # </weight>
|
||||
#[pallet::weight(T::WeightInfo::remove_proxies(T::MaxProxies::get().into()))]
|
||||
pub fn remove_proxies(origin: OriginFor<T>) -> DispatchResultWithPostInfo {
|
||||
pub fn remove_proxies(origin: OriginFor<T>) -> DispatchResult {
|
||||
let who = ensure_signed(origin)?;
|
||||
let (_, old_deposit) = Proxies::<T>::take(&who);
|
||||
T::Currency::unreserve(&who, old_deposit);
|
||||
@@ -300,7 +300,7 @@ pub mod pallet {
|
||||
proxy_type: T::ProxyType,
|
||||
delay: T::BlockNumber,
|
||||
index: u16,
|
||||
) -> DispatchResultWithPostInfo {
|
||||
) -> DispatchResult {
|
||||
let who = ensure_signed(origin)?;
|
||||
|
||||
let anonymous = Self::anonymous_account(&who, &proxy_type, index, None);
|
||||
@@ -348,7 +348,7 @@ pub mod pallet {
|
||||
index: u16,
|
||||
#[pallet::compact] height: T::BlockNumber,
|
||||
#[pallet::compact] ext_index: u32,
|
||||
) -> DispatchResultWithPostInfo {
|
||||
) -> DispatchResult {
|
||||
let who = ensure_signed(origin)?;
|
||||
|
||||
let when = (height, ext_index);
|
||||
@@ -387,7 +387,7 @@ pub mod pallet {
|
||||
origin: OriginFor<T>,
|
||||
real: T::AccountId,
|
||||
call_hash: CallHashOf<T>,
|
||||
) -> DispatchResultWithPostInfo {
|
||||
) -> DispatchResult {
|
||||
let who = ensure_signed(origin)?;
|
||||
Proxies::<T>::get(&real)
|
||||
.0
|
||||
@@ -443,7 +443,7 @@ pub mod pallet {
|
||||
origin: OriginFor<T>,
|
||||
real: T::AccountId,
|
||||
call_hash: CallHashOf<T>,
|
||||
) -> DispatchResultWithPostInfo {
|
||||
) -> DispatchResult {
|
||||
let who = ensure_signed(origin)?;
|
||||
Self::edit_announcements(&who, |ann| ann.real != real || ann.call_hash != call_hash)?;
|
||||
|
||||
@@ -473,7 +473,7 @@ pub mod pallet {
|
||||
origin: OriginFor<T>,
|
||||
delegate: T::AccountId,
|
||||
call_hash: CallHashOf<T>,
|
||||
) -> DispatchResultWithPostInfo {
|
||||
) -> DispatchResult {
|
||||
let who = ensure_signed(origin)?;
|
||||
Self::edit_announcements(&delegate, |ann| {
|
||||
ann.real != who || ann.call_hash != call_hash
|
||||
@@ -513,7 +513,7 @@ pub mod pallet {
|
||||
real: T::AccountId,
|
||||
force_proxy_type: Option<T::ProxyType>,
|
||||
call: Box<<T as Config>::Call>,
|
||||
) -> DispatchResultWithPostInfo {
|
||||
) -> DispatchResult {
|
||||
ensure_signed(origin)?;
|
||||
let def = Self::find_proxy(&real, &delegate, force_proxy_type)?;
|
||||
|
||||
@@ -641,7 +641,7 @@ impl<T: Config> Pallet<T> {
|
||||
delegatee: T::AccountId,
|
||||
proxy_type: T::ProxyType,
|
||||
delay: T::BlockNumber,
|
||||
) -> DispatchResultWithPostInfo {
|
||||
) -> DispatchResult {
|
||||
ensure!(delegator != &delegatee, Error::<T>::NoSelfProxy);
|
||||
Proxies::<T>::try_mutate(delegator, |(ref mut proxies, ref mut deposit)| {
|
||||
let proxy_def = ProxyDefinition { delegate: delegatee, proxy_type, delay };
|
||||
@@ -671,7 +671,7 @@ impl<T: Config> Pallet<T> {
|
||||
delegatee: T::AccountId,
|
||||
proxy_type: T::ProxyType,
|
||||
delay: T::BlockNumber,
|
||||
) -> DispatchResultWithPostInfo {
|
||||
) -> DispatchResult {
|
||||
Proxies::<T>::try_mutate_exists(delegator, |x| {
|
||||
let (mut proxies, old_deposit) = x.take().ok_or(Error::<T>::NotFound)?;
|
||||
let proxy_def = ProxyDefinition { delegate: delegatee, proxy_type, delay };
|
||||
|
||||
Reference in New Issue
Block a user