-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fix pallet bags list and doc #10231
Fix pallet bags list and doc #10231
Changes from 4 commits
c1550d2
29ce8c0
ed1fb34
c2f6366
eb90700
2e72037
ce7fff7
fede886
61e8612
ee451a5
ae9c70e
18a0d8b
790456b
56e3ede
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -338,10 +338,11 @@ pub trait SortedListProvider<AccountId> { | |
| weight_of: Box<dyn Fn(&AccountId) -> VoteWeight>, | ||
| ) -> u32; | ||
|
|
||
| /// Remove `maybe_count` number of items from the list. Returns the number of items actually | ||
| /// removed. WARNING: removes all items if `maybe_count` is `None`, which should never be done | ||
| /// in production settings because it can lead to an unbounded amount of storage accesses. | ||
| fn clear(maybe_count: Option<u32>) -> u32; | ||
| /// Remove all items from the list. | ||
| /// | ||
| /// WARNING: should never be called in production settings because it can lead to an unbounded | ||
| /// amount of storage accesses. | ||
| fn clear(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe call this
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also in pallet-bags-list when implementing the function
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes we should
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. addressed in fede886 |
||
|
|
||
| /// Sanity check internal state of list. Only meant for debug compilation. | ||
| fn sanity_check() -> Result<(), &'static str>; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -234,7 +234,11 @@ where | |
| <Self as crate::storage::StorageMap<Key, Value>>::migrate_key::<OldHasher, _>(key) | ||
| } | ||
|
|
||
| /// Remove all value of the storage. | ||
| /// Remove all values of the storage in the overlay and up to `limit` in the backend. | ||
| /// | ||
|
Comment on lines
+237
to
+238
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Its just a crazy api. This is absolutely not an "expected" behavior, and we shouldn't really expose such weird things in this way... We need apis like this which are both bounded and behave in expected ways.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes I agree, IMO we should at least have sp_io::storage::clear_prefix return the exact number of value removed (in both overlay and backend). |
||
| /// All values in the client overlay will be deleted, if there is some `limit` then up to | ||
| /// `limit` values are deleted from the client backend, if `limit` is none then all values in | ||
| /// the client backend are deleted. | ||
| pub fn remove_all(limit: Option<u32>) -> sp_io::KillStorageResult { | ||
| <Self as crate::storage::StoragePrefixedMap<Value>>::remove_all(limit) | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.