diff --git a/substrate/node/runtime/src/lib.rs b/substrate/node/runtime/src/lib.rs
index 0a30e09f5e..562dea598f 100644
--- a/substrate/node/runtime/src/lib.rs
+++ b/substrate/node/runtime/src/lib.rs
@@ -82,8 +82,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// and set impl_version to equal spec_version. If only runtime
// implementation changes and behavior does not, then leave spec_version as
// is and increment impl_version.
- spec_version: 156,
- impl_version: 158,
+ spec_version: 157,
+ impl_version: 157,
apis: RUNTIME_API_VERSIONS,
};
diff --git a/substrate/srml/sudo/src/lib.rs b/substrate/srml/sudo/src/lib.rs
index 845f1e4104..7d80851719 100644
--- a/substrate/srml/sudo/src/lib.rs
+++ b/substrate/srml/sudo/src/lib.rs
@@ -113,9 +113,10 @@ decl_module! {
/// #
/// - O(1).
/// - Limited storage reads.
- /// - No DB writes.
+ /// - One DB write (event).
+ /// - Unknown weight of derivative `proposal` execution.
/// #
- #[weight = SimpleDispatchInfo::FixedOperational(1_000_000)]
+ #[weight = SimpleDispatchInfo::FreeOperational]
fn sudo(origin, proposal: Box) {
// This is a public call, so we ensure that the origin is some signed account.
let sender = ensure_signed(origin)?;
@@ -151,6 +152,37 @@ decl_module! {
Self::deposit_event(RawEvent::KeyChanged(Self::key()));
>::put(new);
}
+
+ /// Authenticates the sudo key and dispatches a function call with `Signed` origin from
+ /// a given account.
+ ///
+ /// The dispatch origin for this call must be _Signed_.
+ ///
+ /// #
+ /// - O(1).
+ /// - Limited storage reads.
+ /// - One DB write (event).
+ /// - Unknown weight of derivative `proposal` execution.
+ /// #
+ #[weight = SimpleDispatchInfo::FixedOperational(0)]
+ fn sudo_as(origin, who: ::Source, proposal: Box) {
+ // This is a public call, so we ensure that the origin is some signed account.
+ let sender = ensure_signed(origin)?;
+ ensure!(sender == Self::key(), "only the current sudo key can sudo");
+
+ let who = T::Lookup::lookup(who)?;
+
+ let res = match proposal.dispatch(system::RawOrigin::Signed(who).into()) {
+ Ok(_) => true,
+ Err(e) => {
+ let e: DispatchError = e.into();
+ runtime_io::print(e);
+ false
+ }
+ };
+
+ Self::deposit_event(RawEvent::SudoAsDone(res));
+ }
}
}
@@ -160,6 +192,8 @@ decl_event!(
Sudid(bool),
/// The sudoer just switched identity; the old key is supplied.
KeyChanged(AccountId),
+ /// A sudo just took place.
+ SudoAsDone(bool),
}
);