mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 21:41:12 +00:00
pallet-utility: Only disallow the None origin (#12351)
This commit is contained in:
@@ -63,7 +63,7 @@ use frame_support::{
|
||||
};
|
||||
use sp_core::TypeId;
|
||||
use sp_io::hashing::blake2_256;
|
||||
use sp_runtime::traits::{Dispatchable, TrailingZeroInput};
|
||||
use sp_runtime::traits::{BadOrigin, Dispatchable, TrailingZeroInput};
|
||||
use sp_std::prelude::*;
|
||||
pub use weights::WeightInfo;
|
||||
|
||||
@@ -203,7 +203,12 @@ pub mod pallet {
|
||||
origin: OriginFor<T>,
|
||||
calls: Vec<<T as Config>::RuntimeCall>,
|
||||
) -> DispatchResultWithPostInfo {
|
||||
let is_root = ensure_signed_or_root(origin.clone())?.is_none();
|
||||
// Do not allow the `None` origin.
|
||||
if ensure_none(origin.clone()).is_ok() {
|
||||
return Err(BadOrigin.into())
|
||||
}
|
||||
|
||||
let is_root = ensure_root(origin.clone()).is_ok();
|
||||
let calls_len = calls.len();
|
||||
ensure!(calls_len <= Self::batched_calls_limit() as usize, Error::<T>::TooManyCalls);
|
||||
|
||||
@@ -319,7 +324,12 @@ pub mod pallet {
|
||||
origin: OriginFor<T>,
|
||||
calls: Vec<<T as Config>::RuntimeCall>,
|
||||
) -> DispatchResultWithPostInfo {
|
||||
let is_root = ensure_signed_or_root(origin.clone())?.is_none();
|
||||
// Do not allow the `None` origin.
|
||||
if ensure_none(origin.clone()).is_ok() {
|
||||
return Err(BadOrigin.into())
|
||||
}
|
||||
|
||||
let is_root = ensure_root(origin.clone()).is_ok();
|
||||
let calls_len = calls.len();
|
||||
ensure!(calls_len <= Self::batched_calls_limit() as usize, Error::<T>::TooManyCalls);
|
||||
|
||||
@@ -426,7 +436,12 @@ pub mod pallet {
|
||||
origin: OriginFor<T>,
|
||||
calls: Vec<<T as Config>::RuntimeCall>,
|
||||
) -> DispatchResultWithPostInfo {
|
||||
let is_root = ensure_signed_or_root(origin.clone())?.is_none();
|
||||
// Do not allow the `None` origin.
|
||||
if ensure_none(origin.clone()).is_ok() {
|
||||
return Err(BadOrigin.into())
|
||||
}
|
||||
|
||||
let is_root = ensure_root(origin.clone()).is_ok();
|
||||
let calls_len = calls.len();
|
||||
ensure!(calls_len <= Self::batched_calls_limit() as usize, Error::<T>::TooManyCalls);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user