Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
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
Update frame/support/src/storage/types/counted_map.rs
  • Loading branch information
gui1117 authored Dec 1, 2021
commit de685ff68854953a65cbcf997944dc0fce865b5d
20 changes: 7 additions & 13 deletions frame/support/src/storage/types/counted_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,21 +100,15 @@ where
OnEmpty: Get<QueryKind::Query> + 'static,
MaxValues: Get<Option<u32>>,
{
/// Module prefix. Used for generating final key.
fn module_prefix() -> &'static [u8] {
Prefix::pallet_prefix().as_bytes()
/// The key used to store the counter of the map.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very good 👍

pub fn counter_storage_final_key() -> [u8; 32] {
CounterFor::<Prefix>::hashed_key()
}

/// Counted Storage prefix. Used for generating final key.
pub fn storage_counter_prefix() -> &'static [u8] {
Prefix::STORAGE_PREFIX.as_bytes()
}

/// The full prefix; just the hash of `module_prefix` concatenated to the hash of
/// `storage_counter_prefix`.
pub fn prefix_hash() -> Vec<u8> {
let result = storage_prefix(Self::module_prefix(), Self::storage_counter_prefix());
result.to_vec()
/// The prefix used to generate the key of the map.
pub fn map_storage_final_prefix() -> Vec<u8> {
use crate::storage::generator::StorageMap;
<Self as MapWrapper>::Map::prefix_hash()
}

/// Get the storage key used to fetch a value corresponding to a specific key.
Expand Down