From bacffb9f65cf570384bac35ed023222a7737650b Mon Sep 17 00:00:00 2001 From: bennethxyz Date: Sun, 17 Nov 2024 16:26:09 -0800 Subject: [PATCH 01/13] frame-verify-signature --- Cargo.lock | 6 +----- substrate/frame/src/lib.rs | 5 +++-- substrate/frame/verify-signature/Cargo.toml | 20 ++++--------------- .../verify-signature/src/benchmarking.rs | 8 ++++++-- .../frame/verify-signature/src/extension.rs | 5 ++++- substrate/frame/verify-signature/src/lib.rs | 8 +++++--- substrate/frame/verify-signature/src/tests.rs | 15 ++++++++------ .../frame/verify-signature/src/weights.rs | 3 ++- 8 files changed, 34 insertions(+), 36 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 182d8f6bacad..dfd2a2374783 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15778,18 +15778,14 @@ dependencies = [ name = "pallet-verify-signature" version = "1.0.0" dependencies = [ - "frame-benchmarking 28.0.0", - "frame-support 28.0.0", "frame-system 28.0.0", "pallet-balances 28.0.0", "pallet-collective 28.0.0", "pallet-root-testing 4.0.0", "pallet-timestamp 27.0.0", "parity-scale-codec", + "polkadot-sdk-frame 0.1.0", "scale-info", - "sp-core 28.0.0", - "sp-io 30.0.0", - "sp-runtime 31.0.1", "sp-weights 27.0.0", ] diff --git a/substrate/frame/src/lib.rs b/substrate/frame/src/lib.rs index 0ca36ca8545a..dafadc910dbd 100644 --- a/substrate/frame/src/lib.rs +++ b/substrate/frame/src/lib.rs @@ -202,7 +202,7 @@ pub mod prelude { /// Dispatch types from `frame-support`, other fundamental traits #[doc(no_inline)] - pub use frame_support::dispatch::{GetDispatchInfo, PostDispatchInfo}; + pub use frame_support::dispatch::{GetDispatchInfo, PostDispatchInfo, DispatchInfo}; pub use frame_support::traits::{Contains, IsSubType, OnRuntimeUpgrade}; /// Pallet prelude of `frame-system`. @@ -392,7 +392,7 @@ pub mod runtime { }; pub use sp_inherents::{CheckInherentsResult, InherentData}; pub use sp_keyring::AccountKeyring; - pub use sp_runtime::{ApplyExtrinsicResult, ExtrinsicInclusionMode}; + pub use sp_runtime::{ApplyExtrinsicResult, ExtrinsicInclusionMode, impl_tx_ext_default}; } /// Types and traits for runtimes that implement runtime APIs. @@ -494,6 +494,7 @@ pub mod runtime { pub mod testing_prelude { pub use sp_core::storage::Storage; pub use sp_runtime::BuildStorage; + pub use sp_runtime::{testing::{TestSignature, UintAuthorityId}, generic::ExtensionVersion}; } } diff --git a/substrate/frame/verify-signature/Cargo.toml b/substrate/frame/verify-signature/Cargo.toml index 3c5fd5e65157..7443f5be9e0a 100644 --- a/substrate/frame/verify-signature/Cargo.toml +++ b/substrate/frame/verify-signature/Cargo.toml @@ -18,12 +18,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { workspace = true } scale-info = { features = ["derive"], workspace = true } -frame-benchmarking = { optional = true, workspace = true } -frame-support = { workspace = true } +frame = { workspace = true, features = ["experimental", "runtime"] } frame-system = { workspace = true } -sp-core = { workspace = true } -sp-io = { workspace = true } -sp-runtime = { workspace = true } sp-weights = { features = ["serde"], workspace = true } [dev-dependencies] @@ -31,40 +27,32 @@ pallet-balances = { workspace = true, default-features = true } pallet-root-testing = { workspace = true, default-features = true } pallet-collective = { workspace = true, default-features = true } pallet-timestamp = { workspace = true, default-features = true } -sp-core = { workspace = true, default-features = true } [features] default = ["std"] std = [ "codec/std", - "frame-benchmarking?/std", - "frame-support/std", + "frame/std", "frame-system/std", "pallet-balances/std", "pallet-collective/std", "pallet-root-testing/std", "pallet-timestamp/std", "scale-info/std", - "sp-core/std", - "sp-io/std", - "sp-runtime/std", "sp-weights/std", ] runtime-benchmarks = [ - "frame-benchmarking/runtime-benchmarks", - "frame-support/runtime-benchmarks", + "frame/runtime-benchmarks", "frame-system/runtime-benchmarks", "pallet-balances/runtime-benchmarks", "pallet-collective/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", ] try-runtime = [ - "frame-support/try-runtime", + "frame/try-runtime", "frame-system/try-runtime", "pallet-balances/try-runtime", "pallet-collective/try-runtime", "pallet-root-testing/try-runtime", "pallet-timestamp/try-runtime", - "sp-runtime/try-runtime", ] diff --git a/substrate/frame/verify-signature/src/benchmarking.rs b/substrate/frame/verify-signature/src/benchmarking.rs index 99e893e6f6ab..0457b20179cd 100644 --- a/substrate/frame/verify-signature/src/benchmarking.rs +++ b/substrate/frame/verify-signature/src/benchmarking.rs @@ -20,23 +20,27 @@ #![cfg(feature = "runtime-benchmarks")] extern crate alloc; - +use frame::{benchmarking::prelude::*, prelude::{DispatchInfo, Dispatchable}, testing_prelude::ExtensionVersion, traits::{AsTransactionAuthorizedOrigin, DispatchTransaction}}; use super::*; #[allow(unused)] use crate::{extension::VerifySignature, Config, Pallet as VerifySignaturePallet}; use alloc::vec; +/* use frame_benchmarking::{v2::*, BenchmarkError}; use frame_support::{ dispatch::{DispatchInfo, GetDispatchInfo}, pallet_prelude::TransactionSource, }; -use frame_system::{Call as SystemCall, RawOrigin}; +*/ +use frame_system::Call as SystemCall; //RawOrigin}; +/* use sp_io::hashing::blake2_256; use sp_runtime::{ generic::ExtensionVersion, traits::{AsTransactionAuthorizedOrigin, DispatchTransaction, Dispatchable}, }; +*/ pub trait BenchmarkHelper { fn create_signature(entropy: &[u8], msg: &[u8]) -> (Signature, Signer); diff --git a/substrate/frame/verify-signature/src/extension.rs b/substrate/frame/verify-signature/src/extension.rs index d48991e7a1da..945dcf36dc3f 100644 --- a/substrate/frame/verify-signature/src/extension.rs +++ b/substrate/frame/verify-signature/src/extension.rs @@ -20,8 +20,9 @@ use crate::{Config, WeightInfo}; use codec::{Decode, Encode}; -use frame_support::{pallet_prelude::TransactionSource, traits::OriginTrait}; use scale_info::TypeInfo; +/* +use frame_support::{pallet_prelude::TransactionSource, traits::OriginTrait}; use sp_io::hashing::blake2_256; use sp_runtime::{ impl_tx_ext_default, @@ -31,6 +32,8 @@ use sp_runtime::{ }, transaction_validity::{InvalidTransaction, TransactionValidityError, ValidTransaction}, }; +*/ +use frame::{traits::{TransactionExtension, Dispatchable, AsTransactionAuthorizedOrigin, DispatchInfoOf, Verify, OriginTrait}, runtime::prelude::{TransactionSource, ValidTransaction, InvalidTransaction, TransactionValidityError, impl_tx_ext_default}, hashing::blake2_256}; use sp_weights::Weight; /// Extension that, if enabled, validates a signature type against the payload constructed from the diff --git a/substrate/frame/verify-signature/src/lib.rs b/substrate/frame/verify-signature/src/lib.rs index 96d83dbef9f7..fa53504bf05b 100644 --- a/substrate/frame/verify-signature/src/lib.rs +++ b/substrate/frame/verify-signature/src/lib.rs @@ -34,15 +34,17 @@ extern crate alloc; pub use benchmarking::BenchmarkHelper; use codec::{Decode, Encode}; pub use extension::VerifySignature; -use frame_support::Parameter; +// use frame_support::Parameter; +use frame::{prelude::*, traits::{IdentifyAccount, Verify}}; pub use weights::WeightInfo; pub use pallet::*; -#[frame_support::pallet] +// #[frame_support::pallet] +#[frame::pallet] pub mod pallet { use super::*; - use sp_runtime::traits::{IdentifyAccount, Verify}; + // use sp_runtime::traits::{IdentifyAccount, Verify}; #[pallet::pallet] pub struct Pallet(_); diff --git a/substrate/frame/verify-signature/src/tests.rs b/substrate/frame/verify-signature/src/tests.rs index 63a310506eec..b08e4d5c4c86 100644 --- a/substrate/frame/verify-signature/src/tests.rs +++ b/substrate/frame/verify-signature/src/tests.rs @@ -22,23 +22,26 @@ use super::*; use extension::VerifySignature; +/* use frame_support::{ derive_impl, dispatch::GetDispatchInfo, pallet_prelude::{InvalidTransaction, TransactionSource, TransactionValidityError}, traits::OriginTrait, }; -use frame_system::Call as SystemCall; +; use sp_io::hashing::blake2_256; use sp_runtime::{ generic::ExtensionVersion, testing::{TestSignature, UintAuthorityId}, traits::DispatchTransaction, }; - +*/ +use frame_system::Call as SystemCall; +use frame::{testing_prelude::*, pallet_macros::derive_impl, traits::{DispatchTransaction, OriginTrait}}; type Block = frame_system::mocking::MockBlock; -frame_support::construct_runtime!( +construct_runtime!( pub enum Test { System: frame_system, @@ -69,10 +72,10 @@ impl crate::Config for Test { } #[cfg(feature = "runtime-benchmarks")] -pub fn new_test_ext() -> sp_io::TestExternalities { - use sp_runtime::BuildStorage; +pub fn new_test_ext() -> TestExternalities { + // use sp_runtime::BuildStorage; let t = frame_system::GenesisConfig::::default().build_storage().unwrap(); - let mut ext = sp_io::TestExternalities::new(t); + let mut ext = TestExternalities::new(t); ext.execute_with(|| System::set_block_number(1)); ext } diff --git a/substrate/frame/verify-signature/src/weights.rs b/substrate/frame/verify-signature/src/weights.rs index a8bfa9ea902d..9b6ddb0eac64 100644 --- a/substrate/frame/verify-signature/src/weights.rs +++ b/substrate/frame/verify-signature/src/weights.rs @@ -46,7 +46,8 @@ #![allow(unused_imports)] #![allow(missing_docs)] -use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +// use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use frame::weights_prelude::*; use core::marker::PhantomData; /// Weight functions needed for `pallet_verify_signature`. From 418709c5fa5f4d717a13d7d10a80a52f218727b4 Mon Sep 17 00:00:00 2001 From: bennethxyz Date: Sun, 24 Nov 2024 13:03:18 -0800 Subject: [PATCH 02/13] cargo +nightly fmt, add prdoc --- prdoc/pr_6515.prdoc | 17 ++++++++++++++ .../verify-signature/src/benchmarking.rs | 23 ++++++------------- .../frame/verify-signature/src/extension.rs | 20 ++++++++-------- substrate/frame/verify-signature/src/lib.rs | 8 +++---- substrate/frame/verify-signature/src/tests.rs | 19 ++++----------- .../frame/verify-signature/src/weights.rs | 1 - 6 files changed, 41 insertions(+), 47 deletions(-) create mode 100644 prdoc/pr_6515.prdoc diff --git a/prdoc/pr_6515.prdoc b/prdoc/pr_6515.prdoc new file mode 100644 index 000000000000..c64db4aea22d --- /dev/null +++ b/prdoc/pr_6515.prdoc @@ -0,0 +1,17 @@ +# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0 +# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json + +title: migrate pallet-verify-signature to umbrella crate + +doc: + - audience: Runtime Dev + description: | + This pull request adapts the frame umbrella crate into pallet-verify-signature + by importing existing systems into the pallet. + + +crates: + - name: polkadot-sdk-frame + bump: minor + - name: pallet-verify-signature + bump: minor \ No newline at end of file diff --git a/substrate/frame/verify-signature/src/benchmarking.rs b/substrate/frame/verify-signature/src/benchmarking.rs index 0457b20179cd..947f26ac5143 100644 --- a/substrate/frame/verify-signature/src/benchmarking.rs +++ b/substrate/frame/verify-signature/src/benchmarking.rs @@ -20,27 +20,18 @@ #![cfg(feature = "runtime-benchmarks")] extern crate alloc; -use frame::{benchmarking::prelude::*, prelude::{DispatchInfo, Dispatchable}, testing_prelude::ExtensionVersion, traits::{AsTransactionAuthorizedOrigin, DispatchTransaction}}; use super::*; +use frame::{ + benchmarking::prelude::*, + prelude::{DispatchInfo, Dispatchable}, + testing_prelude::ExtensionVersion, + traits::{AsTransactionAuthorizedOrigin, DispatchTransaction}, +}; #[allow(unused)] use crate::{extension::VerifySignature, Config, Pallet as VerifySignaturePallet}; use alloc::vec; -/* -use frame_benchmarking::{v2::*, BenchmarkError}; -use frame_support::{ - dispatch::{DispatchInfo, GetDispatchInfo}, - pallet_prelude::TransactionSource, -}; -*/ -use frame_system::Call as SystemCall; //RawOrigin}; -/* -use sp_io::hashing::blake2_256; -use sp_runtime::{ - generic::ExtensionVersion, - traits::{AsTransactionAuthorizedOrigin, DispatchTransaction, Dispatchable}, -}; -*/ +use frame_system::Call as SystemCall; pub trait BenchmarkHelper { fn create_signature(entropy: &[u8], msg: &[u8]) -> (Signature, Signer); diff --git a/substrate/frame/verify-signature/src/extension.rs b/substrate/frame/verify-signature/src/extension.rs index 945dcf36dc3f..7ef355bb0480 100644 --- a/substrate/frame/verify-signature/src/extension.rs +++ b/substrate/frame/verify-signature/src/extension.rs @@ -20,20 +20,18 @@ use crate::{Config, WeightInfo}; use codec::{Decode, Encode}; -use scale_info::TypeInfo; -/* -use frame_support::{pallet_prelude::TransactionSource, traits::OriginTrait}; -use sp_io::hashing::blake2_256; -use sp_runtime::{ - impl_tx_ext_default, +use frame::{ + hashing::blake2_256, + runtime::prelude::{ + impl_tx_ext_default, InvalidTransaction, TransactionSource, TransactionValidityError, + ValidTransaction, + }, traits::{ - transaction_extension::TransactionExtension, AsTransactionAuthorizedOrigin, DispatchInfoOf, - Dispatchable, Verify, + AsTransactionAuthorizedOrigin, DispatchInfoOf, Dispatchable, OriginTrait, + TransactionExtension, Verify, }, - transaction_validity::{InvalidTransaction, TransactionValidityError, ValidTransaction}, }; -*/ -use frame::{traits::{TransactionExtension, Dispatchable, AsTransactionAuthorizedOrigin, DispatchInfoOf, Verify, OriginTrait}, runtime::prelude::{TransactionSource, ValidTransaction, InvalidTransaction, TransactionValidityError, impl_tx_ext_default}, hashing::blake2_256}; +use scale_info::TypeInfo; use sp_weights::Weight; /// Extension that, if enabled, validates a signature type against the payload constructed from the diff --git a/substrate/frame/verify-signature/src/lib.rs b/substrate/frame/verify-signature/src/lib.rs index fa53504bf05b..e4f1370e2c5d 100644 --- a/substrate/frame/verify-signature/src/lib.rs +++ b/substrate/frame/verify-signature/src/lib.rs @@ -34,17 +34,17 @@ extern crate alloc; pub use benchmarking::BenchmarkHelper; use codec::{Decode, Encode}; pub use extension::VerifySignature; -// use frame_support::Parameter; -use frame::{prelude::*, traits::{IdentifyAccount, Verify}}; +use frame::{ + prelude::*, + traits::{IdentifyAccount, Verify}, +}; pub use weights::WeightInfo; pub use pallet::*; -// #[frame_support::pallet] #[frame::pallet] pub mod pallet { use super::*; - // use sp_runtime::traits::{IdentifyAccount, Verify}; #[pallet::pallet] pub struct Pallet(_); diff --git a/substrate/frame/verify-signature/src/tests.rs b/substrate/frame/verify-signature/src/tests.rs index b08e4d5c4c86..6364cfd809a7 100644 --- a/substrate/frame/verify-signature/src/tests.rs +++ b/substrate/frame/verify-signature/src/tests.rs @@ -22,23 +22,12 @@ use super::*; use extension::VerifySignature; -/* -use frame_support::{ - derive_impl, - dispatch::GetDispatchInfo, - pallet_prelude::{InvalidTransaction, TransactionSource, TransactionValidityError}, - traits::OriginTrait, +use frame::{ + pallet_macros::derive_impl, + testing_prelude::*, + traits::{DispatchTransaction, OriginTrait}, }; -; -use sp_io::hashing::blake2_256; -use sp_runtime::{ - generic::ExtensionVersion, - testing::{TestSignature, UintAuthorityId}, - traits::DispatchTransaction, -}; -*/ use frame_system::Call as SystemCall; -use frame::{testing_prelude::*, pallet_macros::derive_impl, traits::{DispatchTransaction, OriginTrait}}; type Block = frame_system::mocking::MockBlock; construct_runtime!( diff --git a/substrate/frame/verify-signature/src/weights.rs b/substrate/frame/verify-signature/src/weights.rs index 9b6ddb0eac64..d9779da9fc85 100644 --- a/substrate/frame/verify-signature/src/weights.rs +++ b/substrate/frame/verify-signature/src/weights.rs @@ -46,7 +46,6 @@ #![allow(unused_imports)] #![allow(missing_docs)] -// use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; use frame::weights_prelude::*; use core::marker::PhantomData; From 60986094015ebeccf2ab4c75a28d0f2eb9cc5477 Mon Sep 17 00:00:00 2001 From: bennethxyz Date: Wed, 27 Nov 2024 11:04:04 -0800 Subject: [PATCH 03/13] nit prdoc --- prdoc/pr_6515.prdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prdoc/pr_6515.prdoc b/prdoc/pr_6515.prdoc index c64db4aea22d..af927eb13cbe 100644 --- a/prdoc/pr_6515.prdoc +++ b/prdoc/pr_6515.prdoc @@ -14,4 +14,4 @@ crates: - name: polkadot-sdk-frame bump: minor - name: pallet-verify-signature - bump: minor \ No newline at end of file + bump: minor \ No newline at end of file From 7e590842aad6324896e993d5498e023bf06d3ccf Mon Sep 17 00:00:00 2001 From: bennethxyz Date: Fri, 6 Dec 2024 05:48:33 -0800 Subject: [PATCH 04/13] prelude, improved pr_doc --- Cargo.lock | 1 - prdoc/pr_6515.prdoc | 10 ++++++++-- substrate/frame/src/lib.rs | 2 +- substrate/frame/verify-signature/Cargo.toml | 4 ---- substrate/frame/verify-signature/src/benchmarking.rs | 12 ++++-------- substrate/frame/verify-signature/src/extension.rs | 11 ++--------- substrate/frame/verify-signature/src/tests.rs | 4 +--- 7 files changed, 16 insertions(+), 28 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 23bde87ef746..adbe7872c9fc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15780,7 +15780,6 @@ dependencies = [ name = "pallet-verify-signature" version = "1.0.0" dependencies = [ - "frame-system 28.0.0", "pallet-balances 28.0.0", "pallet-collective 28.0.0", "pallet-root-testing 4.0.0", diff --git a/prdoc/pr_6515.prdoc b/prdoc/pr_6515.prdoc index af927eb13cbe..51ef28f0399e 100644 --- a/prdoc/pr_6515.prdoc +++ b/prdoc/pr_6515.prdoc @@ -6,8 +6,14 @@ title: migrate pallet-verify-signature to umbrella crate doc: - audience: Runtime Dev description: | - This pull request adapts the frame umbrella crate into pallet-verify-signature - by importing existing systems into the pallet. + This pull request refactors the pallet-verify-signature + to integrate it into the Frame umbrella crate. + + The update incorporates components from the `sp_runtime` testing module, + specifically `TestSignature` and `UintAuthorityId`, now included in + `frame::runtime::testing_prelude`. This transition enhances the consistency + and modularity of the pallet within the broader Frame ecosystem, + aligning it with the testing infrastructure provided by the umbrella crate. crates: diff --git a/substrate/frame/src/lib.rs b/substrate/frame/src/lib.rs index 1eac042c518c..0cc1e448c5ca 100644 --- a/substrate/frame/src/lib.rs +++ b/substrate/frame/src/lib.rs @@ -494,7 +494,7 @@ pub mod runtime { pub mod testing_prelude { pub use sp_core::storage::Storage; pub use sp_runtime::BuildStorage; - pub use sp_runtime::{testing::{TestSignature, UintAuthorityId}, generic::ExtensionVersion}; + pub use sp_runtime::testing::{TestSignature, UintAuthorityId}; } } diff --git a/substrate/frame/verify-signature/Cargo.toml b/substrate/frame/verify-signature/Cargo.toml index 7443f5be9e0a..982fa101c937 100644 --- a/substrate/frame/verify-signature/Cargo.toml +++ b/substrate/frame/verify-signature/Cargo.toml @@ -19,7 +19,6 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { workspace = true } scale-info = { features = ["derive"], workspace = true } frame = { workspace = true, features = ["experimental", "runtime"] } -frame-system = { workspace = true } sp-weights = { features = ["serde"], workspace = true } [dev-dependencies] @@ -33,7 +32,6 @@ default = ["std"] std = [ "codec/std", "frame/std", - "frame-system/std", "pallet-balances/std", "pallet-collective/std", "pallet-root-testing/std", @@ -43,14 +41,12 @@ std = [ ] runtime-benchmarks = [ "frame/runtime-benchmarks", - "frame-system/runtime-benchmarks", "pallet-balances/runtime-benchmarks", "pallet-collective/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", ] try-runtime = [ "frame/try-runtime", - "frame-system/try-runtime", "pallet-balances/try-runtime", "pallet-collective/try-runtime", "pallet-root-testing/try-runtime", diff --git a/substrate/frame/verify-signature/src/benchmarking.rs b/substrate/frame/verify-signature/src/benchmarking.rs index 947f26ac5143..649c39b22b19 100644 --- a/substrate/frame/verify-signature/src/benchmarking.rs +++ b/substrate/frame/verify-signature/src/benchmarking.rs @@ -21,12 +21,7 @@ extern crate alloc; use super::*; -use frame::{ - benchmarking::prelude::*, - prelude::{DispatchInfo, Dispatchable}, - testing_prelude::ExtensionVersion, - traits::{AsTransactionAuthorizedOrigin, DispatchTransaction}, -}; +use frame::benchmarking::prelude::*; #[allow(unused)] use crate::{extension::VerifySignature, Config, Pallet as VerifySignaturePallet}; @@ -40,16 +35,17 @@ pub trait BenchmarkHelper { #[benchmarks(where T: Config + Send + Sync, T::RuntimeCall: Dispatchable + GetDispatchInfo, - T::RuntimeOrigin: AsTransactionAuthorizedOrigin, + T::RuntimeOrigin: frame::traits::AsTransactionAuthorizedOrigin, )] mod benchmarks { use super::*; + use frame::traits::DispatchTransaction; #[benchmark] fn verify_signature() -> Result<(), BenchmarkError> { let entropy = [42u8; 256]; let call: T::RuntimeCall = SystemCall::remark { remark: vec![] }.into(); - let ext_version: ExtensionVersion = 0; + let ext_version: frame::deps::sp_runtime::generic::ExtensionVersion = 0; let info = call.get_dispatch_info(); let msg = (ext_version, &call).using_encoded(blake2_256).to_vec(); let (signature, signer) = T::BenchmarkHelper::create_signature(&entropy, &msg[..]); diff --git a/substrate/frame/verify-signature/src/extension.rs b/substrate/frame/verify-signature/src/extension.rs index 7ef355bb0480..3d0cfe352845 100644 --- a/substrate/frame/verify-signature/src/extension.rs +++ b/substrate/frame/verify-signature/src/extension.rs @@ -21,15 +21,8 @@ use crate::{Config, WeightInfo}; use codec::{Decode, Encode}; use frame::{ - hashing::blake2_256, - runtime::prelude::{ - impl_tx_ext_default, InvalidTransaction, TransactionSource, TransactionValidityError, - ValidTransaction, - }, - traits::{ - AsTransactionAuthorizedOrigin, DispatchInfoOf, Dispatchable, OriginTrait, - TransactionExtension, Verify, - }, + runtime::prelude::*, + traits::{AsTransactionAuthorizedOrigin, OriginTrait, TransactionExtension, Verify}, }; use scale_info::TypeInfo; use sp_weights::Weight; diff --git a/substrate/frame/verify-signature/src/tests.rs b/substrate/frame/verify-signature/src/tests.rs index 6364cfd809a7..a1fe364f23e9 100644 --- a/substrate/frame/verify-signature/src/tests.rs +++ b/substrate/frame/verify-signature/src/tests.rs @@ -23,7 +23,6 @@ use super::*; use extension::VerifySignature; use frame::{ - pallet_macros::derive_impl, testing_prelude::*, traits::{DispatchTransaction, OriginTrait}, }; @@ -62,7 +61,6 @@ impl crate::Config for Test { #[cfg(feature = "runtime-benchmarks")] pub fn new_test_ext() -> TestExternalities { - // use sp_runtime::BuildStorage; let t = frame_system::GenesisConfig::::default().build_storage().unwrap(); let mut ext = TestExternalities::new(t); ext.execute_with(|| System::set_block_number(1)); @@ -73,7 +71,7 @@ pub fn new_test_ext() -> TestExternalities { fn verification_works() { let who = 0; let call: RuntimeCall = SystemCall::remark { remark: vec![] }.into(); - let ext_version: ExtensionVersion = 0; + let ext_version: frame::deps::sp_runtime::generic::ExtensionVersion = 0; let sig = TestSignature(0, (ext_version, &call).using_encoded(blake2_256).to_vec()); let info = call.get_dispatch_info(); From def0054ddf969411b4485ea6ed54d87cc3b32d64 Mon Sep 17 00:00:00 2001 From: bennethxyz Date: Wed, 11 Dec 2024 19:22:24 -0800 Subject: [PATCH 05/13] remove prdoc --- prdoc/pr_6515.prdoc | 23 ------------------- .../verify-signature/src/benchmarking.rs | 3 +-- 2 files changed, 1 insertion(+), 25 deletions(-) delete mode 100644 prdoc/pr_6515.prdoc diff --git a/prdoc/pr_6515.prdoc b/prdoc/pr_6515.prdoc deleted file mode 100644 index 51ef28f0399e..000000000000 --- a/prdoc/pr_6515.prdoc +++ /dev/null @@ -1,23 +0,0 @@ -# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0 -# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json - -title: migrate pallet-verify-signature to umbrella crate - -doc: - - audience: Runtime Dev - description: | - This pull request refactors the pallet-verify-signature - to integrate it into the Frame umbrella crate. - - The update incorporates components from the `sp_runtime` testing module, - specifically `TestSignature` and `UintAuthorityId`, now included in - `frame::runtime::testing_prelude`. This transition enhances the consistency - and modularity of the pallet within the broader Frame ecosystem, - aligning it with the testing infrastructure provided by the umbrella crate. - - -crates: - - name: polkadot-sdk-frame - bump: minor - - name: pallet-verify-signature - bump: minor \ No newline at end of file diff --git a/substrate/frame/verify-signature/src/benchmarking.rs b/substrate/frame/verify-signature/src/benchmarking.rs index 649c39b22b19..81d6c4e28422 100644 --- a/substrate/frame/verify-signature/src/benchmarking.rs +++ b/substrate/frame/verify-signature/src/benchmarking.rs @@ -21,12 +21,11 @@ extern crate alloc; use super::*; -use frame::benchmarking::prelude::*; +use frame::benchmarking::prelude::{*, frame_system::Call as SystemCall}; #[allow(unused)] use crate::{extension::VerifySignature, Config, Pallet as VerifySignaturePallet}; use alloc::vec; -use frame_system::Call as SystemCall; pub trait BenchmarkHelper { fn create_signature(entropy: &[u8], msg: &[u8]) -> (Signature, Signer); From e688742ec0966d7b09d6ea452393ed13b24899de Mon Sep 17 00:00:00 2001 From: bennethxyz Date: Sun, 29 Dec 2024 16:21:55 +0100 Subject: [PATCH 06/13] just prelude --- Cargo.lock | 1 - substrate/frame/src/lib.rs | 43 +++++++++++++------ substrate/frame/verify-signature/Cargo.toml | 2 - .../verify-signature/src/benchmarking.rs | 2 +- .../frame/verify-signature/src/extension.rs | 6 +-- substrate/frame/verify-signature/src/lib.rs | 5 +-- substrate/frame/verify-signature/src/tests.rs | 7 +-- 7 files changed, 34 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9ff0f38b414d..ea08edfc5521 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15992,7 +15992,6 @@ dependencies = [ "parity-scale-codec", "polkadot-sdk-frame 0.1.0", "scale-info", - "sp-weights 27.0.0", ] [[package]] diff --git a/substrate/frame/src/lib.rs b/substrate/frame/src/lib.rs index 0cc1e448c5ca..de31c7fe2e11 100644 --- a/substrate/frame/src/lib.rs +++ b/substrate/frame/src/lib.rs @@ -202,8 +202,8 @@ pub mod prelude { /// Dispatch types from `frame-support`, other fundamental traits #[doc(no_inline)] - pub use frame_support::dispatch::{GetDispatchInfo, PostDispatchInfo, DispatchInfo}; - pub use frame_support::traits::{Contains, IsSubType, OnRuntimeUpgrade}; + pub use frame_support::dispatch::{DispatchInfo, GetDispatchInfo, PostDispatchInfo}; + pub use frame_support::traits::{Contains, IsSubType, OnRuntimeUpgrade, OriginTrait}; /// Pallet prelude of `frame-system`. #[doc(no_inline)] @@ -213,14 +213,18 @@ pub mod prelude { #[doc(no_inline)] pub use super::derive::*; - /// All hashing related things - pub use super::hashing::*; + /// All crypto related things. + pub use super::cryptography::*; + + /// All account related things. + pub use super::account::*; /// Runtime traits #[doc(no_inline)] pub use sp_runtime::traits::{ - BlockNumberProvider, Bounded, DispatchInfoOf, Dispatchable, SaturatedConversion, - Saturating, StaticLookup, TrailingZeroInput, + AsTransactionAuthorizedOrigin, BlockNumberProvider, Bounded, DispatchInfoOf, + DispatchTransaction, Dispatchable, SaturatedConversion, Saturating, StaticLookup, + TrailingZeroInput, TransactionExtension, }; /// Other error/result types for runtime @@ -364,7 +368,7 @@ pub mod runtime { }; /// Used for simple fee calculation. - pub use frame_support::weights::{self, FixedFee, NoFee}; + pub use frame_support::weights::{self, FixedFee, NoFee, Weight}; /// Primary types used to parameterize `EnsureOrigin` and `EnsureRootWithArg`. pub use frame_system::{ @@ -391,8 +395,8 @@ pub mod runtime { LOCAL_TESTNET_RUNTIME_PRESET, }; pub use sp_inherents::{CheckInherentsResult, InherentData}; - pub use sp_keyring::AccountKeyring; - pub use sp_runtime::{ApplyExtrinsicResult, ExtrinsicInclusionMode, impl_tx_ext_default}; + pub use sp_keyring::Sr25519Keyring; + pub use sp_runtime::{impl_tx_ext_default, ApplyExtrinsicResult, ExtrinsicInclusionMode}; } /// Types and traits for runtimes that implement runtime APIs. @@ -493,8 +497,7 @@ pub mod runtime { #[cfg(feature = "std")] pub mod testing_prelude { pub use sp_core::storage::Storage; - pub use sp_runtime::BuildStorage; - pub use sp_runtime::testing::{TestSignature, UintAuthorityId}; + pub use sp_runtime::{testing::UintAuthorityId, BuildStorage}; } } @@ -528,9 +531,21 @@ pub mod derive { pub use sp_runtime::RuntimeDebug; } -pub mod hashing { - pub use sp_core::{hashing::*, H160, H256, H512, U256, U512}; - pub use sp_runtime::traits::{BlakeTwo256, Hash, Keccak256}; +pub mod cryptography { + pub use sp_core::{ + crypto::{VrfPublic, VrfSecret, Wraps}, + hashing::*, + Pair, H160, H256, H512, U256, U512, + }; + pub use sp_runtime::traits::{BlakeTwo256, Hash, Keccak256, Verify}; +} + +/// All account management related traits. +/// +/// This is already part of the [`prelude`]. +pub mod account { + pub use frame_support::traits::{ChangeMembers, EitherOfDiverse, InitializeMembers}; + pub use sp_runtime::traits::IdentifyAccount; } /// Access to all of the dependencies of this crate. In case the prelude re-exports are not enough, diff --git a/substrate/frame/verify-signature/Cargo.toml b/substrate/frame/verify-signature/Cargo.toml index 982fa101c937..ac515e383c70 100644 --- a/substrate/frame/verify-signature/Cargo.toml +++ b/substrate/frame/verify-signature/Cargo.toml @@ -19,7 +19,6 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { workspace = true } scale-info = { features = ["derive"], workspace = true } frame = { workspace = true, features = ["experimental", "runtime"] } -sp-weights = { features = ["serde"], workspace = true } [dev-dependencies] pallet-balances = { workspace = true, default-features = true } @@ -37,7 +36,6 @@ std = [ "pallet-root-testing/std", "pallet-timestamp/std", "scale-info/std", - "sp-weights/std", ] runtime-benchmarks = [ "frame/runtime-benchmarks", diff --git a/substrate/frame/verify-signature/src/benchmarking.rs b/substrate/frame/verify-signature/src/benchmarking.rs index 81d6c4e28422..f447a2ffe284 100644 --- a/substrate/frame/verify-signature/src/benchmarking.rs +++ b/substrate/frame/verify-signature/src/benchmarking.rs @@ -21,7 +21,7 @@ extern crate alloc; use super::*; -use frame::benchmarking::prelude::{*, frame_system::Call as SystemCall}; +use frame::benchmarking::prelude::{frame_system::Call as SystemCall, *}; #[allow(unused)] use crate::{extension::VerifySignature, Config, Pallet as VerifySignaturePallet}; diff --git a/substrate/frame/verify-signature/src/extension.rs b/substrate/frame/verify-signature/src/extension.rs index 3d0cfe352845..b3c080ee8294 100644 --- a/substrate/frame/verify-signature/src/extension.rs +++ b/substrate/frame/verify-signature/src/extension.rs @@ -20,12 +20,8 @@ use crate::{Config, WeightInfo}; use codec::{Decode, Encode}; -use frame::{ - runtime::prelude::*, - traits::{AsTransactionAuthorizedOrigin, OriginTrait, TransactionExtension, Verify}, -}; +use frame::runtime::prelude::*; use scale_info::TypeInfo; -use sp_weights::Weight; /// Extension that, if enabled, validates a signature type against the payload constructed from the /// call and the rest of the transaction extension pipeline. This extension provides the diff --git a/substrate/frame/verify-signature/src/lib.rs b/substrate/frame/verify-signature/src/lib.rs index e4f1370e2c5d..caad11d75e16 100644 --- a/substrate/frame/verify-signature/src/lib.rs +++ b/substrate/frame/verify-signature/src/lib.rs @@ -34,10 +34,7 @@ extern crate alloc; pub use benchmarking::BenchmarkHelper; use codec::{Decode, Encode}; pub use extension::VerifySignature; -use frame::{ - prelude::*, - traits::{IdentifyAccount, Verify}, -}; +use frame::prelude::*; pub use weights::WeightInfo; pub use pallet::*; diff --git a/substrate/frame/verify-signature/src/tests.rs b/substrate/frame/verify-signature/src/tests.rs index a1fe364f23e9..28bc743cc91b 100644 --- a/substrate/frame/verify-signature/src/tests.rs +++ b/substrate/frame/verify-signature/src/tests.rs @@ -22,12 +22,9 @@ use super::*; use extension::VerifySignature; -use frame::{ - testing_prelude::*, - traits::{DispatchTransaction, OriginTrait}, -}; +use frame::{deps::sp_runtime::testing::TestSignature, testing_prelude::*}; use frame_system::Call as SystemCall; -type Block = frame_system::mocking::MockBlock; +type Block = MockBlock; construct_runtime!( pub enum Test From 660f38b514e56e21f80bd0cb12a5d5f760f84b52 Mon Sep 17 00:00:00 2001 From: bennethxyz Date: Sun, 29 Dec 2024 20:58:09 +0100 Subject: [PATCH 07/13] add transaction module --- substrate/frame/src/lib.rs | 24 +++++++++++++++---- .../verify-signature/src/benchmarking.rs | 5 ++-- substrate/frame/verify-signature/src/tests.rs | 2 +- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/substrate/frame/src/lib.rs b/substrate/frame/src/lib.rs index de31c7fe2e11..c5b6b6bee830 100644 --- a/substrate/frame/src/lib.rs +++ b/substrate/frame/src/lib.rs @@ -219,12 +219,13 @@ pub mod prelude { /// All account related things. pub use super::account::*; + pub use crate::transaction::*; + /// Runtime traits #[doc(no_inline)] pub use sp_runtime::traits::{ - AsTransactionAuthorizedOrigin, BlockNumberProvider, Bounded, DispatchInfoOf, - DispatchTransaction, Dispatchable, SaturatedConversion, Saturating, StaticLookup, - TrailingZeroInput, TransactionExtension, + BlockNumberProvider, Bounded, DispatchInfoOf, Dispatchable, SaturatedConversion, + Saturating, StaticLookup, TrailingZeroInput, }; /// Other error/result types for runtime @@ -396,7 +397,7 @@ pub mod runtime { }; pub use sp_inherents::{CheckInherentsResult, InherentData}; pub use sp_keyring::Sr25519Keyring; - pub use sp_runtime::{impl_tx_ext_default, ApplyExtrinsicResult, ExtrinsicInclusionMode}; + pub use sp_runtime::{ApplyExtrinsicResult, ExtrinsicInclusionMode}; } /// Types and traits for runtimes that implement runtime APIs. @@ -548,6 +549,21 @@ pub mod account { pub use sp_runtime::traits::IdentifyAccount; } +/// Systems involved in transaction fulfilment. +/// +/// This is already part of the [`prelude`]. +pub mod transaction { + pub use sp_runtime::{ + generic::ExtensionVersion, + impl_tx_ext_default, + traits::{ + AsTransactionAuthorizedOrigin, DispatchTransaction, TransactionExtension, + ValidateResult, + }, + transaction_validity::{InvalidTransaction, ValidTransaction}, + }; +} + /// Access to all of the dependencies of this crate. In case the prelude re-exports are not enough, /// this module can be used. /// diff --git a/substrate/frame/verify-signature/src/benchmarking.rs b/substrate/frame/verify-signature/src/benchmarking.rs index f447a2ffe284..8407aea95309 100644 --- a/substrate/frame/verify-signature/src/benchmarking.rs +++ b/substrate/frame/verify-signature/src/benchmarking.rs @@ -34,17 +34,16 @@ pub trait BenchmarkHelper { #[benchmarks(where T: Config + Send + Sync, T::RuntimeCall: Dispatchable + GetDispatchInfo, - T::RuntimeOrigin: frame::traits::AsTransactionAuthorizedOrigin, + T::RuntimeOrigin: AsTransactionAuthorizedOrigin, )] mod benchmarks { use super::*; - use frame::traits::DispatchTransaction; #[benchmark] fn verify_signature() -> Result<(), BenchmarkError> { let entropy = [42u8; 256]; let call: T::RuntimeCall = SystemCall::remark { remark: vec![] }.into(); - let ext_version: frame::deps::sp_runtime::generic::ExtensionVersion = 0; + let ext_version: ExtensionVersion = 0; let info = call.get_dispatch_info(); let msg = (ext_version, &call).using_encoded(blake2_256).to_vec(); let (signature, signer) = T::BenchmarkHelper::create_signature(&entropy, &msg[..]); diff --git a/substrate/frame/verify-signature/src/tests.rs b/substrate/frame/verify-signature/src/tests.rs index 28bc743cc91b..5f83257b52db 100644 --- a/substrate/frame/verify-signature/src/tests.rs +++ b/substrate/frame/verify-signature/src/tests.rs @@ -68,7 +68,7 @@ pub fn new_test_ext() -> TestExternalities { fn verification_works() { let who = 0; let call: RuntimeCall = SystemCall::remark { remark: vec![] }.into(); - let ext_version: frame::deps::sp_runtime::generic::ExtensionVersion = 0; + let ext_version: ExtensionVersion = 0; let sig = TestSignature(0, (ext_version, &call).using_encoded(blake2_256).to_vec()); let info = call.get_dispatch_info(); From 0235df2a5e5022f06b4bcfa83d87ca11d1257343 Mon Sep 17 00:00:00 2001 From: bennethxyz Date: Sat, 4 Jan 2025 03:27:58 +0100 Subject: [PATCH 08/13] Doc Checkable --- substrate/frame/verify-signature/src/extension.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/verify-signature/src/extension.rs b/substrate/frame/verify-signature/src/extension.rs index b3c080ee8294..aa802d6238b4 100644 --- a/substrate/frame/verify-signature/src/extension.rs +++ b/substrate/frame/verify-signature/src/extension.rs @@ -26,7 +26,7 @@ use scale_info::TypeInfo; /// Extension that, if enabled, validates a signature type against the payload constructed from the /// call and the rest of the transaction extension pipeline. This extension provides the /// functionality that traditionally signed transactions had with the implicit signature checking -/// implemented in [`Checkable`](sp_runtime::traits::Checkable). It is meant to be placed ahead of +/// implemented in [`Checkable`](frame::traits::Checkable). It is meant to be placed ahead of /// any other extensions that do authorization work in the [`TransactionExtension`] pipeline. #[derive(Encode, Decode, Clone, Eq, PartialEq, TypeInfo)] #[scale_info(skip_type_params(T))] From a99771578d3337a136c936e7eab2b5d69899a0cf Mon Sep 17 00:00:00 2001 From: bennethxyz Date: Sat, 4 Jan 2025 03:56:38 +0100 Subject: [PATCH 09/13] final nit --- substrate/frame/src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/substrate/frame/src/lib.rs b/substrate/frame/src/lib.rs index c9c39d9b832d..4b5640b082eb 100644 --- a/substrate/frame/src/lib.rs +++ b/substrate/frame/src/lib.rs @@ -203,7 +203,10 @@ pub mod prelude { /// Dispatch types from `frame-support`, other fundamental traits #[doc(no_inline)] pub use frame_support::dispatch::{DispatchInfo, GetDispatchInfo, PostDispatchInfo}; - pub use frame_support::traits::{Contains, EstimateNextSessionRotation, IsSubType, OnRuntimeUpgrade, OriginTrait}; + pub use frame_support::traits::{ + Contains, EstimateNextSessionRotation, IsSubType, OnRuntimeUpgrade, OneSessionHandler, + OriginTrait, + }; /// Pallet prelude of `frame-system`. #[doc(no_inline)] From f6fcfcc80b667f420f76397d971aed90f3632d41 Mon Sep 17 00:00:00 2001 From: bennethxyz Date: Tue, 14 Jan 2025 04:24:23 +0100 Subject: [PATCH 10/13] cargo +nightly fmt --- substrate/frame/src/lib.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/substrate/frame/src/lib.rs b/substrate/frame/src/lib.rs index c50264764fb7..5becacbe8e2d 100644 --- a/substrate/frame/src/lib.rs +++ b/substrate/frame/src/lib.rs @@ -204,10 +204,12 @@ pub mod prelude { #[doc(no_inline)] pub use frame_support::dispatch::{DispatchInfo, GetDispatchInfo, PostDispatchInfo}; pub use frame_support::{ - defensive, defensive_assert, - traits::{ - Contains, EitherOf, EstimateNextSessionRotation, IsSubType, MapSuccess, NoOpPoll, OnRuntimeUpgrade, OneSessionHandler, RankedMembers, RankedMembersSwapHandler, - OriginTrait} + defensive, defensive_assert, + traits::{ + Contains, EitherOf, EstimateNextSessionRotation, IsSubType, MapSuccess, NoOpPoll, + OnRuntimeUpgrade, OneSessionHandler, OriginTrait, RankedMembers, + RankedMembersSwapHandler, + }, }; /// Pallet prelude of `frame-system`. @@ -516,6 +518,7 @@ pub mod runtime { pub mod testing_prelude { pub use sp_core::storage::Storage; pub use sp_runtime::{testing::UintAuthorityId, BuildStorage, DispatchError}; + } } /// All traits often used in FRAME pallets. From 52d32835d5088e7731849e81de6ac48bd1c2a82e Mon Sep 17 00:00:00 2001 From: bennethxyz Date: Sun, 19 Jan 2025 04:37:33 +0100 Subject: [PATCH 11/13] remove experimental --- substrate/frame/verify-signature/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/verify-signature/Cargo.toml b/substrate/frame/verify-signature/Cargo.toml index 4bfc73e3c0b8..58cc68445b39 100644 --- a/substrate/frame/verify-signature/Cargo.toml +++ b/substrate/frame/verify-signature/Cargo.toml @@ -17,8 +17,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { workspace = true } +frame = { workspace = true, features = ["runtime"] } scale-info = { features = ["derive"], workspace = true } -frame = { workspace = true, features = ["experimental", "runtime"] } [dev-dependencies] pallet-balances = { workspace = true, default-features = true } From 6e176dd1cbc7a333fb6cc76560f1d9fd2045085a Mon Sep 17 00:00:00 2001 From: bennethxyz Date: Mon, 20 Jan 2025 22:30:15 +0100 Subject: [PATCH 12/13] remove extra account mod --- substrate/frame/src/lib.rs | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-) diff --git a/substrate/frame/src/lib.rs b/substrate/frame/src/lib.rs index bed61a0f5589..c8400baf6a76 100644 --- a/substrate/frame/src/lib.rs +++ b/substrate/frame/src/lib.rs @@ -205,9 +205,9 @@ pub mod prelude { pub use frame_support::{ defensive, defensive_assert, traits::{ - Contains, EitherOf, EstimateNextSessionRotation, Everything, IsSubType, MapSuccess, NoOpPoll, - OnRuntimeUpgrade, OneSessionHandler, OriginTrait, RankedMembers, - RankedMembersSwapHandler, VariantCount, VariantCountOf + Contains, EitherOf, EstimateNextSessionRotation, Everything, IsSubType, MapSuccess, + NoOpPoll, OnRuntimeUpgrade, OneSessionHandler, OriginTrait, RankedMembers, + RankedMembersSwapHandler, VariantCount, VariantCountOf, }, }; @@ -231,9 +231,6 @@ pub mod prelude { pub use crate::transaction::*; - /// All account related things. - pub use super::account::*; - /// All arithmetic types and traits used for safe math. pub use super::arithmetic::*; @@ -538,6 +535,16 @@ pub mod traits { pub use sp_runtime::traits::*; } +/// All account management related traits. +/// +/// This is already part of the [`prelude`]. +pub mod account { + pub use frame_support::traits::{ + AsEnsureOriginWithArg, ChangeMembers, EitherOfDiverse, InitializeMembers, + }; + pub use sp_runtime::traits::{IdentifyAccount, IdentityLookup}; +} + /// The arithmetic types used for safe math. /// /// This is already part of the [`prelude`]. @@ -568,14 +575,6 @@ pub mod cryptography { pub use sp_runtime::traits::{BlakeTwo256, Hash, Keccak256, Verify}; } -/// All account management related traits. -/// -/// This is already part of the [`prelude`]. -pub mod account { - pub use frame_support::traits::{ChangeMembers, EitherOfDiverse, InitializeMembers}; - pub use sp_runtime::traits::IdentifyAccount; -} - /// Systems involved in transaction fulfilment. /// /// This is already part of the [`prelude`]. @@ -591,16 +590,6 @@ pub mod transaction { }; } -/// All account management related traits. -/// -/// This is already part of the [`prelude`]. -pub mod account { - pub use frame_support::traits::{ - AsEnsureOriginWithArg, ChangeMembers, EitherOfDiverse, InitializeMembers, - }; - pub use sp_runtime::traits::{IdentifyAccount, IdentityLookup}; -} - /// Access to all of the dependencies of this crate. In case the prelude re-exports are not enough, /// this module can be used. /// From 868903237382b36bccc5852bfcc5afa7ddb9abd4 Mon Sep 17 00:00:00 2001 From: bennethxyz Date: Mon, 20 Jan 2025 22:46:42 +0100 Subject: [PATCH 13/13] reorder mods --- substrate/frame/src/lib.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/substrate/frame/src/lib.rs b/substrate/frame/src/lib.rs index c8400baf6a76..84f2f9fc5b79 100644 --- a/substrate/frame/src/lib.rs +++ b/substrate/frame/src/lib.rs @@ -535,16 +535,6 @@ pub mod traits { pub use sp_runtime::traits::*; } -/// All account management related traits. -/// -/// This is already part of the [`prelude`]. -pub mod account { - pub use frame_support::traits::{ - AsEnsureOriginWithArg, ChangeMembers, EitherOfDiverse, InitializeMembers, - }; - pub use sp_runtime::traits::{IdentifyAccount, IdentityLookup}; -} - /// The arithmetic types used for safe math. /// /// This is already part of the [`prelude`]. @@ -590,6 +580,16 @@ pub mod transaction { }; } +/// All account management related traits. +/// +/// This is already part of the [`prelude`]. +pub mod account { + pub use frame_support::traits::{ + AsEnsureOriginWithArg, ChangeMembers, EitherOfDiverse, InitializeMembers, + }; + pub use sp_runtime::traits::{IdentifyAccount, IdentityLookup}; +} + /// Access to all of the dependencies of this crate. In case the prelude re-exports are not enough, /// this module can be used. ///