diff --git a/bridges/modules/grandpa/src/lib.rs b/bridges/modules/grandpa/src/lib.rs index c2c1218418fb1..cd98ad0d95767 100644 --- a/bridges/modules/grandpa/src/lib.rs +++ b/bridges/modules/grandpa/src/lib.rs @@ -98,6 +98,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; diff --git a/bridges/modules/messages/src/lib.rs b/bridges/modules/messages/src/lib.rs index 61763186cb021..02013ad01ec80 100644 --- a/bridges/modules/messages/src/lib.rs +++ b/bridges/modules/messages/src/lib.rs @@ -107,6 +107,7 @@ pub mod pallet { // General types /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Benchmarks results from runtime we're plugged into. diff --git a/bridges/modules/parachains/src/lib.rs b/bridges/modules/parachains/src/lib.rs index bbf6a6600d56f..656f79594803b 100644 --- a/bridges/modules/parachains/src/lib.rs +++ b/bridges/modules/parachains/src/lib.rs @@ -183,6 +183,7 @@ pub mod pallet { BoundedBridgeGrandpaConfig { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Benchmarks results from runtime we're plugged into. diff --git a/bridges/modules/relayers/src/lib.rs b/bridges/modules/relayers/src/lib.rs index 05d48982a938f..20acc60a25d5b 100644 --- a/bridges/modules/relayers/src/lib.rs +++ b/bridges/modules/relayers/src/lib.rs @@ -75,6 +75,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; diff --git a/bridges/modules/xcm-bridge-hub-router/src/lib.rs b/bridges/modules/xcm-bridge-hub-router/src/lib.rs index 7361696faba71..44249b97080c5 100644 --- a/bridges/modules/xcm-bridge-hub-router/src/lib.rs +++ b/bridges/modules/xcm-bridge-hub-router/src/lib.rs @@ -79,6 +79,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Benchmarks results from runtime we're plugged into. diff --git a/bridges/modules/xcm-bridge-hub/src/lib.rs b/bridges/modules/xcm-bridge-hub/src/lib.rs index 1633e99d7f303..0262cc426e23a 100644 --- a/bridges/modules/xcm-bridge-hub/src/lib.rs +++ b/bridges/modules/xcm-bridge-hub/src/lib.rs @@ -194,6 +194,7 @@ pub mod pallet { BridgeMessagesConfig { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; diff --git a/bridges/snowbridge/pallets/ethereum-client/src/lib.rs b/bridges/snowbridge/pallets/ethereum-client/src/lib.rs index 0644010e92b5d..6ec613840abf7 100644 --- a/bridges/snowbridge/pallets/ethereum-client/src/lib.rs +++ b/bridges/snowbridge/pallets/ethereum-client/src/lib.rs @@ -90,6 +90,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; #[pallet::constant] type ForkVersions: Get; diff --git a/bridges/snowbridge/pallets/inbound-queue/src/lib.rs b/bridges/snowbridge/pallets/inbound-queue/src/lib.rs index 85b98c643b6c8..58520cb050e46 100644 --- a/bridges/snowbridge/pallets/inbound-queue/src/lib.rs +++ b/bridges/snowbridge/pallets/inbound-queue/src/lib.rs @@ -96,6 +96,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The verifier for inbound messages from Ethereum diff --git a/bridges/snowbridge/pallets/outbound-queue/src/lib.rs b/bridges/snowbridge/pallets/outbound-queue/src/lib.rs index 9b9dbe854a5ee..9a8890cd9389f 100644 --- a/bridges/snowbridge/pallets/outbound-queue/src/lib.rs +++ b/bridges/snowbridge/pallets/outbound-queue/src/lib.rs @@ -140,6 +140,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; type Hashing: Hash; diff --git a/bridges/snowbridge/pallets/system/src/lib.rs b/bridges/snowbridge/pallets/system/src/lib.rs index eb3da095fe855..e45c2b626151d 100644 --- a/bridges/snowbridge/pallets/system/src/lib.rs +++ b/bridges/snowbridge/pallets/system/src/lib.rs @@ -147,6 +147,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Send messages to Ethereum diff --git a/cumulus/pallets/collator-selection/src/lib.rs b/cumulus/pallets/collator-selection/src/lib.rs index 34c6ca8b36eab..1b21e85e9617a 100644 --- a/cumulus/pallets/collator-selection/src/lib.rs +++ b/cumulus/pallets/collator-selection/src/lib.rs @@ -141,6 +141,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// Overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The currency mechanism. diff --git a/cumulus/pallets/dmp-queue/src/lib.rs b/cumulus/pallets/dmp-queue/src/lib.rs index cedca6f3fb97f..ca042e32dadb2 100644 --- a/cumulus/pallets/dmp-queue/src/lib.rs +++ b/cumulus/pallets/dmp-queue/src/lib.rs @@ -59,6 +59,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type of the runtime. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The sink for all DMP messages that the lazy migration will use. diff --git a/cumulus/pallets/parachain-system/src/lib.rs b/cumulus/pallets/parachain-system/src/lib.rs index 0a4a29539b2cc..3a25e02efb894 100644 --- a/cumulus/pallets/parachain-system/src/lib.rs +++ b/cumulus/pallets/parachain-system/src/lib.rs @@ -247,6 +247,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config> { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Something which can be notified when the validation data is set. diff --git a/cumulus/pallets/solo-to-para/src/lib.rs b/cumulus/pallets/solo-to-para/src/lib.rs index f8761e13a0544..ff68d1b63fe7f 100644 --- a/cumulus/pallets/solo-to-para/src/lib.rs +++ b/cumulus/pallets/solo-to-para/src/lib.rs @@ -33,6 +33,7 @@ pub mod pallet { pub trait Config: frame_system::Config + parachain_system::Config + pallet_sudo::Config { + #[allow(deprecated)] type RuntimeEvent: From + IsType<::RuntimeEvent>; } diff --git a/cumulus/pallets/xcm/src/lib.rs b/cumulus/pallets/xcm/src/lib.rs index db98b781304c1..2541bd947b853 100644 --- a/cumulus/pallets/xcm/src/lib.rs +++ b/cumulus/pallets/xcm/src/lib.rs @@ -39,6 +39,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; type XcmExecutor: ExecuteXcm; diff --git a/cumulus/pallets/xcmp-queue/src/lib.rs b/cumulus/pallets/xcmp-queue/src/lib.rs index 08629e6376328..b7c9ad2fffc76 100644 --- a/cumulus/pallets/xcmp-queue/src/lib.rs +++ b/cumulus/pallets/xcmp-queue/src/lib.rs @@ -112,6 +112,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Information on the available XCMP channels. diff --git a/cumulus/parachains/pallets/collective-content/src/lib.rs b/cumulus/parachains/pallets/collective-content/src/lib.rs index 7ea3c2d79fa79..58c220c0c606f 100644 --- a/cumulus/parachains/pallets/collective-content/src/lib.rs +++ b/cumulus/parachains/pallets/collective-content/src/lib.rs @@ -69,6 +69,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; diff --git a/cumulus/parachains/pallets/ping/src/lib.rs b/cumulus/parachains/pallets/ping/src/lib.rs index 6895b34296cfe..05919e5077f6e 100644 --- a/cumulus/parachains/pallets/ping/src/lib.rs +++ b/cumulus/parachains/pallets/ping/src/lib.rs @@ -48,6 +48,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; type RuntimeOrigin: From<::RuntimeOrigin> diff --git a/docs/sdk/packages/guides/first-pallet/src/lib.rs b/docs/sdk/packages/guides/first-pallet/src/lib.rs index 168b7ca44aba2..8e4b45c09000c 100644 --- a/docs/sdk/packages/guides/first-pallet/src/lib.rs +++ b/docs/sdk/packages/guides/first-pallet/src/lib.rs @@ -365,6 +365,7 @@ pub mod pallet_v2 { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type of the runtime. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent> + TryInto>; diff --git a/docs/sdk/src/guides/your_first_pallet/mod.rs b/docs/sdk/src/guides/your_first_pallet/mod.rs index aef8981b4d4a3..bff2e4bfa56f2 100644 --- a/docs/sdk/src/guides/your_first_pallet/mod.rs +++ b/docs/sdk/src/guides/your_first_pallet/mod.rs @@ -673,6 +673,7 @@ pub mod pallet_v2 { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type of the runtime. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent> + TryInto>; diff --git a/docs/sdk/src/polkadot_sdk/frame_runtime.rs b/docs/sdk/src/polkadot_sdk/frame_runtime.rs index 24595e445fdd6..38068fc9c925f 100644 --- a/docs/sdk/src/polkadot_sdk/frame_runtime.rs +++ b/docs/sdk/src/polkadot_sdk/frame_runtime.rs @@ -104,6 +104,7 @@ pub mod pallet { pub trait Config: frame_system::Config { /// A type that is not known now, but the runtime that will contain this pallet will /// know it later, therefore we define it here as an associated type. + #[allow(deprecated)] type RuntimeEvent: IsType<::RuntimeEvent> + From>; /// A parameterize-able value that we receive later via the `Get<_>` trait. diff --git a/polkadot/runtime/common/src/assigned_slots/mod.rs b/polkadot/runtime/common/src/assigned_slots/mod.rs index dcde616392b8a..efb3a528ceb28 100644 --- a/polkadot/runtime/common/src/assigned_slots/mod.rs +++ b/polkadot/runtime/common/src/assigned_slots/mod.rs @@ -120,6 +120,7 @@ pub mod pallet { #[pallet::disable_frame_system_supertrait_check] pub trait Config: configuration::Config + paras::Config + slots::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Origin for assigning slots. diff --git a/polkadot/runtime/common/src/auctions/mod.rs b/polkadot/runtime/common/src/auctions/mod.rs index 84d8a3846d40e..9cf9ec2c06d0e 100644 --- a/polkadot/runtime/common/src/auctions/mod.rs +++ b/polkadot/runtime/common/src/auctions/mod.rs @@ -90,6 +90,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The type representing the leasing system. diff --git a/polkadot/runtime/common/src/claims/mod.rs b/polkadot/runtime/common/src/claims/mod.rs index 1c557051add47..9df53ab5fb6e3 100644 --- a/polkadot/runtime/common/src/claims/mod.rs +++ b/polkadot/runtime/common/src/claims/mod.rs @@ -202,6 +202,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; type VestingSchedule: VestingSchedule>; #[pallet::constant] diff --git a/polkadot/runtime/common/src/crowdloan/mod.rs b/polkadot/runtime/common/src/crowdloan/mod.rs index 1b40f248bfb11..94bac8b84f3de 100644 --- a/polkadot/runtime/common/src/crowdloan/mod.rs +++ b/polkadot/runtime/common/src/crowdloan/mod.rs @@ -186,6 +186,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// `PalletId` for the crowdloan pallet. An appropriate value could be diff --git a/polkadot/runtime/common/src/identity_migrator.rs b/polkadot/runtime/common/src/identity_migrator.rs index e3835b692526e..5bd835b29897d 100644 --- a/polkadot/runtime/common/src/identity_migrator.rs +++ b/polkadot/runtime/common/src/identity_migrator.rs @@ -78,6 +78,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config + pallet_identity::Config { /// Overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The origin that can reap identities. Expected to be `EnsureSigned` on the diff --git a/polkadot/runtime/common/src/paras_registrar/mod.rs b/polkadot/runtime/common/src/paras_registrar/mod.rs index aed0729c9d517..124f8426f0793 100644 --- a/polkadot/runtime/common/src/paras_registrar/mod.rs +++ b/polkadot/runtime/common/src/paras_registrar/mod.rs @@ -121,6 +121,7 @@ pub mod pallet { #[pallet::disable_frame_system_supertrait_check] pub trait Config: configuration::Config + paras::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The aggregated origin type must support the `parachains` origin. We require that we can diff --git a/polkadot/runtime/common/src/purchase/mod.rs b/polkadot/runtime/common/src/purchase/mod.rs index 58822bcdd8f4e..e734ec1c734b9 100644 --- a/polkadot/runtime/common/src/purchase/mod.rs +++ b/polkadot/runtime/common/src/purchase/mod.rs @@ -100,6 +100,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Balances Pallet diff --git a/polkadot/runtime/common/src/slots/mod.rs b/polkadot/runtime/common/src/slots/mod.rs index 1fbfe451dcbf7..edcc7c86e914f 100644 --- a/polkadot/runtime/common/src/slots/mod.rs +++ b/polkadot/runtime/common/src/slots/mod.rs @@ -74,6 +74,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The currency type used for bidding. diff --git a/polkadot/runtime/parachains/src/coretime/mod.rs b/polkadot/runtime/parachains/src/coretime/mod.rs index e961d5fa76a8b..2c08dd3cb2051 100644 --- a/polkadot/runtime/parachains/src/coretime/mod.rs +++ b/polkadot/runtime/parachains/src/coretime/mod.rs @@ -118,6 +118,7 @@ pub mod pallet { pub trait Config: frame_system::Config + assigner_coretime::Config + on_demand::Config { type RuntimeOrigin: From<::RuntimeOrigin> + Into::RuntimeOrigin>>; + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The ParaId of the coretime chain. #[pallet::constant] diff --git a/polkadot/runtime/parachains/src/disputes.rs b/polkadot/runtime/parachains/src/disputes.rs index a3735c6ee3aaf..fbf59824b4398 100644 --- a/polkadot/runtime/parachains/src/disputes.rs +++ b/polkadot/runtime/parachains/src/disputes.rs @@ -372,6 +372,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config + configuration::Config + session_info::Config { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; type RewardValidators: RewardValidators; type SlashingHandler: SlashingHandler>; diff --git a/polkadot/runtime/parachains/src/hrmp.rs b/polkadot/runtime/parachains/src/hrmp.rs index 220543f00ec33..35992652b3509 100644 --- a/polkadot/runtime/parachains/src/hrmp.rs +++ b/polkadot/runtime/parachains/src/hrmp.rs @@ -259,6 +259,7 @@ pub mod pallet { frame_system::Config + configuration::Config + paras::Config + dmp::Config { /// The outer event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; type RuntimeOrigin: From diff --git a/polkadot/runtime/parachains/src/inclusion/mod.rs b/polkadot/runtime/parachains/src/inclusion/mod.rs index 1e9706533cfd8..1e37ea0517755 100644 --- a/polkadot/runtime/parachains/src/inclusion/mod.rs +++ b/polkadot/runtime/parachains/src/inclusion/mod.rs @@ -286,6 +286,7 @@ pub mod pallet { + configuration::Config + scheduler::Config { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; type DisputesHandler: disputes::DisputesHandler>; type RewardValidators: RewardValidators; diff --git a/polkadot/runtime/parachains/src/on_demand/mod.rs b/polkadot/runtime/parachains/src/on_demand/mod.rs index c8ff4b1ae4a5d..9b49f62a9bf3a 100644 --- a/polkadot/runtime/parachains/src/on_demand/mod.rs +++ b/polkadot/runtime/parachains/src/on_demand/mod.rs @@ -117,6 +117,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config + configuration::Config + paras::Config { /// The runtime's definition of an event. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The runtime's definition of a Currency. diff --git a/polkadot/runtime/parachains/src/paras/mod.rs b/polkadot/runtime/parachains/src/paras/mod.rs index 87744fc5ae3e1..1646c7c256902 100644 --- a/polkadot/runtime/parachains/src/paras/mod.rs +++ b/polkadot/runtime/parachains/src/paras/mod.rs @@ -628,6 +628,7 @@ pub mod pallet { + shared::Config + frame_system::offchain::CreateInherent> { + #[allow(deprecated)] type RuntimeEvent: From + IsType<::RuntimeEvent>; #[pallet::constant] diff --git a/polkadot/runtime/rococo/src/validator_manager.rs b/polkadot/runtime/rococo/src/validator_manager.rs index ecfbff4fa0688..7a3a99078ff77 100644 --- a/polkadot/runtime/rococo/src/validator_manager.rs +++ b/polkadot/runtime/rococo/src/validator_manager.rs @@ -37,6 +37,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config + pallet_session::Config { /// The overreaching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Privileged origin that can add or remove validators. diff --git a/polkadot/runtime/test-runtime/src/lib.rs b/polkadot/runtime/test-runtime/src/lib.rs index fc489e3bc685e..6f9100955b02b 100644 --- a/polkadot/runtime/test-runtime/src/lib.rs +++ b/polkadot/runtime/test-runtime/src/lib.rs @@ -697,6 +697,7 @@ pub mod pallet_test_notifier { #[pallet::config] pub trait Config: frame_system::Config + pallet_xcm::Config { + #[allow(deprecated)] type RuntimeEvent: IsType<::RuntimeEvent> + From>; type RuntimeOrigin: IsType<::RuntimeOrigin> + Into::RuntimeOrigin>>; diff --git a/polkadot/xcm/pallet-xcm/src/lib.rs b/polkadot/xcm/pallet-xcm/src/lib.rs index a422756ed570a..c82af68c547a5 100644 --- a/polkadot/xcm/pallet-xcm/src/lib.rs +++ b/polkadot/xcm/pallet-xcm/src/lib.rs @@ -216,6 +216,7 @@ pub mod pallet { /// The module configuration trait. pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// A lockable currency. diff --git a/polkadot/xcm/pallet-xcm/src/mock.rs b/polkadot/xcm/pallet-xcm/src/mock.rs index 74d2f4584d63b..ca3806f8f20de 100644 --- a/polkadot/xcm/pallet-xcm/src/mock.rs +++ b/polkadot/xcm/pallet-xcm/src/mock.rs @@ -64,6 +64,7 @@ pub mod pallet_test_notifier { #[pallet::config] pub trait Config: frame_system::Config + crate::Config { + #[allow(deprecated)] type RuntimeEvent: IsType<::RuntimeEvent> + From>; type RuntimeOrigin: IsType<::RuntimeOrigin> + Into::RuntimeOrigin>>; @@ -222,10 +223,10 @@ impl SendXcm for TestPaidForPara3000SendXcm { ) -> SendResult<(Location, Xcm<()>)> { if let Some(dest) = dest.as_ref() { if !dest.eq(&Para3000Location::get()) { - return Err(SendError::NotApplicable) + return Err(SendError::NotApplicable); } } else { - return Err(SendError::NotApplicable) + return Err(SendError::NotApplicable); } let pair = (dest.take().unwrap(), msg.take().unwrap()); diff --git a/polkadot/xcm/xcm-simulator/fuzzer/src/parachain.rs b/polkadot/xcm/xcm-simulator/fuzzer/src/parachain.rs index 38530fd3f5aa5..fdc6c3feb58cc 100644 --- a/polkadot/xcm/xcm-simulator/fuzzer/src/parachain.rs +++ b/polkadot/xcm/xcm-simulator/fuzzer/src/parachain.rs @@ -156,6 +156,7 @@ pub mod mock_msg_queue { #[pallet::config] pub trait Config: frame_system::Config { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; type XcmExecutor: ExecuteXcm; } diff --git a/polkadot/xcm/xcm-simulator/src/mock_message_queue.rs b/polkadot/xcm/xcm-simulator/src/mock_message_queue.rs index 726af0468acb5..9d1c20314f197 100644 --- a/polkadot/xcm/xcm-simulator/src/mock_message_queue.rs +++ b/polkadot/xcm/xcm-simulator/src/mock_message_queue.rs @@ -35,6 +35,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; type XcmExecutor: ExecuteXcm; } diff --git a/prdoc/pr_7229.prdoc b/prdoc/pr_7229.prdoc new file mode 100644 index 0000000000000..0717ac7f0be7e --- /dev/null +++ b/prdoc/pr_7229.prdoc @@ -0,0 +1,41 @@ +# 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: "FRAME: Deprecate `RuntimeEvent` associated type from `Config` trait" +doc: + - audience: Runtime Dev + description: | + This PR removes the need for defining `RuntimeEvent` in the `Config` trait of a pallet. It uses associated type bound feature under the hood + to make sure that `Event` of the pallet is convertible to the `frame_system::RuntimeEvent` type. + + With this change, we can do this: + + ```rs + #[pallet::config] + pub trait Config: frame_system::Config { + } + ``` + instead of this: + + ```rs + #[pallet::config] + pub trait Config: frame_system::Config { + /// Overarching event type. + #[allow(deprecated)] + type RuntimeEvent: From> + IsType<::RuntimeEvent>; + } + ``` + The latter compiles but is redundant since the associated type bound is automatically appended + if pallet defines `Event` type, i.e it looks like this after macro expansion: + + ```rs + #[pallet::config] + pub trait Config: frame_system::Config + frame_system::Config>> { + } + ``` + +crates: + - name: frame-support + bump: minor + - name: pallet-examples + bump: minor diff --git a/substrate/frame/alliance/src/lib.rs b/substrate/frame/alliance/src/lib.rs index 234fd59ef89fd..30cb5a6f2665c 100644 --- a/substrate/frame/alliance/src/lib.rs +++ b/substrate/frame/alliance/src/lib.rs @@ -236,6 +236,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; diff --git a/substrate/frame/asset-conversion/ops/src/lib.rs b/substrate/frame/asset-conversion/ops/src/lib.rs index 58c15b47a3eb3..1a451f8283768 100644 --- a/substrate/frame/asset-conversion/ops/src/lib.rs +++ b/substrate/frame/asset-conversion/ops/src/lib.rs @@ -73,6 +73,7 @@ pub mod pallet { > + frame_system::Config { /// Overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Type previously used to derive the account ID for a pool. Indicates that the pool's diff --git a/substrate/frame/asset-conversion/src/lib.rs b/substrate/frame/asset-conversion/src/lib.rs index d6671a45be559..5e2879ccb7889 100644 --- a/substrate/frame/asset-conversion/src/lib.rs +++ b/substrate/frame/asset-conversion/src/lib.rs @@ -113,6 +113,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// Overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The type in which the assets for swapping are measured. diff --git a/substrate/frame/asset-rate/src/lib.rs b/substrate/frame/asset-rate/src/lib.rs index cfb013a73f5e8..e3344c015008b 100644 --- a/substrate/frame/asset-rate/src/lib.rs +++ b/substrate/frame/asset-rate/src/lib.rs @@ -106,6 +106,7 @@ pub mod pallet { type WeightInfo: WeightInfo; /// The runtime event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The origin permissioned to create a conversion rate for an asset. diff --git a/substrate/frame/asset-rewards/src/lib.rs b/substrate/frame/asset-rewards/src/lib.rs index 4ce73e9febf96..994bf0b61f5ae 100644 --- a/substrate/frame/asset-rewards/src/lib.rs +++ b/substrate/frame/asset-rewards/src/lib.rs @@ -210,6 +210,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// Overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The pallet's unique identifier, used to derive the pool's account ID. diff --git a/substrate/frame/assets-freezer/src/lib.rs b/substrate/frame/assets-freezer/src/lib.rs index e298658f16dbc..d9c63d55c2238 100644 --- a/substrate/frame/assets-freezer/src/lib.rs +++ b/substrate/frame/assets-freezer/src/lib.rs @@ -81,6 +81,7 @@ pub mod pallet { /// The overarching event type. #[pallet::no_default_bounds] + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; } diff --git a/substrate/frame/assets/src/lib.rs b/substrate/frame/assets/src/lib.rs index 6e946d610e073..a7f9bf14a631a 100644 --- a/substrate/frame/assets/src/lib.rs +++ b/substrate/frame/assets/src/lib.rs @@ -310,6 +310,7 @@ pub mod pallet { pub trait Config: frame_system::Config { /// The overarching event type. #[pallet::no_default_bounds] + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; diff --git a/substrate/frame/atomic-swap/src/lib.rs b/substrate/frame/atomic-swap/src/lib.rs index f35f0efa618ab..bc3359e4e9bc0 100644 --- a/substrate/frame/atomic-swap/src/lib.rs +++ b/substrate/frame/atomic-swap/src/lib.rs @@ -181,6 +181,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Swap action. type SwapAction: SwapAction + Parameter + MaxEncodedLen; diff --git a/substrate/frame/bags-list/src/lib.rs b/substrate/frame/bags-list/src/lib.rs index 606b07b6e7b6f..7ce3b644f797b 100644 --- a/substrate/frame/bags-list/src/lib.rs +++ b/substrate/frame/bags-list/src/lib.rs @@ -178,6 +178,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; diff --git a/substrate/frame/balances/src/lib.rs b/substrate/frame/balances/src/lib.rs index e994f05a77c51..d4d5087347583 100644 --- a/substrate/frame/balances/src/lib.rs +++ b/substrate/frame/balances/src/lib.rs @@ -251,6 +251,7 @@ pub mod pallet { pub trait Config: frame_system::Config { /// The overarching event type. #[pallet::no_default_bounds] + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; diff --git a/substrate/frame/benchmarking/pov/src/lib.rs b/substrate/frame/benchmarking/pov/src/lib.rs index 4cdbaec2305c1..10e93bd65e548 100644 --- a/substrate/frame/benchmarking/pov/src/lib.rs +++ b/substrate/frame/benchmarking/pov/src/lib.rs @@ -38,6 +38,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; } diff --git a/substrate/frame/benchmarking/src/tests_instance.rs b/substrate/frame/benchmarking/src/tests_instance.rs index 11062813e33ce..ac1269d7eb77c 100644 --- a/substrate/frame/benchmarking/src/tests_instance.rs +++ b/substrate/frame/benchmarking/src/tests_instance.rs @@ -40,6 +40,7 @@ mod pallet_test { #[pallet::config] pub trait Config: frame_system::Config + OtherConfig { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; type LowerBound: Get; diff --git a/substrate/frame/bounties/src/lib.rs b/substrate/frame/bounties/src/lib.rs index 9b6e3c06e9141..f52ba15a8c0f6 100644 --- a/substrate/frame/bounties/src/lib.rs +++ b/substrate/frame/bounties/src/lib.rs @@ -249,6 +249,7 @@ pub mod pallet { type DataDepositPerByte: Get>; /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; diff --git a/substrate/frame/broker/src/lib.rs b/substrate/frame/broker/src/lib.rs index 3ecfec6b643d3..a02fea6369985 100644 --- a/substrate/frame/broker/src/lib.rs +++ b/substrate/frame/broker/src/lib.rs @@ -75,6 +75,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Weight information for all calls of this pallet. diff --git a/substrate/frame/child-bounties/src/lib.rs b/substrate/frame/child-bounties/src/lib.rs index 9fca26510989a..6593c159d5902 100644 --- a/substrate/frame/child-bounties/src/lib.rs +++ b/substrate/frame/child-bounties/src/lib.rs @@ -162,6 +162,7 @@ pub mod pallet { type ChildBountyValueMinimum: Get>; /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Weight information for extrinsics in this pallet. diff --git a/substrate/frame/collective/src/lib.rs b/substrate/frame/collective/src/lib.rs index a7bd00a7f4114..ce18292d66b63 100644 --- a/substrate/frame/collective/src/lib.rs +++ b/substrate/frame/collective/src/lib.rs @@ -348,6 +348,7 @@ pub mod pallet { + GetDispatchInfo; /// The runtime event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; diff --git a/substrate/frame/collective/src/tests.rs b/substrate/frame/collective/src/tests.rs index 300d5ad3772a9..09fddb9d6c363 100644 --- a/substrate/frame/collective/src/tests.rs +++ b/substrate/frame/collective/src/tests.rs @@ -62,6 +62,7 @@ mod mock_democracy { #[pallet::config] pub trait Config: frame_system::Config + Sized { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; type ExternalMajorityOrigin: EnsureOrigin; diff --git a/substrate/frame/contracts/mock-network/src/mocks/msg_queue.rs b/substrate/frame/contracts/mock-network/src/mocks/msg_queue.rs index 45715d973b545..25e39ee89051c 100644 --- a/substrate/frame/contracts/mock-network/src/mocks/msg_queue.rs +++ b/substrate/frame/contracts/mock-network/src/mocks/msg_queue.rs @@ -34,6 +34,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; type XcmExecutor: ExecuteXcm; } diff --git a/substrate/frame/contracts/src/lib.rs b/substrate/frame/contracts/src/lib.rs index 627aca17c9c94..25760395a5d84 100644 --- a/substrate/frame/contracts/src/lib.rs +++ b/substrate/frame/contracts/src/lib.rs @@ -276,6 +276,7 @@ pub mod pallet { /// The overarching event type. #[pallet::no_default_bounds] + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The overarching call type. diff --git a/substrate/frame/conviction-voting/src/lib.rs b/substrate/frame/conviction-voting/src/lib.rs index fda97281f16bd..e58fb4c5eef65 100644 --- a/substrate/frame/conviction-voting/src/lib.rs +++ b/substrate/frame/conviction-voting/src/lib.rs @@ -106,6 +106,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config + Sized { // System level stuff. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Weight information for extrinsics in this pallet. diff --git a/substrate/frame/core-fellowship/src/lib.rs b/substrate/frame/core-fellowship/src/lib.rs index 3d2da6e9f717e..abd72da13061d 100644 --- a/substrate/frame/core-fellowship/src/lib.rs +++ b/substrate/frame/core-fellowship/src/lib.rs @@ -196,6 +196,7 @@ pub mod pallet { type WeightInfo: WeightInfo; /// The runtime event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; diff --git a/substrate/frame/delegated-staking/src/lib.rs b/substrate/frame/delegated-staking/src/lib.rs index fadc8d290d6f9..813dc8c50f71e 100644 --- a/substrate/frame/delegated-staking/src/lib.rs +++ b/substrate/frame/delegated-staking/src/lib.rs @@ -190,6 +190,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Injected identifier for the pallet. diff --git a/substrate/frame/democracy/src/lib.rs b/substrate/frame/democracy/src/lib.rs index 2c662fbad26a5..f70ec6fba100d 100644 --- a/substrate/frame/democracy/src/lib.rs +++ b/substrate/frame/democracy/src/lib.rs @@ -222,6 +222,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config + Sized { type WeightInfo: WeightInfo; + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The Scheduler. diff --git a/substrate/frame/election-provider-multi-block/src/lib.rs b/substrate/frame/election-provider-multi-block/src/lib.rs index 86a94c67c5844..70f231d6a39cd 100644 --- a/substrate/frame/election-provider-multi-block/src/lib.rs +++ b/substrate/frame/election-provider-multi-block/src/lib.rs @@ -366,6 +366,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching runtime event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent> + TryInto>; diff --git a/substrate/frame/election-provider-multi-block/src/signed/mod.rs b/substrate/frame/election-provider-multi-block/src/signed/mod.rs index 1784a87b22433..ef047c89fc5dd 100644 --- a/substrate/frame/election-provider-multi-block/src/signed/mod.rs +++ b/substrate/frame/election-provider-multi-block/src/signed/mod.rs @@ -220,6 +220,7 @@ pub mod pallet { #[pallet::disable_frame_system_supertrait_check] pub trait Config: crate::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent> + TryInto>; diff --git a/substrate/frame/election-provider-multi-block/src/verifier/impls.rs b/substrate/frame/election-provider-multi-block/src/verifier/impls.rs index 0f5f0fb911be8..6d6524e69b513 100644 --- a/substrate/frame/election-provider-multi-block/src/verifier/impls.rs +++ b/substrate/frame/election-provider-multi-block/src/verifier/impls.rs @@ -112,6 +112,7 @@ pub(crate) mod pallet { #[pallet::disable_frame_system_supertrait_check] pub trait Config: crate::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent> + TryInto> diff --git a/substrate/frame/election-provider-multi-phase/src/lib.rs b/substrate/frame/election-provider-multi-phase/src/lib.rs index c0e256c3e6525..76be7eaa4a7b1 100644 --- a/substrate/frame/election-provider-multi-phase/src/lib.rs +++ b/substrate/frame/election-provider-multi-phase/src/lib.rs @@ -613,6 +613,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config + CreateInherent> { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent> + TryInto>; diff --git a/substrate/frame/elections-phragmen/src/lib.rs b/substrate/frame/elections-phragmen/src/lib.rs index d73cd510f820d..94719e73818fa 100644 --- a/substrate/frame/elections-phragmen/src/lib.rs +++ b/substrate/frame/elections-phragmen/src/lib.rs @@ -201,6 +201,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Identifier for the elections-phragmen pallet's lock diff --git a/substrate/frame/examples/basic/src/lib.rs b/substrate/frame/examples/basic/src/lib.rs index 7d7f1d838c9f3..4246a0799dece 100644 --- a/substrate/frame/examples/basic/src/lib.rs +++ b/substrate/frame/examples/basic/src/lib.rs @@ -164,9 +164,6 @@ pub mod pallet { #[pallet::constant] type MagicNumber: Get; - /// The overarching event type. - type RuntimeEvent: From> + IsType<::RuntimeEvent>; - /// Type representing the weight of this pallet type WeightInfo: WeightInfo; } diff --git a/substrate/frame/examples/basic/src/tests.rs b/substrate/frame/examples/basic/src/tests.rs index bb50c0f75f835..dbae3abfe1209 100644 --- a/substrate/frame/examples/basic/src/tests.rs +++ b/substrate/frame/examples/basic/src/tests.rs @@ -85,7 +85,6 @@ impl pallet_balances::Config for Test { impl Config for Test { type MagicNumber = ConstU64<1_000_000_000>; - type RuntimeEvent = RuntimeEvent; type WeightInfo = (); } diff --git a/substrate/frame/examples/default-config/src/lib.rs b/substrate/frame/examples/default-config/src/lib.rs index cc6e75d5418aa..6147f97d4b5be 100644 --- a/substrate/frame/examples/default-config/src/lib.rs +++ b/substrate/frame/examples/default-config/src/lib.rs @@ -50,13 +50,9 @@ pub mod pallet { /// It will be an identical, but won't have anything that is `#[pallet::no_default]`. #[pallet::config(with_default)] pub trait Config: frame_system::Config { - /// The overarching event type. This is coming from the runtime, and cannot have a default. + /// The overarching task type. This is coming from the runtime, and cannot have a default. /// In general, `Runtime*`-oriented types cannot have a sensible default. #[pallet::no_default] // optional. `RuntimeEvent` is automatically excluded as well. - type RuntimeEvent: From> + IsType<::RuntimeEvent>; - - /// The overarching task type. - #[pallet::no_default] type RuntimeTask: Task; /// An input parameter to this pallet. This value can have a default, because it is not @@ -202,8 +198,7 @@ pub mod tests { #[derive_impl(TestDefaultConfig as pallet::DefaultConfig)] impl pallet_default_config_example::Config for Runtime { - // These two both cannot have defaults. - type RuntimeEvent = RuntimeEvent; + // This cannot have default. type RuntimeTask = RuntimeTask; type HasNoDefault = frame_support::traits::ConstU32<1>; diff --git a/substrate/frame/examples/dev-mode/src/lib.rs b/substrate/frame/examples/dev-mode/src/lib.rs index 6c255665891b3..64907777dda0a 100644 --- a/substrate/frame/examples/dev-mode/src/lib.rs +++ b/substrate/frame/examples/dev-mode/src/lib.rs @@ -57,10 +57,7 @@ pub mod pallet { use frame_system::pallet_prelude::*; #[pallet::config] - pub trait Config: pallet_balances::Config + frame_system::Config { - /// The overarching event type. - type RuntimeEvent: From> + IsType<::RuntimeEvent>; - } + pub trait Config: pallet_balances::Config + frame_system::Config {} // Simple declaration of the `Pallet` type. It is placeholder we use to implement traits and // method. diff --git a/substrate/frame/examples/dev-mode/src/tests.rs b/substrate/frame/examples/dev-mode/src/tests.rs index 4c93c631d6930..ea629b3a17a71 100644 --- a/substrate/frame/examples/dev-mode/src/tests.rs +++ b/substrate/frame/examples/dev-mode/src/tests.rs @@ -76,9 +76,7 @@ impl pallet_balances::Config for Test { type AccountStore = System; } -impl Config for Test { - type RuntimeEvent = RuntimeEvent; -} +impl Config for Test {} // This function basically just builds a genesis storage key/value store according to // our desired mockup. diff --git a/substrate/frame/examples/frame-crate/src/lib.rs b/substrate/frame/examples/frame-crate/src/lib.rs index 454c8d8d2ad03..d44edb6eba297 100644 --- a/substrate/frame/examples/frame-crate/src/lib.rs +++ b/substrate/frame/examples/frame-crate/src/lib.rs @@ -28,9 +28,7 @@ pub mod pallet { use super::*; #[pallet::config] - pub trait Config: frame_system::Config { - type RuntimeEvent: IsType<::RuntimeEvent> + From>; - } + pub trait Config: frame_system::Config {} #[pallet::pallet] pub struct Pallet(_); @@ -66,7 +64,5 @@ mod tests { type Block = MockBlock; } - impl my_pallet::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - } + impl my_pallet::Config for Runtime {} } diff --git a/substrate/frame/examples/kitchensink/src/lib.rs b/substrate/frame/examples/kitchensink/src/lib.rs index 1fe6db8f183c2..f5137741363af 100644 --- a/substrate/frame/examples/kitchensink/src/lib.rs +++ b/substrate/frame/examples/kitchensink/src/lib.rs @@ -75,9 +75,6 @@ pub mod pallet { /// `frame_system::Config` to exist, which you should almost never need. #[pallet::config] pub trait Config: frame_system::Config { - /// The overarching runtime event type. - type RuntimeEvent: From> + IsType<::RuntimeEvent>; - /// Type representing the weight of this pallet type WeightInfo: WeightInfo; diff --git a/substrate/frame/examples/kitchensink/src/tests.rs b/substrate/frame/examples/kitchensink/src/tests.rs index fb0766b8293e7..594a9d9ecfbd5 100644 --- a/substrate/frame/examples/kitchensink/src/tests.rs +++ b/substrate/frame/examples/kitchensink/src/tests.rs @@ -64,7 +64,6 @@ parameter_types! { } impl Config for Test { - type RuntimeEvent = RuntimeEvent; type WeightInfo = (); type Currency = Balances; diff --git a/substrate/frame/examples/offchain-worker/src/lib.rs b/substrate/frame/examples/offchain-worker/src/lib.rs index 9976a5256afa9..92215f49bd8bc 100644 --- a/substrate/frame/examples/offchain-worker/src/lib.rs +++ b/substrate/frame/examples/offchain-worker/src/lib.rs @@ -136,9 +136,6 @@ pub mod pallet { /// The identifier type for an offchain worker. type AuthorityId: AppCrypto; - /// The overarching event type. - type RuntimeEvent: From> + IsType<::RuntimeEvent>; - // Configuration parameters /// A grace period after we send transaction. diff --git a/substrate/frame/examples/offchain-worker/src/tests.rs b/substrate/frame/examples/offchain-worker/src/tests.rs index cc226714e6e9e..a8af7d2e31147 100644 --- a/substrate/frame/examples/offchain-worker/src/tests.rs +++ b/substrate/frame/examples/offchain-worker/src/tests.rs @@ -135,7 +135,6 @@ parameter_types! { } impl Config for Test { - type RuntimeEvent = RuntimeEvent; type AuthorityId = crypto::TestAuthId; type GracePeriod = ConstU64<5>; type UnsignedInterval = ConstU64<128>; diff --git a/substrate/frame/examples/split/src/lib.rs b/substrate/frame/examples/split/src/lib.rs index b1f09226e0072..0fb6dfbf9df2f 100644 --- a/substrate/frame/examples/split/src/lib.rs +++ b/substrate/frame/examples/split/src/lib.rs @@ -64,8 +64,6 @@ pub mod pallet { /// Configure the pallet by specifying the parameters and types on which it depends. #[pallet::config] pub trait Config: frame_system::Config { - /// Because this pallet emits events, it depends on the runtime's definition of an event. - type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Type representing the weight of this pallet type WeightInfo: WeightInfo; } diff --git a/substrate/frame/examples/split/src/mock.rs b/substrate/frame/examples/split/src/mock.rs index 4b0c75b9d15ec..20c0d5a34c831 100644 --- a/substrate/frame/examples/split/src/mock.rs +++ b/substrate/frame/examples/split/src/mock.rs @@ -43,7 +43,6 @@ impl frame_system::Config for Test { } impl pallet_template::Config for Test { - type RuntimeEvent = RuntimeEvent; type WeightInfo = (); } diff --git a/substrate/frame/fast-unstake/src/lib.rs b/substrate/frame/fast-unstake/src/lib.rs index 41920907bd57b..78a44890e2663 100644 --- a/substrate/frame/fast-unstake/src/lib.rs +++ b/substrate/frame/fast-unstake/src/lib.rs @@ -174,6 +174,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent> + TryInto>; diff --git a/substrate/frame/glutton/src/lib.rs b/substrate/frame/glutton/src/lib.rs index c8d2981ebfef1..85608ad25e727 100644 --- a/substrate/frame/glutton/src/lib.rs +++ b/substrate/frame/glutton/src/lib.rs @@ -61,6 +61,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From + IsType<::RuntimeEvent>; /// The admin origin that can set computational limits and initialize the pallet. diff --git a/substrate/frame/grandpa/src/lib.rs b/substrate/frame/grandpa/src/lib.rs index 9017eec2ca8f8..67cf98413640c 100644 --- a/substrate/frame/grandpa/src/lib.rs +++ b/substrate/frame/grandpa/src/lib.rs @@ -85,6 +85,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The event type of this module. + #[allow(deprecated)] type RuntimeEvent: From + Into<::RuntimeEvent> + IsType<::RuntimeEvent>; diff --git a/substrate/frame/identity/src/lib.rs b/substrate/frame/identity/src/lib.rs index 6a71e831cca11..d8b30fa1ce461 100644 --- a/substrate/frame/identity/src/lib.rs +++ b/substrate/frame/identity/src/lib.rs @@ -153,6 +153,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The currency trait. diff --git a/substrate/frame/im-online/src/lib.rs b/substrate/frame/im-online/src/lib.rs index 28d97489d9814..3eb9d5cc57b0a 100644 --- a/substrate/frame/im-online/src/lib.rs +++ b/substrate/frame/im-online/src/lib.rs @@ -277,6 +277,7 @@ pub mod pallet { type MaxPeerInHeartbeats: Get; /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// A type for retrieving the validators supposed to be online in a session. diff --git a/substrate/frame/indices/src/lib.rs b/substrate/frame/indices/src/lib.rs index 1629a730176f7..5a8caec55d186 100644 --- a/substrate/frame/indices/src/lib.rs +++ b/substrate/frame/indices/src/lib.rs @@ -70,6 +70,7 @@ pub mod pallet { type Deposit: Get>; /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Weight information for extrinsics in this pallet. diff --git a/substrate/frame/lottery/src/lib.rs b/substrate/frame/lottery/src/lib.rs index 6a15de55ebd76..e8eb7a815205b 100644 --- a/substrate/frame/lottery/src/lib.rs +++ b/substrate/frame/lottery/src/lib.rs @@ -147,6 +147,7 @@ pub mod pallet { type Randomness: Randomness>; /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The manager origin. diff --git a/substrate/frame/membership/src/lib.rs b/substrate/frame/membership/src/lib.rs index bbd17c66be4d8..28cfe038329ea 100644 --- a/substrate/frame/membership/src/lib.rs +++ b/substrate/frame/membership/src/lib.rs @@ -67,6 +67,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; diff --git a/substrate/frame/message-queue/src/lib.rs b/substrate/frame/message-queue/src/lib.rs index 0e2a2f6b01b4a..63afc6e11fdb2 100644 --- a/substrate/frame/message-queue/src/lib.rs +++ b/substrate/frame/message-queue/src/lib.rs @@ -484,6 +484,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Weight information for extrinsics in this pallet. diff --git a/substrate/frame/migrations/src/lib.rs b/substrate/frame/migrations/src/lib.rs index 5f321b6c8a1b9..b62736fc3fb1f 100644 --- a/substrate/frame/migrations/src/lib.rs +++ b/substrate/frame/migrations/src/lib.rs @@ -332,6 +332,7 @@ pub mod pallet { pub trait Config: frame_system::Config { /// The overarching event type of the runtime. #[pallet::no_default_bounds] + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// All the multi-block migrations to run. diff --git a/substrate/frame/multisig/src/lib.rs b/substrate/frame/multisig/src/lib.rs index 6fdc52d6887d0..5c234bd5d4ae3 100644 --- a/substrate/frame/multisig/src/lib.rs +++ b/substrate/frame/multisig/src/lib.rs @@ -134,6 +134,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The overarching call type. diff --git a/substrate/frame/nft-fractionalization/src/lib.rs b/substrate/frame/nft-fractionalization/src/lib.rs index 5fa990ecebe66..b8dc2331c524f 100644 --- a/substrate/frame/nft-fractionalization/src/lib.rs +++ b/substrate/frame/nft-fractionalization/src/lib.rs @@ -91,6 +91,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The currency mechanism, used for paying for deposits. diff --git a/substrate/frame/nfts/src/lib.rs b/substrate/frame/nfts/src/lib.rs index 346ad162c5035..7a2a0d7765235 100644 --- a/substrate/frame/nfts/src/lib.rs +++ b/substrate/frame/nfts/src/lib.rs @@ -128,6 +128,7 @@ pub mod pallet { /// The module configuration trait. pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; diff --git a/substrate/frame/nis/src/lib.rs b/substrate/frame/nis/src/lib.rs index 87e2276e768d0..6ca2ad0a0652c 100644 --- a/substrate/frame/nis/src/lib.rs +++ b/substrate/frame/nis/src/lib.rs @@ -214,6 +214,7 @@ pub mod pallet { type WeightInfo: WeightInfo; /// Overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The treasury's pallet id, used for deriving its sovereign account ID. diff --git a/substrate/frame/node-authorization/src/lib.rs b/substrate/frame/node-authorization/src/lib.rs index 4fbb9555deeb2..016200397251f 100644 --- a/substrate/frame/node-authorization/src/lib.rs +++ b/substrate/frame/node-authorization/src/lib.rs @@ -70,6 +70,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The maximum number of well known nodes that are allowed to set diff --git a/substrate/frame/nomination-pools/src/lib.rs b/substrate/frame/nomination-pools/src/lib.rs index 39a7cf05b3aba..8f8ce463265fb 100644 --- a/substrate/frame/nomination-pools/src/lib.rs +++ b/substrate/frame/nomination-pools/src/lib.rs @@ -1654,6 +1654,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Weight information for extrinsics in this pallet. diff --git a/substrate/frame/offences/src/lib.rs b/substrate/frame/offences/src/lib.rs index 18f37c759a6a2..fea6475f7dc28 100644 --- a/substrate/frame/offences/src/lib.rs +++ b/substrate/frame/offences/src/lib.rs @@ -64,6 +64,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From + IsType<::RuntimeEvent>; /// Full identification of the validator. type IdentificationTuple: Parameter; diff --git a/substrate/frame/parameters/src/lib.rs b/substrate/frame/parameters/src/lib.rs index 55a6f1ff91ded..aa91c57b90688 100644 --- a/substrate/frame/parameters/src/lib.rs +++ b/substrate/frame/parameters/src/lib.rs @@ -148,6 +148,7 @@ pub mod pallet { pub trait Config: frame_system::Config { /// The overarching event type. #[pallet::no_default_bounds] + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The overarching KV type of the parameters. diff --git a/substrate/frame/parameters/src/tests/mock.rs b/substrate/frame/parameters/src/tests/mock.rs index b7c391f383c22..000bc6d606af6 100644 --- a/substrate/frame/parameters/src/tests/mock.rs +++ b/substrate/frame/parameters/src/tests/mock.rs @@ -140,8 +140,6 @@ impl Config for Runtime { impl pallet_example_basic::Config for Runtime { // Use the dynamic key in the pallet config: type MagicNumber = dynamic_params::pallet1::Key1; - - type RuntimeEvent = RuntimeEvent; type WeightInfo = (); } diff --git a/substrate/frame/parameters/src/tests/test_renamed.rs b/substrate/frame/parameters/src/tests/test_renamed.rs index 7c371c5e55f87..9cf0f457d7002 100644 --- a/substrate/frame/parameters/src/tests/test_renamed.rs +++ b/substrate/frame/parameters/src/tests/test_renamed.rs @@ -90,8 +90,6 @@ impl Config for Runtime { impl pallet_example_basic::Config for Runtime { // Use the dynamic key in the pallet config: type MagicNumber = dynamic_params::pallet1::Key1; - - type RuntimeEvent = RuntimeEvent; type WeightInfo = (); } diff --git a/substrate/frame/preimage/src/lib.rs b/substrate/frame/preimage/src/lib.rs index 744e2d18d67bc..e397d7a43b5ea 100644 --- a/substrate/frame/preimage/src/lib.rs +++ b/substrate/frame/preimage/src/lib.rs @@ -110,6 +110,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The Weight information for this pallet. diff --git a/substrate/frame/proxy/src/lib.rs b/substrate/frame/proxy/src/lib.rs index 594d1721cd41b..5acb112017093 100644 --- a/substrate/frame/proxy/src/lib.rs +++ b/substrate/frame/proxy/src/lib.rs @@ -99,6 +99,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The overarching call type. diff --git a/substrate/frame/ranked-collective/src/lib.rs b/substrate/frame/ranked-collective/src/lib.rs index 4b1b3d9010db1..9a789aadbfdd1 100644 --- a/substrate/frame/ranked-collective/src/lib.rs +++ b/substrate/frame/ranked-collective/src/lib.rs @@ -404,6 +404,7 @@ pub mod pallet { type WeightInfo: WeightInfo; /// The runtime event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; diff --git a/substrate/frame/recovery/src/lib.rs b/substrate/frame/recovery/src/lib.rs index 8159bbefa76b1..88d1755e4f4a5 100644 --- a/substrate/frame/recovery/src/lib.rs +++ b/substrate/frame/recovery/src/lib.rs @@ -229,6 +229,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Weight information for extrinsics in this pallet. diff --git a/substrate/frame/referenda/src/lib.rs b/substrate/frame/referenda/src/lib.rs index b58baa341cf59..c9c4174f9dca8 100644 --- a/substrate/frame/referenda/src/lib.rs +++ b/substrate/frame/referenda/src/lib.rs @@ -143,6 +143,7 @@ pub mod pallet { + From> + IsType<::RuntimeCall> + From>; + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Weight information for extrinsics in this pallet. diff --git a/substrate/frame/remark/src/lib.rs b/substrate/frame/remark/src/lib.rs index eae8e0b83f5d2..158f64b41028b 100644 --- a/substrate/frame/remark/src/lib.rs +++ b/substrate/frame/remark/src/lib.rs @@ -45,6 +45,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Weight information for extrinsics in this pallet. type WeightInfo: WeightInfo; diff --git a/substrate/frame/revive/mock-network/src/mocks/msg_queue.rs b/substrate/frame/revive/mock-network/src/mocks/msg_queue.rs index 45715d973b545..25e39ee89051c 100644 --- a/substrate/frame/revive/mock-network/src/mocks/msg_queue.rs +++ b/substrate/frame/revive/mock-network/src/mocks/msg_queue.rs @@ -34,6 +34,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; type XcmExecutor: ExecuteXcm; } diff --git a/substrate/frame/revive/src/lib.rs b/substrate/frame/revive/src/lib.rs index b1851ebe41f09..a92544e198d6b 100644 --- a/substrate/frame/revive/src/lib.rs +++ b/substrate/frame/revive/src/lib.rs @@ -137,6 +137,7 @@ pub mod pallet { /// The overarching event type. #[pallet::no_default_bounds] + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The overarching call type. diff --git a/substrate/frame/root-offences/src/lib.rs b/substrate/frame/root-offences/src/lib.rs index 8e91c4ecfd1cd..e4500b474b9bf 100644 --- a/substrate/frame/root-offences/src/lib.rs +++ b/substrate/frame/root-offences/src/lib.rs @@ -53,6 +53,7 @@ pub mod pallet { FullIdentificationOf = pallet_staking::NullIdentity, > { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; } diff --git a/substrate/frame/root-testing/src/lib.rs b/substrate/frame/root-testing/src/lib.rs index 98e1f5c5b668d..c7b5d71b4aa9d 100644 --- a/substrate/frame/root-testing/src/lib.rs +++ b/substrate/frame/root-testing/src/lib.rs @@ -37,6 +37,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; } diff --git a/substrate/frame/safe-mode/src/lib.rs b/substrate/frame/safe-mode/src/lib.rs index 110f46b032204..53dd2aabacda1 100644 --- a/substrate/frame/safe-mode/src/lib.rs +++ b/substrate/frame/safe-mode/src/lib.rs @@ -109,6 +109,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Currency type for this pallet, used for Deposits. diff --git a/substrate/frame/salary/src/lib.rs b/substrate/frame/salary/src/lib.rs index 45c711e21c109..efa0d2f52a57d 100644 --- a/substrate/frame/salary/src/lib.rs +++ b/substrate/frame/salary/src/lib.rs @@ -87,6 +87,7 @@ pub mod pallet { type WeightInfo: WeightInfo; /// The runtime event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; diff --git a/substrate/frame/scheduler/src/lib.rs b/substrate/frame/scheduler/src/lib.rs index 2ad94ec04df47..c65d73a406573 100644 --- a/substrate/frame/scheduler/src/lib.rs +++ b/substrate/frame/scheduler/src/lib.rs @@ -243,6 +243,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The aggregated origin which the dispatch will take. diff --git a/substrate/frame/scheduler/src/mock.rs b/substrate/frame/scheduler/src/mock.rs index a9aea97542acd..e89f87ade0bad 100644 --- a/substrate/frame/scheduler/src/mock.rs +++ b/substrate/frame/scheduler/src/mock.rs @@ -60,6 +60,7 @@ pub mod logger { #[pallet::config] pub trait Config: frame_system::Config { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; } diff --git a/substrate/frame/scored-pool/src/lib.rs b/substrate/frame/scored-pool/src/lib.rs index fcaa6950110a8..4abff121a8dd9 100644 --- a/substrate/frame/scored-pool/src/lib.rs +++ b/substrate/frame/scored-pool/src/lib.rs @@ -163,6 +163,7 @@ pub mod pallet { + MaxEncodedLen; /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; diff --git a/substrate/frame/session/src/lib.rs b/substrate/frame/session/src/lib.rs index a80a2b235757b..a0df5a2139c61 100644 --- a/substrate/frame/session/src/lib.rs +++ b/substrate/frame/session/src/lib.rs @@ -400,6 +400,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// A stable ID for a validator. diff --git a/substrate/frame/society/src/lib.rs b/substrate/frame/society/src/lib.rs index 577c1a71f89d7..3af56b4cbf43a 100644 --- a/substrate/frame/society/src/lib.rs +++ b/substrate/frame/society/src/lib.rs @@ -497,6 +497,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; diff --git a/substrate/frame/staking/src/pallet/mod.rs b/substrate/frame/staking/src/pallet/mod.rs index 6bd52e2bce166..578ae02af6371 100644 --- a/substrate/frame/staking/src/pallet/mod.rs +++ b/substrate/frame/staking/src/pallet/mod.rs @@ -196,6 +196,7 @@ pub mod pallet { /// The overarching event type. #[pallet::no_default_bounds] + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Handler for the unbalanced reduction when slashing a staker. diff --git a/substrate/frame/state-trie-migration/src/lib.rs b/substrate/frame/state-trie-migration/src/lib.rs index 1418ea0b6f0a4..e912f8106c8db 100644 --- a/substrate/frame/state-trie-migration/src/lib.rs +++ b/substrate/frame/state-trie-migration/src/lib.rs @@ -507,6 +507,7 @@ pub mod pallet { /// The overarching event type. #[pallet::no_default_bounds] + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The currency provider type. diff --git a/substrate/frame/statement/src/lib.rs b/substrate/frame/statement/src/lib.rs index 02eef2ca1b2c6..24f00c4d750ba 100644 --- a/substrate/frame/statement/src/lib.rs +++ b/substrate/frame/statement/src/lib.rs @@ -70,6 +70,7 @@ pub mod pallet { ::AccountId: From, { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The currency which is used to calculate account limits. type Currency: Inspect; diff --git a/substrate/frame/sudo/src/lib.rs b/substrate/frame/sudo/src/lib.rs index 66616bf801ebf..6363b3cbab0f3 100644 --- a/substrate/frame/sudo/src/lib.rs +++ b/substrate/frame/sudo/src/lib.rs @@ -175,6 +175,7 @@ pub mod pallet { pub trait Config: frame_system::Config { /// The overarching event type. #[pallet::no_default_bounds] + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// A sudo-able call. diff --git a/substrate/frame/sudo/src/mock.rs b/substrate/frame/sudo/src/mock.rs index 67f896e1c021c..f1c076332febf 100644 --- a/substrate/frame/sudo/src/mock.rs +++ b/substrate/frame/sudo/src/mock.rs @@ -31,6 +31,7 @@ pub mod logger { #[pallet::config] pub trait Config: frame_system::Config { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; } diff --git a/substrate/frame/support/procedural/examples/proc_main/main.rs b/substrate/frame/support/procedural/examples/proc_main/main.rs index 946bd5ff03ed2..fff4831fd5744 100644 --- a/substrate/frame/support/procedural/examples/proc_main/main.rs +++ b/substrate/frame/support/procedural/examples/proc_main/main.rs @@ -65,7 +65,7 @@ pub mod frame_system { #[pallet::pallet] pub struct Pallet(_); - #[pallet::config(with_default)] + #[pallet::config(with_default, is_frame_system)] #[pallet::disable_frame_system_supertrait_check] pub trait Config: 'static { #[pallet::no_default] diff --git a/substrate/frame/support/procedural/src/pallet/expand/config.rs b/substrate/frame/support/procedural/src/pallet/expand/config.rs index d39f276723600..b70f7cebb0674 100644 --- a/substrate/frame/support/procedural/src/pallet/expand/config.rs +++ b/substrate/frame/support/procedural/src/pallet/expand/config.rs @@ -15,7 +15,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::pallet::Def; +use crate::pallet::{parse::GenericKind, Def}; use proc_macro2::TokenStream; use quote::quote; use syn::{parse_quote, Item}; @@ -48,6 +48,29 @@ Consequently, a runtime that wants to include this pallet must implement this tr ), ); + // insert `frame_system::Config` supertrait with `RuntimeEvent: From>` if neither + // associated type nor type bound is defined. + if let Some(event) = &def.event { + if !def.is_frame_system { + let frame_system = &def.frame_system; + + // can't use `type_use_gen()` since it returns `T`, not `Self` + let event_use_gen = match event.gen_kind { + GenericKind::None => quote!(), + GenericKind::Config => quote::quote_spanned! {event.attr_span => Self}, + GenericKind::ConfigAndInstance => + quote::quote_spanned! {event.attr_span => Self, I}, + }; + + let supertrait_with_event_bound = syn::parse2::( + quote! { #frame_system::Config>> }, + ) + .expect("should be possible to parse system supertrait"); + + config_item.supertraits.push(supertrait_with_event_bound.into()); + } + } + // we only emit `DefaultConfig` if there are trait items, so an empty `DefaultConfig` is // impossible consequently. match &config.default_sub_trait { @@ -92,7 +115,7 @@ Consequently, a runtime that wants to include this pallet must implement this tr } ) }, - _ => Default::default(), + _ => quote!(), } } diff --git a/substrate/frame/support/procedural/src/pallet/expand/event.rs b/substrate/frame/support/procedural/src/pallet/expand/event.rs index 8ebf077d0925d..4cdaf50c3c6c5 100644 --- a/substrate/frame/support/procedural/src/pallet/expand/event.rs +++ b/substrate/frame/support/procedural/src/pallet/expand/event.rs @@ -137,7 +137,6 @@ pub fn expand_event(def: &mut Def) -> proc_macro2::TokenStream { let deposit_event = if let Some(deposit_event) = &event.deposit_event { let event_use_gen = &event.gen_kind.type_use_gen(event.attr_span); - let trait_use_gen = &def.trait_use_generics(event.attr_span); let type_impl_gen = &def.type_impl_generics(event.attr_span); let type_use_gen = &def.type_use_generics(event.attr_span); let pallet_ident = &def.pallet_struct.pallet; @@ -148,12 +147,12 @@ pub fn expand_event(def: &mut Def) -> proc_macro2::TokenStream { impl<#type_impl_gen> #pallet_ident<#type_use_gen> #completed_where_clause { #fn_vis fn deposit_event(event: Event<#event_use_gen>) { let event = < - ::RuntimeEvent as + ::RuntimeEvent as From> >::from(event); let event = < - ::RuntimeEvent as + ::RuntimeEvent as Into<::RuntimeEvent> >::into(event); diff --git a/substrate/frame/support/procedural/src/pallet/expand/mod.rs b/substrate/frame/support/procedural/src/pallet/expand/mod.rs index 439ec55e269d4..960a44db582cd 100644 --- a/substrate/frame/support/procedural/src/pallet/expand/mod.rs +++ b/substrate/frame/support/procedural/src/pallet/expand/mod.rs @@ -80,6 +80,8 @@ pub fn expand(mut def: Def) -> proc_macro2::TokenStream { let doc_only = doc_only::expand_doc_only(&mut def); let composites = composite::expand_composites(&mut def); + let warnings = def.config.warnings; + def.item.attrs.insert( 0, syn::parse_quote!( @@ -100,6 +102,9 @@ storage item. Otherwise, all storage items are listed among [*Type Definitions*] ); let new_items = quote::quote!( + #( + #warnings + )* #metadata_docs #constants #pallet_struct diff --git a/substrate/frame/support/procedural/src/pallet/parse/config.rs b/substrate/frame/support/procedural/src/pallet/parse/config.rs index 6b6dcc802e2e7..1871cfbf34a9b 100644 --- a/substrate/frame/support/procedural/src/pallet/parse/config.rs +++ b/substrate/frame/support/procedural/src/pallet/parse/config.rs @@ -17,8 +17,9 @@ use super::helper; use frame_support_procedural_tools::{get_cfg_attributes, get_doc_literals, is_using_frame_crate}; +use proc_macro_warning::Warning; use quote::ToTokens; -use syn::{spanned::Spanned, token, Token, TraitItemType}; +use syn::{parse_quote, spanned::Spanned, token, Token, TraitItemType}; /// List of additional token to be used for parsing. mod keyword { @@ -58,11 +59,6 @@ pub struct ConfigDef { pub consts_metadata: Vec, /// Associated types metadata. pub associated_types_metadata: Vec, - /// Whether the trait has the associated type `Event`, note that those bounds are - /// checked: - /// * `IsType::RuntimeEvent` - /// * `From` or `From>` or `From>` - pub has_event_type: bool, /// The where clause on trait definition but modified so `Self` is `T`. pub where_clause: Option, /// Whether a default sub-trait should be generated. @@ -71,6 +67,8 @@ pub struct ConfigDef { /// Vec will be empty if `#[pallet::config(with_default)]` is not specified or if there are /// no trait items. pub default_sub_trait: Option, + /// Compile time warnings. Mainly for deprecated items. + pub warnings: Vec, } /// Input definition for an associated type in pallet config. @@ -373,6 +371,7 @@ impl ConfigDef { item: &mut syn::Item, enable_default: bool, disable_associated_metadata: bool, + is_frame_system: bool, ) -> syn::Result { let syn::Item::Trait(item) = item else { let msg = "Invalid pallet::config, expected trait definition"; @@ -406,31 +405,42 @@ impl ConfigDef { false }; - let has_frame_system_supertrait = item.supertraits.iter().any(|s| { - syn::parse2::(s.to_token_stream()) - .map_or(false, |b| has_expected_system_config(b, frame_system)) - }); - - let mut has_event_type = false; let mut consts_metadata = vec![]; let mut associated_types_metadata = vec![]; + let mut warnings = vec![]; let mut default_sub_trait = if enable_default { - Some(DefaultTrait { - items: Default::default(), - has_system: has_frame_system_supertrait, - }) + Some(DefaultTrait { items: Default::default(), has_system: !is_frame_system }) } else { None }; for trait_item in &mut item.items { let is_event = check_event_type(frame_system, trait_item, has_instance)?; - has_event_type = has_event_type || is_event; let mut already_no_default = false; let mut already_constant = false; let mut already_no_default_bounds = false; let mut already_collected_associated_type = None; + // add deprecation notice for `RuntimeEvent`, iff pallet is not `frame_system` + if is_event && !is_frame_system { + if let syn::TraitItem::Type(type_event) = trait_item { + let allow_dep: syn::Attribute = parse_quote!(#[allow(deprecated)]); + + // Check if the `#[allow(deprecated)]` attribute is present + if !type_event.attrs.iter().any(|attr| attr == &allow_dep) { + let warning = Warning::new_deprecated("RuntimeEvent") + .old("have `RuntimeEvent` associated type in the pallet config") + .new("remove it as it is redundant since associated bound gets appended automatically: \n + pub trait Config: frame_system::Config>> { }") + .help_link("https://github.com/paritytech/polkadot-sdk/pull/7229") + .span(type_event.ident.span()) + .build_or_panic(); + + warnings.push(warning); + } + } + } + while let Ok(Some(pallet_attr)) = helper::take_first_item_pallet_attr::(trait_item) { @@ -558,6 +568,11 @@ impl ConfigDef { helper::take_first_item_pallet_attr(&mut item.attrs)?; let disable_system_supertrait_check = attr.is_some(); + let has_frame_system_supertrait = item.supertraits.iter().any(|s| { + syn::parse2::(s.to_token_stream()) + .map_or(false, |b| has_expected_system_config(b, frame_system)) + }); + if !has_frame_system_supertrait && !disable_system_supertrait_check { let found = if item.supertraits.is_empty() { "none".to_string() @@ -588,9 +603,9 @@ impl ConfigDef { has_instance, consts_metadata, associated_types_metadata, - has_event_type, where_clause, default_sub_trait, + warnings, }) } } diff --git a/substrate/frame/support/procedural/src/pallet/parse/mod.rs b/substrate/frame/support/procedural/src/pallet/parse/mod.rs index 89875974b8b5d..eb7264007b416 100644 --- a/substrate/frame/support/procedural/src/pallet/parse/mod.rs +++ b/substrate/frame/support/procedural/src/pallet/parse/mod.rs @@ -72,6 +72,7 @@ pub struct Def { pub frame_support: syn::Path, pub dev_mode: bool, pub view_functions: Option, + pub is_frame_system: bool, } impl Def { @@ -106,19 +107,23 @@ impl Def { let mut type_values = vec![]; let mut composites: Vec = vec![]; let mut view_functions = None; + let mut is_frame_system = false; for (index, item) in items.iter_mut().enumerate() { let pallet_attr: Option = helper::take_first_item_pallet_attr(item)?; match pallet_attr { - Some(PalletAttr::Config{ with_default, without_automatic_metadata, ..}) if config.is_none() => + Some(PalletAttr::Config{ with_default, is_frame_system: is_frame_system_val, without_automatic_metadata, ..}) if config.is_none() => { + is_frame_system = is_frame_system_val; config = Some(config::ConfigDef::try_from( &frame_system, index, item, with_default, without_automatic_metadata, - )?), + is_frame_system, + )?); + }, Some(PalletAttr::Pallet(span)) if pallet_struct.is_none() => { let p = pallet_struct::PalletStructDef::try_from(span, index, item)?; pallet_struct = Some(p); @@ -257,10 +262,10 @@ impl Def { frame_support, dev_mode, view_functions, + is_frame_system, }; def.check_instance_usage()?; - def.check_event_usage()?; Ok(def) } @@ -358,26 +363,6 @@ impl Def { Ok(()) } - /// Check that usage of trait `Event` is consistent with the definition, i.e. it is declared - /// and trait defines type RuntimeEvent, or not declared and no trait associated type. - fn check_event_usage(&self) -> syn::Result<()> { - match (self.config.has_event_type, self.event.is_some()) { - (true, false) => { - let msg = "Invalid usage of RuntimeEvent, `Config` contains associated type `RuntimeEvent`, \ - but enum `Event` is not declared (i.e. no use of `#[pallet::event]`). \ - Note that type `RuntimeEvent` in trait is reserved to work alongside pallet event."; - Err(syn::Error::new(proc_macro2::Span::call_site(), msg)) - }, - (false, true) => { - let msg = "Invalid usage of RuntimeEvent, `Config` contains no associated type \ - `RuntimeEvent`, but enum `Event` is declared (in use of `#[pallet::event]`). \ - An RuntimeEvent associated type must be declare on trait `Config`."; - Err(syn::Error::new(proc_macro2::Span::call_site(), msg)) - }, - _ => Ok(()), - } - } - /// Check that usage of trait `Config` is consistent with the definition, i.e. it is used with /// instance iff it is defined with instance. fn check_instance_usage(&self) -> syn::Result<()> { @@ -559,6 +544,7 @@ mod keyword { syn::custom_keyword!(config); syn::custom_keyword!(with_default); syn::custom_keyword!(without_automatic_metadata); + syn::custom_keyword!(is_frame_system); syn::custom_keyword!(hooks); syn::custom_keyword!(inherent); syn::custom_keyword!(error); @@ -580,6 +566,8 @@ enum ConfigValue { WithDefault(keyword::with_default), /// `#[pallet::config(without_automatic_metadata)]` WithoutAutomaticMetadata(keyword::without_automatic_metadata), + /// `#[pallet::config(is_frame_system)]` + IsFrameSystem(keyword::is_frame_system), } impl syn::parse::Parse for ConfigValue { @@ -590,6 +578,8 @@ impl syn::parse::Parse for ConfigValue { input.parse().map(ConfigValue::WithDefault) } else if lookahead.peek(keyword::without_automatic_metadata) { input.parse().map(ConfigValue::WithoutAutomaticMetadata) + } else if lookahead.peek(keyword::is_frame_system) { + input.parse().map(ConfigValue::IsFrameSystem) } else { Err(lookahead.error()) } @@ -603,6 +593,7 @@ enum PalletAttr { span: proc_macro2::Span, with_default: bool, without_automatic_metadata: bool, + is_frame_system: bool, }, Pallet(proc_macro2::Span), Hooks(proc_macro2::Span), @@ -714,6 +705,7 @@ impl syn::parse::Parse for PalletAttr { let mut with_default = false; let mut without_automatic_metadata = false; + let mut is_frame_system = false; for config in config_values { match config { ConfigValue::WithDefault(_) => { @@ -734,15 +726,30 @@ impl syn::parse::Parse for PalletAttr { } without_automatic_metadata = true; }, + ConfigValue::IsFrameSystem(_) => { + if is_frame_system { + return Err(syn::Error::new( + span, + "Invalid duplicated attribute for `#[pallet::config]`. Please remove duplicates: is_frame_system.", + )); + } + is_frame_system = true; + }, } } - Ok(PalletAttr::Config { span, with_default, without_automatic_metadata }) + Ok(PalletAttr::Config { + span, + with_default, + without_automatic_metadata, + is_frame_system, + }) } else { Ok(PalletAttr::Config { span, with_default: false, without_automatic_metadata: false, + is_frame_system: false, }) } } else if lookahead.peek(keyword::pallet) { diff --git a/substrate/frame/support/src/lib.rs b/substrate/frame/support/src/lib.rs index 86c7330d275de..8945e6a8e0ca9 100644 --- a/substrate/frame/support/src/lib.rs +++ b/substrate/frame/support/src/lib.rs @@ -1372,8 +1372,7 @@ pub mod pallet_macros { /// pub struct Pallet(_); /// # /// # #[pallet::config] - /// # pub trait Config: frame_system::Config { - /// # type RuntimeEvent: From> + IsType<::RuntimeEvent>; + /// # pub trait Config: frame_system::Config>> { /// # } /// } /// ``` @@ -1510,12 +1509,6 @@ pub mod pallet_macros { /// optionally other supertraits and a where clause. (Specifying other supertraits here is /// known as [tight coupling](https://docs.substrate.io/reference/how-to-guides/pallet-design/use-tight-coupling/)) /// - /// The associated type `RuntimeEvent` is reserved. If defined, it must have the bounds - /// `From` and `IsType<::RuntimeEvent>`. - /// - /// [`#[pallet::event]`](`event`) must be present if `RuntimeEvent` - /// exists as a config item in your `#[pallet::config]`. - /// /// ## Optional: `with_default` /// /// An optional `with_default` argument may also be specified. Doing so will automatically @@ -1538,10 +1531,6 @@ pub mod pallet_macros { /// /// #[pallet::config(with_default)] // <- with_default is optional /// pub trait Config: frame_system::Config { - /// /// The overarching event type. - /// #[pallet::no_default_bounds] // Default with bounds is not supported for RuntimeEvent - /// type RuntimeEvent: From> + IsType<::RuntimeEvent>; - /// /// /// A more complex type. /// #[pallet::no_default] // Example of type where no default should be provided /// type MoreComplexType: SomeMoreComplexBound; @@ -1610,14 +1599,13 @@ pub mod pallet_macros { /// Furthermore, the `without_automatic_metadata` argument can be used in combination with /// the [`#[pallet::include_metadata]`](`include_metadata`) attribute to selectively /// include only certain associated types in the metadata collection. - /// /// ``` /// #[frame_support::pallet] /// mod pallet { /// # use frame_support::pallet_prelude::*; /// # use frame_system::pallet_prelude::*; /// # use core::fmt::Debug; - /// # use frame_support::traits::Contains; + /// # use frame_support::traits::{Contains, VariantCount}; /// # /// # pub trait SomeMoreComplexBound {} /// # @@ -1626,10 +1614,9 @@ pub mod pallet_macros { /// /// #[pallet::config(with_default, without_automatic_metadata)] // <- with_default and without_automatic_metadata are optional /// pub trait Config: frame_system::Config { - /// /// The overarching event type. - /// #[pallet::no_default_bounds] // Default with bounds is not supported for RuntimeEvent - /// type RuntimeEvent: From> + IsType<::RuntimeEvent>; - /// + /// /// The overarching freeze reason. + /// #[pallet::no_default_bounds] // Default with bounds is not supported for RuntimeFreezeReason + /// type RuntimeFreezeReason: Parameter + Member + MaxEncodedLen + Copy + VariantCount; /// /// A simple type. /// // Type that would have been included in metadata, but is now excluded. /// type SimpleType: From + TypeInfo; @@ -2067,26 +2054,28 @@ pub mod pallet_macros { /// #[pallet::pallet] /// pub struct Pallet(_); /// + /// #[pallet::config] + /// pub trait Config: frame_system::Config {} + /// /// #[pallet::event] /// #[pallet::generate_deposit(fn deposit_event)] // Optional /// pub enum Event { /// /// SomeEvent doc /// SomeEvent(u16, u32), // SomeEvent with two fields /// } - /// - /// #[pallet::config] - /// pub trait Config: frame_system::Config { - /// /// The overarching runtime event type. - /// type RuntimeEvent: From> - /// + IsType<::RuntimeEvent>; - /// } /// } /// ``` /// /// I.e. an enum (with named or unnamed fields variant), named `Event`, with generic: none /// or `T` or `T: Config`, and optional w here clause. /// - /// `RuntimeEvent` must be defined in the `Config`, as shown in the example. + /// Macro expansion automatically appends `From>` bound to + /// system supertrait's `RuntimeEvent `associated type, i.e: + /// + /// ```rs + /// #[pallet::config] + /// pub trait Config: frame_system::Config>> {} + /// ``` /// /// Each field must implement [`Clone`], [`Eq`], [`PartialEq`], [`codec::Encode`], /// [`codec::Decode`], and [`Debug`] (on std only). For ease of use, bound by the trait diff --git a/substrate/frame/support/src/tests/mod.rs b/substrate/frame/support/src/tests/mod.rs index b10e719b9ac36..e8b6888d390fb 100644 --- a/substrate/frame/support/src/tests/mod.rs +++ b/substrate/frame/support/src/tests/mod.rs @@ -58,7 +58,7 @@ pub mod frame_system { #[pallet::pallet] pub struct Pallet(_); - #[pallet::config(with_default)] + #[pallet::config(with_default, is_frame_system)] #[pallet::disable_frame_system_supertrait_check] pub trait Config: 'static { #[pallet::no_default] diff --git a/substrate/frame/support/test/src/lib.rs b/substrate/frame/support/test/src/lib.rs index b080740b0a4b1..fccc101db0c45 100644 --- a/substrate/frame/support/test/src/lib.rs +++ b/substrate/frame/support/test/src/lib.rs @@ -36,7 +36,7 @@ pub mod pallet { pub struct Pallet(_); /// The configuration trait. - #[pallet::config] + #[pallet::config(is_frame_system)] #[pallet::disable_frame_system_supertrait_check] pub trait Config: 'static + Eq + Clone { /// The block number type. diff --git a/substrate/frame/support/test/tests/common/outer_enums.rs b/substrate/frame/support/test/tests/common/outer_enums.rs index 92dc7ac522079..9659f08430d8d 100644 --- a/substrate/frame/support/test/tests/common/outer_enums.rs +++ b/substrate/frame/support/test/tests/common/outer_enums.rs @@ -27,6 +27,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; } @@ -71,6 +72,7 @@ pub mod pallet2 { #[pallet::config] pub trait Config: frame_system::Config { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; } @@ -115,6 +117,7 @@ pub mod pallet3 { #[pallet::config] pub trait Config: frame_system::Config { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; } diff --git a/substrate/frame/support/test/tests/enum_deprecation.rs b/substrate/frame/support/test/tests/enum_deprecation.rs index c8f133b06b97e..92ceaafd237bc 100644 --- a/substrate/frame/support/test/tests/enum_deprecation.rs +++ b/substrate/frame/support/test/tests/enum_deprecation.rs @@ -60,6 +60,7 @@ pub mod pallet { { type Balance: Parameter + Default + TypeInfo; + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; } diff --git a/substrate/frame/support/test/tests/instance.rs b/substrate/frame/support/test/tests/instance.rs index 1325e112de16f..36bdc914284fb 100644 --- a/substrate/frame/support/test/tests/instance.rs +++ b/substrate/frame/support/test/tests/instance.rs @@ -50,6 +50,7 @@ mod module1 { #[pallet::config] pub trait Config: frame_system::Config { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; type RuntimeOrigin: From>; @@ -168,6 +169,7 @@ mod module2 { #[pallet::config] pub trait Config: frame_system::Config { type Amount: Parameter + MaybeSerializeDeserialize + Default + MaxEncodedLen; + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; type RuntimeOrigin: From>; diff --git a/substrate/frame/support/test/tests/origin.rs b/substrate/frame/support/test/tests/origin.rs index c507da320ac97..81e7f46189290 100644 --- a/substrate/frame/support/test/tests/origin.rs +++ b/substrate/frame/support/test/tests/origin.rs @@ -36,6 +36,7 @@ mod nested { #[pallet::config] pub trait Config: frame_system::Config { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; } @@ -95,6 +96,7 @@ pub mod module { #[pallet::config] pub trait Config: frame_system::Config { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; } diff --git a/substrate/frame/support/test/tests/pallet.rs b/substrate/frame/support/test/tests/pallet.rs index dc09f1d35f989..d22a273c2c86b 100644 --- a/substrate/frame/support/test/tests/pallet.rs +++ b/substrate/frame/support/test/tests/pallet.rs @@ -154,6 +154,7 @@ pub mod pallet { type Balance: Parameter + Default + TypeInfo; + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; } @@ -594,6 +595,7 @@ pub mod pallet2 { where ::AccountId: From + SomeAssociation1, { + #[allow(deprecated)] type RuntimeEvent: From + IsType<::RuntimeEvent>; } diff --git a/substrate/frame/support/test/tests/pallet_associated_types_metadata.rs b/substrate/frame/support/test/tests/pallet_associated_types_metadata.rs index a2b916f54c5ed..8ff230470693b 100644 --- a/substrate/frame/support/test/tests/pallet_associated_types_metadata.rs +++ b/substrate/frame/support/test/tests/pallet_associated_types_metadata.rs @@ -35,6 +35,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { // Runtime events already propagated to the metadata. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; // Constants are already propagated. @@ -59,6 +60,7 @@ pub mod pallet2 { #[pallet::config] pub trait Config: frame_system::Config { // Runtime events already propagated to the metadata. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; // Constants are already propagated. @@ -95,6 +97,7 @@ pub mod pallet3 { #[pallet::config(without_automatic_metadata)] pub trait Config: frame_system::Config { // Runtime events already propagated to the metadata. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; // Constants are already propagated. diff --git a/substrate/frame/support/test/tests/pallet_instance.rs b/substrate/frame/support/test/tests/pallet_instance.rs index 75e0c09e0b719..7593c42e76f98 100644 --- a/substrate/frame/support/test/tests/pallet_instance.rs +++ b/substrate/frame/support/test/tests/pallet_instance.rs @@ -48,6 +48,7 @@ pub mod pallet { #[pallet::constant] type MyGetParam: Get; type Balance: Parameter + Default + scale_info::StaticTypeInfo; + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; } @@ -267,6 +268,7 @@ pub mod pallet2 { #[pallet::config] pub trait Config: frame_system::Config { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; } diff --git a/substrate/frame/support/test/tests/pallet_ui/config_metadata_on_events.rs b/substrate/frame/support/test/tests/pallet_ui/config_metadata_on_events.rs index d91f86771bf6d..5746d21a91b29 100644 --- a/substrate/frame/support/test/tests/pallet_ui/config_metadata_on_events.rs +++ b/substrate/frame/support/test/tests/pallet_ui/config_metadata_on_events.rs @@ -24,6 +24,7 @@ mod pallet { pub trait Config: frame_system::Config { #[pallet::no_default_bounds] #[pallet::include_metadata] + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; #[pallet::constant] diff --git a/substrate/frame/support/test/tests/pallet_ui/event_type_invalid_bound_2.rs b/substrate/frame/support/test/tests/pallet_ui/event_deprecated_runtime_event.rs similarity index 92% rename from substrate/frame/support/test/tests/pallet_ui/event_type_invalid_bound_2.rs rename to substrate/frame/support/test/tests/pallet_ui/event_deprecated_runtime_event.rs index 23d5a3b449ec8..7e597106ba41f 100644 --- a/substrate/frame/support/test/tests/pallet_ui/event_type_invalid_bound_2.rs +++ b/substrate/frame/support/test/tests/pallet_ui/event_deprecated_runtime_event.rs @@ -22,8 +22,8 @@ mod pallet { #[pallet::config] pub trait Config: frame_system::Config { - type Bar; - type RuntimeEvent: IsType<::RuntimeEvent>; + type Bar: Clone + PartialEq + std::fmt::Debug; + type RuntimeEvent: IsType<::RuntimeEvent> + From>; } #[pallet::pallet] @@ -41,5 +41,4 @@ mod pallet { } } -fn main() { -} +fn main() {} diff --git a/substrate/frame/support/test/tests/pallet_ui/event_deprecated_runtime_event.stderr b/substrate/frame/support/test/tests/pallet_ui/event_deprecated_runtime_event.stderr new file mode 100644 index 0000000000000..7931d55a1a16f --- /dev/null +++ b/substrate/frame/support/test/tests/pallet_ui/event_deprecated_runtime_event.stderr @@ -0,0 +1,24 @@ +error: unused import: `event` + --> tests/pallet_ui/event_deprecated_runtime_event.rs:38:12 + | +38 | #[pallet::event] + | ^^^^^ + | + = note: `-D unused-imports` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(unused_imports)]` + +error: use of deprecated constant `pallet::RuntimeEvent::_w`: + It is deprecated to have `RuntimeEvent` associated type in the pallet config. + Please instead remove it as it is redundant since associated bound gets appended automatically: + + pub trait Config: frame_system::Config>> { }. + + For more info see: + + --> tests/pallet_ui/event_deprecated_runtime_event.rs:26:8 + | +26 | type RuntimeEvent: IsType<::RuntimeEvent> + From>; + | ^^^^^^^^^^^^ + | + = note: `-D deprecated` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(deprecated)]` diff --git a/substrate/frame/support/test/tests/pallet_ui/event_field_not_member.rs b/substrate/frame/support/test/tests/pallet_ui/event_field_not_member.rs index 33603d6f559a8..8e46895ace15f 100644 --- a/substrate/frame/support/test/tests/pallet_ui/event_field_not_member.rs +++ b/substrate/frame/support/test/tests/pallet_ui/event_field_not_member.rs @@ -24,7 +24,6 @@ mod pallet { #[pallet::config] pub trait Config: frame_system::Config { type Bar; - type RuntimeEvent: IsType<::RuntimeEvent> + From>; } #[pallet::pallet] diff --git a/substrate/frame/support/test/tests/pallet_ui/event_field_not_member.stderr b/substrate/frame/support/test/tests/pallet_ui/event_field_not_member.stderr index 44660d2690603..fc4a33b721500 100644 --- a/substrate/frame/support/test/tests/pallet_ui/event_field_not_member.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/event_field_not_member.stderr @@ -1,19 +1,19 @@ error[E0277]: the trait bound `::Bar: Clone` is not satisfied - --> tests/pallet_ui/event_field_not_member.rs:41:7 + --> tests/pallet_ui/event_field_not_member.rs:40:7 | -41 | B { b: T::Bar }, +40 | B { b: T::Bar }, | ^ the trait `Clone` is not implemented for `::Bar` error[E0369]: binary operation `==` cannot be applied to type `&::Bar` - --> tests/pallet_ui/event_field_not_member.rs:41:7 + --> tests/pallet_ui/event_field_not_member.rs:40:7 | -41 | B { b: T::Bar }, +40 | B { b: T::Bar }, | ^ error[E0277]: `::Bar` doesn't implement `std::fmt::Debug` - --> tests/pallet_ui/event_field_not_member.rs:41:7 + --> tests/pallet_ui/event_field_not_member.rs:40:7 | -41 | B { b: T::Bar }, +40 | B { b: T::Bar }, | ^ `::Bar` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` | = help: the trait `std::fmt::Debug` is not implemented for `::Bar` diff --git a/substrate/frame/support/test/tests/pallet_ui/event_not_in_trait.rs b/substrate/frame/support/test/tests/pallet_ui/event_not_in_trait.rs deleted file mode 100644 index 405faeb6de050..0000000000000 --- a/substrate/frame/support/test/tests/pallet_ui/event_not_in_trait.rs +++ /dev/null @@ -1,44 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#[frame_support::pallet] -mod pallet { - use frame_support::pallet_prelude::Hooks; - use frame_system::pallet_prelude::BlockNumberFor; - - #[pallet::config] - pub trait Config: frame_system::Config { - type Bar; - } - - #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); - - #[pallet::hooks] - impl Hooks> for Pallet {} - - #[pallet::call] - impl Pallet {} - - #[pallet::event] - pub enum Event { - B { b: T::Bar }, - } -} - -fn main() { -} diff --git a/substrate/frame/support/test/tests/pallet_ui/event_not_in_trait.stderr b/substrate/frame/support/test/tests/pallet_ui/event_not_in_trait.stderr deleted file mode 100644 index eef17ffab4fef..0000000000000 --- a/substrate/frame/support/test/tests/pallet_ui/event_not_in_trait.stderr +++ /dev/null @@ -1,7 +0,0 @@ -error: Invalid usage of RuntimeEvent, `Config` contains no associated type `RuntimeEvent`, but enum `Event` is declared (in use of `#[pallet::event]`). An RuntimeEvent associated type must be declare on trait `Config`. - --> tests/pallet_ui/event_not_in_trait.rs:18:1 - | -18 | #[frame_support::pallet] - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: this error originates in the attribute macro `frame_support::pallet` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/substrate/frame/support/test/tests/pallet_ui/event_type_invalid_bound.rs b/substrate/frame/support/test/tests/pallet_ui/event_type_invalid_bound.rs deleted file mode 100644 index 34b563ffb6433..0000000000000 --- a/substrate/frame/support/test/tests/pallet_ui/event_type_invalid_bound.rs +++ /dev/null @@ -1,44 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#[frame_support::pallet] -mod pallet { - use frame_support::pallet_prelude::Hooks; - use frame_system::pallet_prelude::BlockNumberFor; - - #[pallet::config] - pub trait Config: frame_system::Config { - type Bar; - type RuntimeEvent; - } - - #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); - - #[pallet::hooks] - impl Hooks> for Pallet {} - - #[pallet::call] - impl Pallet {} - - #[pallet::event] - pub enum Event { - B { b: T::Bar }, - } -} - -fn main() {} diff --git a/substrate/frame/support/test/tests/pallet_ui/event_type_invalid_bound.stderr b/substrate/frame/support/test/tests/pallet_ui/event_type_invalid_bound.stderr deleted file mode 100644 index e9e4c1269f29d..0000000000000 --- a/substrate/frame/support/test/tests/pallet_ui/event_type_invalid_bound.stderr +++ /dev/null @@ -1,5 +0,0 @@ -error: Invalid `type RuntimeEvent`, associated type `RuntimeEvent` is reserved and must bound: `IsType<::RuntimeEvent>` - --> tests/pallet_ui/event_type_invalid_bound.rs:26:3 - | -26 | type RuntimeEvent; - | ^^^^ diff --git a/substrate/frame/support/test/tests/pallet_ui/event_type_invalid_bound_2.stderr b/substrate/frame/support/test/tests/pallet_ui/event_type_invalid_bound_2.stderr deleted file mode 100644 index 436a8651bb80d..0000000000000 --- a/substrate/frame/support/test/tests/pallet_ui/event_type_invalid_bound_2.stderr +++ /dev/null @@ -1,5 +0,0 @@ -error: Invalid `type RuntimeEvent`, associated type `RuntimeEvent` is reserved and must bound: `From` or `From>` or `From>` - --> tests/pallet_ui/event_type_invalid_bound_2.rs:26:3 - | -26 | type RuntimeEvent: IsType<::RuntimeEvent>; - | ^^^^ diff --git a/substrate/frame/support/test/tests/pallet_ui/event_type_invalid_bound_no_frame_crate.rs b/substrate/frame/support/test/tests/pallet_ui/event_type_invalid_bound_no_frame_crate.rs deleted file mode 100644 index b510beb54dda0..0000000000000 --- a/substrate/frame/support/test/tests/pallet_ui/event_type_invalid_bound_no_frame_crate.rs +++ /dev/null @@ -1,45 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#[frame_support::pallet] -mod pallet { - use polkadot_sdk_frame::deps::frame_system::pallet_prelude::BlockNumberFor; - use frame_support::pallet_prelude::{Hooks, IsType}; - - #[pallet::config] - pub trait Config: polkadot_sdk_frame::deps::frame_system::Config { - type Bar: Clone + std::fmt::Debug + Eq; - type RuntimeEvent: IsType<::RuntimeEvent> - + From>; - } - - #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); - - #[pallet::hooks] - impl Hooks> for Pallet {} - - #[pallet::call] - impl Pallet {} - - #[pallet::event] - pub enum Event { - B { b: T::Bar }, - } -} - -fn main() {} diff --git a/substrate/frame/support/test/tests/pallet_ui/event_type_invalid_bound_no_frame_crate.stderr b/substrate/frame/support/test/tests/pallet_ui/event_type_invalid_bound_no_frame_crate.stderr deleted file mode 100644 index 384e44d97a617..0000000000000 --- a/substrate/frame/support/test/tests/pallet_ui/event_type_invalid_bound_no_frame_crate.stderr +++ /dev/null @@ -1,5 +0,0 @@ -error: Invalid `type RuntimeEvent`, associated type `RuntimeEvent` is reserved and must bound: `IsType<::RuntimeEvent>` - --> tests/pallet_ui/event_type_invalid_bound_no_frame_crate.rs:26:3 - | -26 | type RuntimeEvent: IsType<::RuntimeEvent> - | ^^^^ diff --git a/substrate/frame/support/test/tests/pallet_ui/pass/event_type_bound_system_config_assoc_type.rs b/substrate/frame/support/test/tests/pallet_ui/pass/event_type_bound_system_config_assoc_type.rs index f028dd20de869..e388128daf095 100644 --- a/substrate/frame/support/test/tests/pallet_ui/pass/event_type_bound_system_config_assoc_type.rs +++ b/substrate/frame/support/test/tests/pallet_ui/pass/event_type_bound_system_config_assoc_type.rs @@ -22,9 +22,10 @@ pub mod pallet { use frame_system::pallet_prelude::BlockNumberFor; #[pallet::config] - pub trait Config: frame_system::Config { + pub trait Config: + frame_system::Config>> + { type Bar: Clone + std::fmt::Debug + Eq; - type RuntimeEvent: IsType<::RuntimeEvent> + From>; } #[pallet::pallet] diff --git a/substrate/frame/support/test/tests/runtime.rs b/substrate/frame/support/test/tests/runtime.rs index a7a2f6ca37860..5f89c5bfc94ec 100644 --- a/substrate/frame/support/test/tests/runtime.rs +++ b/substrate/frame/support/test/tests/runtime.rs @@ -52,6 +52,7 @@ mod module1 { #[pallet::config] pub trait Config: frame_system::Config { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; } @@ -100,6 +101,7 @@ mod module2 { #[pallet::config] pub trait Config: frame_system::Config { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; } @@ -156,6 +158,7 @@ mod nested { #[pallet::config] pub trait Config: frame_system::Config { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; } @@ -234,6 +237,7 @@ pub mod module3 { #[pallet::config] pub trait Config: frame_system::Config { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; } diff --git a/substrate/frame/support/test/tests/runtime_legacy_ordering.rs b/substrate/frame/support/test/tests/runtime_legacy_ordering.rs index cbe5276d0b726..c2163cddb057d 100644 --- a/substrate/frame/support/test/tests/runtime_legacy_ordering.rs +++ b/substrate/frame/support/test/tests/runtime_legacy_ordering.rs @@ -52,6 +52,7 @@ mod module1 { #[pallet::config] pub trait Config: frame_system::Config { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; } @@ -100,6 +101,7 @@ mod module2 { #[pallet::config] pub trait Config: frame_system::Config { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; } @@ -156,6 +158,7 @@ mod nested { #[pallet::config] pub trait Config: frame_system::Config { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; } @@ -234,6 +237,7 @@ pub mod module3 { #[pallet::config] pub trait Config: frame_system::Config { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; } diff --git a/substrate/frame/support/test/tests/split_ui/pass/split_valid.rs b/substrate/frame/support/test/tests/split_ui/pass/split_valid.rs index a3ad7c2bf6f98..9775ab2d367a6 100644 --- a/substrate/frame/support/test/tests/split_ui/pass/split_valid.rs +++ b/substrate/frame/support/test/tests/split_ui/pass/split_valid.rs @@ -41,6 +41,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; } @@ -53,5 +54,4 @@ pub mod pallet { } } -fn main() { -} +fn main() {} diff --git a/substrate/frame/support/test/tests/split_ui/pass/split_valid_disambiguation.rs b/substrate/frame/support/test/tests/split_ui/pass/split_valid_disambiguation.rs index dba0eb7333a01..28bcb8c4edf95 100644 --- a/substrate/frame/support/test/tests/split_ui/pass/split_valid_disambiguation.rs +++ b/substrate/frame/support/test/tests/split_ui/pass/split_valid_disambiguation.rs @@ -36,7 +36,7 @@ mod first { mod second { use super::*; - + #[pallet_section(section2)] mod section { #[pallet::error] @@ -58,6 +58,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; } @@ -74,5 +75,4 @@ pub mod pallet { } } -fn main() { -} +fn main() {} diff --git a/substrate/frame/system/benches/bench.rs b/substrate/frame/system/benches/bench.rs index 1b0f459c9792f..84ece9d8b3065 100644 --- a/substrate/frame/system/benches/bench.rs +++ b/substrate/frame/system/benches/bench.rs @@ -27,6 +27,7 @@ mod module { #[pallet::config] pub trait Config: frame_system::Config { + #[allow(deprecated)] type RuntimeEvent: From + IsType<::RuntimeEvent>; } diff --git a/substrate/frame/system/src/lib.rs b/substrate/frame/system/src/lib.rs index 9a21c65902983..bbb41cef5275f 100644 --- a/substrate/frame/system/src/lib.rs +++ b/substrate/frame/system/src/lib.rs @@ -476,7 +476,7 @@ pub mod pallet { } /// System configuration trait. Implemented by runtime. - #[pallet::config(with_default)] + #[pallet::config(with_default, is_frame_system)] #[pallet::disable_frame_system_supertrait_check] pub trait Config: 'static + Eq + Clone { /// The aggregated event type of the runtime. diff --git a/substrate/frame/tips/src/lib.rs b/substrate/frame/tips/src/lib.rs index 67bcdfa0685e5..53d1be1c2df32 100644 --- a/substrate/frame/tips/src/lib.rs +++ b/substrate/frame/tips/src/lib.rs @@ -135,6 +135,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config + pallet_treasury::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; diff --git a/substrate/frame/transaction-payment/asset-conversion-tx-payment/src/lib.rs b/substrate/frame/transaction-payment/asset-conversion-tx-payment/src/lib.rs index d6721c46422bd..faa2245f51638 100644 --- a/substrate/frame/transaction-payment/asset-conversion-tx-payment/src/lib.rs +++ b/substrate/frame/transaction-payment/asset-conversion-tx-payment/src/lib.rs @@ -111,6 +111,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config + pallet_transaction_payment::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The asset ID type that can be used for transaction payments in addition to a /// native asset. diff --git a/substrate/frame/transaction-payment/asset-tx-payment/src/lib.rs b/substrate/frame/transaction-payment/asset-tx-payment/src/lib.rs index 4a96cbcacb580..96bac679af21d 100644 --- a/substrate/frame/transaction-payment/asset-tx-payment/src/lib.rs +++ b/substrate/frame/transaction-payment/asset-tx-payment/src/lib.rs @@ -121,6 +121,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config + pallet_transaction_payment::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The fungibles instance used to pay for transactions in assets. type Fungibles: Balanced; diff --git a/substrate/frame/transaction-payment/skip-feeless-payment/src/lib.rs b/substrate/frame/transaction-payment/skip-feeless-payment/src/lib.rs index 5ba1d1297679e..e5107b950028e 100644 --- a/substrate/frame/transaction-payment/skip-feeless-payment/src/lib.rs +++ b/substrate/frame/transaction-payment/skip-feeless-payment/src/lib.rs @@ -66,6 +66,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; } diff --git a/substrate/frame/transaction-payment/src/lib.rs b/substrate/frame/transaction-payment/src/lib.rs index 216697beac698..db9285f4d5b3b 100644 --- a/substrate/frame/transaction-payment/src/lib.rs +++ b/substrate/frame/transaction-payment/src/lib.rs @@ -347,6 +347,7 @@ pub mod pallet { pub trait Config: frame_system::Config { /// The overarching event type. #[pallet::no_default_bounds] + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Handler for withdrawing, refunding and depositing the transaction fee. diff --git a/substrate/frame/transaction-storage/src/lib.rs b/substrate/frame/transaction-storage/src/lib.rs index 1fa5109ad6178..bb02bf2f66e62 100644 --- a/substrate/frame/transaction-storage/src/lib.rs +++ b/substrate/frame/transaction-storage/src/lib.rs @@ -104,6 +104,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// A dispatchable call. type RuntimeCall: Parameter diff --git a/substrate/frame/treasury/src/lib.rs b/substrate/frame/treasury/src/lib.rs index 0f1897872cc1f..1b0158d750809 100644 --- a/substrate/frame/treasury/src/lib.rs +++ b/substrate/frame/treasury/src/lib.rs @@ -218,6 +218,7 @@ pub mod pallet { type RejectOrigin: EnsureOrigin; /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; diff --git a/substrate/frame/tx-pause/src/lib.rs b/substrate/frame/tx-pause/src/lib.rs index 962bfd744a658..d06b837d67af9 100644 --- a/substrate/frame/tx-pause/src/lib.rs +++ b/substrate/frame/tx-pause/src/lib.rs @@ -111,6 +111,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The overarching call type. diff --git a/substrate/frame/uniques/src/lib.rs b/substrate/frame/uniques/src/lib.rs index d2fa0adb11704..75071d24b592a 100644 --- a/substrate/frame/uniques/src/lib.rs +++ b/substrate/frame/uniques/src/lib.rs @@ -96,6 +96,7 @@ pub mod pallet { /// The module configuration trait. pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; diff --git a/substrate/frame/utility/src/lib.rs b/substrate/frame/utility/src/lib.rs index 518e75453501c..3473e528327a1 100644 --- a/substrate/frame/utility/src/lib.rs +++ b/substrate/frame/utility/src/lib.rs @@ -88,6 +88,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From + IsType<::RuntimeEvent>; /// The overarching call type. diff --git a/substrate/frame/utility/src/tests.rs b/substrate/frame/utility/src/tests.rs index 56e7e3c21ea24..9eb85aa616a1b 100644 --- a/substrate/frame/utility/src/tests.rs +++ b/substrate/frame/utility/src/tests.rs @@ -99,6 +99,7 @@ mod mock_democracy { #[pallet::config] pub trait Config: frame_system::Config + Sized { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; type ExternalMajorityOrigin: EnsureOrigin; diff --git a/substrate/frame/vesting/src/lib.rs b/substrate/frame/vesting/src/lib.rs index 357f454519dd9..f6d79150fdf05 100644 --- a/substrate/frame/vesting/src/lib.rs +++ b/substrate/frame/vesting/src/lib.rs @@ -160,6 +160,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The currency trait. diff --git a/substrate/frame/whitelist/src/lib.rs b/substrate/frame/whitelist/src/lib.rs index 28887e0ca4aca..a16d524a6fc69 100644 --- a/substrate/frame/whitelist/src/lib.rs +++ b/substrate/frame/whitelist/src/lib.rs @@ -64,6 +64,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The overarching call type. diff --git a/templates/parachain/pallets/template/src/lib.rs b/templates/parachain/pallets/template/src/lib.rs index 211bef51aa86e..0f61f7a29a361 100644 --- a/templates/parachain/pallets/template/src/lib.rs +++ b/templates/parachain/pallets/template/src/lib.rs @@ -73,6 +73,7 @@ pub mod pallet { /// Configure the pallet by specifying the parameters and types on which it depends. #[pallet::config] pub trait Config: frame_system::Config { + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// A type representing the weights required by the dispatchables of this pallet. diff --git a/templates/solochain/pallets/template/src/lib.rs b/templates/solochain/pallets/template/src/lib.rs index 90dfe37014585..db01d163dc2b2 100644 --- a/templates/solochain/pallets/template/src/lib.rs +++ b/templates/solochain/pallets/template/src/lib.rs @@ -81,6 +81,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching runtime event type. + #[allow(deprecated)] type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// A type representing the weights required by the dispatchables of this pallet. type WeightInfo: WeightInfo;