-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0060729
commit e90921b
Showing
4 changed files
with
65 additions
and
65 deletions.
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
1 change: 1 addition & 0 deletions
1
toolkit/pallets/session-validator-management/src/migrations/mod.rs
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
pub mod v0; | ||
pub mod v1; |
52 changes: 52 additions & 0 deletions
52
toolkit/pallets/session-validator-management/src/migrations/v0.rs
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
use frame_support::pallet_prelude::{OptionQuery, ValueQuery, Zero}; | ||
use frame_support::{storage_alias, BoundedVec, CloneNoBound}; | ||
use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; | ||
use scale_info::TypeInfo; | ||
|
||
#[derive(CloneNoBound, Encode, Decode, TypeInfo, MaxEncodedLen)] | ||
#[scale_info(skip_type_params(MaxValidators))] | ||
pub struct LegacyCommitteeInfo< | ||
ScEpochNumber: Clone, | ||
AuthorityId: Clone, | ||
AuthorityKeys: Clone, | ||
MaxValidators, | ||
> { | ||
pub epoch: ScEpochNumber, | ||
pub committee: BoundedVec<(AuthorityId, AuthorityKeys), MaxValidators>, | ||
} | ||
|
||
impl<ScEpochNumber, AuthorityId, AuthorityKeys, MaxValidators> Default | ||
for LegacyCommitteeInfo<ScEpochNumber, AuthorityId, AuthorityKeys, MaxValidators> | ||
where | ||
AuthorityId: Clone, | ||
AuthorityKeys: Clone, | ||
ScEpochNumber: Clone + Zero, | ||
{ | ||
fn default() -> Self { | ||
Self { epoch: ScEpochNumber::zero(), committee: BoundedVec::new() } | ||
} | ||
} | ||
|
||
#[storage_alias] | ||
pub type CurrentCommittee<T: crate::pallet::Config> = StorageValue< | ||
crate::Pallet<T>, | ||
LegacyCommitteeInfo< | ||
<T as crate::pallet::Config>::ScEpochNumber, | ||
<T as crate::pallet::Config>::AuthorityId, | ||
<T as crate::pallet::Config>::AuthorityKeys, | ||
<T as crate::pallet::Config>::MaxValidators, | ||
>, | ||
ValueQuery, | ||
>; | ||
|
||
#[storage_alias] | ||
pub type NextCommittee<T: crate::pallet::Config> = StorageValue< | ||
crate::Pallet<T>, | ||
LegacyCommitteeInfo< | ||
<T as crate::pallet::Config>::ScEpochNumber, | ||
<T as crate::pallet::Config>::AuthorityId, | ||
<T as crate::pallet::Config>::AuthorityKeys, | ||
<T as crate::pallet::Config>::MaxValidators, | ||
>, | ||
OptionQuery, | ||
>; |
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