Skip to content
Snippets Groups Projects
Commit 02f17720 authored by Bastian Köcher's avatar Bastian Köcher Committed by GitHub
Browse files

pallet-sudo: Store `DispatchResult` in `Sudid` event (#5804)

parent 00378d40
No related merge requests found
......@@ -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.
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment