-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Conversation
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Co-authored-by: Koute <[email protected]> Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Co-authored-by: Koute <[email protected]>
Co-authored-by: Koute <[email protected]> Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In terms of organization, this is very similar to what pallet-bags-list
is providing.
Perhaps we can put their associated traits in frame-support::collectio ns
or something similar, with a more holistic documentation, explaining what each does and when they should each be used. If not done here, would be great if you make an issue about it and assign me.
I recall the queue in message-queue
was also something that I imagined could be extracted as one of these "data structure as a pallet" thingies.
bot rebase |
Rebased |
bot merge |
Waiting for commit status. |
Merge cancelled due to error. Error: Statuses failed for dbceffa |
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
bot merge |
Waiting for commit status. |
Merge cancelled due to error. Error: Statuses failed for 551ad22 |
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
bot merge |
|
||
/// A storage paged list akin to what the FRAME macros would generate. | ||
// Note that FRAME does natively support paged lists in storage. | ||
pub type List<T, I> = StoragePagedList< |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pallet only holds a single storage. It should be possible to make the PagedList struct to be generic to take storage as generic parameter. So that the storage can be defined in other pallets and have no need to have an actual paged list pallet here. This can help reduce the complexity (all related storages are defined in a single pallet) and reduce numbers of pallets, which we have a hard cap of 255.
This is an example https://github.com/open-web3-stack/open-runtime-module-library/blob/58146e4a227c4cc4c49669a749dc04ee54d8f009/utilities/src/linked_item.rs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, why isn't this just another storage primitive?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes the pallet could provide multiple lists per instance. We can still add that. Currently it was designed in the simplest way possible to allow for a fix to be deployed in a timely manner.
It could also have been done as FRAME primitive, but then it needs support in the metadata.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But now it is also not supported in metadata :P
* Prototype StoragePagedList Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Add drain Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Remove stale docs Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Add fuzzer tests Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Update Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Review Co-authored-by: Koute <[email protected]> Signed-off-by: Oliver Tale-Yazdi <[email protected]> * fmt Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Docs and clippy Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Sum docs Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Cleanup Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Undo WIP Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Add pallet-paged-list Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Move code to pallet Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Move fuzzer Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Cleanup Signed-off-by: Oliver Tale-Yazdi <[email protected]> * fmt Signed-off-by: Oliver Tale-Yazdi <[email protected]> * docs Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Rename Appendix -> Appender Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Rename clear -> delete Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Feature gate testing stuff Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Docs review Co-authored-by: Koute <[email protected]> Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Cleanup Signed-off-by: Oliver Tale-Yazdi <[email protected]> * doc review Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Review renames Co-authored-by: Koute <[email protected]> Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Add docs Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Fix fuzzer Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Docs + examples Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Remove hasher Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Remove empty Event and Call Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Remove MaxPages Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Fix docs Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Test eager page removal Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Cleanup Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Update frame/paged-list/src/paged_list.rs Co-authored-by: Koute <[email protected]> * Fix docs Co-authored-by: Koute <[email protected]> Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Remove as_*_vec Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Update versions Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Rename ValuesPerPage -> ValuesPerNewPage Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Update lockfile Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Fix mock Signed-off-by: Oliver Tale-Yazdi <[email protected]> --------- Signed-off-by: Oliver Tale-Yazdi <[email protected]> Co-authored-by: Koute <[email protected]> Co-authored-by: parity-processbot <>
Abstract
Introduces a pallet to provide a linked list data structure:
pallet-paged-list
. The elements are aggregated into pages to keep a low PoV footprint on reading. The main advantage is a smaller memory footprint within the runtime when a transaction errors and causes a storage rollback.(Detailed implementation documentation is in the Rust Code)
API
The external API is defined by trait
StoragePagedList
:And specifically trait
StorageAppender
to conveniently append values:Testing
Fuzzer tests are in place to test random sequences of appending and removal of elements. The fuzzer tests are currently not running in the CI.