pallet-sudo: add CheckOnlySudoAccount signed extension (#12496)

* pallet-sudo: add `CheckSudoKey` signed extension

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* Rename CheckSudoKey => CheckOnlySudo

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* Rename extension name and Add some docs

* Apply review suggestions

* Update frame/sudo/src/extension.rs

Co-authored-by: Jegor Sidorenko <5252494+jsidorenko@users.noreply.github.com>

* Update frame/sudo/src/extension.rs

Signed-off-by: koushiro <koushiro.cqx@gmail.com>
Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: Jegor Sidorenko <5252494+jsidorenko@users.noreply.github.com>
This commit is contained in:
Qinxuan Chen
2022-11-04 07:08:24 +08:00
committed by GitHub
parent a2e98a943a
commit 6ba635fcff
2 changed files with 117 additions and 1 deletions
+10 -1
View File
@@ -59,7 +59,7 @@
//! use frame_system::pallet_prelude::*;
//!
//! #[pallet::pallet]
//! pub struct Pallet<T>(_);
//! pub struct Pallet<T>(PhantomData<T>);
//!
//! #[pallet::config]
//! pub trait Config: frame_system::Config {}
@@ -79,6 +79,13 @@
//! # fn main() {}
//! ```
//!
//! ### Signed Extension
//!
//! The Sudo pallet defines the following extension:
//!
//! - [`CheckOnlySudoAccount`]: Ensures that the signed transactions are only valid if they are
//! signed by sudo account.
//!
//! ## Genesis Config
//!
//! The Sudo pallet depends on the [`GenesisConfig`].
@@ -97,11 +104,13 @@ use sp_std::prelude::*;
use frame_support::{dispatch::GetDispatchInfo, traits::UnfilteredDispatchable};
mod extension;
#[cfg(test)]
mod mock;
#[cfg(test)]
mod tests;
pub use extension::CheckOnlySudoAccount;
pub use pallet::*;
type AccountIdLookupOf<T> = <<T as frame_system::Config>::Lookup as StaticLookup>::Source;