Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
662fffe
Removed counters and used CountedStorageMap instead.
ayevbeosa Nov 11, 2021
48a4825
Merge branch 'master' of https://github.com/paritytech/substrate into…
ayevbeosa Nov 11, 2021
da2d7ec
Little refactoring
ayevbeosa Nov 11, 2021
31f7bd7
Update frame/staking/src/migrations.rs
ayevbeosa Nov 11, 2021
a8c2f16
Removed redundant code to update counter for validator & nominator.
ayevbeosa Nov 11, 2021
01a605d
Removed redundant code to update counter for validator & nominator.
ayevbeosa Nov 11, 2021
2c192d8
Removed unreachable code to inject the hashed prefix for nominator & …
ayevbeosa Nov 11, 2021
c2f7577
Removed redundant check for nominator & validator count.
ayevbeosa Nov 15, 2021
b332858
Merge branch 'master' of https://github.com/paritytech/substrate into…
ayevbeosa Nov 16, 2021
d771e4a
Merge branch 'master' of https://github.com/paritytech/substrate into…
ayevbeosa Nov 19, 2021
e449fe5
Generated `fn prefix_hash` for `CountedStorageMap`.
ayevbeosa Nov 19, 2021
65d7d02
Merge branch 'master' of https://github.com/paritytech/substrate into…
ayevbeosa Nov 19, 2021
b9d0a88
Applied changes from `cargo fmt`
ayevbeosa Nov 19, 2021
9b21bef
Merge branch 'master' of https://github.com/paritytech/substrate into…
ayevbeosa Nov 19, 2021
d79d380
Possible correct implementation of migration code
ayevbeosa Nov 20, 2021
16d6a44
Merge branch 'master' of https://github.com/paritytech/substrate into…
ayevbeosa Nov 24, 2021
190ec8e
Implemented fn module_prefix, storage_prefix and prefix_hash.
ayevbeosa Nov 24, 2021
41f8dae
Merge branch 'master' of https://github.com/paritytech/substrate into…
ayevbeosa Nov 24, 2021
3a0500f
Removed counted_map.rs
ayevbeosa Nov 29, 2021
fac8882
Merge branch 'master' of https://github.com/paritytech/substrate into…
ayevbeosa Nov 29, 2021
bf1bc0a
Renamed `fn storage_prefix` to `storage_counter_prefix`.
ayevbeosa Nov 30, 2021
36115cb
Merge branch 'master' of https://github.com/paritytech/substrate into…
ayevbeosa Nov 30, 2021
de685ff
Update frame/support/src/storage/types/counted_map.rs
gui1117 Dec 1, 2021
d07414f
Update frame/bags-list/remote-tests/src/snapshot.rs
gui1117 Dec 1, 2021
256ac95
Update frame/support/src/storage/types/counted_map.rs
gui1117 Dec 1, 2021
fa56998
Merge branch 'master' into ayevbeosa-employ-counted-map
ayevbeosa Dec 4, 2021
a437c17
Fixed errors.
ayevbeosa Dec 4, 2021
b7e8047
Merge branch 'master' of https://github.com/paritytech/substrate into…
ayevbeosa Dec 4, 2021
da0f59f
Merge remote-tracking branch 'origin/master' into 10233
gui1117 Dec 7, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed errors.
  • Loading branch information
ayevbeosa committed Dec 4, 2021
commit a437c17488ca0a6309672d1da2946c293c27f064
6 changes: 1 addition & 5 deletions frame/staking/src/pallet/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -952,8 +952,6 @@ impl<T: Config> ElectionDataProvider<T::AccountId, BlockNumberFor<T>> for Pallet
<Validators<T>>::remove_all();
<Nominators<T>>::remove_all();

<CounterForNominators<T>>::kill();
<CounterForValidators<T>>::kill();
T::SortedListProvider::unsafe_clear();
}

Expand Down Expand Up @@ -1296,8 +1294,6 @@ impl<T: Config> SortedListProvider<T::AccountId> for UseNominatorsMap<T> {
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();

Nominators::<T>::remove_all();
}
}
5 changes: 2 additions & 3 deletions frame/staking/src/testing_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,11 @@ const SEED: u32 = 0;

/// This function removes all validators and nominators from storage.
pub fn clear_validators_and_nominators<T: Config>() {
Validators::<T>::remove_all(None);
Validators::<T>::remove_all();

// whenever we touch nominators counter we should update `T::SortedListProvider` as well.
Nominators::<T>::remove_all(None);
Nominators::<T>::remove_all();

CounterForNominators::<T>::kill();
// NOTE: safe to call outside block production
T::SortedListProvider::unsafe_clear();
}
Expand Down