diff --git a/Cargo.lock b/Cargo.lock index 330c2563d976..2371ec9a9739 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11957,16 +11957,12 @@ dependencies = [ name = "pallet-authority-discovery" version = "28.0.0" dependencies = [ - "frame-support 28.0.0", - "frame-system 28.0.0", "pallet-session 28.0.0", "parity-scale-codec", + "polkadot-sdk-frame 0.1.0", "scale-info", "sp-application-crypto 30.0.0", "sp-authority-discovery 26.0.0", - "sp-core 28.0.0", - "sp-io 30.0.0", - "sp-runtime 31.0.1", ] [[package]] diff --git a/substrate/frame/authority-discovery/Cargo.toml b/substrate/frame/authority-discovery/Cargo.toml index 01f574a262ad..45117e0fdf05 100644 --- a/substrate/frame/authority-discovery/Cargo.toml +++ b/substrate/frame/authority-discovery/Cargo.toml @@ -20,36 +20,24 @@ codec = { features = [ "derive", ], workspace = true } scale-info = { features = ["derive"], workspace = true } -frame-support = { workspace = true } -frame-system = { workspace = true } +frame = { workspace = true, features = ["experimental", "runtime"] } pallet-session = { features = [ "historical", ], workspace = true } sp-application-crypto = { workspace = true } sp-authority-discovery = { workspace = true } -sp-runtime = { workspace = true } - -[dev-dependencies] -sp-core = { workspace = true, default-features = true } -sp-io = { workspace = true, default-features = true } [features] default = ["std"] std = [ "codec/std", - "frame-support/std", - "frame-system/std", + "frame/std", "pallet-session/std", "scale-info/std", "sp-application-crypto/std", "sp-authority-discovery/std", - "sp-core/std", - "sp-io/std", - "sp-runtime/std", ] try-runtime = [ - "frame-support/try-runtime", - "frame-system/try-runtime", + "frame/try-runtime", "pallet-session/try-runtime", - "sp-runtime/try-runtime", ] diff --git a/substrate/frame/authority-discovery/src/lib.rs b/substrate/frame/authority-discovery/src/lib.rs index 220b39292b57..593a0003f0c9 100644 --- a/substrate/frame/authority-discovery/src/lib.rs +++ b/substrate/frame/authority-discovery/src/lib.rs @@ -26,18 +26,20 @@ extern crate alloc; use alloc::vec::Vec; -use frame_support::{ +use frame::{ + deps::frame_support::WeakBoundedVec, + derive::DefaultNoBound, + prelude::*, traits::{Get, OneSessionHandler}, - WeakBoundedVec, }; use sp_authority_discovery::AuthorityId; pub use pallet::*; -#[frame_support::pallet] +// #[frame_support::pallet] +#[frame::pallet] pub mod pallet { use super::*; - use frame_support::pallet_prelude::*; #[pallet::pallet] pub struct Pallet(_); @@ -59,7 +61,7 @@ pub mod pallet { pub(super) type NextKeys = StorageValue<_, WeakBoundedVec, ValueQuery>; - #[derive(frame_support::DefaultNoBound)] + #[derive(DefaultNoBound)] #[pallet::genesis_config] pub struct GenesisConfig { pub keys: Vec, @@ -113,7 +115,7 @@ impl Pallet { } } -impl sp_runtime::BoundToRuntimeAppPublic for Pallet { +impl frame::deps::sp_runtime::BoundToRuntimeAppPublic for Pallet { type Public = AuthorityId; } @@ -171,20 +173,22 @@ mod tests { use super::*; use crate as pallet_authority_discovery; use alloc::vec; - use frame_support::{derive_impl, parameter_types, traits::ConstU32}; + use frame::{ + arithmetic::Perbill, + deps::sp_runtime::KeyTypeId, + runtime::{ + prelude::{construct_runtime, derive_impl, parameter_types}, + testing_prelude::BuildStorage, + }, + testing_prelude::TestExternalities, + traits::{ConstU32, ConvertInto, IdentityLookup, OpaqueKeys}, + }; use sp_application_crypto::Pair; use sp_authority_discovery::AuthorityPair; - use sp_core::crypto::key_types; - use sp_io::TestExternalities; - use sp_runtime::{ - testing::UintAuthorityId, - traits::{ConvertInto, IdentityLookup, OpaqueKeys}, - BuildStorage, KeyTypeId, Perbill, - }; type Block = frame_system::mocking::MockBlock; - frame_support::construct_runtime!( + construct_runtime!( pub enum Test { System: frame_system, @@ -203,7 +207,7 @@ mod tests { impl pallet_session::Config for Test { type SessionManager = (); - type Keys = UintAuthorityId; + type Keys = frame::deps::sp_runtime::testing::UintAuthorityId; type ShouldEndSession = pallet_session::PeriodicSessions; type SessionHandler = TestSessionHandler; type RuntimeEvent = RuntimeEvent; @@ -234,7 +238,8 @@ mod tests { pub struct TestSessionHandler; impl pallet_session::SessionHandler for TestSessionHandler { - const KEY_TYPE_IDS: &'static [KeyTypeId] = &[key_types::DUMMY]; + const KEY_TYPE_IDS: &'static [KeyTypeId] = + &[frame::deps::sp_core::crypto::key_types::DUMMY]; fn on_new_session( _changed: bool, @@ -308,7 +313,7 @@ mod tests { let mut externalities = TestExternalities::new(t); externalities.execute_with(|| { - use frame_support::traits::OneSessionHandler; + use frame::deps::frame_support::traits::OneSessionHandler; AuthorityDiscovery::on_genesis_session( first_authorities.iter().map(|id| (id, id.clone())),