-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathv0.rs
52 lines (48 loc) · 1.51 KB
/
v0.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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,
>;