diff --git a/substrate/node/runtime/wasm/Cargo.lock b/substrate/node/runtime/wasm/Cargo.lock index eacbe250c4..cee874bf50 100644 --- a/substrate/node/runtime/wasm/Cargo.lock +++ b/substrate/node/runtime/wasm/Cargo.lock @@ -2481,6 +2481,7 @@ version = "2.0.0" dependencies = [ "parity-codec 3.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 2.0.0", "sr-primitives 2.0.0", "sr-std 2.0.0", "srml-support 2.0.0", diff --git a/substrate/srml/sudo/Cargo.toml b/substrate/srml/sudo/Cargo.toml index d6271cae8b..29ef579516 100644 --- a/substrate/srml/sudo/Cargo.toml +++ b/substrate/srml/sudo/Cargo.toml @@ -8,6 +8,7 @@ edition = "2018" serde = { version = "1.0", optional = true } parity-codec = { version = "3.3", default-features = false, features = ["derive"] } sr-std = { path = "../../core/sr-std", default-features = false } +sr-io = { path = "../../core/sr-io", default-features = false } sr-primitives = { path = "../../core/sr-primitives", default-features = false } srml-support = { path = "../support", default-features = false } srml-support-procedural = { path = "../support/procedural" } @@ -23,6 +24,7 @@ std = [ "serde", "parity-codec/std", "sr-std/std", + "sr-io/std", "sr-primitives/std", "srml-support/std", "system/std", diff --git a/substrate/srml/sudo/src/lib.rs b/substrate/srml/sudo/src/lib.rs index 8c59536469..1caeac73b8 100644 --- a/substrate/srml/sudo/src/lib.rs +++ b/substrate/srml/sudo/src/lib.rs @@ -88,7 +88,10 @@ use sr_std::prelude::*; use sr_primitives::traits::StaticLookup; -use srml_support::{StorageValue, Parameter, Dispatchable, decl_module, decl_event, decl_storage, ensure}; +use srml_support::{ + StorageValue, Parameter, Dispatchable, decl_module, decl_event, + decl_storage, ensure +}; use system::ensure_signed; pub trait Trait: system::Trait { @@ -112,8 +115,15 @@ decl_module! { let sender = ensure_signed(origin)?; ensure!(sender == Self::key(), "only the current sudo key can sudo"); - let ok = proposal.dispatch(system::RawOrigin::Root.into()).is_ok(); - Self::deposit_event(RawEvent::Sudid(ok)); + let res = match proposal.dispatch(system::RawOrigin::Root.into()) { + Ok(_) => true, + Err(e) => { + sr_io::print(e); + false + } + }; + + Self::deposit_event(RawEvent::Sudid(res)); } /// Authenticates the current sudo key and sets the given AccountId (`new`) as the new sudo key.