-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Update Pallet Referenda to support Block Number Provider #6338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
muharem
merged 20 commits into
paritytech:master
from
dharjeezy:dami/pallet_referenda_block_number_provider
Feb 7, 2025
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
46abe42
Update Pallet Referenda to support relay chain Block Number Provider
dharjeezy fd92baa
Include BlockNumberProvider for all runtime configs
dharjeezy 57be43c
introduce custom BlockProvider type
dharjeezy e62fe61
fmt
dharjeezy da6dbe1
fix benchmarks
dharjeezy a25aa88
Merge remote-tracking branch 'origin/master' into dami/pallet_referen…
dharjeezy 059e1bd
Merge remote-tracking branch 'origin/master' into dami/pallet_referen…
dharjeezy 0cd84f0
fmt benchmarks
dharjeezy 975c50c
Merge remote-tracking branch 'origin/master' into dami/pallet_referen…
dharjeezy 76e5f94
migration
dharjeezy 3214f28
doc
dharjeezy c905dcf
conversation nits
dharjeezy f488c51
change trait for conversion in migration
dharjeezy 12c1476
standalone function for migration
dharjeezy 678991b
standalone function for migration
dharjeezy 77ab73d
test to migrate from v1 to block number provider
dharjeezy f79afd8
nit on conversation
dharjeezy b95e228
nit based on conversation
dharjeezy 0f9749a
revert
dharjeezy 41c7300
Merge branch 'master' into dami/pallet_referenda_block_number_provider
muharem File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -82,7 +82,6 @@ use frame_support::{ | |||||||||
| }, | ||||||||||
| BoundedVec, | ||||||||||
| }; | ||||||||||
| use frame_system::pallet_prelude::BlockNumberFor; | ||||||||||
| use scale_info::TypeInfo; | ||||||||||
| use sp_runtime::{ | ||||||||||
| traits::{AtLeast32BitUnsigned, Bounded, Dispatchable, One, Saturating, Zero}, | ||||||||||
|
|
@@ -101,7 +100,7 @@ pub use self::{ | |||||||||
| BalanceOf, BoundedCallOf, CallOf, Curve, DecidingStatus, DecidingStatusOf, Deposit, | ||||||||||
| InsertSorted, NegativeImbalanceOf, PalletsOriginOf, ReferendumIndex, ReferendumInfo, | ||||||||||
| ReferendumInfoOf, ReferendumStatus, ReferendumStatusOf, ScheduleAddressOf, TallyOf, | ||||||||||
| TrackIdOf, TrackInfo, TrackInfoOf, TracksInfo, VotesOf, | ||||||||||
| TrackIdOf, TrackInfo, TrackInfoOf, TracksInfo, VotesOf, BlockNumberFor | ||||||||||
| }, | ||||||||||
| weights::WeightInfo, | ||||||||||
| }; | ||||||||||
|
|
@@ -145,7 +144,7 @@ const ASSEMBLY_ID: LockIdentifier = *b"assembly"; | |||||||||
| pub mod pallet { | ||||||||||
| use super::*; | ||||||||||
| use frame_support::{pallet_prelude::*, traits::EnsureOriginWithArg}; | ||||||||||
| use frame_system::pallet_prelude::*; | ||||||||||
| use frame_system::pallet_prelude::{OriginFor, BlockNumberFor as SystemBlockNumberFor, ensure_root, ensure_signed_or_root, ensure_signed}; | ||||||||||
|
|
||||||||||
| /// The in-code storage version. | ||||||||||
| const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); | ||||||||||
|
|
@@ -168,12 +167,12 @@ pub mod pallet { | |||||||||
| type WeightInfo: WeightInfo; | ||||||||||
| /// The Scheduler. | ||||||||||
| type Scheduler: ScheduleAnon< | ||||||||||
| BlockNumberFor<Self>, | ||||||||||
| BlockNumberFor<Self, I>, | ||||||||||
| CallOf<Self, I>, | ||||||||||
| PalletsOriginOf<Self>, | ||||||||||
| Hasher = Self::Hashing, | ||||||||||
| > + ScheduleNamed< | ||||||||||
| BlockNumberFor<Self>, | ||||||||||
| BlockNumberFor<Self, I>, | ||||||||||
| CallOf<Self, I>, | ||||||||||
| PalletsOriginOf<Self>, | ||||||||||
| Hasher = Self::Hashing, | ||||||||||
|
|
@@ -216,33 +215,33 @@ pub mod pallet { | |||||||||
| /// The number of blocks after submission that a referendum must begin being decided by. | ||||||||||
| /// Once this passes, then anyone may cancel the referendum. | ||||||||||
| #[pallet::constant] | ||||||||||
| type UndecidingTimeout: Get<BlockNumberFor<Self>>; | ||||||||||
| type UndecidingTimeout: Get<BlockNumberFor<Self, I>>; | ||||||||||
|
|
||||||||||
| /// Quantization level for the referendum wakeup scheduler. A higher number will result in | ||||||||||
| /// fewer storage reads/writes needed for smaller voters, but also result in delays to the | ||||||||||
| /// automatic referendum status changes. Explicit servicing instructions are unaffected. | ||||||||||
| #[pallet::constant] | ||||||||||
| type AlarmInterval: Get<BlockNumberFor<Self>>; | ||||||||||
| type AlarmInterval: Get<BlockNumberFor<Self, I>>; | ||||||||||
|
|
||||||||||
| // The other stuff. | ||||||||||
| /// Information concerning the different referendum tracks. | ||||||||||
| #[pallet::constant] | ||||||||||
| type Tracks: Get< | ||||||||||
| Vec<( | ||||||||||
| <Self::Tracks as TracksInfo<BalanceOf<Self, I>, BlockNumberFor<Self>>>::Id, | ||||||||||
| TrackInfo<BalanceOf<Self, I>, BlockNumberFor<Self>>, | ||||||||||
| <Self::Tracks as TracksInfo<BalanceOf<Self, I>, BlockNumberFor<Self, I>>>::Id, | ||||||||||
| TrackInfo<BalanceOf<Self, I>, BlockNumberFor<Self, I>>, | ||||||||||
| )>, | ||||||||||
| > + TracksInfo< | ||||||||||
| BalanceOf<Self, I>, | ||||||||||
| BlockNumberFor<Self>, | ||||||||||
| BlockNumberFor<Self, I>, | ||||||||||
| RuntimeOrigin = <Self::RuntimeOrigin as OriginTrait>::PalletsOrigin, | ||||||||||
| >; | ||||||||||
|
|
||||||||||
| /// The preimage provider. | ||||||||||
| type Preimages: QueryPreimage<H = Self::Hashing> + StorePreimage; | ||||||||||
|
|
||||||||||
| /// Provider for the block number. Normally this is the `frame_system` pallet. | ||||||||||
|
||||||||||
| /// Provider for the block number. Normally this is the `frame_system` pallet. | |
| /// Provider for the block number. | |
| /// | |
| /// Normally this is the `frame_system` pallet. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.