mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 11:07:56 +00:00
pallet-sudo: Store DispatchResult in Sudid event (#5804)
This commit is contained in:
@@ -87,7 +87,7 @@
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
use sp_std::prelude::*;
|
||||
use sp_runtime::traits::{StaticLookup, Dispatchable};
|
||||
use sp_runtime::{DispatchResult, traits::{StaticLookup, Dispatchable}};
|
||||
|
||||
use frame_support::{
|
||||
Parameter, decl_module, decl_event, decl_storage, decl_error, ensure,
|
||||
@@ -130,15 +130,8 @@ decl_module! {
|
||||
let sender = ensure_signed(origin)?;
|
||||
ensure!(sender == Self::key(), Error::<T>::RequireSudo);
|
||||
|
||||
let res = match call.dispatch(frame_system::RawOrigin::Root.into()) {
|
||||
Ok(_) => true,
|
||||
Err(e) => {
|
||||
sp_runtime::print(e);
|
||||
false
|
||||
}
|
||||
};
|
||||
|
||||
Self::deposit_event(RawEvent::Sudid(res));
|
||||
let res = call.dispatch(frame_system::RawOrigin::Root.into());
|
||||
Self::deposit_event(RawEvent::Sudid(res.map(|_| ()).map_err(|e| e.error)));
|
||||
}
|
||||
|
||||
/// Authenticates the current sudo key and sets the given AccountId (`new`) as the new sudo key.
|
||||
@@ -204,7 +197,7 @@ decl_module! {
|
||||
decl_event!(
|
||||
pub enum Event<T> where AccountId = <T as frame_system::Trait>::AccountId {
|
||||
/// A sudo just took place.
|
||||
Sudid(bool),
|
||||
Sudid(DispatchResult),
|
||||
/// The sudoer just switched identity; the old key is supplied.
|
||||
KeyChanged(AccountId),
|
||||
/// A sudo just took place.
|
||||
|
||||
Reference in New Issue
Block a user