use CountedMap in pallet-bags-list#10179
Conversation
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
| CounterFor::<Prefix>::set(0u32); | ||
| <Self as MapWrapper>::Map::remove_all(None); | ||
| pub fn remove_all(maybe_limit: Option<u32>) { | ||
| let leftover = Self::count().saturating_sub(maybe_limit.unwrap_or_else(Bounded::max_value)); |
There was a problem hiding this comment.
this is the only logical change here.
There was a problem hiding this comment.
this is not correct, the documentation of remove_all for the storage map is indeed missing, but underneath it calls sp-io::storage::clear_prefix
Which deletes all keys in the overlay and up to limit in the backend.
Thus we cannot keep an accurate leftover here, we need to change sp-io::storage::clear_prefix to return here the number of key deleted in the overlay.
shawntabrizi
left a comment
There was a problem hiding this comment.
we need to double check the storage prefix is the same?
Code points to the prefix being |
|
Let's see if this bad boy is still alive: |
… into kiz-use-counted-map
|
/try-runtime queue RUST_LOG=runtime=debug --execution Native --no-spec-name-check on-runtime-upgrade live --uri ws://kusama |
|
Preparing try-runtime command for branch: "kiz-use-counted-map". Comment will be updated. |
|
@kianenigma Results are ready for cargo run --quiet --features=try-runtime try-runtime --execution Native --no-spec-name-check on-runtime-upgrade live --uri ws://try-runtime-kusama-node-0:9944 Output |
|
anyways, locall I get: |
|
bot merge |
|
Waiting for commit status. |
| let pre = crate::ListNodes::<T>::count(); | ||
| crate::ListNodes::<T>::remove_all(maybe_count); | ||
| if let Some(count) = maybe_count { | ||
| crate::CounterForListNodes::<T>::mutate(|items| *items - count); |
There was a problem hiding this comment.
this previous code also doesn't seems correct, it is not ensure that count items are removed.
* master: (27 commits) Bump rustversion from 1.0.4 to 1.0.5 (#10243) Kill the light client, CHTs and change tries. (#10080) tuple to struct event variants (#10206) Bump thiserror from 1.0.26 to 1.0.30 (#10240) Warn about usage of pallet collective set members call. (#10156) Bump git2 from 0.13.22 to 0.13.23 (#10238) Add group name in task metrics (#10196) Bump proc-macro-crate from 1.0.0 to 1.1.0 (#10237) Bump parity-util-mem from 0.10.0 to 0.10.2 (#10236) Bump substrate-bip39 from 0.4.2 to 0.4.4 (#10213) Upgrade jsonrpsee to v0.4.1 (#10022) expose substrate-cli service (#10229) Intend to reactivate cargo-unleash check (#10167) CI: build docs with deps (#9884) use CountedMap in pallet-bags-list (#10179) Move all example pallets under `examples` folder. (#10215) Upgrade wasm builder (#10226) upgrade ss58-registry with additional networks. (#10224) move wiki -> docs (#10225) new remote-ext mode: (#10192) ...
* use CountedMap in pallet-bags-list * Fix build * Update frame/bags-list/src/list/mod.rs Co-authored-by: Keith Yeung <kungfukeith11@gmail.com> * add a check as well Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
* use CountedMap in pallet-bags-list * Fix build * Update frame/bags-list/src/list/mod.rs Co-authored-by: Keith Yeung <kungfukeith11@gmail.com> * add a check as well Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
* use CountedMap in pallet-bags-list * Fix build * Update frame/bags-list/src/list/mod.rs Co-authored-by: Keith Yeung <kungfukeith11@gmail.com> * add a check as well Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
No description provided.