mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 05:51:02 +00:00
Fix pallet bags list and doc (#10231)
* fix bags list * improve doc * doc * inner doc * fix test * Update docs in frame/election-provider-support/src/lib.rs * fix staking impl * prepend unsafe to clear and regenerate * fix test Co-authored-by: Keith Yeung <kungfukeith11@gmail.com> Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
committed by
GitHub
parent
798e01bf9b
commit
9756615d5b
@@ -971,7 +971,7 @@ impl<T: Config> ElectionDataProvider<T::AccountId, BlockNumberFor<T>> for Pallet
|
||||
<Nominators<T>>::remove_all(None);
|
||||
<CounterForNominators<T>>::kill();
|
||||
<CounterForValidators<T>>::kill();
|
||||
let _ = T::SortedListProvider::clear(None);
|
||||
T::SortedListProvider::unsafe_clear();
|
||||
}
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
@@ -1299,7 +1299,7 @@ impl<T: Config> SortedListProvider<T::AccountId> for UseNominatorsMap<T> {
|
||||
fn on_remove(_: &T::AccountId) {
|
||||
// nothing to do on remove.
|
||||
}
|
||||
fn regenerate(
|
||||
fn unsafe_regenerate(
|
||||
_: impl IntoIterator<Item = T::AccountId>,
|
||||
_: Box<dyn Fn(&T::AccountId) -> VoteWeight>,
|
||||
) -> u32 {
|
||||
@@ -1309,13 +1309,10 @@ impl<T: Config> SortedListProvider<T::AccountId> for UseNominatorsMap<T> {
|
||||
fn sanity_check() -> Result<(), &'static str> {
|
||||
Ok(())
|
||||
}
|
||||
fn clear(maybe_count: Option<u32>) -> u32 {
|
||||
Nominators::<T>::remove_all(maybe_count);
|
||||
if let Some(count) = maybe_count {
|
||||
CounterForNominators::<T>::mutate(|noms| *noms - count);
|
||||
count
|
||||
} else {
|
||||
CounterForNominators::<T>::take()
|
||||
}
|
||||
fn unsafe_clear() {
|
||||
// NOTE: Caller must ensure this doesn't lead to too many storage accesses. This is a
|
||||
// condition of SortedListProvider::unsafe_clear.
|
||||
Nominators::<T>::remove_all(None);
|
||||
CounterForNominators::<T>::take();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user