This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Use #[pallet::storage_version] for pallet staking #12728
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
805ea9a
delete releases
Ank4n 4c71f5a
use standard pallet storage version
Ank4n 59b0689
migrate to standard storage version for staking
Ank4n 2a8dcc1
not compiling
Ank4n b3b1090
keep old releases enum around for decoding
Ank4n 90f17a9
fix releases
Ank4n 143eecd
Merge branch 'master' into ankan/12041-staking-migration-versioning
Ank4n e5d1f70
rename old releases
Ank4n 7edb2a0
Merge branch 'master' into ankan/12041-staking-migration-versioning
Ank4n 6ae9b70
Merge remote-tracking branch 'origin/master' into ankan/12041-staking…
c53a848
retriggering ci
Ank4n 80fa571
Merge branch 'master' into ankan/12041-staking-migration-versioning
Ank4n 93ba64a
fix migration comments
Ank4n c2f3cbc
doc update
Ank4n 2e3f919
Merge remote-tracking branch 'origin/master' into ankan/12041-staking…
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 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 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 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 |
---|---|---|
|
@@ -46,7 +46,7 @@ pub use impls::*; | |
use crate::{ | ||
slashing, weights::WeightInfo, AccountIdLookupOf, ActiveEraInfo, BalanceOf, EraPayout, | ||
EraRewardPoints, Exposure, Forcing, NegativeImbalanceOf, Nominations, PositiveImbalanceOf, | ||
Releases, RewardDestination, SessionInterface, StakingLedger, UnappliedSlash, UnlockChunk, | ||
RewardDestination, SessionInterface, StakingLedger, UnappliedSlash, UnlockChunk, | ||
ValidatorPrefs, | ||
}; | ||
|
||
|
@@ -64,8 +64,12 @@ pub mod pallet { | |
|
||
use super::*; | ||
|
||
/// The current storage version. | ||
const STORAGE_VERSION: StorageVersion = StorageVersion::new(13); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. technically we could have started from 0 as well, but whatever :P There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Technically yes :). But may be still nice to convey this is the 13th migration. 😉 |
||
|
||
#[pallet::pallet] | ||
#[pallet::generate_store(pub(crate) trait Store)] | ||
#[pallet::storage_version(STORAGE_VERSION)] | ||
pub struct Pallet<T>(_); | ||
|
||
/// Possible operations on the configuration values of this pallet. | ||
|
@@ -561,13 +565,6 @@ pub mod pallet { | |
#[pallet::getter(fn offending_validators)] | ||
pub type OffendingValidators<T: Config> = StorageValue<_, Vec<(u32, bool)>, ValueQuery>; | ||
|
||
/// True if network has been upgraded to this version. | ||
/// Storage version of the pallet. | ||
/// | ||
/// This is set to v7.0.0 for new networks. | ||
#[pallet::storage] | ||
pub(crate) type StorageVersion<T: Config> = StorageValue<_, Releases, ValueQuery>; | ||
|
||
/// The threshold for when users can start calling `chill_other` for other validators / | ||
/// nominators. The threshold is compared to the actual number of validators / nominators | ||
/// (`CountFor*`) in the system compared to the configured max (`Max*Count`). | ||
|
@@ -618,7 +615,6 @@ pub mod pallet { | |
ForceEra::<T>::put(self.force_era); | ||
CanceledSlashPayout::<T>::put(self.canceled_payout); | ||
SlashRewardFraction::<T>::put(self.slash_reward_fraction); | ||
StorageVersion::<T>::put(Releases::V7_0_0); | ||
MinNominatorBond::<T>::put(self.min_nominator_bond); | ||
MinValidatorBond::<T>::put(self.min_validator_bond); | ||
if let Some(x) = self.max_validator_count { | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be scoped in v13?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its used in all migrations prior to v13. May be we should get rid of old migrations (unless you see a reason to keep them) and keep it scoped only in v13?