Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Update frame/sudo/src/extension.rs
Browse files Browse the repository at this point in the history
Co-authored-by: Jegor Sidorenko <5252494+jsidorenko@users.noreply.github.com>
  • Loading branch information
bkchr and jsidorenko authored Nov 3, 2022
1 parent e2f955b commit edb408e
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions frame/sudo/src/extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,13 @@ where
info: &DispatchInfoOf<Self::Call>,
_len: usize,
) -> TransactionValidity {
let sudo_key: T::AccountId = match <Pallet<T>>::key() {
Some(account) => account,
None => return Err(UnknownTransaction::CannotLookup.into()),
};
let sudo_key: T::AccountId = <Pallet<T>>::key().ok_or(UnknownTransaction::CannotLookup)?;
ensure!(*who == sudo_key, InvalidTransaction::BadSigner);

if *who == sudo_key {
Ok(ValidTransaction {
priority: info.weight.ref_time() as TransactionPriority,
..Default::default()
})
} else {
Err(InvalidTransaction::BadSigner.into())
}
Ok(ValidTransaction {
priority: info.weight.ref_time() as TransactionPriority,
..Default::default()
})
}

fn pre_dispatch(
Expand Down

0 comments on commit edb408e

Please sign in to comment.